qBittorrent
TriStateAction Class Reference

#include <tristateaction.h>

Inheritance diagram for TriStateAction:
Collaboration diagram for TriStateAction:

Public Member Functions

 TriStateAction (const QString &text, QWidget *parent)
 
void setCheckState (Qt::CheckState checkState)
 
void setCloseOnInteraction (bool enabled)
 

Private Attributes

TriStateWidgetm_triStateWidget
 

Detailed Description

Definition at line 41 of file tristateaction.h.

Constructor & Destructor Documentation

◆ TriStateAction()

TriStateAction::TriStateAction ( const QString &  text,
QWidget *  parent 
)

Definition at line 36 of file tristateaction.cpp.

37  : QWidgetAction {parent}
38  , m_triStateWidget {new TriStateWidget {text, parent}}
39 {
40  setCheckable(true);
41 
42  // required for QAction::setChecked(bool) to work
43  connect(this, &QAction::toggled, this, [this](const bool checked)
44  {
45  m_triStateWidget->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
46  });
47 
48  connect(m_triStateWidget, &TriStateWidget::triggered, this, &QAction::toggled);
49  setDefaultWidget(m_triStateWidget);
50 }
TriStateWidget * m_triStateWidget
void setCheckState(Qt::CheckState checkState)
void triggered(bool checked) const

References m_triStateWidget, TriStateWidget::setCheckState(), and TriStateWidget::triggered().

Here is the call graph for this function:

Member Function Documentation

◆ setCheckState()

void TriStateAction::setCheckState ( Qt::CheckState  checkState)

Definition at line 52 of file tristateaction.cpp.

53 {
54  QWidgetAction::setChecked((checkState == Qt::Checked) ? true : false);
55  m_triStateWidget->setCheckState(checkState);
56 }

References m_triStateWidget, and TriStateWidget::setCheckState().

Here is the call graph for this function:

◆ setCloseOnInteraction()

void TriStateAction::setCloseOnInteraction ( bool  enabled)

Definition at line 58 of file tristateaction.cpp.

59 {
61 }
void setCloseOnInteraction(bool enabled)

References m_triStateWidget, and TriStateWidget::setCloseOnInteraction().

Here is the call graph for this function:

Member Data Documentation

◆ m_triStateWidget

TriStateWidget* TriStateAction::m_triStateWidget
private

Definition at line 57 of file tristateaction.h.

Referenced by setCheckState(), setCloseOnInteraction(), and TriStateAction().


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