mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +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
|
// Own
|
||||||
#include "IncrementalSearchBar.h"
|
#include "IncrementalSearchBar.h"
|
||||||
|
|
||||||
// Qt
|
// Katie
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QtGui/qevent.h>
|
|
||||||
#include <QtCore/QTimer>
|
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
// KDE
|
// KDE
|
||||||
#include <KColorScheme>
|
#include <KColorScheme>
|
||||||
|
@ -242,27 +241,21 @@ void IncrementalSearchBar::setVisible(bool visible)
|
||||||
void IncrementalSearchBar::setFoundMatch(bool match)
|
void IncrementalSearchBar::setFoundMatch(bool match)
|
||||||
{
|
{
|
||||||
if (!match && !_searchEdit->text().isEmpty()) {
|
if (!match && !_searchEdit->text().isEmpty()) {
|
||||||
KStatefulBrush backgroundBrush(KColorScheme::View, KColorScheme::NegativeBackground);
|
QPalette pal = palette();
|
||||||
|
KColorScheme::adjustBackground(pal, KColorScheme::NegativeBackground);
|
||||||
QString matchStyleSheet = QString("QLineEdit{ background-color:%1 }")
|
_searchEdit->setPalette(pal);
|
||||||
.arg(backgroundBrush.brush(_searchEdit).color().name());
|
|
||||||
|
|
||||||
_searchEdit->setStyleSheet(matchStyleSheet);
|
|
||||||
} else if (_searchEdit->text().isEmpty()) {
|
} else if (_searchEdit->text().isEmpty()) {
|
||||||
clearLineEdit();
|
clearLineEdit();
|
||||||
} else {
|
} else {
|
||||||
KStatefulBrush backgroundBrush(KColorScheme::View, KColorScheme::PositiveBackground);
|
QPalette pal = palette();
|
||||||
|
KColorScheme::adjustBackground(pal, KColorScheme::PositiveBackground);
|
||||||
QString matchStyleSheet = QString("QLineEdit{ background-color:%1 }")
|
_searchEdit->setPalette(pal);
|
||||||
.arg(backgroundBrush.brush(_searchEdit).color().name());
|
|
||||||
|
|
||||||
_searchEdit->setStyleSheet(matchStyleSheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncrementalSearchBar::clearLineEdit()
|
void IncrementalSearchBar::clearLineEdit()
|
||||||
{
|
{
|
||||||
_searchEdit->setStyleSheet(QString());
|
_searchEdit->setPalette(palette());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncrementalSearchBar::focusLineEdit()
|
void IncrementalSearchBar::focusLineEdit()
|
||||||
|
|
|
@ -20,15 +20,16 @@
|
||||||
#ifndef INCREMENTALSEARCHBAR_H
|
#ifndef INCREMENTALSEARCHBAR_H
|
||||||
#define INCREMENTALSEARCHBAR_H
|
#define INCREMENTALSEARCHBAR_H
|
||||||
|
|
||||||
// Qt
|
// Katie
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QtCore/QBitArray>
|
#include <QBitArray>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
class KLineEdit;
|
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
class KLineEdit;
|
||||||
|
|
||||||
namespace Konsole
|
namespace Konsole
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue