Search code examples
qtqpushbuttonqtstylesheets

QCommandLinkButton text and icon position style with QSS


I want to customize a QCommandLinkButton using QSS and I want to customize to widget's icon position and text position. Is this possible? I couldn't find anything on the web or on the QSS Reference Documentation although the widget can be styled. I tried the width and height properties and they do work. I think all the properties that work on QPushButton work also on QCommandLinkButton as QCommandLinkButton inherits QPushButton.

I tried

QCommandLinkButton::text {
    left: 10px;
}


QCommandLinkButton::icon {
    left: 10px;
}

but no effect.

Any thoughts?


Solution

  • This is not possible yet (speaking as of Qt 5.3.1). In order to achieve this you have to derive the class and reimplement the paintEvent.