File indexing completed on 2024-04-14 05:24:31

0001 /*
0002     SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef PERSISTENTMENU_H
0007 #define PERSISTENTMENU_H
0008 
0009 //Qt
0010 #include <QMenu>
0011 #include <QMouseEvent>
0012 
0013 namespace Latte {
0014 namespace Settings {
0015 namespace Layout {
0016 namespace Delegate {
0017 
0018 class PersistentMenu : public QMenu
0019 {
0020   Q_OBJECT
0021 public:
0022   PersistentMenu(QWidget *parent = nullptr);
0023 
0024   int masterIndex() const;
0025   void setMasterIndex(const int &index);
0026 
0027 protected:
0028   void setVisible(bool visible) override;
0029   void mouseReleaseEvent(QMouseEvent *e) override;
0030 
0031 signals:
0032   void masterIndexChanged(const int &masterRow);
0033 
0034 private:
0035   bool m_blockHide{false};
0036 
0037   int m_masterIndex{-1};
0038 
0039 };
0040 
0041 }
0042 }
0043 }
0044 }
0045 
0046 #endif