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. Problems with QML Style change from Qt5 to Qt6
Forum Updated to NodeBB v4.3 + New Features

Problems with QML Style change from Qt5 to Qt6

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.3k 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.
  • K Offline
    K Offline
    Kenz Dale
    wrote on 14 Mar 2023, 12:14 last edited by
    #1

    I am upgrading a Qt5 app to Qt6. Everything is fine, except for the fact that the styles are weird and off.

    This is how it used to look:
    Screenshot 2023-03-14 at 8.10.48 AM.png

    This is how it looks now:
    Screenshot 2023-03-14 at 8.11.08 AM.png

    Button text placements are wrong, the background color has changed, I'm getting a ton of The current style does not support customization of this control warning messages, etc...

    Before I manhandle this back into shape, is there a simple Style setting I'm overlooking in moving from Qt5 to Qt6? I've tried a variety of import QtQuick.Controls..., and import QtQuick.Controls.Basic 2.15 gives the most similar results, although the colors are still inverted and button sizes still are subtly adjusted.

    J 1 Reply Last reply 14 Mar 2023, 13:45
    0
    • K Kenz Dale
      14 Mar 2023, 12:14

      I am upgrading a Qt5 app to Qt6. Everything is fine, except for the fact that the styles are weird and off.

      This is how it used to look:
      Screenshot 2023-03-14 at 8.10.48 AM.png

      This is how it looks now:
      Screenshot 2023-03-14 at 8.11.08 AM.png

      Button text placements are wrong, the background color has changed, I'm getting a ton of The current style does not support customization of this control warning messages, etc...

      Before I manhandle this back into shape, is there a simple Style setting I'm overlooking in moving from Qt5 to Qt6? I've tried a variety of import QtQuick.Controls..., and import QtQuick.Controls.Basic 2.15 gives the most similar results, although the colors are still inverted and button sizes still are subtly adjusted.

      J Offline
      J Offline
      JoeCFD
      wrote on 14 Mar 2023, 13:45 last edited by
      #2

      @Kenz-Dale I feel the same way. There are a lot of changes in Qt6. Better to use the latest Qt6. Otherwise, there could be even more changes. If you have a product made from Qt5, do not rush to upgrade to Qt6.

      G 1 Reply Last reply 14 Mar 2023, 14:37
      0
      • J JoeCFD
        14 Mar 2023, 13:45

        @Kenz-Dale I feel the same way. There are a lot of changes in Qt6. Better to use the latest Qt6. Otherwise, there could be even more changes. If you have a product made from Qt5, do not rush to upgrade to Qt6.

        G Offline
        G Offline
        GrecKo
        Qt Champions 2018
        wrote on 14 Mar 2023, 14:37 last edited by
        #3

        @Kenz-Dale That happens because you didn't specify an explicit Style for your app.

        In Qt 5 the default style was the aptly named Default Style. In Qt 6, it's platform dependent. So if you are on macOs, it will be the macOs Style.

        You can specify the style to be the Basic Style. If you want to use compile time selection and not runtime selection, make sure you don't import QtQuick.Controls but only import QtQuick.Controls.Basic.

        K 1 Reply Last reply 15 Mar 2023, 00:42
        3
        • G GrecKo
          14 Mar 2023, 14:37

          @Kenz-Dale That happens because you didn't specify an explicit Style for your app.

          In Qt 5 the default style was the aptly named Default Style. In Qt 6, it's platform dependent. So if you are on macOs, it will be the macOs Style.

          You can specify the style to be the Basic Style. If you want to use compile time selection and not runtime selection, make sure you don't import QtQuick.Controls but only import QtQuick.Controls.Basic.

          K Offline
          K Offline
          Kenz Dale
          wrote on 15 Mar 2023, 00:42 last edited by
          #4

          @GrecKo Thanks, that helped a ton.
          Adding

          #include <QQuickStyle>
          .
          .
          .
          int main(int argc, char *argv[]) {
             .
             .
             .
             // Set QML style. Could be Material, Universal, Basic, etc... Doing
             // it here sets it app-wide.
             QQuickStyle::setStyle("Basic");
             .
             .
             .
          }
          

          was exactly what I needed.

          1 Reply Last reply
          1
          • J JoeCFD referenced this topic on 17 Apr 2023, 14:16

          1/4

          14 Mar 2023, 12:14

          • Login

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