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. Default Controls Style not the same as no style given
QtWS25 Last Chance

Default Controls Style not the same as no style given

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 4 Posters 1.7k 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.
  • J Offline
    J Offline
    JeromeGodbout
    wrote on last edited by
    #1

    Hi,
    I have a question regarding the default style used by Controls (under Windows 7 / 8, not tested under other platforms). When I create a Slider {} or make a Slider { style: SliderStyle {} } I don't end up with the same widget at all (used the slider since it's probably one of the most visual obvious one).

    I was wondering which style is used by default for the widget (Base, Desktop...)? Any way to used it or make it with style like SliderStyle?

    This make it hard to make a simple modif to style and keep a coherent look with the not styled controls.

    We have a fully skinned style or offer native style into the application and can switch between both during runtime. The native look with a few modif (like font size) is the part where things get ugly.

    Thanks,
    Jerome

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      It works on Ubuntu 14.04 with Qt 5.3.1
      Here's a screenshot:
      !http://i.imgur.com/Zn3Pzbg.png(screenshot)!

      Here's the code with which i tested
      @
      import QtQuick 2.2
      import QtQuick.Controls 1.2
      import QtQuick.Controls.Styles 1.2

      Item {
      width: 360
      height: 260

      Button {
          id: a
          text: "click"
      }
      
      Button {
          anchors.left: a.right
          text: "click"
          style: ButtonStyle { }
      }
      
      Slider {
          id: b
          anchors.top: a.bottom
      }
      
      Slider {
          anchors.left: b.right
          anchors.top: a.bottom
          style: SliderStyle { }
      }
      
      CheckBox {
          id: c
          anchors.top: b.bottom
      }
      
      CheckBox {
          anchors.left: c.right
          anchors.top: b.bottom
          style: CheckBoxStyle { }
      }
      

      }
      @

      May be it could be a problem on Windows.

      157

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jens
        wrote on last edited by
        #3

        I am afraid this is by design. The style delegates you get by importing QtQuick.Controls.Styles are cross-platform and do not match any specific desktop style. This makes it possible to re-use the custom styles you make across multiple platforms.

        If you have a strong desire to use the low level native styling, you can in principle access the undocumented "StyledItem" from the QtQuick.Controls.Private import. Needless to say this is not documented or supported.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JeromeGodbout
          wrote on last edited by
          #4

          Here's the same code as p3c0 above but under Windows 7 and Qt 5.3.1 (look like a Windows only problems, not tested on OS X yet will try to update it soon):
          !http://i.imgur.com/35kdWmK.png(Windows Style)!

          Which one is correct does not really matter to me, it's just a consistency problem here, I have a full custom style which can be used, we just want to be able to offer default platform look also. For Windows I guess I will have to provide a style for every controls (no matter what).

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JeromeGodbout
            wrote on last edited by
            #5

            Look like the deafult style like ButtonStyle {} is loading the plastic theme look alike of Windows and the no style is the default Windows theme. My computer is not set to use the plastic theme btw. If that may help.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jseeQt
              wrote on last edited by
              #6

              Hi Jerome,

              On Windows and Mac OS X, there is the "Desktop" style. "Base" style is used on Linux / on platforms that have no specific style.
              When you do
              @
              import QtQuick.Controls.Styles 1.2
              @

              you will import the "Base" styles. So
              @
              style: ButtonStyle { }
              @

              will override the loaded "Desktop" style.
              To modify the "Desktop" style, replace the
              @
              import QtQuick.Controls.Styles 1.2
              @

              with
              @
              import "qrc:/QtQuick/Controls/Styles/Desktop"
              @

              Note that this is NOT an official way/API and can change with new Qt versions.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JeromeGodbout
                wrote on last edited by
                #7

                Thanks for the information, that's clarify the observed behavior.

                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 Extensions
                • Unsolved