如何包含 QtQuickControls [英] How to include QtQuickControls
问题描述
我已包含在我的项目中:
I've included to my project :
导入QtQuickQontrols 1.4";
但现在我需要使用 ScrollBar ,为此,我需要包括
But now I need to use ScrollBar , and for this, I need to include
导入QtQuickControls 2.2"
但是当我包含 2.2 版并删除 1.4 版时,我的项目被毁了... MenuBar,TableView 出现错误!好的,当我同时包含这个版本时,它也是错误的!我确实运行了 qmake,并给了我一些建议,我应该怎么做才能实现我的 ScrollBar.我尝试添加 ScrollView,但在这里面它不起作用:
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 &2、它们会有名字冲突.但是您可以重命名它们,以免它们发生冲突:
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 {
}
这篇关于如何包含 QtQuickControls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!