Qt Utilities
5.6.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
|
The ButtonOverlay class is used to display buttons on top of other widgets. More...
#include <buttonoverlay.h>
Public Member Functions | |
ButtonOverlay (QWidget *widget) | |
Constructs a button overlay for the specified widget. More... | |
virtual | ~ButtonOverlay () |
Destroys the button overlay. More... | |
QHBoxLayout * | buttonLayout () |
Returns the layout manager holding the buttons. More... | |
bool | isClearButtonEnabled () const |
Returns whether the clear button is enabled. More... | |
void | setClearButtonEnabled (bool enabled) |
Sets whether the clear button is enabled. More... | |
bool | isInfoButtonEnabled () const |
Returns whether the info button is enabled. More... | |
void | enableInfoButton (const QPixmap &pixmap, const QString &infoText) |
Shows an info button with the specified pixmap and infoText. More... | |
void | disableInfoButton () |
Hides an info button if one is shown. More... | |
void | addCustomButton (QWidget *button) |
Adds a custom button. More... | |
void | insertCustomButton (int index, QWidget *button) |
Inserts a custom button at the specified index. More... | |
void | removeCustomButton (QWidget *button) |
Removes the specified custom button. More... | |
virtual bool | isCleared () const |
Returns whether the related widget is cleared. More... | |
Protected Member Functions | |
void | updateClearButtonVisibility (bool visible) |
Updates the visibility of the clear button. More... | |
virtual void | handleClearButtonClicked () |
Clears the related widget. More... | |
The ButtonOverlay class is used to display buttons on top of other widgets.
The class creates a new layout manager and sets it to the widget which is specified when constructing an instance. Thus this widget must not already have a layout manager.
The class is used to implement widget customization like ClearLineEidt and ClearComboBox.
Definition at line 17 of file buttonoverlay.h.
|
explicit |
Constructs a button overlay for the specified widget.
widget | Specifies the widget to display the buttons on. |
Definition at line 34 of file buttonoverlay.cpp.
|
virtual |
Destroys the button overlay.
Definition at line 55 of file buttonoverlay.cpp.
void Widgets::ButtonOverlay::addCustomButton | ( | QWidget * | button | ) |
Adds a custom button.
The button overlay takes ownership over the specified button.
Definition at line 121 of file buttonoverlay.cpp.
|
inline |
Returns the layout manager holding the buttons.
Definition at line 51 of file buttonoverlay.h.
void Widgets::ButtonOverlay::disableInfoButton | ( | ) |
Hides an info button if one is shown.
Definition at line 107 of file buttonoverlay.cpp.
void Widgets::ButtonOverlay::enableInfoButton | ( | const QPixmap & | pixmap, |
const QString & | infoText | ||
) |
Shows an info button with the specified pixmap and infoText.
If there is already an info button enabled, it gets replaced with the new button.
Definition at line 87 of file buttonoverlay.cpp.
|
protectedvirtual |
Clears the related widget.
This method is meant to be implemented when subclassing.
Definition at line 163 of file buttonoverlay.cpp.
void Widgets::ButtonOverlay::insertCustomButton | ( | int | index, |
QWidget * | button | ||
) |
Inserts a custom button at the specified index.
The button overlay takes ownership over the specified button.
Definition at line 131 of file buttonoverlay.cpp.
|
inline |
Returns whether the clear button is enabled.
Definition at line 59 of file buttonoverlay.h.
|
virtual |
Returns whether the related widget is cleared.
This method is meant to be implemented when subclassing.
Reimplemented in Widgets::ClearSpinBox, Widgets::ClearLineEdit, Widgets::ClearComboBox, and Widgets::ClearPlainTextEdit.
Definition at line 171 of file buttonoverlay.cpp.
|
inline |
Returns whether the info button is enabled.
Definition at line 67 of file buttonoverlay.h.
void Widgets::ButtonOverlay::removeCustomButton | ( | QWidget * | button | ) |
Removes the specified custom button.
The ownership of widget remains the same as when it was added.
Definition at line 141 of file buttonoverlay.cpp.
void Widgets::ButtonOverlay::setClearButtonEnabled | ( | bool | enabled | ) |
Sets whether the clear button is enabled.
Definition at line 61 of file buttonoverlay.cpp.
|
protected |
Updates the visibility of the clear button.
This method is meant to be called when subclassing.
Definition at line 151 of file buttonoverlay.cpp.