Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Customize QMenu

    General and Desktop
    4
    6
    3506
    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.
    • N
      neel2818 last edited by

      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 Reply Quote 0
      • J
        Jake007 last edited by

        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 Reply Quote 0
        • N
          neel2818 last edited by

          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 Reply Quote 0
          • R
            rschaub last edited by

            use

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

            or
            @
            action->setText(text);
            @

            1 Reply Last reply Reply Quote 0
            • M
              miroslav last edited by

              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 Reply Quote 0
              • N
                neel2818 last edited by

                thanks for your reply. I will check..

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