Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Inconsistent output when running Qt Design Studio vs Python
Forum Updated to NodeBB v4.3 + New Features

Inconsistent output when running Qt Design Studio vs Python

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 3 Posters 235 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.
  • A Offline
    A Offline
    Amr Essam
    wrote on last edited by Amr Essam
    #1

    Hello everyone, I've been trying to develop a Python Qt application with QML, so I learned about Qt Design Studio from the latest Qt Summit in Berlin and I thought why not try it and see if I'll get better workflow?
    So basically I'm trying to use the drag and drop feature in Qt Design Studio to build the UI and write code for my data classes and my algorithms in Python but I can find inconsistent results when running the project using python vs running it in Qt Design Studio.

    So these are the steps I've done so far:
    1- Create a Qt Design Studio application with a basic style.
    2- Choose the export option "Enable Python Generator" which dumps a "Python" directory.
    3- Installed Python, pyside6, and PySide6_DS libraries as guided here: https://doc.qt.io/qtdesignstudio/studio-designer-developer-workflow.html
    4- Tried to run from Qt Design Studio and from using the python command "python main.py" as advised in the guide mentioned above

    Unfortunately, I get different styling when running using Python vs running using Qt Design Studio, can you please help with that issue? Am I doing something wrong?

    As you'll notice the styling for the button is completely different.

    Python Screenshot:
    Image 03-02-2025 at 9.31 AM.jpeg

    Qt Design Studio Screenshot:
    Image 03-02-2025 at 9.30 AM.jpeg

    jsulmJ 1 Reply Last reply
    0
    • A Amr Essam

      Hello everyone, I've been trying to develop a Python Qt application with QML, so I learned about Qt Design Studio from the latest Qt Summit in Berlin and I thought why not try it and see if I'll get better workflow?
      So basically I'm trying to use the drag and drop feature in Qt Design Studio to build the UI and write code for my data classes and my algorithms in Python but I can find inconsistent results when running the project using python vs running it in Qt Design Studio.

      So these are the steps I've done so far:
      1- Create a Qt Design Studio application with a basic style.
      2- Choose the export option "Enable Python Generator" which dumps a "Python" directory.
      3- Installed Python, pyside6, and PySide6_DS libraries as guided here: https://doc.qt.io/qtdesignstudio/studio-designer-developer-workflow.html
      4- Tried to run from Qt Design Studio and from using the python command "python main.py" as advised in the guide mentioned above

      Unfortunately, I get different styling when running using Python vs running using Qt Design Studio, can you please help with that issue? Am I doing something wrong?

      As you'll notice the styling for the button is completely different.

      Python Screenshot:
      Image 03-02-2025 at 9.31 AM.jpeg

      Qt Design Studio Screenshot:
      Image 03-02-2025 at 9.30 AM.jpeg

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Amr-Essam said in Inconsistent output when running Qt Design Studio vs Python:

      Am I doing something wrong?

      No, your app is using different style when running compared to what Qt Design Studio is using. Normally you should not care as the style is selected depending on the platform when your app starts (to match the design of the platform).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • Jaime02J Offline
        Jaime02J Offline
        Jaime02
        Qt Champion 2021
        wrote on last edited by
        #3

        I guess that the is that the Qt Quick style configuration file (qtquickcontrols2.conf) is not being applied in the case of the Python version.
        You may add the file to the environment variables:

        # Assuming this is in <project>/Python/main.py, path to the DS project root folder
        project_root = Path(__file__).parent.parent  
        os.environ["QT_QUICK_CONTROLS_CONF"] = str(project_root / "qtquickcontrols2.conf")
        

        More info about the configuration file in the docs:
        https://doc.qt.io/qt-6/qtquickcontrols-configuration.html

        A 1 Reply Last reply
        2
        • jsulmJ jsulm

          @Amr-Essam said in Inconsistent output when running Qt Design Studio vs Python:

          Am I doing something wrong?

          No, your app is using different style when running compared to what Qt Design Studio is using. Normally you should not care as the style is selected depending on the platform when your app starts (to match the design of the platform).

          A Offline
          A Offline
          Amr Essam
          wrote on last edited by
          #4

          @jsulm I was actually trying to enforce the style regardless of the platform, It turned out to be that the main.py file written by the Qt Design Studio don't set the "QT_QUICK_CONTROLS_CONF" to the correct quick control ".conf" file, thanks a lot.

          1 Reply Last reply
          0
          • Jaime02J Jaime02

            I guess that the is that the Qt Quick style configuration file (qtquickcontrols2.conf) is not being applied in the case of the Python version.
            You may add the file to the environment variables:

            # Assuming this is in <project>/Python/main.py, path to the DS project root folder
            project_root = Path(__file__).parent.parent  
            os.environ["QT_QUICK_CONTROLS_CONF"] = str(project_root / "qtquickcontrols2.conf")
            

            More info about the configuration file in the docs:
            https://doc.qt.io/qt-6/qtquickcontrols-configuration.html

            A Offline
            A Offline
            Amr Essam
            wrote on last edited by
            #5

            @Jaime02 This actually solved the issue, they are both having the same style, thanks a lot for helping.

            1 Reply Last reply
            1

            • Login

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