简体   繁体   English

如何包含 QtQuickControls

[英]How to include QtQuickControls

I've included to my project :我已经包含在我的项目中:

"import QtQuickQontrols 1.4"

But now I need to use ScrollBar , and for this, I need to include但现在我需要使用 ScrollBar ,为此,我需要包括

"import QtQuickControls 2.2"

But when I include version 2.2 and delete 1.4, my project is ruined... MenuBar, TableView is under errors!但是当我包含 2.2 版本并删除 1.4 时,我的项目被毁了...... MenuBar,TableView 出现错误! 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.我确实运行了 qmake,并给了我一些建议,我应该怎么做才能实现我的 ScrollBar。 I've tried to add ScrollView, but inside this it doesn't work :我试图添加 ScrollView,但在这里面它不起作用:

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

If you need to import both controls 1 & 2, they will have name collisions.如果您需要同时导入控件 1 和 2,它们将发生名称冲突。 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 {
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM