Qt Utilities  6.0.4
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Public Member Functions | Protected Member Functions | List of all members
QtUtilities::ButtonOverlay Class Reference

The ButtonOverlay class is used to display buttons on top of other widgets. More...

#include <buttonoverlay.h>

Inheritance diagram for QtUtilities::ButtonOverlay:
[legend]

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ButtonOverlay()

QtUtilities::ButtonOverlay::ButtonOverlay ( QWidget *  widget)
explicit

Constructs a button overlay for the specified widget.

Parameters
widgetSpecifies the widget to display the buttons on.

Definition at line 33 of file buttonoverlay.cpp.

◆ ~ButtonOverlay()

QtUtilities::ButtonOverlay::~ButtonOverlay ( )
virtual

Destroys the button overlay.

Definition at line 55 of file buttonoverlay.cpp.

Member Function Documentation

◆ addCustomButton()

void QtUtilities::ButtonOverlay::addCustomButton ( QWidget *  button)

Adds a custom button.

The button overlay takes ownership over the specified button.

Definition at line 123 of file buttonoverlay.cpp.

◆ buttonLayout()

QHBoxLayout * QtUtilities::ButtonOverlay::buttonLayout ( )
inline

Returns the layout manager holding the buttons.

Definition at line 50 of file buttonoverlay.h.

◆ disableInfoButton()

void QtUtilities::ButtonOverlay::disableInfoButton ( )

Hides an info button if one is shown.

See also
ButtonOverlay::enableInfoButton()

Definition at line 109 of file buttonoverlay.cpp.

◆ enableInfoButton()

void QtUtilities::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.

See also
ButtonOverlay::disableInfoButton()

Definition at line 89 of file buttonoverlay.cpp.

◆ handleClearButtonClicked()

void QtUtilities::ButtonOverlay::handleClearButtonClicked ( )
protectedvirtual

Clears the related widget.

This method is meant to be implemented when subclassing.

Definition at line 165 of file buttonoverlay.cpp.

◆ insertCustomButton()

void QtUtilities::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 133 of file buttonoverlay.cpp.

◆ isClearButtonEnabled()

bool QtUtilities::ButtonOverlay::isClearButtonEnabled ( ) const
inline

Returns whether the clear button is enabled.

Definition at line 58 of file buttonoverlay.h.

◆ isCleared()

bool QtUtilities::ButtonOverlay::isCleared ( ) const
virtual

Returns whether the related widget is cleared.

This method is meant to be implemented when subclassing.

Reimplemented in QtUtilities::ClearSpinBox, QtUtilities::ClearLineEdit, QtUtilities::ClearComboBox, and QtUtilities::ClearPlainTextEdit.

Definition at line 174 of file buttonoverlay.cpp.

◆ isInfoButtonEnabled()

bool QtUtilities::ButtonOverlay::isInfoButtonEnabled ( ) const
inline

Returns whether the info button is enabled.

Definition at line 66 of file buttonoverlay.h.

◆ removeCustomButton()

void QtUtilities::ButtonOverlay::removeCustomButton ( QWidget *  button)

Removes the specified custom button.

The ownership of widget remains the same as when it was added.

Definition at line 143 of file buttonoverlay.cpp.

◆ setClearButtonEnabled()

void QtUtilities::ButtonOverlay::setClearButtonEnabled ( bool  enabled)

Sets whether the clear button is enabled.

Definition at line 62 of file buttonoverlay.cpp.

◆ updateClearButtonVisibility()

void QtUtilities::ButtonOverlay::updateClearButtonVisibility ( bool  visible)
protected

Updates the visibility of the clear button.

This method is meant to be called when subclassing.

Definition at line 153 of file buttonoverlay.cpp.


The documentation for this class was generated from the following files: