How to include QtQuickControls

☆樱花仙子☆ 提交于 2021-02-10 15:59:00

问题


I've included to my project :

"import QtQuickQontrols 1.4"

But now I need to use ScrollBar , and for this, I need to include

"import QtQuickControls 2.2"

But when I include version 2.2 and delete 1.4, my project is ruined... MenuBar, TableView is under errors! Ok, when I include both this version it's errors , too! I did run qmake, and give me some advice what should I do to implement my ScrollBar. I've tried to add ScrollView, but inside this it doesn't work :

     ....
      ScrollBar.vertical: ScrollBar {...} ...}

回答1:


If you need to import both controls 1 & 2, they will have name collisions. But you can rename them so they don't conflict:

import QtQuick.Controls 1.4 as QC1
import QtQuick.Controls 2.2 as QC2

QC1.MenuBar {
}

QC2.ScrollBar {
}


来源:https://stackoverflow.com/questions/64632318/how-to-include-qtquickcontrols

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!