Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. import QtQuick.Controls 2.0 as QQC2
Qt 6.12 LTS is out! See what's new in the release blog

import QtQuick.Controls 2.0 as QQC2

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 749 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Nio74N Offline
    Nio74N Offline
    Nio74
    wrote on last edited by
    #1

    good morning,what does that " as QQC2"

    jsulmJ raven-worxR 2 Replies Last reply
    0
    • Nio74N Nio74

      good morning,what does that " as QQC2"

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Nio74 It's just a short name for "QtQuick.Controls 2.0". You can put what ever you want after "as".
      You should read http://doc.qt.io/qt-5/qtqml-syntax-imports.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • Nio74N Nio74

        good morning,what does that " as QQC2"

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by raven-worx
        #3

        @Nio74
        it's called "import namespace" and in most cases not needed.
        It comes in handy when two imports provide an element with the same type name.

        To make them distinguishable (the later import overrides the element types with same names from the previous one) you then can access them via the namespace prefix.

        import QtQuick.Controls 2.0 as QQC2
        import QtQuick.Controls 1.0 as QQC1 // would override Button (and some others from Controls 2) without using namespace
        
        Item {
            QQC2.Button {
            }
        
            QQC1.Button
            {
            }
        }
        

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        3
        • Nio74N Offline
          Nio74N Offline
          Nio74
          wrote on last edited by
          #4

          thank you very clear answer, thank you all

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt
          • Unsolved