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. Change trinagle in the menu button
Forum Update on Monday, May 27th 2025

Change trinagle in the menu button

Scheduled Pinned Locked Moved General and Desktop
20 Posts 6 Posters 9.6k 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.
  • T Offline
    T Offline
    TonyR
    wrote on last edited by
    #1

    When the popup menu is associateed with push button in some styles we can see will produce a small triangle to the right of the button's text. How we can change this triangle?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

      you mean a tool tip ? You could post here a screen shot too..


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TonyR
        wrote on last edited by
        #3

        !http://developer.qt.nokia.com/doc/qt-4.8/images/cleanlooks-pushbutton-menu.png(Menu button)!

        You can see it the documentation for QPushButton
        @void QPushButton::setMenu ( QMenu * menu )@

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rahul Das
          wrote on last edited by
          #4

          Doc also says that,in some styles it will produce a small triangle to the right of the button's text. I afraid, we can't control drawing that triangle.


          Declaration of (Platform) independence.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fluca1978
            wrote on last edited by
            #5

            The appearance is driven by the style in use, so you have to deal with the windowing style. I don't think this is possible without implementing a new style.

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

              You could try creating a [[doc:QProxyStyle]] and reimplementing QStyle::standardItemImplementation() to return whatever you need when the SP_ArrowDown pixmap is requested. However, I am not sure that this is actually used by all styles, nor that this is the right pixmap. YMMV

              1 Reply Last reply
              0
              • T Offline
                T Offline
                TonyR
                wrote on last edited by
                #7

                [quote author="Andre" date="1325171799"]You could try creating a [[doc:QProxyStyle]] and reimplementing QStyle::standardItemImplementation() [/quote]
                Interesting idea, but I don't found [[doc:QStyle::standardItemImplementation()]]

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Chris H
                  wrote on last edited by
                  #8

                  I think he means "standardIconImplementation":http://developer.qt.nokia.com/doc/qt-4.8/qstyle.html#standardIconImplementation

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

                    Yeah, sorry, that's what I mend.

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      BlackJack
                      wrote on last edited by
                      #10

                      Hello
                      I have a similar problem.
                      You need to replace the standard icon, on the other

                      I created a new class inherited from QProxyStyle and redefined method standardIconImplementation, but for some reason I will not have changed...

                      @class CustomStyle :
                      public QProxyStyle
                      {
                      Q_OBJECT
                      public:
                      CustomStyle();

                      protected slots:
                      QIcon standardIconImplementation(StandardPixmap standardIcon,
                      const QStyleOption *option,
                      const QWidget *widget) const;
                      };
                      @
                      and the implementation itself
                      @QIcon CustomStyle::standardIconImplementation(StandardPixmap standardIcon,
                      const QStyleOption *option,
                      const QWidget *widget) const
                      {
                      switch(standardIcon)
                      {
                      case QStyle::SP_TitleBarMenuButton:
                      return QIcon(":/image/circle_middle.png");
                      case QStyle::SP_ArrowDown:
                      return QIcon(":/image/circle_middle.png");
                      case QStyle::SP_CommandLink:
                      return QIcon(":/image/circle_middle.png");
                      }
                      return QProxyStyle::standardIconImplementation(standardIcon, option, widget);

                      }
                      @

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        BlackJack
                        wrote on last edited by
                        #11

                        that no one will help me not? :(

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

                          Is your method actually called? Are you sure your proxy style is used as the style for the application?

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            BlackJack
                            wrote on last edited by
                            #13

                            Yes it is connected and is the default style
                            @#include "customstyle.h"
                            #include "widget.h"

                            int main(int argc, char *argv[])
                            {
                            QApplication a(argc, argv);

                            a.setStyle(new CustomStyle());
                            
                            Widget w;   w.show();
                            
                            return a.exec();
                            

                            }@

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

                              Are you sure as in: you inserted some debug statement in your QProxyStyle-derived class and you actually get the debug output?

                              1 Reply Last reply
                              0
                              • B Offline
                                B Offline
                                BlackJack
                                wrote on last edited by
                                #15

                                In the debugger, there is some reason only one event where:

                                standardIcon = QStyle:: SP_CommandLink (56)

                                and nothing else happens, comes only once in the function

                                @QIcon CustomStyle::standardIconImplementation(StandardPixmap standardIcon,
                                const QStyleOption *option,
                                const QWidget *widget) const@

                                1 Reply Last reply
                                0
                                • B Offline
                                  B Offline
                                  BlackJack
                                  wrote on last edited by
                                  #16

                                  it turns out that what that is processed by rendering elements of the application, but not items that are on the main widget, the widget belongs at the application
                                  If any ideas?

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

                                    I have no idea what you mean by your last question. Sorry. Please try to reformulate.

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      BlackJack
                                      wrote on last edited by
                                      #18

                                      have any idea why the realties do not want to handle the painting elements widgit ?

                                      1 Reply Last reply
                                      0
                                      • B Offline
                                        B Offline
                                        BlackJack
                                        wrote on last edited by
                                        #19

                                        sorry, it's probably my bad english (

                                        I will try to reformulate.

                                        When run the program in the debugger and do a breakpoint in my overriding function

                                        @
                                        QIcon CustomStyle::standardIconImplementation(StandardPixmap standardIcon,
                                        const QStyleOption *option,
                                        const QWidget *widget) const--
                                        @

                                        function comes in only 2 times though Widgit is all sorts of different elements of the table, buttons, and just from the drop-down lists on PushButton with which the problem's

                                        1 Reply Last reply
                                        0
                                        • B Offline
                                          B Offline
                                          BlackJack
                                          wrote on last edited by
                                          #20

                                          problem can be solved much more than I ask all thought to remove the triangle can be with the aid of styles

                                          @
                                          QPushButton:: menu-indicator {
                                          image: "";
                                          }
                                          @

                                          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