colorize it in the way it used in kde3

svn path=/branches/work/kde4/playground/graphics/okular/; revision=545344
remotes/origin/old/work/newpageview
Pino Toscano 20 years ago
parent 6301d6b397
commit e05ea9f5a6
  1. 17
      ui/searchwidget.cpp

@ -10,6 +10,7 @@
// qt/kde includes // qt/kde includes
#include <qmenu.h> #include <qmenu.h>
#include <qaction.h> #include <qaction.h>
#include <qapplication.h>
#include <qsizepolicy.h> #include <qsizepolicy.h>
#include <qtimer.h> #include <qtimer.h>
#include <qtoolbutton.h> #include <qtoolbutton.h>
@ -89,11 +90,13 @@ void SearchWidget::clearText()
void SearchWidget::slotTextChanged( const QString & text ) void SearchWidget::slotTextChanged( const QString & text )
{ {
QPalette qAppPalette = QApplication::palette();
// if length<3 set 'red' text and send a blank string to document // if length<3 set 'red' text and send a blank string to document
QColor color = text.length() < 3 ? Qt::darkRed : palette().active().text(); QColor color = text.length() < 3 ? Qt::darkRed : qAppPalette.color( QPalette::Text );
KLineEdit * lineEdit = m_lineEdit; QPalette pal = m_lineEdit->palette();
lineEdit->setPaletteForegroundColor( color ); pal.setColor( QPalette::Base, qAppPalette.color( QPalette::Base ) );
lineEdit->setPaletteBackgroundColor( palette().active().base() ); pal.setColor( QPalette::Text, color );
m_lineEdit->setPalette( pal );
m_inputDelayTimer->stop(); m_inputDelayTimer->stop();
m_inputDelayTimer->start(333); m_inputDelayTimer->start(333);
} }
@ -143,8 +146,10 @@ void SearchWidget::startSearch()
// if not found, use warning colors // if not found, use warning colors
if ( !ok ) if ( !ok )
{ {
m_lineEdit->setPaletteForegroundColor( Qt::white ); QPalette pal = m_lineEdit->palette();
m_lineEdit->setPaletteBackgroundColor( Qt::red ); pal.setColor( QPalette::Base, Qt::red );
pal.setColor( QPalette::Text, Qt::white );
m_lineEdit->setPalette( pal );
} }
} }

Loading…
Cancel
Save