Skip to content
Snippets Groups Projects
Commit 57c347db authored by Lyndon Brown's avatar Lyndon Brown Committed by Jean-Baptiste Kempf
Browse files

qt: merge lazy creation of related widgets

the search filter for the advanced preferences tree should always be
lazily created at the same time we lazily create the tree widget itself.
there would never be a situation where this function would find one already
created and not the other. we can thus merge the condition blocks here.
parent 601ff86a
No related branches found
No related tags found
No related merge requests found
......@@ -154,7 +154,8 @@ PrefsDialog::~PrefsDialog()
void PrefsDialog::setAdvanced()
{
if ( !tree_filter )
/* Lazy creation */
if( !advanced_tree )
{
tree_filter = new SearchLineEdit( advanced_tree_panel );
tree_filter->setMinimumHeight( 26 );
......@@ -173,15 +174,10 @@ void PrefsDialog::setAdvanced()
QShortcut *search = new QShortcut( QKeySequence( QKeySequence::Find ), tree_filter );
CONNECT( search, activated(), tree_filter, setFocus() );
}
/* If don't have already and advanced TREE, then create it */
if( !advanced_tree )
{
/* Creation */
p_list = module_list_get( &count );
advanced_tree = new PrefsTree( p_intf, advanced_tree_panel, p_list, count );
/* and connections */
CONNECT( advanced_tree,
currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ),
this, changeAdvPanel( QTreeWidgetItem * ) );
......@@ -189,7 +185,7 @@ void PrefsDialog::setAdvanced()
advanced_tree_panel->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
}
/* If no advanced Panel exist, create one, attach it and show it*/
/* Create empty, dummy, controls panel, if needed */
if( advanced_panels_stack->count() < 1 )
{
AdvPrefsPanel *insert = new AdvPrefsPanel( advanced_panels_stack );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment