File indexing completed on 2024-05-26 04:32:50

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Mathias Wein <lynx.mw+kde@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 #ifndef WGSELECTORPOPUP_H
0007 #define WGSELECTORPOPUP_H
0008 
0009 #include <QWidget>
0010 
0011 class KisVisualColorSelector;
0012 class WGShadeSelector;
0013 class WGSelectorWidgetBase;
0014 
0015 class WGSelectorPopup : public QWidget
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit WGSelectorPopup(QWidget *parent = nullptr);
0020     void setSelectorWidget(KisVisualColorSelector *selector);
0021     void setSelectorWidget(WGSelectorWidgetBase *selector);
0022     WGSelectorWidgetBase* selectorWidget() const;
0023 public Q_SLOTS:
0024     void slotShowPopup();
0025 protected:
0026     void paintEvent(QPaintEvent *event) override;
0027     //void enterEvent(QEvent *event) override;
0028     void leaveEvent(QEvent *event) override;
0029     void keyPressEvent(QKeyEvent *event);
0030     void hideEvent(QHideEvent *event) override;
0031 
0032 Q_SIGNALS:
0033     void sigPopupClosed(WGSelectorPopup *popup);
0034 private Q_SLOTS:
0035     void slotInteraction(bool active);
0036 private:
0037     void replaceCentranWidget(QWidget *widget);
0038 
0039     int m_margin {10};
0040     bool m_isInteracting {false};
0041     WGSelectorWidgetBase *m_selectorWidget {0};
0042 };
0043 
0044 #endif // WGSELECTORPOPUP_H