Qt Utilities  5.11.0
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
Widgets::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 Widgets::ClearSpinBox:
[legend]
Collaboration diagram for Widgets::ClearSpinBox:
[legend]

Public Member Functions

 ClearSpinBox (QWidget *parent=nullptr)
 Constructs a clear spin box. More...
 
 ~ClearSpinBox ()
 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
 Returns whether the related widget is cleared. More...
 
- Public Member Functions inherited from Widgets::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
 
QString textFromValue (int val) const
 
- Protected Member Functions inherited from Widgets::ButtonOverlay
void updateClearButtonVisibility (bool visible)
 Updates the visibility of the clear button. More...
 
virtual void handleClearButtonClicked ()
 Clears the related widget. More...
 

Properties

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

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()

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

Constructs a clear spin box.

Definition at line 19 of file clearspinbox.cpp.

◆ ~ClearSpinBox()

Widgets::ClearSpinBox::~ClearSpinBox ( )

Destroys the clear spin box.

Definition at line 39 of file clearspinbox.cpp.

Member Function Documentation

◆ isCleared()

bool Widgets::ClearSpinBox::isCleared ( ) const
virtual

Returns whether the related widget is cleared.

This method is meant to be implemented when subclassing.

Reimplemented from Widgets::ButtonOverlay.

◆ minimumHidden()

bool Widgets::ClearSpinBox::minimumHidden ( ) const

◆ placeholderText()

QString Widgets::ClearSpinBox::placeholderText ( ) const

◆ setMinimumHidden()

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

Sets whether the minimum value should be hidden.

Definition at line 53 of file clearspinbox.h.

◆ setPlaceholderText()

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

Sets the placeholder text.

See also
QLineEdit::setPlaceholderText()

Definition at line 71 of file clearspinbox.h.

◆ textFromValue()

QString Widgets::ClearSpinBox::textFromValue ( int  val) const
protected

Definition at line 70 of file clearspinbox.cpp.

◆ valueFromText()

int Widgets::ClearSpinBox::valueFromText ( const QString &  text) const
protected

Definition at line 61 of file clearspinbox.cpp.

Property Documentation

◆ isCleared

bool Widgets::ClearSpinBox::isCleared
read

Definition at line 19 of file clearspinbox.h.

◆ minimumHidden

bool Widgets::ClearSpinBox::minimumHidden
inlinereadwrite

Returns whether the minimum value will be hidden.

Definition at line 17 of file clearspinbox.h.

◆ placeholderText

QString Widgets::ClearSpinBox::placeholderText
inlinereadwrite

Returns the placeholder text.

See also
QLineEdit::placeholderText()

Definition at line 18 of file clearspinbox.h.


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