Qt QPushbutton Icon above Text

Qt QPushbutton Icon above Text

Asked on January 10, 2019 in Qt.
Add Comment

  • 3 Answer(s)

    The Qt QPushbutton Icon text:

    Click this link . QToolButton 

    QToolButton* button = new QToolButton(this);
    button->setText("Sample text");

    By  creating  the button widget and copied   from QPushButton or QAbstractButton  and  to focus  by the  efforts of complementging  paintEvent().

    Answered on January 10, 2019.
    Add Comment

    The given below code is simple:

    QPushButton {
        padding: -25px 0 10px 0;
        border: 1px solid black;
        border-radius: 2px;
        background-position: center bottom;
        background-repeat: no-repeat;
        background-origin: content;
        background-image: url(":/new/resource/accept.png");
    QPushButton:disabled {
        background-image: url(":/new/resource/accept_b.png");
    Answered on January 10, 2019.
    Add Comment

    The simple statement is:

    Here the  QPushButton  is not available. In QPushButton, the options are fixed the LayoutDirection are LeftToRight, RightToLeft and Auto. And to can the QToolButton  .

    By using the  Qt Creator, switch to Design pane, add a QToolButton and in the right side bottom pane, an  option ‘textFormat’, in that select ToolButtonTextUnderIcon.

     Modify: The textFormat  are changed to toolButtonStyle in the versions of Qt Creator (4.7.0).


    Answered on January 10, 2019.
    Add Comment

  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.