KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
PlayPauseButton Class Reference

Compound widget that toggles between "play" and "pause" states. More...

#include <playpausebutton.h>

+ Inheritance diagram for PlayPauseButton:
+ Collaboration diagram for PlayPauseButton:

Public Slots

void setPlaying (bool value, bool blockSignal=false)
 Set the playing state and optionally suppress the signal.
 
void setText (const QString &value)
 Set the companion text label text.
 
void setTextVisible (bool value)
 Show or hide the companion text label.
 
void setTextAlignment (Qt::Alignment value)
 Set the text label alignment.
 
void setIconWhilePlaying (const QIcon &value)
 Set the icon displayed while in the playing state.
 
void setIconWhilePaused (const QIcon &value)
 Set the icon displayed while in the paused state.
 

Signals

void clicked ()
 Emitted when the button is clicked.
 
void playingChanged (bool playing)
 Emitted when the playing state changes.
 
void textChanged (bool playing)
 Emitted when the text label text changes.
 

Public Member Functions

 PlayPauseButton (QWidget *parent=nullptr)
 Construct with an optional parent.
 
bool isPlaying () const
 Return whether the widget is in the "playing" state.
 
QString text () const
 Return the companion text label's text.
 
bool isTextVisible () const
 Return whether the companion text label is visible.
 
void setButtonSize (const QSize &min, const QSize &max, const QSize &icon)
 Set minimum, maximum, and icon sizes on the button.
 
Qt::Alignment textAlignment () const
 Return the alignment of the companion text label.
 
QIcon iconWhilePlaying () const
 Return the icon shown while playing.
 
QIcon iconWhilePaused () const
 Return the icon shown while paused.
 

Properties

bool playing
 Whether the button is in the playing state.
 
bool textVisible
 Whether the companion text label is visible.
 
QString text
 Text shown in the companion label.
 
QIcon iconWhilePlaying
 Icon displayed while the button is in the playing state.
 
QIcon iconWhilePaused
 Icon displayed while the button is in the paused state.
 
Qt::Alignment textAlignment
 Alignment of the companion text label.
 

Detailed Description

Compound widget that toggles between "play" and "pause" states.

PlayPauseButton displays a QPushButton whose icon switches between iconWhilePlaying and iconWhilePaused according to the current playing state. An optional text label can be shown alongside the button with configurable alignment. The playing property is fully bindable and notifies via playingChanged().

Definition at line 19 of file playpausebutton.h.

Constructor & Destructor Documentation

◆ PlayPauseButton()

PlayPauseButton::PlayPauseButton ( QWidget *  parent = nullptr)
explicit

Construct with an optional parent.

Parameters
parentOptional QWidget parent

Member Function Documentation

◆ iconWhilePaused()

QIcon PlayPauseButton::iconWhilePaused ( ) const
inline

Return the icon shown while paused.

Returns
Paused icon

Definition at line 84 of file playpausebutton.h.

◆ iconWhilePlaying()

QIcon PlayPauseButton::iconWhilePlaying ( ) const
inline

Return the icon shown while playing.

Returns
Playing icon

Definition at line 78 of file playpausebutton.h.

◆ isPlaying()

bool PlayPauseButton::isPlaying ( ) const
inline

Return whether the widget is in the "playing" state.

Returns
true if playing

Definition at line 46 of file playpausebutton.h.

◆ isTextVisible()

bool PlayPauseButton::isTextVisible ( ) const

Return whether the companion text label is visible.

Returns
true if visible

◆ playingChanged

void PlayPauseButton::playingChanged ( bool  playing)
signal

Emitted when the playing state changes.

Parameters
playingNew playing state

◆ setButtonSize()

void PlayPauseButton::setButtonSize ( const QSize &  min,
const QSize &  max,
const QSize &  icon 
)

Set minimum, maximum, and icon sizes on the button.

Parameters
minMinimum button size
maxMaximum button size
iconIcon size

◆ setIconWhilePaused

void PlayPauseButton::setIconWhilePaused ( const QIcon &  value)
inlineslot

Set the icon displayed while in the paused state.

Parameters
valueNew paused icon

Definition at line 122 of file playpausebutton.h.

◆ setIconWhilePlaying

void PlayPauseButton::setIconWhilePlaying ( const QIcon &  value)
inlineslot

Set the icon displayed while in the playing state.

Parameters
valueNew playing icon

Definition at line 116 of file playpausebutton.h.

◆ setPlaying

void PlayPauseButton::setPlaying ( bool  value,
bool  blockSignal = false 
)
slot

Set the playing state and optionally suppress the signal.

Parameters
valuetrue for playing, false for paused
blockSignaltrue to suppress playingChanged()

◆ setText

void PlayPauseButton::setText ( const QString &  value)
slot

Set the companion text label text.

Parameters
valueNew text string

◆ setTextAlignment

void PlayPauseButton::setTextAlignment ( Qt::Alignment  value)
slot

Set the text label alignment.

Parameters
valueQt alignment flags

◆ setTextVisible

void PlayPauseButton::setTextVisible ( bool  value)
slot

Show or hide the companion text label.

Parameters
valuetrue to show, false to hide

◆ text()

QString PlayPauseButton::text ( ) const
inline

Return the companion text label's text.

Returns
Label text string

Definition at line 52 of file playpausebutton.h.

◆ textAlignment()

Qt::Alignment PlayPauseButton::textAlignment ( ) const
inline

Return the alignment of the companion text label.

Returns
Qt alignment flags

Definition at line 72 of file playpausebutton.h.

◆ textChanged

void PlayPauseButton::textChanged ( bool  playing)
signal

Emitted when the text label text changes.

Parameters
playingNew playing state at time of text change

Property Documentation

◆ iconWhilePaused

QIcon PlayPauseButton::iconWhilePaused
readwrite

Icon displayed while the button is in the paused state.

Definition at line 31 of file playpausebutton.h.

◆ iconWhilePlaying

QIcon PlayPauseButton::iconWhilePlaying
readwrite

Icon displayed while the button is in the playing state.

Definition at line 29 of file playpausebutton.h.

◆ playing

bool PlayPauseButton::playing
readwrite

Whether the button is in the playing state.

Definition at line 23 of file playpausebutton.h.

◆ text

QString PlayPauseButton::text
readwrite

Text shown in the companion label.

Definition at line 27 of file playpausebutton.h.

◆ textAlignment

Qt::Alignment PlayPauseButton::textAlignment
readwrite

Alignment of the companion text label.

Definition at line 33 of file playpausebutton.h.

◆ textVisible

bool PlayPauseButton::textVisible
readwrite

Whether the companion text label is visible.

Definition at line 25 of file playpausebutton.h.


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