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. Icon on the menu of Qaction not showing up. [ Solved ]
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
16 Posts 4 Posters 11.1k 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #3

    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
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #4

      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
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #5

        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
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #6

          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
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #7

            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
            0
            • L Offline
              L Offline
              Leon
              wrote on last edited by
              #8

              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
              0
              • F Offline
                F Offline
                Franzk
                wrote on last edited by
                #9

                [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
                0
                • L Offline
                  L Offline
                  Leon
                  wrote on last edited by
                  #10

                  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
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #11

                    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
                    0
                    • L Offline
                      L Offline
                      Leon
                      wrote on last edited by
                      #12

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

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

                        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
                        0
                        • L Offline
                          L Offline
                          Leon
                          wrote on last edited by
                          #14

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

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

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

                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              Leon
                              wrote on last edited by
                              #16

                              I agree!

                              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