[libcalamaresui] Sanitize API of PrettyRadioButton
- Don't expose internals - Drop unnecessary virtual - Offer new API to do the things, for which internals were exposed
This commit is contained in:
parent
3b7c3c4f5d
commit
17231ae41f
@ -21,6 +21,7 @@
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "widgets/ClickableLabel.h"
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
@ -80,12 +81,26 @@ PrettyRadioButton::iconSize() const
|
||||
}
|
||||
|
||||
|
||||
QRadioButton*
|
||||
PrettyRadioButton::buttonWidget() const
|
||||
void
|
||||
PrettyRadioButton::setChecked( bool checked )
|
||||
{
|
||||
return m_radio;
|
||||
m_radio->setChecked( checked );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PrettyRadioButton::isChecked() const
|
||||
{
|
||||
return m_radio->isChecked();
|
||||
}
|
||||
|
||||
void
|
||||
PrettyRadioButton::addToGroup( QButtonGroup* group, int id )
|
||||
{
|
||||
group->addButton( m_radio, id );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PrettyRadioButton::addOptionsComboBox( QComboBox* box )
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <QRadioButton>
|
||||
|
||||
class QButtonGroup;
|
||||
class QComboBox;
|
||||
class QGridLayout;
|
||||
class QHBoxLayout;
|
||||
@ -32,6 +33,9 @@ namespace Calamares
|
||||
class ClickableLabel;
|
||||
|
||||
/** @brief A radio button with fancy label next to it.
|
||||
*
|
||||
* The fancy label is used so that the text alongside the radio
|
||||
* button can word-wrap, be multi-line, and support rich text.
|
||||
*
|
||||
* The radio button itself can be retrieved with buttonWidget(),
|
||||
* and the whole behaves a lot like a label. Extra options can be
|
||||
@ -45,17 +49,26 @@ public:
|
||||
explicit PrettyRadioButton( QWidget* parent = nullptr );
|
||||
virtual ~PrettyRadioButton() { }
|
||||
|
||||
virtual void setText( const QString& text );
|
||||
/// @brief Passes @p text on to the ClickableLabel
|
||||
void setText( const QString& text );
|
||||
|
||||
virtual void setIconSize( const QSize& size );
|
||||
// Icon applies to the radio-button part
|
||||
void setIconSize( const QSize& size );
|
||||
QSize iconSize() const;
|
||||
void setIcon( const QIcon& icon );
|
||||
|
||||
virtual void setIcon( const QIcon& icon );
|
||||
// Applies to the radio-button part
|
||||
void setChecked( bool checked );
|
||||
bool isChecked() const;
|
||||
|
||||
virtual QSize iconSize() const;
|
||||
/** @brief Adds the radio-button part to the given @p group
|
||||
*
|
||||
* For managing the pretty-radio-button in button groups like normal
|
||||
* radio buttons, call addToGroup() rather that group->addButton().
|
||||
*/
|
||||
void addToGroup( QButtonGroup* group, int id = -1 );
|
||||
|
||||
virtual QRadioButton* buttonWidget() const;
|
||||
|
||||
/** @brief Add an options drop-down to this button. */
|
||||
/// @brief Add an options drop-down to this button.
|
||||
void addOptionsComboBox( QComboBox* );
|
||||
|
||||
protected slots:
|
||||
|
Loading…
Reference in New Issue
Block a user