Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QToolButton text and image position set // help me



  • 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.



  • @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.



  • Thank you for your reply.


Log in to reply