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. How does QToolBar get it's buttons?
QtWS25 Last Chance

How does QToolBar get it's buttons?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 4.4k 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.
  • N Offline
    N Offline
    nonot1
    wrote on last edited by
    #1

    Hello,

    If you add Actions to a QToolBar somehow it generates QToolButtons and wires it up so that the Actions's signals are emitted when the button is clicked.

    How does it do this, and what guidelines should I follow if I want to create my own "action containing" widget?

    Thank you

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      Have a look at the "source":http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/widgets/qtoolbar.cpp, I'd say. Also look at http://doc.trolltech.com/latest/qwidget.html#addAction, for that is what QToolBar also uses.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nonot1
        wrote on last edited by
        #3

        Franzk,

        The docs (and source) only show addAction appending the QAction to the Widget's internal list of actions.. nothing more.

        What is QToolBar doing to generate it's buttons?

        Also, since I'd like to build my own Action containing widget, I'd like to know if there is API or guidelines to model my widgets behavior after.

        Thank you

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          QToolBar creates the buttons from the list of QActions, using the icons and/or text of those.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nonot1
            wrote on last edited by
            #5

            Volker,

            I realize that QToolBar is making the buttons, but where / how is this happening?

            The same question could be asked about QMenu.

            The "source":http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/widgets/qtoolbar.cpp for QToolBar is not very clear on this point. (Or, at least, I did not spot it.)

            Again, I am trying to build my own widget that can have actions added to it, and I'd like to see the right/"qt" way to make this happen.

            Thank you

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              Line 979 is, I think, where you should start your trace of what happens.

              1 Reply Last reply
              0

              • Login

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