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. qtoolbutton icon is cropped
QtWS25 Last Chance

qtoolbutton icon is cropped

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.7k 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #1

    i create a QMenu, and a QToolButton, and set the menu to the tool button. i also set an icon to the tool button, but since it has a menu, the icon is located on both the action part of the button and also on the part from where you click and the menu is displayed. is this a QToolButton problem? cause the icon is an ordinary .png file and it's okay.

    how can i solve this?

    A 1 Reply Last reply
    0
    • U user4592357

      i create a QMenu, and a QToolButton, and set the menu to the tool button. i also set an icon to the tool button, but since it has a menu, the icon is located on both the action part of the button and also on the part from where you click and the menu is displayed. is this a QToolButton problem? cause the icon is an ordinary .png file and it's okay.

      how can i solve this?

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @user4592357 Can you show a screenshot of what you're talking about?

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      1
      • U Offline
        U Offline
        user4592357
        wrote on last edited by
        #3

        @ambershark here's what i'm talking about: alt text

        as you can see, the part of the picture falls under that menu-button

        A 1 Reply Last reply
        0
        • U user4592357

          @ambershark here's what i'm talking about: alt text

          as you can see, the part of the picture falls under that menu-button

          A Offline
          A Offline
          ambershark
          wrote on last edited by
          #4

          @user4592357 Hmm that is weird. Can you share some code to reproduce that issue? I'll play with it and see if I can see what is causing it for you.

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          1 Reply Last reply
          1
          • U Offline
            U Offline
            user4592357
            wrote on last edited by
            #5

            it's basically this:

            auto toolBar = new QToolBar();
            auto menu = new QMenu(toolBar);
            
            // add actions to menu
            
            auto toolButton = new QToolButton(toolBar);
            toolButton->setIcon(QIcon(":/icon"));
            toolButton->setPopupMode(QToolButton::MenuButtonPopup);
            toolButton->setMenu(textCasesMenu);
            
            toolBar->addWidget(toolButton);
            
            1 Reply Last reply
            0
            • A Offline
              A Offline
              ambershark
              wrote on last edited by ambershark
              #6

              Worked fine for me using that code you posted.

              alt text

              My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

              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