Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ApplicationWindow "opacity" is error?

ApplicationWindow "opacity" is error?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 4 Posters 2.5k Views
  • 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.
  • A Offline
    A Offline
    Alex_wang
    wrote on last edited by
    #1

    import QtQuick.Controls 2.0
    ApplicationWindow
    {
    opacity : 0.8
    }
    error:
    applicationwindow.opacity is not available due to component version

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Hi Alex_wang,

      I don't know what version of Qt you are using. In Qt5.9 you can use :

      import QtQuick 2.7
      

      If I omit hits import directive I can reproduce your problem.

      Eddy

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Alex_wang
        wrote on last edited by
        #3

        Qt version : 5.8.0
        import QtQuick 2.5

        D 1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          Can you check the highest import versions available on your system. AFAIR it could be for Qt5.8:

          import QtQuick 2.7
          import QtQuick.Controls 2.1
          

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

            Hi,

            My attention was needed in the real world. Now I'm back, but unfortunately I cannot reproduce the use case where I didn't have any problems.

            I found some similar bugs reports with the same error message but yours looks differently.

            You could file a bug report for your case, unless somebody else knows a solution here.

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • A Alex_wang

              Qt version : 5.8.0
              import QtQuick 2.5

              D Offline
              D Offline
              Devopia53
              wrote on last edited by
              #6

              @Alex_wang @Eddy

              Hi.

              It's not a bug.
              It's releated to meta object revison.
              Property oapacity of ApplicationWindow is defined as revison 1.
              But, QtQuick.Controls 2 can only use revision 0.
              Take a look at the defined type information for that plugin(aka. plugins.qmltypes) and following doc: http://doc.qt.io/qt-5/qtqml-cppintegration-definetypes.html#type-revisions-and-versions

              1 Reply Last reply
              0
              • jpnurmiJ Offline
                jpnurmiJ Offline
                jpnurmi
                wrote on last edited by
                #7

                Hi, it is a bug and has been fixed in Qt 5.9.1.

                1 Reply Last reply
                2
                • jpnurmiJ Offline
                  jpnurmiJ Offline
                  jpnurmi
                  wrote on last edited by
                  #8

                  As a workaround, you could try setting the opacity in Component.onCompleted or using Binding element.

                  1 Reply Last reply
                  2
                  • EddyE Offline
                    EddyE Offline
                    Eddy
                    wrote on last edited by Eddy
                    #9

                    @jpnurmi
                    Thanks for the feedback.

                    @Alex_wang : you can use it like this:

                    import QtQuick 2.7
                    import QtQuick.Controls 2.1
                    import QtQuick.Layouts 1.3
                    
                    
                    ApplicationWindow {
                        id: app
                        visible: true
                        width: 640
                        height: 480
                        title: qsTr("Hello World")
                    
                     color: "yellow"
                    
                     Binding { target: app; property: "opacity"; value: 0.5}
                    

                    Qt Certified Specialist
                    www.edalsolutions.be

                    1 Reply Last reply
                    1
                    • A Offline
                      A Offline
                      Alex_wang
                      wrote on last edited by
                      #10

                      thanks all replies!
                      Thanks for Eddy and jpnurmi !

                      1 Reply Last reply
                      2

                      • Login

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