mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
konsole: set the palette instead of the stylesheet of the search line editor
this makes it adapt to palette changes (after match is found, not found or the search is cleared) Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
995c996cc2
commit
db60d4e29d
2 changed files with 14 additions and 20 deletions
|
@ -20,13 +20,12 @@
|
|||
// Own
|
||||
#include "IncrementalSearchBar.h"
|
||||
|
||||
// Qt
|
||||
// Katie
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QToolButton>
|
||||
#include <QMenu>
|
||||
#include <QApplication>
|
||||
|
||||
// KDE
|
||||
#include <KColorScheme>
|
||||
|
@ -242,27 +241,21 @@ void IncrementalSearchBar::setVisible(bool visible)
|
|||
void IncrementalSearchBar::setFoundMatch(bool match)
|
||||
{
|
||||
if (!match && !_searchEdit->text().isEmpty()) {
|
||||
KStatefulBrush backgroundBrush(KColorScheme::View, KColorScheme::NegativeBackground);
|
||||
|
||||
QString matchStyleSheet = QString("QLineEdit{ background-color:%1 }")
|
||||
.arg(backgroundBrush.brush(_searchEdit).color().name());
|
||||
|
||||
_searchEdit->setStyleSheet(matchStyleSheet);
|
||||
QPalette pal = palette();
|
||||
KColorScheme::adjustBackground(pal, KColorScheme::NegativeBackground);
|
||||
_searchEdit->setPalette(pal);
|
||||
} else if (_searchEdit->text().isEmpty()) {
|
||||
clearLineEdit();
|
||||
} else {
|
||||
KStatefulBrush backgroundBrush(KColorScheme::View, KColorScheme::PositiveBackground);
|
||||
|
||||
QString matchStyleSheet = QString("QLineEdit{ background-color:%1 }")
|
||||
.arg(backgroundBrush.brush(_searchEdit).color().name());
|
||||
|
||||
_searchEdit->setStyleSheet(matchStyleSheet);
|
||||
QPalette pal = palette();
|
||||
KColorScheme::adjustBackground(pal, KColorScheme::PositiveBackground);
|
||||
_searchEdit->setPalette(pal);
|
||||
}
|
||||
}
|
||||
|
||||
void IncrementalSearchBar::clearLineEdit()
|
||||
{
|
||||
_searchEdit->setStyleSheet(QString());
|
||||
_searchEdit->setPalette(palette());
|
||||
}
|
||||
|
||||
void IncrementalSearchBar::focusLineEdit()
|
||||
|
|
|
@ -20,15 +20,16 @@
|
|||
#ifndef INCREMENTALSEARCHBAR_H
|
||||
#define INCREMENTALSEARCHBAR_H
|
||||
|
||||
// Qt
|
||||
// Katie
|
||||
#include <QWidget>
|
||||
#include <QtCore/QBitArray>
|
||||
|
||||
#include <QBitArray>
|
||||
#include <QAction>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
class KLineEdit;
|
||||
#include <QToolButton>
|
||||
#include <QKeyEvent>
|
||||
|
||||
class KLineEdit;
|
||||
|
||||
namespace Konsole
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue