mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-12 01:44:35 +01:00
Add ability to add a search term with tab and space in the smart
playlist window
This commit is contained in:
parent
b077fe97cf
commit
f5d0759559
@ -29,6 +29,7 @@
|
|||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
// Exported by QtGui
|
// Exported by QtGui
|
||||||
void qt_blurImage(QPainter* p, QImage& blurImage, qreal radius, bool quality,
|
void qt_blurImage(QPainter* p, QImage& blurImage, qreal radius, bool quality,
|
||||||
@ -49,6 +50,7 @@ class SearchTermWidget::Overlay : public QWidget {
|
|||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent*);
|
void paintEvent(QPaintEvent*);
|
||||||
void mouseReleaseEvent(QMouseEvent*);
|
void mouseReleaseEvent(QMouseEvent*);
|
||||||
|
void keyReleaseEvent(QKeyEvent* e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SearchTermWidget* parent_;
|
SearchTermWidget* parent_;
|
||||||
@ -209,6 +211,8 @@ void SearchTermWidget::SetActive(bool active) {
|
|||||||
delete overlay_;
|
delete overlay_;
|
||||||
overlay_ = nullptr;
|
overlay_ = nullptr;
|
||||||
|
|
||||||
|
ui_->container->setEnabled(active);
|
||||||
|
|
||||||
if (!active) {
|
if (!active) {
|
||||||
overlay_ = new Overlay(this);
|
overlay_ = new Overlay(this);
|
||||||
}
|
}
|
||||||
@ -352,6 +356,7 @@ SearchTermWidget::Overlay::Overlay(SearchTermWidget* parent)
|
|||||||
text_(tr("Add search term")),
|
text_(tr("Add search term")),
|
||||||
icon_(IconLoader::Load("list-add").pixmap(kIconSize)) {
|
icon_(IconLoader::Load("list-add").pixmap(kIconSize)) {
|
||||||
raise();
|
raise();
|
||||||
|
setFocusPolicy(Qt::TabFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchTermWidget::Overlay::SetOpacity(float opacity) {
|
void SearchTermWidget::Overlay::SetOpacity(float opacity) {
|
||||||
@ -417,4 +422,8 @@ void SearchTermWidget::Overlay::mouseReleaseEvent(QMouseEvent*) {
|
|||||||
emit parent_->Clicked();
|
emit parent_->Clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchTermWidget::Overlay::keyReleaseEvent(QKeyEvent* e) {
|
||||||
|
if (e->key() == Qt::Key_Space) emit parent_->Clicked();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user