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. Qt equivalent for GTK expander

Qt equivalent for GTK expander

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 2.3k Views 4 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.
  • 3 Offline
    3 Offline
    3beezer
    wrote on last edited by
    #1

    I just started learning Qt in preparation for porting an application from GTK. I am not finding a widget equivalent to a GTK expander, but I see it in Qt Designer. What is the widget in the attached image with the text "Display Widgets"?

    0_1561329868265_expander.jpg

    JKSHJ 1 Reply Last reply
    0
    • 3 3beezer

      I just started learning Qt in preparation for porting an application from GTK. I am not finding a widget equivalent to a GTK expander, but I see it in Qt Designer. What is the widget in the attached image with the text "Display Widgets"?

      0_1561329868265_expander.jpg

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      @3beezer said in Qt equivalent for GTK expander:

      I just started learning Qt in preparation for porting an application from GTK. I am not finding a widget equivalent to a GTK expander, but I see it in Qt Designer. What is the widget in the attached image with the text "Display Widgets"?

      Hi @3beezer, and welcome!

      Have a look at QToolBox. It shows 1 child at a time -- does that suit your needs?

      If I'm not mistaken, the Qt Designer expander for "Display Widgets" is custom code. I can look up the code if QToolBox isn't suitable.

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

      1 Reply Last reply
      2
      • 3 Offline
        3 Offline
        3beezer
        wrote on last edited by
        #3

        QToolBox is at least close. It appears to provide the same functionality, but the appearance is quite difference. I like the appearance of the widget in Qt Designer better. If it is custom, is it possible to get the code? I am using PySide2, but I suppose I could translate C++ code.

        I found a lot of postings from people looking for such a widget. Your response suggesting a QToolBox comes closer than any other I have seen, which all suggested a custom solution. It is surprising to me that such a widget is not standard considering how many widgets there are in Qt. It is also surprising that there seems to be no gallery of all the widgets showing them in action. Such a thing would be very helpful to beginners like me. The Widget Box in Qt Designer is the closest thing I have found. The documentation sometimes has an image, but not always. Is there an app that displays all the widgets and permits them to be operated?

        Thanks for the suggestion.

        JKSHJ 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          The source of Qt Designer is in the qttool module that you can either get through the Maintenance Tool if you installed Qt using the online installer or clone it from https://code.qt.io

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • 3 3beezer

            QToolBox is at least close. It appears to provide the same functionality, but the appearance is quite difference. I like the appearance of the widget in Qt Designer better. If it is custom, is it possible to get the code? I am using PySide2, but I suppose I could translate C++ code.

            I found a lot of postings from people looking for such a widget. Your response suggesting a QToolBox comes closer than any other I have seen, which all suggested a custom solution. It is surprising to me that such a widget is not standard considering how many widgets there are in Qt. It is also surprising that there seems to be no gallery of all the widgets showing them in action. Such a thing would be very helpful to beginners like me. The Widget Box in Qt Designer is the closest thing I have found. The documentation sometimes has an image, but not always. Is there an app that displays all the widgets and permits them to be operated?

            Thanks for the suggestion.

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            @3beezer said in Qt equivalent for GTK expander:

            QToolBox is at least close. It appears to provide the same functionality, but the appearance is quite difference. I like the appearance of the widget in Qt Designer better.

            Try customizing the style of a QToolBox first:

            • https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbox
            • https://doc.qt.io/qt-5/stylesheet-reference.html

            is it possible to get the code?

            Yep. It's the WidgetBox in Qt Designer: https://code.qt.io/cgit/qt/qttools.git/tree/src/designer/src/components/widgetbox

            The WidgetBox reads widgetbox.xml and uses the data to dynamically populate itself. The GUI is mainly in the WidgetBoxTreeWidget

            Here's an interactive code browser, but it only shows the *.h and *.cpp files: https://code.woboq.org/qt5/qttools/src/designer/src/components/widgetbox/

            I suppose I could translate C++ code

            If you don't like styling or the WidgetBox code, there's also the option of using a QTreeView or QTreeWidget.

            It is surprising to me that such a widget is not standard considering how many widgets there are in Qt.

            You could suggest a feature at https://bugreports.qt.io/

            It is also surprising that there seems to be no gallery of all the widgets showing them in action. Such a thing would be very helpful to beginners like me... The documentation sometimes has an image, but not always. Is there an app that displays all the widgets and permits them to be operated?

            You're right, such an example would be useful. Unfortunately, it doesn't exist.

            Here are some alternatives:

            • List of all widget classes: https://doc.qt.io/qt-5/widget-classes.html
            • Gallery code for Qt Quick Controls 2: https://doc.qt.io/qt-5/qtquickcontrols-gallery-example.html

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

            1 Reply Last reply
            2
            • 3 Offline
              3 Offline
              3beezer
              wrote on last edited by
              #6

              Thanks for the informative replies. Today is day 2 of learning Qt, but I will investigate your suggestions as I get up to speed.

              1 Reply Last reply
              0
              • Kent-DorfmanK Offline
                Kent-DorfmanK Offline
                Kent-Dorfman
                wrote on last edited by
                #7

                The expander is just a specialization of a "tree view" node, right? maybe see if the tree view classes can provide what you want.

                If you meet the AI on the road, kill it.

                1 Reply Last reply
                0
                • 3 Offline
                  3 Offline
                  3beezer
                  wrote on last edited by
                  #8

                  I thought I should mention for the benefit of any readers also seeking such a resource that Summerfield "Rapid GUI Programming with Python and Qt" contains in Appendix B a gallery of some Qt widgets. This book is out of date because it is based on PyQt 4, but I still find it to be very helpful. His discussions of program structure, methodologies, techniques, and philosophies are still very current, and the numerous program examples may be out of date, but they are close enough to be informative. "Hands-On Qt for Python Developers" is current -- it appeared late May 2019 -- but it contains little of this sort of information.

                  1 Reply Last reply
                  3

                  • Login

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