diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2010-04-13 15:56:27 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2010-04-20 10:00:29 (GMT) |
commit | d8b3186319cf5a3d1cf3784fa93dd0cf114f8ab5 (patch) | |
tree | d37016f21ed463868172b89b8ca806c9111d6a23 | |
parent | 84eadc0bc232d8196e08f5aa5614ce9a17ea93bd (diff) | |
download | Qt-d8b3186319cf5a3d1cf3784fa93dd0cf114f8ab5.zip Qt-d8b3186319cf5a3d1cf3784fa93dd0cf114f8ab5.tar.gz Qt-d8b3186319cf5a3d1cf3784fa93dd0cf114f8ab5.tar.bz2 |
Backport a few fixes to the Designer filteredit from Creator
First problem is that there are too many animations triggered.
Second problem is that it doesnt reflect the disabled state.
Reviewed-by: thorbjorn
-rw-r--r-- | tools/designer/src/lib/shared/filterwidget.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/designer/src/lib/shared/filterwidget.cpp b/tools/designer/src/lib/shared/filterwidget.cpp index f485346..07af901 100644 --- a/tools/designer/src/lib/shared/filterwidget.cpp +++ b/tools/designer/src/lib/shared/filterwidget.cpp @@ -80,8 +80,11 @@ void IconButton::paintEvent(QPaintEvent *) QPainter painter(this); // Note isDown should really use the active state but in most styles // this has no proper feedback - QPixmap iconpixmap = icon().pixmap(ICONBUTTON_SIZE, ICONBUTTON_SIZE, isDown() ? - QIcon::Selected : QIcon::Normal); + QIcon::Mode state = QIcon::Disabled; + if (isEnabled()) + state = isDown() ? QIcon::Selected : QIcon::Normal; + QPixmap iconpixmap = icon().pixmap(QSize(ICONBUTTON_SIZE, ICONBUTTON_SIZE), + state, QIcon::Off); QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height()); pixmapRect.moveCenter(rect().center()); painter.setOpacity(m_fader); @@ -204,9 +207,12 @@ QString FilterWidget::text() const return m_editor->text(); } -void FilterWidget::checkButton(const QString &) +void FilterWidget::checkButton(const QString &text) { - m_button->animateShow(!m_editor->text().isEmpty()); + static QString oldtext; + if (oldtext.isEmpty() || text.isEmpty()) + m_button->animateShow(!m_editor->text().isEmpty()); + oldtext = text; } void FilterWidget::reset() |