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. In win10 can't customization
Forum Updated to NodeBB v4.3 + New Features

In win10 can't customization

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 3 Posters 70 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.
  • M Offline
    M Offline
    Mihaill
    wrote last edited by
    #1

    Hi!
    I use win 10. I don't uze style for QML. In Qt5 I can customization QtQuick.Controls, but in QT6 I get error:

    [08.07.2025 11:01:14.852 UTC+03:00][W]: {qrc:/qml/customWidgets/MTextField.qml:127} qrc:/qml/customWidgets/MTextField.qml:127:17: QML QQuickRectangle: The current style does not support customization of this control (property: "background" item: QQuickRectangle(0x187c27431b0, parent=0x0, geometry=0,0 0x0)). Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference
    

    I get error in TextField here:

        background: Rectangle {
            id: backgroundField
            radius: 5
            color: root.readOnly ? backgroundColorDisabled : backgroundColorPrimary
            border.width: ( isError || root.activeFocus ) ? 2 : 1
            border.color: isError ? "red" : root.activeFocus ? themeStyles.primaryColor : "#BDBDBD"
        }
    
    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bob64
      wrote last edited by
      #2

      I think this is because of the default style that is used in Qt 6. I found that I needed to use the "Basic" style. In my C++ startup code, I have this:

      #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
        QQuickStyle::setStyle("Basic");
      #endif
      

      I think you can set the style in other ways, such as using an environment variable, but this is how I do it.

      JKSHJ 1 Reply Last reply
      2
      • M Mihaill has marked this topic as solved
      • B Bob64

        I think this is because of the default style that is used in Qt 6. I found that I needed to use the "Basic" style. In my C++ startup code, I have this:

        #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
          QQuickStyle::setStyle("Basic");
        #endif
        

        I think you can set the style in other ways, such as using an environment variable, but this is how I do it.

        JKSHJ Online
        JKSHJ Online
        JKSH
        Moderators
        wrote last edited by
        #3

        @Bob64 said in In win10 can't customization:

        you can set the style in other ways

        Yes, the best way is via the import statement: import QtQuick.Controls.Basic -- this allows the Qt Quick Compiler to optimize your code. That optimization can't happen if you set the style at runtime.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        B 1 Reply Last reply
        1
        • JKSHJ JKSH

          @Bob64 said in In win10 can't customization:

          you can set the style in other ways

          Yes, the best way is via the import statement: import QtQuick.Controls.Basic -- this allows the Qt Quick Compiler to optimize your code. That optimization can't happen if you set the style at runtime.

          B Offline
          B Offline
          Bob64
          wrote last edited by
          #4

          @JKSH said in In win10 can't customization:

          Yes, the best way is via the import statement: import QtQuick.Controls.Basic -- this allows the Qt Quick Compiler to optimize your code. That optimization can't happen if you set the style at runtime.

          Thanks for this tip. I'll bear it in mind for later. I currently have my code running in both Qt 5.15 and 6.8 as I may or may not need to make the switch in the near future (out of my control unfortunately). The runtime selection is a pragmatic approach for me at the moment.

          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