PIVX Core  5.6.99
P2P Digital Currency
expandablebutton.h
Go to the documentation of this file.
1 // Copyright (c) 2019-2020 The PIVX Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef PIVX_QT_EXPANDABLEBUTTON_H
6 #define PIVX_QT_EXPANDABLEBUTTON_H
7 
8 #include <QWidget>
9 #include <QEvent>
10 #include <QString>
11 #include <iostream>
12 
13 #include <QPropertyAnimation>
14 #include <atomic>
15 
16 namespace Ui {
17 class ExpandableButton;
18 }
19 
20 class ExpandableButton : public QWidget
21 {
22  Q_OBJECT
23 
24 public:
25  explicit ExpandableButton(QWidget *parent = nullptr);
27 
28  void setButtonClassStyle(const char *name, const QVariant &value, bool forceUpdate = false);
29  void setButtonText(const QString& _text);
30  void setNoIconText(const QString& _text);
31  void setIcon(QString path);
32 
33  bool isChecked();
34  void setChecked(bool check);
35  void setKeepExpanded(bool _keepExpended){
36  this->keepExpanded = _keepExpended;
37  }
38  void setSmall();
39  void setExpanded();
40 Q_SIGNALS:
41  void Mouse_Pressed();
42  void Mouse_Hover();
44 
45 public Q_SLOTS:
46  void setText2(QString text2);
47 
48  QString getText(){
49  return this->text;
50  }
51 
52 protected:
53  virtual void enterEvent(QEvent *);
54  virtual void leaveEvent(QEvent *);
55 
56 private Q_SLOTS:
57 
58  void on_pushButton_clicked(bool checked);
59 
60  void innerMousePressEvent();
61 private:
62  Ui::ExpandableButton *ui;
63  QString notExpandedText;
64  QString text;
65  std::atomic<bool> isAnimating;
66  QPropertyAnimation *animation = nullptr;
67  bool isExpanded = false;
68 
69  bool keepExpanded = false;
70 };
71 
72 #endif // PIVX_QT_EXPANDABLEBUTTON_H
void setButtonText(const QString &_text)
virtual void leaveEvent(QEvent *)
void setChecked(bool check)
void Mouse_HoverLeave()
ExpandableButton(QWidget *parent=nullptr)
void setText2(QString text2)
void on_pushButton_clicked(bool checked)
void setNoIconText(const QString &_text)
QPropertyAnimation * animation
Ui::ExpandableButton * ui
void setButtonClassStyle(const char *name, const QVariant &value, bool forceUpdate=false)
std::atomic< bool > isAnimating
void setKeepExpanded(bool _keepExpended)
virtual void enterEvent(QEvent *)
void setIcon(QString path)
const char * name
Definition: rest.cpp:37