qtqmlscrollviewscrollbarqtquickcontrols

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

"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 {...} ...}

Solution

  • 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 {
    }