Changeset View
Changeset View
Standalone View
Standalone View
src/IncrementalSearchBar.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 42 | IncrementalSearchBar::IncrementalSearchBar(QWidget *aParent) : | |||
---|---|---|---|---|---|
46 | _regExpression(nullptr), | 46 | _regExpression(nullptr), | ||
47 | _highlightMatches(nullptr), | 47 | _highlightMatches(nullptr), | ||
48 | _reverseSearch(nullptr), | 48 | _reverseSearch(nullptr), | ||
49 | _findNextButton(nullptr), | 49 | _findNextButton(nullptr), | ||
50 | _findPreviousButton(nullptr), | 50 | _findPreviousButton(nullptr), | ||
51 | _searchFromButton(nullptr), | 51 | _searchFromButton(nullptr), | ||
52 | _searchTimer(nullptr) | 52 | _searchTimer(nullptr) | ||
53 | { | 53 | { | ||
54 | setPalette(qApp->palette()); | ||||
55 | setAutoFillBackground(true); | ||||
54 | 56 | | |||
55 | auto closeButton = new QToolButton(this); | 57 | auto closeButton = new QToolButton(this); | ||
56 | closeButton->setObjectName(QStringLiteral("close-button")); | 58 | closeButton->setObjectName(QStringLiteral("close-button")); | ||
57 | closeButton->setToolTip(i18nc("@info:tooltip", "Close the search bar")); | 59 | closeButton->setToolTip(i18nc("@info:tooltip", "Close the search bar")); | ||
58 | closeButton->setAutoRaise(true); | 60 | closeButton->setAutoRaise(true); | ||
59 | closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close"))); | 61 | closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close"))); | ||
60 | connect(closeButton, &QToolButton::clicked, this, &Konsole::IncrementalSearchBar::closeClicked); | 62 | connect(closeButton, &QToolButton::clicked, this, &Konsole::IncrementalSearchBar::closeClicked); | ||
61 | 63 | | |||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Line(s) | |||||
302 | 304 | | |||
303 | void IncrementalSearchBar::setOptions() | 305 | void IncrementalSearchBar::setOptions() | ||
304 | { | 306 | { | ||
305 | _caseSensitive->setChecked(KonsoleSettings::searchCaseSensitive()); | 307 | _caseSensitive->setChecked(KonsoleSettings::searchCaseSensitive()); | ||
306 | _regExpression->setChecked(KonsoleSettings::searchRegExpression()); | 308 | _regExpression->setChecked(KonsoleSettings::searchRegExpression()); | ||
307 | _highlightMatches->setChecked(KonsoleSettings::searchHighlightMatches()); | 309 | _highlightMatches->setChecked(KonsoleSettings::searchHighlightMatches()); | ||
308 | _reverseSearch->setChecked(KonsoleSettings::searchReverseSearch()); | 310 | _reverseSearch->setChecked(KonsoleSettings::searchReverseSearch()); | ||
309 | } | 311 | } | ||
310 | | ||||
311 | void IncrementalSearchBar::paintEvent(QPaintEvent *event) | | |||
312 | { | | |||
313 | /* For some reason setAutoFillBackground was filling with | | |||
314 | * black - I guess it's because it's the parent's palette, | | |||
315 | * I'v tried to set the palette to the window but that was | | |||
316 | * a no go, so we paint manually. */ | | |||
317 | | ||||
318 | if ( QApplication::topLevelWidgets().count()) { | | |||
319 | auto topLevelWindow = QApplication::topLevelWidgets().at(0); | | |||
320 | QPainter painter(this); | | |||
321 | painter.setPen(topLevelWindow->palette().window().color()); | | |||
322 | painter.setBrush(topLevelWindow->palette().window()); | | |||
323 | painter.drawRect(0, 0, geometry().width(), geometry().height()); | | |||
324 | } | | |||
325 | QWidget::paintEvent(event); | | |||
326 | } | |