Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Icon on the menu of Qaction not showing up. [ Solved ]

    General and Desktop
    4
    16
    9738
    Loading More Posts
    • 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.
    • L
      Leon last edited by

      See screenshot and you will understand..
      !http://oi55.tinypic.com/2071i06.jpg(Screen)!

      That's because there isn't any seticonvisible option
      Any ideas?

      1 Reply Last reply Reply Quote 0
      • F
        Franzk last edited by

        Set the icon on the menu action.

        @QMenu *menu = ...;
        menu->menuAction()->setIcon(icon);@

        "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 Reply Quote 0
        • L
          Leon last edited by

          I have set it via the Qt Designer.

          !http://oi56.tinypic.com/29qi0ya.jpg(Screen)!

          But as i said there isn't any seticonvisible option...

          1 Reply Last reply Reply Quote 0
          • F
            Franzk last edited by

            Chances are that if you add the menu to the tool bar itself, you will see the icon. As I mentioned in my previous post, set the icon on the menu action explicitly in your code.

            "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 Reply Quote 0
            • L
              Leon last edited by

              The same with this
              ui>menuHere_no_icon_is_been_shown>setIcon(QIcon(":/icons/Icons/button_blue_fastforward.png"));

              If you want download example project-> http://dl.dropbox.com/u/11379868/example.zip

              1 Reply Last reply Reply Quote 0
              • G
                goetz last edited by

                Did you add the icons to the resource file of the project?

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

                1 Reply Last reply Reply Quote 0
                • A
                  andre last edited by

                  Doesn't it depend on the style if you can have an icon for a complete menu, not just for actions in a menu?

                  1 Reply Last reply Reply Quote 0
                  • L
                    Leon last edited by

                    See clementine screenshot.
                    !http://oi54.tinypic.com/i3cvpu.jpg(Screen)!

                    So Andre what i want, is used in other programs.. ( + Clementine is a qt app )

                    Volker yes the icons are on the resource file..
                    Again If you want download example project-> http://dl.dropbox.com/u/11379868/example.zip

                    1 Reply Last reply Reply Quote 0
                    • F
                      Franzk last edited by

                      [quote author="Leon Vytanos" date="1298466699"]The same with this
                      ui>menuHere_no_icon_is_been_shown>setIcon(QIcon(":/icons/Icons/button_blue_fastforward.png"));
                      [/quote]Dude, reread my post and then fix to this:
                      @ui->menuHere_no_icon_is_been_shown->menuAction()->setIcon(QIcon(":/icons/Icons/button_blue_fastforward.png"));@

                      "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 Reply Quote 0
                      • L
                        Leon last edited by

                        This is how to set the icon to be visible

                        @ ui->menuHere_no_icon_is_been_shown->menuAction()->setIconVisibleInMenu(1);
                        @

                        Problem Solved. Thanks Franzk..

                        1 Reply Last reply Reply Quote 0
                        • G
                          goetz last edited by

                          This is kind-of wrong:

                          @
                          ui->menuHere_no_icon_is_been_shown->menuAction()->setIconVisibleInMenu(1);
                          @

                          this is better:

                          @
                          ui->menuHere_no_icon_is_been_shown->menuAction()->setIconVisibleInMenu(true);
                          @

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

                          1 Reply Last reply Reply Quote 0
                          • L
                            Leon last edited by

                            Volker why is it wrong? Doesn't 1 mean true and 0 false? It does..

                            1 Reply Last reply Reply Quote 0
                            • G
                              goetz last edited by

                              1 and 0 are of type int
                              true and false are of type bool

                              It is casted the right way, yes, but it is considered bad style in C++ (in C you do not have a type bool, so 0/1 is ok there).

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

                              1 Reply Last reply Reply Quote 0
                              • L
                                Leon last edited by

                                Ok thank you Volker.. I didn't know it.

                                1 Reply Last reply Reply Quote 0
                                • A
                                  andre last edited by

                                  Besides, it is much easier to read true and false than 1 and 0, IMHO.

                                  1 Reply Last reply Reply Quote 0
                                  • L
                                    Leon last edited by

                                    I agree!

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post