[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdelibs-bugs
Subject:    [Bug 294954] KLineEdit misplaces or does not draw clear button (test case and screenshots included)
From:       Thomas Fischer <fischer () unix-ag ! uni-kl ! de>
Date:       2012-12-31 11:29:42
Message-ID: bug-294954-90985-KxACN3o3d4 () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=294954

--- Comment #3 from Thomas Fischer <fischer@unix-ag.uni-kl.de> ---
For future reference:
The problem as observed in the first KComboBox in my example is due to the fact
that lineEdit() on a KComboBox returns QLineEdit* although internally it is a
KLineEdit*. Calling setReadOnly(..) on this return value calls QLineEdit's
implementation, but not the one of KLineEdit.
The solution is to (dynamic|qobject)_cast the QLineEdit* to a KLineEdit*.
Calling setReadOnly on the cast's result uses KLineEdit's setReadOnly
implementation which performs proper layouting of the clear button.

KLineEdit *internalLineEdit = dynamic_cast<KLineEdit*>(comboBox->lineEdit());
if (internalLineEdit != NULL)
    internalLineEdit->setReadOnly(true);

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Kdelibs-bugs mailing list
Kdelibs-bugs@kde.org
https://mail.kde.org/mailman/listinfo/kdelibs-bugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic