Reputation: 79467
How can I get the text margins for a QLineEdit?
Note the red lines in the screenshot, that's the margins I'm interested in:
I tried qDebug() << ui->lineEdit->textMargins();
for the edit box from the screenshot, but it printed QMargins(0, 0, 0, 0)
, even though the edit box does have margins.
Upvotes: 6
Views: 3930
Reputation: 37697
Check paint event of QLineEdit. As you can see lots of stuff have effect on it.
Besides textMargins
there are stuff which can have impact on values which you are looking for.
The style value is most important and you have to find way to get this value (probably subclass is needed).
Upvotes: 3