Commit df7f74e3 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Settings panel cleanup.

Contributed (with a non-applicable patch) by j-b.
parent e6ef4148
......@@ -35,9 +35,7 @@
const int Panel::M_ICON_HEIGHT = 64;
Panel::Panel( QWidget* parent )
: QWidget( parent ),
m_layout( 0 )
Panel::Panel( QWidget* parent ) : QWidget( parent )
{
m_layout = new QVBoxLayout( this );
m_buttons = new QButtonGroup( this );
......@@ -48,16 +46,10 @@ Panel::Panel( QWidget* parent )
m_layout->insertSpacerItem( 1, new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
connect( m_buttons, SIGNAL( buttonPressed(int) ),
this, SLOT( switchPanel(int) ) );
this, SIGNAL( changePanel(int) ) );
setSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Expanding );
setLayout( m_layout );
}
Panel::~Panel()
{
}
void Panel::addButton( const QString& label,
......@@ -86,12 +78,6 @@ void Panel::addButton( const QString& label,
void Panel::showEvent( QShowEvent *event )
{
// Reset the selection when the dialog is shown.
if ( !event->spontaneous() &&
!m_buttons->buttons().isEmpty() )
if ( !event->spontaneous() && !m_buttons->buttons().isEmpty() )
m_buttons->buttons().first()->setChecked( true );
}
void Panel::switchPanel( int index )
{
emit changePanel( index );
}
......@@ -34,25 +34,23 @@ class Panel : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY( Panel )
public:
Panel( QWidget* parent = 0 );
virtual ~Panel();
void addButton( const QString& label,
const QIcon& icon,
int index );
public:
Panel( QWidget* parent = 0 );
virtual ~Panel() { }
private:
virtual void showEvent( QShowEvent * );
QVBoxLayout* m_layout;
QButtonGroup* m_buttons;
static const int M_ICON_HEIGHT;
void addButton( const QString& label,
const QIcon& icon,
int index );
private slots:
void switchPanel( int index );
private:
virtual void showEvent( QShowEvent * );
QVBoxLayout* m_layout;
QButtonGroup* m_buttons;
static const int M_ICON_HEIGHT;
signals:
void changePanel( int index );
signals:
void changePanel( int index );
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment