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. How to use the `Default` theme on Android

How to use the `Default` theme on Android

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 563 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.
  • Ben SB Offline
    Ben SB Offline
    Ben S
    wrote on last edited by
    #1

    I'm working adding a GUI to a ray tracing application that I wrote and I'm using Qml for it. Right now I've been building it on a Linux desktop, but also testing it out on an Android tablet (Kindle Fire), and have plans to run it on an iPad too. On the desktop, it's using the Default style for UI theming: https://doc.qt.io/qt-5/qtquickcontrols2-default.html . I like it and have been building other custom controls off of it.

    But when trying to run on Android it's been using the Material theme.

    I tried explicitly specifying the Default theme in the qtquickcontrols2.conf file, as well as adding this in the main() function:

    QQuickStyle::setStyle("Default");
    QQuickStyle::setFallbackStyle("Default");
    

    But still on Android it's giving me the Material theme. I was able to specify Fusion and well, got the Fusion theme on Android.

    How can I get the Default UI theme to work on Android?

    J.HilkJ 1 Reply Last reply
    0
    • Ben SB Offline
      Ben SB Offline
      Ben S
      wrote on last edited by
      #4

      I was able to get it to work. I did have to switch to Qt6. I also needed to add a qtquickcontrols2.conf file to my project (e.g. in the qml.qrc file), and add this in:

      [Controls]
      Style=Basic
      
      1 Reply Last reply
      2
      • Ben SB Ben S

        I'm working adding a GUI to a ray tracing application that I wrote and I'm using Qml for it. Right now I've been building it on a Linux desktop, but also testing it out on an Android tablet (Kindle Fire), and have plans to run it on an iPad too. On the desktop, it's using the Default style for UI theming: https://doc.qt.io/qt-5/qtquickcontrols2-default.html . I like it and have been building other custom controls off of it.

        But when trying to run on Android it's been using the Material theme.

        I tried explicitly specifying the Default theme in the qtquickcontrols2.conf file, as well as adding this in the main() function:

        QQuickStyle::setStyle("Default");
        QQuickStyle::setFallbackStyle("Default");
        

        But still on Android it's giving me the Material theme. I was able to specify Fusion and well, got the Fusion theme on Android.

        How can I get the Default UI theme to work on Android?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #2

        hi @Ben-S

        IIRC the default theme for qml objects is only an option in Qt6 and onwards


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        2
        • Ben SB Offline
          Ben SB Offline
          Ben S
          wrote on last edited by
          #3

          Ah, okay. I was using Qt5 on Desktop and Android. But I do have Qt6 installed. I'll give that a whirl and see what happens.

          1 Reply Last reply
          0
          • Ben SB Offline
            Ben SB Offline
            Ben S
            wrote on last edited by
            #4

            I was able to get it to work. I did have to switch to Qt6. I also needed to add a qtquickcontrols2.conf file to my project (e.g. in the qml.qrc file), and add this in:

            [Controls]
            Style=Basic
            
            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