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. QToolButton Arrow is behind text in Instant popup mode. Can I get rid of it?

QToolButton Arrow is behind text in Instant popup mode. Can I get rid of it?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.3k 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.
  • P Offline
    P Offline
    primem0ver
    wrote on last edited by
    #1

    I am using a QToolButton on a toolbar to bring up a menu.

    According to the documentation, if you use ToolButtonPopupMode::MenuButtonPopup it shows an arrow. I discovered that the arrow must be clicked in order to actually show the menu. I didn't want that so I used ToolButtonPopupMode::Instant instead.

    However, the arrow is still there. Only now it is just to the right of the text in the place a period would be if I put it after the text... except that the part of the arrow stretches behind the text. I don't mind an arrow showing where it was with MenuButtonPopup but I do not want to have to click the arrow in order for the menu to show. And I CERTAINLY don't want it at the bottom of the button where it is half covered up by the text.

    Can I make the arrow disappear/Get rid of the arrow entirely and still have it be a menu button?

    1 Reply Last reply
    0
    • W Offline
      W Offline
      witekt
      wrote on last edited by
      #2

      I use something like that:

      @
      // remove when issue 210047 from Trolltech Task Tracker will be solved
      class ToolButtonWorkarounded : public QToolButton
      {
      public:
      ToolButtonWorkarounded( QWidget* _parent = 0 );

      protected:
      void paintEvent( QPaintEvent* _paintEvent );
      }; // class ToolButtonWorkarounded

      ToolButtonWorkarounded::ToolButtonWorkarounded( QWidget* _parent )
      : QToolButton( _parent )
      {
      } // ToolButtonWorkarounded::ToolButtonWorkarounded

      void
      ToolButtonWorkarounded::paintEvent( QPaintEvent* _paintEvent )
      {
      QStyleOptionToolButton styleOption;
      QToolButton::initStyleOption( &styleOption );
      styleOption.features &= ~QStyleOptionToolButton::HasMenu;

      QPainter painter( this );
      style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter, this );
      } // ToolButtonWorkarounded::paintEvent
      @

      1 Reply Last reply
      0
      • P Offline
        P Offline
        primem0ver
        wrote on last edited by
        #3

        Thanks! That worked great. How do I get to the Trolltech task tracker to find that issue?

        1 Reply Last reply
        0
        • W Offline
          W Offline
          witekt
          wrote on last edited by
          #4

          It's so old that I don't think it would ever be fixed. It was reported using previous bugs database, now it's QTBUG-2036.

          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