Do padding affect the tooltip ?
-
class A : public QLineEdit
{
public:
A()
{
setToolTip( "Some text here" );
setStyleSheet("padding-top: -2px;");
}
}here when i hover my mouse on the QlineEdit, the tooltip text get cut off from bottom. But if i remove the padding the toolTip text displays it correctly.
So does applying padding or any stylesheet affects the tooltip ??? I read in other forum that it's Qt bug.
I would be glad if anyone can answer my queries. Thank you
-
Hi,
It's not a bug per-se. Your style sheet is basically interpreted as. "Every widget and child widget has a top padding of -2px". If you only want your line edit to have that padding then you have to use a more precise style sheet.
-
I get your point, but i am setting the stylesheet in the constructor of my class so wouldn't it be only for that class ?
-
@Pou-Lin-Chang
It would be for that class and all its children.Easy fix is to give class A object name and use that for style sheet
then only that is affected. -
Yes its correct as it mean for all QLineEdits
if you just want for sure on a single one.
Give it a name (setObjectName(const QString & name))and use
QPushButton#okButton { color: gray }here button is called okButton
-
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)