I still think you need to re-think your design.
You need a button which is not a button, but looks like a button but it fact is a label...
Read what you're saying - the idea of a button is that it can be interacted with. You're looking for something that will not be interacted with.
What about QLabel? That's exacly what it is for.
You can style the label as you want, even to look like a PushButton (I still fail to see a reason for that).
l->setAlignment( Qt::AlignCenter );
l->setStyleSheet(
"QLabel {"
"margin: 1px;"
"border-color: #0c457e;"
"border-style: outset;"
"border-radius: 3px;"
"border-width: 1px;"
"color: black;"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EBEBEB, stop: 1 #CCCCCC );"
"}"
);
QLabel* l = new QLabel("Test", this);
l->setAlignment( Qt::AlignCenter );
l->setStyleSheet(
"QLabel {"
"margin: 1px;"
"border-color: #0c457e;"
"border-style: outset;"
"border-radius: 3px;"
"border-width: 1px;"
"color: black;"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EBEBEB, stop: 1 #CCCCCC );"
"}"
);
To copy to clipboard, switch view to plain text mode
Bookmarks