| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2020 Mathias Wein <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: GPL-3.0-or-later |
| 5 |
*/ |
| 6 |
#ifndef WGSELECTORPOPUP_H |
| 7 |
#define WGSELECTORPOPUP_H |
| 8 |
|
| 9 |
#include <QWidget> |
| 10 |
#include <QTimer> |
| 11 |
|
| 12 |
class KisVisualColorSelector; |
| 13 |
class WGShadeSelector; |
| 14 |
class WGSelectorWidgetBase; |
| 15 |
|
| 16 |
class WGSelectorPopup : public QWidget |
| 17 |
{ |
| 18 |
Q_OBJECT |
| 19 |
public: |
| 20 |
explicit WGSelectorPopup(QWidget *parent = nullptr); |
| 21 |
void setSelectorWidget(KisVisualColorSelector *selector); |
| 22 |
void setSelectorWidget(WGSelectorWidgetBase *selector); |
| 23 |
WGSelectorWidgetBase* selectorWidget() const; |
| 24 |
public Q_SLOTS: |
| 25 |
void slotShowPopup(); |
| 26 |
protected: |
| 27 |
void paintEvent(QPaintEvent *event) override; |
| 28 |
|
| 29 |
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) |
| 30 |
void enterEvent(QEvent *event) override; |
| 31 |
#else |
| 32 |
void enterEvent(QEnterEvent *event) override; |
| 33 |
#endif |
| 34 |
void leaveEvent(QEvent *event) override; |
| 35 |
void keyPressEvent(QKeyEvent *event) override; |
| 36 |
void hideEvent(QHideEvent *event) override; |
| 37 |
|
| 38 |
Q_SIGNALS: |
| 39 |
void sigPopupClosed(WGSelectorPopup *popup); |
| 40 |
private Q_SLOTS: |
| 41 |
void slotInteraction(bool active); |
| 42 |
private: |
| 43 |
void replaceCentranWidget(QWidget *widget); |
| 44 |
|
| 45 |
int m_margin {10}; |
| 46 |
bool m_isInteracting {false}; |
| 47 |
WGSelectorWidgetBase *m_selectorWidget {0}; |
| 48 |
QTimer *m_hideTimer; |
| 49 |
}; |
| 50 |
|
| 51 |
#endif // WGSELECTORPOPUP_H |