Qt Utilities  6.0.2
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Public Member Functions | Protected Member Functions | Properties | List of all members
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. More...
 
 ~ClearSpinBox () override
 Destroys the clear spin box. More...
 
bool minimumHidden () const
 
void setMinimumHidden (bool value)
 Sets whether the minimum value should be hidden. More...
 
QString placeholderText () const
 
void setPlaceholderText (const QString &placeholderText)
 Sets the placeholder text. More...
 
bool isCleared () const override
 Returns whether the related widget is cleared. More...
 
- Public Member Functions inherited from QtUtilities::ButtonOverlay
 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...
 

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. More...
 
virtual void handleClearButtonClicked ()
 Clears the related widget. More...
 

Properties

bool cleared
 
bool minimumHidden
 Returns whether the minimum value will be hidden. More...
 
QString placeholderText
 Returns the placeholder text. More...
 

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 39 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 56 of file clearspinbox.cpp.

◆ minimumHidden()

bool QtUtilities::ClearSpinBox::minimumHidden ( ) const

◆ placeholderText()

QString QtUtilities::ClearSpinBox::placeholderText ( ) const

◆ setMinimumHidden()

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

Sets whether the minimum value should be hidden.

Definition at line 53 of file clearspinbox.h.

◆ setPlaceholderText()

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

Sets the placeholder text.

See also
QLineEdit::setPlaceholderText()

Definition at line 71 of file clearspinbox.h.

◆ textFromValue()

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

Definition at line 70 of file clearspinbox.cpp.

◆ valueFromText()

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

Definition at line 61 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
inlinereadwrite

Returns whether the minimum value will be hidden.

Definition at line 18 of file clearspinbox.h.

◆ placeholderText

QString QtUtilities::ClearSpinBox::placeholderText
inlinereadwrite

Returns the placeholder text.

See also
QLineEdit::placeholderText()

Definition at line 19 of file clearspinbox.h.


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