forked from qt-creator/qt-creator
QmlDesigner: Handle placeholder color for navigator line edit
Task-number: QDS-10099 Change-Id: Ieede8ffc7ef6251c32cd78f7a90fb6f56f3c0824 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -91,6 +91,21 @@ void LineEdit::keyPressEvent(QKeyEvent *event)
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void LineEdit::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
if (text().isEmpty()) {
|
||||
QPalette p(palette());
|
||||
p.setColor(QPalette::Active,
|
||||
QPalette::PlaceholderText,
|
||||
Utils::creatorTheme()->color(Utils::Theme::DSplaceholderTextColor));
|
||||
p.setColor(QPalette::Inactive,
|
||||
QPalette::PlaceholderText,
|
||||
Utils::creatorTheme()->color(Utils::Theme::DSplaceholderTextColor));
|
||||
setPalette(p);
|
||||
}
|
||||
QLineEdit::paintEvent(event);
|
||||
}
|
||||
|
||||
void LineEdit::updateClearButton(const QString& text)
|
||||
{
|
||||
clearButton->setVisible(!text.isEmpty());
|
||||
|
@@ -21,6 +21,7 @@ public:
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void updateClearButton(const QString &text);
|
||||
|
Reference in New Issue
Block a user