Commit 0a48a346 authored by Clement CHAVANCE's avatar Clement CHAVANCE
Browse files

title of the preference window change when we switch between widgets

parent 45175e2a
...@@ -168,10 +168,10 @@ void MainWindow::createGlobalPreferences() ...@@ -168,10 +168,10 @@ void MainWindow::createGlobalPreferences()
"images/vlmc.png", "images/vlmc.png",
"Language"); "Language");
//For debugging purpose //For debugging purpose
m_globalPreferences->addWidget("language", m_globalPreferences->addWidget("Test",
new QLabel("This is a test"), new QLabel("This is a test"),
"images/vlmc.png", "images/vlmc.png",
"Language"); "Test");
m_globalPreferences->build(); m_globalPreferences->build();
} }
......
...@@ -69,13 +69,15 @@ void SimplePreferences::addWidget( const QString& name, ...@@ -69,13 +69,15 @@ void SimplePreferences::addWidget( const QString& name,
m_widgets.insert( idx, name ); m_widgets.insert( idx, name );
m_panel->addButton( label, icon, idx ); m_panel->addButton( label, icon, idx );
if (m_currentWidget == 0) if (m_currentWidget == 0)
{
m_currentWidget = widget; m_currentWidget = widget;
}
} }
void SimplePreferences::build() void SimplePreferences::build()
{ {
if (m_currentWidget == 0) if (m_currentWidget == 0)
qFatal( "Can't build the preference panel without an added widget" ); qFatal( "Can't build the preference panel without an added widget" );
QHBoxLayout* hLayout = new QHBoxLayout( this ); QHBoxLayout* hLayout = new QHBoxLayout( this );
setLayout( hLayout ); setLayout( hLayout );
//TODO : change the size of the widgets to make it look cleaner //TODO : change the size of the widgets to make it look cleaner
...@@ -104,6 +106,8 @@ QVBoxLayout* SimplePreferences::buildRightHLayout() ...@@ -104,6 +106,8 @@ QVBoxLayout* SimplePreferences::buildRightHLayout()
QDialogButtonBox::Cancel | QDialogButtonBox::Cancel |
QDialogButtonBox::Apply ); QDialogButtonBox::Apply );
QString title( m_widgets.value( m_stackedWidgets->indexOf( m_currentWidget ) ) );
m_title->setText( title );
layout->addWidget( m_title ); layout->addWidget( m_title );
layout->addWidget( titleLine ); layout->addWidget( titleLine );
layout->addWidget( m_stackedWidgets ); layout->addWidget( m_stackedWidgets );
...@@ -118,6 +122,7 @@ void SimplePreferences::switchWidget( int widget ) ...@@ -118,6 +122,7 @@ void SimplePreferences::switchWidget( int widget )
if ( !m_widgets.contains( widget ) ) if ( !m_widgets.contains( widget ) )
return ; return ;
m_title->setText( m_widgets.value( widget ) );
emit widgetSwitched( widget ); emit widgetSwitched( widget );
} }
Supports Markdown
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