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 text and image position set // help me
Forum Updated to NodeBB v4.3 + New Features

QToolButton text and image position set // help me

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.2k 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.
  • K Offline
    K Offline
    Kycho
    wrote on last edited by
    #1

    I want to decorate the buttons in the form shown below.

    0_1545878886871_qtbutton.png

    But I could not solve one problem.
    I have to specify the position of the image and text, I found something similar, but I did not want it.

     // rooms is QToolButton.
        rooms.at(roomIndex)->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        rooms.at(roomIndex)->setIconSize(imageSize);
        rooms.at(roomIndex)->setIcon(image);
    

    This source code is placed at the top of the image and the text at the bottom. I want to reverse the position.
    So, what I want is for the text to be at the top and the image to be at the bottom.

    How can I solve this problem?
    Please help me.

    RatzzR 1 Reply Last reply
    0
    • K Kycho

      I want to decorate the buttons in the form shown below.

      0_1545878886871_qtbutton.png

      But I could not solve one problem.
      I have to specify the position of the image and text, I found something similar, but I did not want it.

       // rooms is QToolButton.
          rooms.at(roomIndex)->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
          rooms.at(roomIndex)->setIconSize(imageSize);
          rooms.at(roomIndex)->setIcon(image);
      

      This source code is placed at the top of the image and the text at the bottom. I want to reverse the position.
      So, what I want is for the text to be at the top and the image to be at the bottom.

      How can I solve this problem?
      Please help me.

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by
      #2

      @Kycho said in QToolButton text and image position set // help me:

      setToolButtonStyle

      U cannot do this with only QToolbutton because the setToolButtonStyle does not have the option http://doc.qt.io/qt-5/qt.html#ToolButtonStyle-enum.
      Alternately u can design with with a QLabel on top of QToolbutton within layout.

      --Alles ist gut.

      1 Reply Last reply
      3
      • K Offline
        K Offline
        Kycho
        wrote on last edited by
        #3

        Thank you for your reply.

        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