[Qt-interest] Height of QPushButton and QLineEdit different
Oliver Demetz
forenbeitraege at oliverdemetz.de
Tue Jun 9 12:30:29 CEST 2009
Hi!
ensurePolished() was a good hint, but it does not do the job.
I am calling in the constructor of the containing widget the following code:
lineedit->ensurePolished();
button->ensurePolished();
lineedit->setMinimumHeight(button->height());
lineedit->setMaximumHeight(button->height());
and it does *nothing*.
*BUT* if I call this code from a slot that is connected to a
button-click ( ie. when the widget is already created *and shown*), then
it works fine.
How can I use this code at construction stage?
I tried it with a stylesheet, but also that does not help:
QPushButton {
min-height:30px;
max-height:30px;
}
QDateEdit, QLineEdit {
min-height:30px;
max-height:30px;
}
Thanks in advance again,
regards,
Oliver
Jens Bache-Wiig schrieb:
>> I tried several things:
>>
>> (A:) lineedit->setMinimumSize(button->height());
>> Didn't change anything.
>>
>> (B:) lineedit->setMinimumHeight(button->height());
>> lineedit->setMaximumHeight(button->height());
>> Leads to crap, the lineedit gets a huge height,
>> I don't know why.
>
> Make sure to call ensurepolished on the edit before querying for the size.
> Otherwise the size returned will only be calculated when you actually show
> the button.
>
> Jens
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list