Qt Utilities  5.8.2
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
buttonoverlay.h
Go to the documentation of this file.
1 #ifndef WIDGETS_BUTTONOVERLAY_H
2 #define WIDGETS_BUTTONOVERLAY_H
3 
4 #include "../global.h"
5 
6 #include <QtGlobal>
7 
8 QT_FORWARD_DECLARE_CLASS(QWidget)
9 QT_FORWARD_DECLARE_CLASS(QHBoxLayout)
10 QT_FORWARD_DECLARE_CLASS(QString)
11 QT_FORWARD_DECLARE_CLASS(QPixmap)
12 
13 namespace Widgets {
14 
15 class IconButton;
16 
18 public:
19  explicit ButtonOverlay(QWidget *widget);
20  virtual ~ButtonOverlay();
21 
22  QHBoxLayout *buttonLayout();
23  bool isClearButtonEnabled() const;
24  void setClearButtonEnabled(bool enabled);
25  bool isInfoButtonEnabled() const;
26  void enableInfoButton(const QPixmap &pixmap, const QString &infoText);
27  void disableInfoButton();
28  void addCustomButton(QWidget *button);
29  void insertCustomButton(int index, QWidget *button);
30  void removeCustomButton(QWidget *button);
31  virtual bool isCleared() const;
32 
33 protected:
34  void updateClearButtonVisibility(bool visible);
35  virtual void handleClearButtonClicked();
36 
37 private:
38  void showInfo();
39 
40  QWidget *m_widget;
41  QWidget *m_buttonWidget;
42  QHBoxLayout *m_buttonLayout;
43  IconButton *m_clearButton;
44  IconButton *m_infoButton;
45 };
46 
50 inline QHBoxLayout *ButtonOverlay::buttonLayout()
51 {
52  return m_buttonLayout;
53 }
54 
58 inline bool ButtonOverlay::isClearButtonEnabled() const
59 {
60  return m_clearButton != nullptr;
61 }
62 
66 inline bool ButtonOverlay::isInfoButtonEnabled() const
67 {
68  return m_infoButton != nullptr;
69 }
70 } // namespace Widgets
71 
72 #endif // WIDGETS_BUTTONOVERLAY_H
A simple QAbstractButton implementation displaying a QPixmap.
Definition: iconbutton.h:11
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
The ButtonOverlay class is used to display buttons on top of other widgets.
Definition: buttonoverlay.h:17
Provides a set of extended widgets such as ClearLineEdit and ClearComboBox.
Definition: buttonoverlay.h:13