Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Vertical spacer doesn't work after latest update
Forum Updated to NodeBB v4.3 + New Features

Vertical spacer doesn't work after latest update

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 6 Posters 2.0k 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #7

    See https://forum.qt.io/topic/157569 and the according bug report here: https://bugreports.qt.io/browse/QTBUG-126966

    @cristian-adam: Qt designer or QtCreator problem? Can't test it - no compilable Qt designer here atm.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    1 Reply Last reply
    2
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #8

      Currently you can not use a Qt designer (or QtCreator) built with Qt6.7 or higher to modify a ui file which should be used with Qt5.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • F Offline
        F Offline
        friedemannkleint
        wrote on last edited by
        #9

        Qt Designer 6.7 writes fully qualified enumeration values to support scoped enums and Qt for Python (see https://lists.qt-project.org/pipermail/development/2023-November/044620.html ). This is supported in 6.6/6.5.4/6.2.13.

        We got several reports that Qt Widgets Designer 6 was used to generate forms for 5.15, so we added support in 5.15.18 . Nevertheless, this is not supported and works by coincidence at best; widget properties and signal/slot names have changed in Qt 6.

        1 Reply Last reply
        2
        • Ali-SZA Offline
          Ali-SZA Offline
          Ali-SZ
          wrote on last edited by
          #10

          @JonB @Christian-Ehrlicher @friedemannkleint
          First thank you for help and i apologise if i made any confusion.

          So i updated Qt6 to 6.7.2 and Qt5 to 5.15.2 and created fresh Qt6 and Qt5 projects for test, the issue with Qt6 is gone but i still have this issue for Qt5.
          For Qt5, i realised changing following code in generated ui_....h file:

          verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Minimum);
          

          to this:

          verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
          

          Will fix the issue.

          JonBJ 1 Reply Last reply
          0
          • Ali-SZA Ali-SZ

            @JonB @Christian-Ehrlicher @friedemannkleint
            First thank you for help and i apologise if i made any confusion.

            So i updated Qt6 to 6.7.2 and Qt5 to 5.15.2 and created fresh Qt6 and Qt5 projects for test, the issue with Qt6 is gone but i still have this issue for Qt5.
            For Qt5, i realised changing following code in generated ui_....h file:

            verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Minimum);
            

            to this:

            verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
            

            Will fix the issue.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #11

            @Ali-SZ said in Vertical spacer doesn't work after latest update:

            For Qt5, i realised changing following code in generated ui_....h file:

            Yes, but you have a problem: the ui_....h file is regenerated/overwritten any/every time you make any change to the .ui file, or if if you rebuild from clean. Sooner or later this is going to bite you on your bottom!

            I think you have been told that you should not be using that version of Designer for Qt5. You should consider this carefully, as there may (well) be other items which will "go wrong" but may be hard to spot.

            If you are determined to continue with a recent version of Creator even for an old Qt5. I would look at leaving whatever line is generated into ui_....h file as-is, because of regeneration. Have a look in ui_....h to see how you can access the variable for the spacer, I think it will be ui->verticalSpacer if you have named the widget.

            Now immediately after the call in your code to setupUi() append code to change it to whatever is needed for Qt5. You might do that at compile-time with a hard-coded replacement by enclosing inside some #ifdef Qt5 ... #endif or at runtime via some if (qt_version() == Qt5). In the latter case you could read the current spacer size policy properties and set them back in swapped order: this could be used if you have other spacers which need changing. I think either of these approaches can be done, you'll have to search docs or ask for the correct symbol/function/variable to use for these tests.

            Ali-SZA L 2 Replies Last reply
            1
            • JonBJ JonB

              @Ali-SZ said in Vertical spacer doesn't work after latest update:

              For Qt5, i realised changing following code in generated ui_....h file:

              Yes, but you have a problem: the ui_....h file is regenerated/overwritten any/every time you make any change to the .ui file, or if if you rebuild from clean. Sooner or later this is going to bite you on your bottom!

              I think you have been told that you should not be using that version of Designer for Qt5. You should consider this carefully, as there may (well) be other items which will "go wrong" but may be hard to spot.

              If you are determined to continue with a recent version of Creator even for an old Qt5. I would look at leaving whatever line is generated into ui_....h file as-is, because of regeneration. Have a look in ui_....h to see how you can access the variable for the spacer, I think it will be ui->verticalSpacer if you have named the widget.

              Now immediately after the call in your code to setupUi() append code to change it to whatever is needed for Qt5. You might do that at compile-time with a hard-coded replacement by enclosing inside some #ifdef Qt5 ... #endif or at runtime via some if (qt_version() == Qt5). In the latter case you could read the current spacer size policy properties and set them back in swapped order: this could be used if you have other spacers which need changing. I think either of these approaches can be done, you'll have to search docs or ask for the correct symbol/function/variable to use for these tests.

              Ali-SZA Offline
              Ali-SZA Offline
              Ali-SZ
              wrote on last edited by
              #12

              @JonB said in Vertical spacer doesn't work after latest update:

              Now immediately after the call in your code to setupUi() append code to change it to whatever is needed for Qt5. You might do that at compile-time with a hard-coded replacement by enclosing inside some #ifdef Qt5 ... #endif or at runtime via some if (qt_version() == Qt5). In the latter case you could read the current spacer size policy properties and set them back in swapped order: this could be used if you have other spacers which need changing. I think either of these approaches can be done, you'll have to search docs or ask for the correct symbol/function/variable to use for these tests.

              Thank you, this solves the issue for now.

              1 Reply Last reply
              1
              • Ali-SZA Ali-SZ has marked this topic as solved on
              • JonBJ JonB

                @Ali-SZ said in Vertical spacer doesn't work after latest update:

                For Qt5, i realised changing following code in generated ui_....h file:

                Yes, but you have a problem: the ui_....h file is regenerated/overwritten any/every time you make any change to the .ui file, or if if you rebuild from clean. Sooner or later this is going to bite you on your bottom!

                I think you have been told that you should not be using that version of Designer for Qt5. You should consider this carefully, as there may (well) be other items which will "go wrong" but may be hard to spot.

                If you are determined to continue with a recent version of Creator even for an old Qt5. I would look at leaving whatever line is generated into ui_....h file as-is, because of regeneration. Have a look in ui_....h to see how you can access the variable for the spacer, I think it will be ui->verticalSpacer if you have named the widget.

                Now immediately after the call in your code to setupUi() append code to change it to whatever is needed for Qt5. You might do that at compile-time with a hard-coded replacement by enclosing inside some #ifdef Qt5 ... #endif or at runtime via some if (qt_version() == Qt5). In the latter case you could read the current spacer size policy properties and set them back in swapped order: this could be used if you have other spacers which need changing. I think either of these approaches can be done, you'll have to search docs or ask for the correct symbol/function/variable to use for these tests.

                L Offline
                L Offline
                legerborea
                wrote on last edited by
                #13

                @JonB Hello,
                You said to not use this version of the Designer for Qt5 projects but how do we go back to a previous QtCreator version ? (I have the exact same issue, designer view is fine but once built, spacer doesn't behave the same)
                Qt MaintenanceTool doesn't provide a way to go back to a previous version and I can't find a parameter to set the designer version... (We are still stuck to Qt5.15 due to missing features in the Qt6 version)

                Any help will be appreciated

                jsulmJ 1 Reply Last reply
                0
                • L legerborea

                  @JonB Hello,
                  You said to not use this version of the Designer for Qt5 projects but how do we go back to a previous QtCreator version ? (I have the exact same issue, designer view is fine but once built, spacer doesn't behave the same)
                  Qt MaintenanceTool doesn't provide a way to go back to a previous version and I can't find a parameter to set the designer version... (We are still stuck to Qt5.15 due to missing features in the Qt6 version)

                  Any help will be appreciated

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

                  @legerborea said in Vertical spacer doesn't work after latest update:

                  Qt MaintenanceTool doesn't provide a way to go back to a previous version

                  There should be "Archive" check boy (not sure what exact text is shown there) to activate older versions.
                  But you can also download from https://download.qt.io/archive/qtcreator/

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

                  L 1 Reply Last reply
                  1
                  • jsulmJ jsulm

                    @legerborea said in Vertical spacer doesn't work after latest update:

                    Qt MaintenanceTool doesn't provide a way to go back to a previous version

                    There should be "Archive" check boy (not sure what exact text is shown there) to activate older versions.
                    But you can also download from https://download.qt.io/archive/qtcreator/

                    L Offline
                    L Offline
                    legerborea
                    wrote on last edited by
                    #15

                    @jsulm Hello, thank you for your answer, I have tried the checkbox "archives" but this only allow for old "kits", not old "qt creator" versions (see picture below).
                    I will try to build it from sources from the link you gave me, thank you.

                    Capture d’écran du 2024-09-17 10-36-39.png

                    jsulmJ 1 Reply Last reply
                    0
                    • L legerborea

                      @jsulm Hello, thank you for your answer, I have tried the checkbox "archives" but this only allow for old "kits", not old "qt creator" versions (see picture below).
                      I will try to build it from sources from the link you gave me, thank you.

                      Capture d’écran du 2024-09-17 10-36-39.png

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

                      @legerborea said in Vertical spacer doesn't work after latest update:

                      I will try to build it from sources from the link you gave me

                      You don't have to build from source - there are also binaries for Windows, Linux and MacOS

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

                      L 1 Reply Last reply
                      1
                      • jsulmJ jsulm

                        @legerborea said in Vertical spacer doesn't work after latest update:

                        I will try to build it from sources from the link you gave me

                        You don't have to build from source - there are also binaries for Windows, Linux and MacOS

                        L Offline
                        L Offline
                        legerborea
                        wrote on last edited by
                        #17

                        @jsulm Thank you, I didn't want to run the installer, simply start a "standalone" version (to not break Qt Creator installed from Qt Maintenance Tool still useful for Qt 6 projects), so I used this one : https://download.qt.io/official_releases/qtcreator/13.0/13.0.2/installer_source/linux_x64/

                        Thank you for your help, this fixed my issue, I can continue to maintain 5.15.x projects :)

                        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