Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Which solution is best to resize QToolButton full-width?
QtWS25 Last Chance

Which solution is best to resize QToolButton full-width?

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 3 Posters 13.3k 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
    khris
    wrote on last edited by
    #1

    I wanted same width and full-width QToolButtons but my phone abandoned me :(

    First I thought set QSS to QToolButton with "width: 100%;" but it didn't be resized I wish. Then I thought some solutions like reimplementing QToolBar's resize event, using QWidgetAction with QPushButton, Inserting HBoxLayout to QToolbar and etc.

    Umm... I guess better solution is exist, maybe. Any other solutions?

    Let it be, let it be, let it be, walk your way.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ajakl
      wrote on last edited by
      #2

      Sounds like your issue is also related to the request here:
      "http://bugreports.qt.nokia.com/browse/QTBUG-13120":http://bugreports.qt.nokia.com/browse/QTBUG-13120
      It's being worked on by the Qt team at the moment. If you have additional comments or suggestions, please post them as a comment to the report!

      1 Reply Last reply
      0
      • K Offline
        K Offline
        khris
        wrote on last edited by
        #3

        Thx ajkl. I have just commented.

        Qt team doesn't think it is not so important. But I think it's very important issue for Symbian developers with Qt… :-/

        Let it be, let it be, let it be, walk your way.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Fuzzbender
          wrote on last edited by
          #4

          We do think it is important (but not critical).

          Note that you can easily set your QToolButtons inside QToolBars occupy fullwidth using sizepolicies.

          For example:
          @
          QToolBar *toolbar = new QToolBar(this);
          QToolButton *toolbutton = new QToolButton(this);
          toolbutton->setText("ToolButton");
          toolbutton->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
          toolbar ->addWidget(toolbutton);
          toolbar ->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
          @

          Hopefully this helps.

          Please follow the linked bug for additional information.

          1 Reply Last reply
          1
          • K Offline
            K Offline
            khris
            wrote on last edited by
            #5

            Thx for your help, Fuzzbender.

            Your code works well but setSizePolicy() doesn't affect QToolButton that created through addAction() method.

            I used setSizePolicy() in actionEvent() and resizeEvent() with QToolButton got by widgetForAction(). Am I worng?

            Let it be, let it be, let it be, walk your way.

            1 Reply Last reply
            0
            • F Offline
              F Offline
              Fuzzbender
              wrote on last edited by
              #6

              Yes, you are right. ToolBar uses layout to internally set the size of QAction derived buttons to "minimal".

              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