[libcalamaresui] Coding style
- Apply coding style - Place the widget classes in namespace Calamares - Export symbols for widgets
This commit is contained in:
parent
c4951d5090
commit
3b7c3c4f5d
@ -18,7 +18,10 @@
|
|||||||
|
|
||||||
#include "ClickableLabel.h"
|
#include "ClickableLabel.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication> // for doubleClickInterval()
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
ClickableLabel::ClickableLabel( QWidget* parent )
|
ClickableLabel::ClickableLabel( QWidget* parent )
|
||||||
@ -53,3 +56,5 @@ ClickableLabel::mouseReleaseEvent( QMouseEvent* event )
|
|||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Calamares
|
||||||
|
@ -20,8 +20,13 @@
|
|||||||
#ifndef LIBCALAMARESUI_CLICKABLELABEL_H
|
#ifndef LIBCALAMARESUI_CLICKABLELABEL_H
|
||||||
#define LIBCALAMARESUI_CLICKABLELABEL_H
|
#define LIBCALAMARESUI_CLICKABLELABEL_H
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
#include "DllMacro.h"
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
/** @brief A Label where the whole label area is clickable
|
/** @brief A Label where the whole label area is clickable
|
||||||
*
|
*
|
||||||
@ -30,7 +35,7 @@
|
|||||||
* buttons or other clickable things where you want mouse interaction
|
* buttons or other clickable things where you want mouse interaction
|
||||||
* with the label, to be the same as mouse interaction with the control.
|
* with the label, to be the same as mouse interaction with the control.
|
||||||
*/
|
*/
|
||||||
class ClickableLabel : public QLabel
|
class UIDLLEXPORT ClickableLabel : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -49,4 +54,6 @@ private:
|
|||||||
QElapsedTimer m_time;
|
QElapsedTimer m_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Calamares
|
||||||
|
|
||||||
#endif // LIBCALAMARESUI_CLICKABLELABEL_H
|
#endif // LIBCALAMARESUI_CLICKABLELABEL_H
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
PrettyRadioButton::PrettyRadioButton( QWidget* parent )
|
PrettyRadioButton::PrettyRadioButton( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
@ -45,10 +47,8 @@ PrettyRadioButton::PrettyRadioButton( QWidget* parent )
|
|||||||
m_mainLayout->addWidget( m_label, 0, 1 );
|
m_mainLayout->addWidget( m_label, 0, 1 );
|
||||||
m_mainLayout->setContentsMargins( 0, 0, 0, 0 );
|
m_mainLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
|
||||||
connect( m_label, &ClickableLabel::clicked,
|
connect( m_label, &ClickableLabel::clicked, m_radio, &QRadioButton::click );
|
||||||
m_radio, &QRadioButton::click );
|
connect( m_radio, &QRadioButton::toggled, this, &PrettyRadioButton::toggleOptions );
|
||||||
connect( m_radio, &QRadioButton::toggled,
|
|
||||||
this, &PrettyRadioButton::toggleOptions );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +90,9 @@ void
|
|||||||
PrettyRadioButton::addOptionsComboBox( QComboBox* box )
|
PrettyRadioButton::addOptionsComboBox( QComboBox* box )
|
||||||
{
|
{
|
||||||
if ( !box )
|
if ( !box )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !m_optionsLayout )
|
if ( !m_optionsLayout )
|
||||||
{
|
{
|
||||||
@ -105,12 +107,16 @@ PrettyRadioButton::addOptionsComboBox( QComboBox* box )
|
|||||||
toggleOptions( m_radio->isChecked() );
|
toggleOptions( m_radio->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_optionsLayout->insertWidget( m_optionsLayout->count()-1, box );
|
m_optionsLayout->insertWidget( m_optionsLayout->count() - 1, box );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PrettyRadioButton::toggleOptions( bool toggle )
|
PrettyRadioButton::toggleOptions( bool toggle )
|
||||||
{
|
{
|
||||||
if ( m_optionsLayout )
|
if ( m_optionsLayout )
|
||||||
|
{
|
||||||
m_optionsLayout->parentWidget()->setVisible( toggle );
|
m_optionsLayout->parentWidget()->setVisible( toggle );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Calamares
|
||||||
|
@ -19,13 +19,18 @@
|
|||||||
#ifndef LIBCALAMARESUI_PRETTYRADIOBUTTON_H
|
#ifndef LIBCALAMARESUI_PRETTYRADIOBUTTON_H
|
||||||
#define LIBCALAMARESUI_PRETTYRADIOBUTTON_H
|
#define LIBCALAMARESUI_PRETTYRADIOBUTTON_H
|
||||||
|
|
||||||
|
#include "DllMacro.h"
|
||||||
|
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
|
|
||||||
class ClickableLabel;
|
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
class ClickableLabel;
|
||||||
|
|
||||||
/** @brief A radio button with fancy label next to it.
|
/** @brief A radio button with fancy label next to it.
|
||||||
*
|
*
|
||||||
* The radio button itself can be retrieved with buttonWidget(),
|
* The radio button itself can be retrieved with buttonWidget(),
|
||||||
@ -33,12 +38,12 @@ class QHBoxLayout;
|
|||||||
* added to the display (options are hidden when the button is
|
* added to the display (options are hidden when the button is
|
||||||
* not selected) with addOptionsComboBox().
|
* not selected) with addOptionsComboBox().
|
||||||
*/
|
*/
|
||||||
class PrettyRadioButton : public QWidget
|
class UIDLLEXPORT PrettyRadioButton : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PrettyRadioButton( QWidget* parent = nullptr );
|
explicit PrettyRadioButton( QWidget* parent = nullptr );
|
||||||
virtual ~PrettyRadioButton() {}
|
virtual ~PrettyRadioButton() { }
|
||||||
|
|
||||||
virtual void setText( const QString& text );
|
virtual void setText( const QString& text );
|
||||||
|
|
||||||
@ -64,4 +69,5 @@ protected:
|
|||||||
QHBoxLayout* m_optionsLayout;
|
QHBoxLayout* m_optionsLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Calamares
|
||||||
#endif // LIBCALAMARESUI_PRETTYRADIOBUTTON_H
|
#endif // LIBCALAMARESUI_PRETTYRADIOBUTTON_H
|
||||||
|
Loading…
Reference in New Issue
Block a user