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. promoting "designer" widgets
QtWS25 Last Chance

promoting "designer" widgets

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 2 Posters 537 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.
  • K Offline
    K Offline
    Kent-Dorfman
    wrote on 10 Jan 2023, 05:44 last edited by
    #1

    It's been a long time since I've actually done any Qt coding, and prior there was a good bit of Qt-designer UI stuff run under pyqt.

    I'm trying to remember if there is an easy "quick-n-dirty" way to use a UI designer widget within a larger designer UI interface. I think the way I hacked it before was to reserve space on the global UI as a QWidget and at object init/constructor of the UI I would reassigned the QWidget pointers to point to my custom UIs. It was ugly but it worked in python.

    I have a complex widget that I need to duplicate four times on the larger UI (probly via an array) such that when I update any subwidget attributes the effects cascade throu the higher numbered ones in the array, and to an output view. The application is a paint/pigment mixing simulation that "correctly" deals with the subtractive nature of mixed pigments, as opposed to the additive light nature of the RGB color model used in computer graphics.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on 10 Jan 2023, 07:19 last edited by
      #2

      In Designer place four QWidgets into your layout and then select the "Promote to..." option for one of the widgets:
      b9dd975e-d1b1-4ed4-af3c-5ad166e24078-image.png
      Tell Designer what class should be used in place of QWidget:
      4bd3ee97-8b4d-428d-a039-22441e76fd28-image.png
      Click Add, then Promote
      For the other Widgets you will have a shortcut menu to Promote them to the previously defined class.

      1 Reply Last reply
      3
      • K Offline
        K Offline
        Kent-Dorfman
        wrote on 10 Jan 2023, 21:17 last edited by
        #3

        that works. Thanks!

        but an annoyance with the designer GUI interface surfaced. The "Promoted Classes" dialog forces the header filename to be all lowercase, regardless of mixed case naming of the class itself. Somewhat annoying, and forced me to manually edit the xml.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote on 10 Jan 2023, 22:08 last edited by
          #4

          @Kent-Dorfman said in promoting "designer" widgets:

          The "Promoted Classes" dialog forces the header filename to be all lowercase

          It does not force anything. It defaults the header file name to a lowercase version of the class name* but you can edit the value in the dialog to suit yourself. The file name does not need to be in any way derived from the class name.
          e2f9c213-c816-4be6-9383-c967e0986397-image.png

          • This is a very common, dare I say the overwhelming prevalent, naming system
          1 Reply Last reply
          1
          • K Offline
            K Offline
            Kent-Dorfman
            wrote on 11 Jan 2023, 03:00 last edited by
            #5

            That's not the behaviour I witnessed. upon changing th header name to mixed case and losing focus in that textedit field, it spontaneously changed it back to lowercase.

            C 1 Reply Last reply 11 Jan 2023, 07:36
            0
            • K Kent-Dorfman
              11 Jan 2023, 03:00

              That's not the behaviour I witnessed. upon changing th header name to mixed case and losing focus in that textedit field, it spontaneously changed it back to lowercase.

              C Offline
              C Offline
              ChrisW67
              wrote on 11 Jan 2023, 07:36 last edited by
              #6

              @Kent-Dorfman I have two versions of Qt 5 Designer and one Qt 6 Designer. All behave correctly on Linux.

              What version of Designer are you using, and on what platform?

              1 Reply Last reply
              0
              • K Offline
                K Offline
                Kent-Dorfman
                wrote on 11 Jan 2023, 08:29 last edited by
                #7

                It is making a liar out of me now, but some combination of operations DID cause it to misbehave earlier.

                My coding standard is a single class per header and use of hpp and cpp as extensions. Class name and header name must exactly match.

                Using Debian11 so it is 5.15.2

                Anyway, tis not important now.

                1 Reply Last reply
                0

                7/7

                11 Jan 2023, 08:29

                • Login

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