Qt Utilities 6.14.3
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
QtUtilities::ClearSpinBox Class Reference

A QSpinBox with an embedded button for clearing its contents and the ability to hide the minimum value. More...

#include <clearspinbox.h>

Inheritance diagram for QtUtilities::ClearSpinBox:
[legend]
Collaboration diagram for QtUtilities::ClearSpinBox:
[legend]

Public Member Functions

 ClearSpinBox (QWidget *parent=nullptr)
 Constructs a clear spin box.
 
 ~ClearSpinBox () override
 Destroys the clear spin box.
 
bool minimumHidden () const
 Returns whether the minimum value will be hidden.
 
void setMinimumHidden (bool value)
 Sets whether the minimum value should be hidden.
 
QString placeholderText () const
 Returns the placeholder text.
 
void setPlaceholderText (const QString &placeholderText)
 Sets the placeholder text.
 
bool isCleared () const override
 Returns whether the related widget is cleared.
 
- Public Member Functions inherited from QtUtilities::ButtonOverlay
 ButtonOverlay (QWidget *widget)
 Constructs a button overlay for the specified widget.
 
 ButtonOverlay (QWidget *widget, QLineEdit *lineEdit)
 Constructs a button overlay for the specified widget.
 
virtual ~ButtonOverlay ()
 Destroys the button overlay.
 
bool isUsingCustomLayout () const
 Returns whether the "custom approach" mentioned in the class documentation is used.
 
QHBoxLayout * buttonLayout ()
 Returns the layout manager holding the buttons.
 
bool isClearButtonEnabled () const
 Returns whether the clear button is enabled.
 
void setClearButtonEnabled (bool enabled)
 Sets whether the clear button is enabled.
 
bool isInfoButtonEnabled () const
 Returns whether the info button is enabled.
 
void enableInfoButton (const QPixmap &pixmap, const QString &infoText)
 Shows an info button with the specified pixmap and infoText.
 
void disableInfoButton ()
 Hides an info button if one is shown.
 
void addCustomButton (QWidget *button)
 Adds a custom button.
 
void insertCustomButton (int index, QWidget *button)
 Inserts a custom button at the specified index.
 
void removeCustomButton (QWidget *button)
 Removes the specified custom button; does nothing if button has not been added.
 
void addCustomAction (QAction *action)
 Adds a custom action.
 
void insertCustomAction (int index, QAction *action)
 Inserts a custom action at the specified index.
 
void removeCustomAction (QAction *action)
 Removes the specified custom action; does nothing if action has not been added.
 

Protected Member Functions

int valueFromText (const QString &text) const override
 
QString textFromValue (int val) const override
 
- Protected Member Functions inherited from QtUtilities::ButtonOverlay
void updateClearButtonVisibility (bool visible)
 Updates the visibility of the clear button.
 
virtual void handleClearButtonClicked ()
 Clears the related widget.
 
virtual void handleCustomLayoutCreated ()
 Applies additional handling when the button layout has been created.
 

Properties

bool cleared
 
bool minimumHidden
 
QString placeholderText
 

Detailed Description

A QSpinBox with an embedded button for clearing its contents and the ability to hide the minimum value.

Definition at line 15 of file clearspinbox.h.

Constructor & Destructor Documentation

◆ ClearSpinBox()

QtUtilities::ClearSpinBox::ClearSpinBox ( QWidget * parent = nullptr)
explicit

Constructs a clear spin box.

Definition at line 19 of file clearspinbox.cpp.

◆ ~ClearSpinBox()

QtUtilities::ClearSpinBox::~ClearSpinBox ( )
override

Destroys the clear spin box.

Definition at line 30 of file clearspinbox.cpp.

Member Function Documentation

◆ isCleared()

bool QtUtilities::ClearSpinBox::isCleared ( ) const
overridevirtual

Returns whether the related widget is cleared.

This method is meant to be implemented when subclassing.

Reimplemented from QtUtilities::ButtonOverlay.

Definition at line 57 of file clearspinbox.cpp.

◆ minimumHidden()

bool QtUtilities::ClearSpinBox::minimumHidden ( ) const
inline

Returns whether the minimum value will be hidden.

Definition at line 46 of file clearspinbox.h.

◆ placeholderText()

QString QtUtilities::ClearSpinBox::placeholderText ( ) const
inline

Returns the placeholder text.

See also
QLineEdit::placeholderText()

Definition at line 63 of file clearspinbox.h.

◆ setMinimumHidden()

void QtUtilities::ClearSpinBox::setMinimumHidden ( bool value)
inline

Sets whether the minimum value should be hidden.

Definition at line 54 of file clearspinbox.h.

◆ setPlaceholderText()

void QtUtilities::ClearSpinBox::setPlaceholderText ( const QString & placeholderText)
inline

Sets the placeholder text.

See also
QLineEdit::setPlaceholderText()

Definition at line 72 of file clearspinbox.h.

◆ textFromValue()

QString QtUtilities::ClearSpinBox::textFromValue ( int val) const
overrideprotected

Definition at line 71 of file clearspinbox.cpp.

◆ valueFromText()

int QtUtilities::ClearSpinBox::valueFromText ( const QString & text) const
overrideprotected

Definition at line 62 of file clearspinbox.cpp.

Property Documentation

◆ cleared

bool QtUtilities::ClearSpinBox::cleared
read

Definition at line 17 of file clearspinbox.h.

◆ minimumHidden

bool QtUtilities::ClearSpinBox::minimumHidden
readwrite

Definition at line 18 of file clearspinbox.h.

◆ placeholderText

QString QtUtilities::ClearSpinBox::placeholderText
readwrite

Definition at line 19 of file clearspinbox.h.


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