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. Customize QMenu
QtWS25 Last Chance

Customize QMenu

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 3.9k 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.
  • N Offline
    N Offline
    neel2818
    wrote on last edited by
    #1

    Hi All,

    I want to customize the QMenu in Qt. I want File,Edit,View and Help Menu to be displayed with text as well as image. I mean File text and image should be displayed same way for other Edit,View and Help menu.

    How can i do this ? Any suggestion

    Thanks,
    Neel

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jake007
      wrote on last edited by
      #2

      If you are using designer is very simple. When you add a menu, you'll have settings in sidebar. Just search for icon.

      If you are creating menu from code, use this function "setIcon":http://qt-project.org/doc/qt-4.8/qaction.html#icon-prop .

      Hope I understood your problem correctly.

      Regards,
      Jake


      Code is poetry

      1 Reply Last reply
      0
      • N Offline
        N Offline
        neel2818
        wrote on last edited by
        #3

        you are right . we can set through setIcon but i want both image and text together in QMenu. Right now at a time from application one will come.

        How to do that ?
        Thanks,
        Neel

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

          use

          @
          menu->addAction(icon, text);
          @

          or
          @
          action->setText(text);
          @

          1 Reply Last reply
          0
          • M Offline
            M Offline
            miroslav
            wrote on last edited by
            #5

            If the concept is unclear, look at how QActions and QMenu work together first. A good reference is here: http://cartan.cas.suffolk.edu/oopdocbook/html/menus.html

            Mirko Boehm | mirko@kde.org | KDE e.V.
            FSFE Fellow
            Qt Certified Specialist

            1 Reply Last reply
            0
            • N Offline
              N Offline
              neel2818
              wrote on last edited by
              #6

              thanks for your reply. I will check..

              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