Important: Please read the Qt Code of Conduct -

QPushButton text, icon and stylesheets

  • Hi there.

    I have my own class named IconButton.
    This class contains QLabel* as member.
    This method allow me very flexible interface with accessing button or label.
    Also i can use custom stylesheets for label and for button.

    Code part:

    class wIconButton : public QPushButton, public wWidget
    	QLabel* m_overlay_label;
    wIconButton::wIconButton(const QString& name)
    	: wWidget(name)
    	, m_sub(0)
    	m_overlay_label = new QLabel(this);

    Button created with this class looks like:
    0_1525784845337_StereoControlCenter 2018-05-08 16.04.48.png

    So main question is:
    Can i draw button like mine without additional Qlabel object?
    (and without tons of code)

    What i need from button:
    Specify text position (bottom, top...)
    Specify text color (font size)
    Specify gradient to label

  • Lifetime Qt Champion

Log in to reply