pqExpanderButton.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqExpanderButton_h
5 #define pqExpanderButton_h
6 
7 #include "pqWidgetsModule.h"
8 #include <QFrame>
9 
15 class PQWIDGETS_EXPORT pqExpanderButton : public QFrame
16 {
17  Q_OBJECT
18  typedef QFrame Superclass;
19 
20  Q_PROPERTY(QString text READ text WRITE setText)
21  Q_PROPERTY(bool checked READ checked WRITE setChecked)
22 public:
23  pqExpanderButton(QWidget* parent = nullptr);
24  ~pqExpanderButton() override;
25 
26 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
30  void toggle();
31 
36  void setChecked(bool);
37  bool checked() const { return this->Checked; }
38 
42  void setText(const QString& text);
43  QString text() const;
44 
45 Q_SIGNALS:
51  void toggled(bool checked);
52 
53 protected:
54  void mousePressEvent(QMouseEvent* evt) override;
55  void mouseReleaseEvent(QMouseEvent* evt) override;
56 
57 private:
58  Q_DISABLE_COPY(pqExpanderButton)
59 
60  class pqInternals;
61  pqInternals* Internals;
62  bool Checked;
63 };
64 
65 #endif
pqExpanderButton provides a frame with a toggle mode.
#define PQWIDGETS_EXPORT