Commit 31208aa9 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

AlgorithmSelector modified so that by default the first category is selected...

AlgorithmSelector modified so that by default the first category is selected when launching the application.
parent 86f1fd6b
......@@ -120,7 +120,10 @@ void AlgorithmSelector::finalizeTools()
* +--------------+
*/
foreach( int categoryId, ToolCategory::categoriesId() )
QPushButton *firstCategoryButton = NULL;
int firstCategoryId = -1;
for( int categoryId : ToolCategory::categoriesId() )
if( !m_ToolsByCategory[categoryId].empty() )
{
QVBoxLayout *l = new QVBoxLayout();
......@@ -138,6 +141,12 @@ void AlgorithmSelector::finalizeTools()
l->addWidget( categoryButton, 0, Qt::AlignHCenter );
m_CategoryButtonGroup->addButton( categoryButton, categoryId );
if( !firstCategoryButton )
{
firstCategoryButton = categoryButton;
firstCategoryId = categoryId;
}
QLabel *categoryLabel = new QLabel( ToolCategory::categoryName(categoryId) );
QFont f = QApplication::font();
f.setPointSize( 7 );
......@@ -154,7 +163,13 @@ void AlgorithmSelector::finalizeTools()
allCategories->addWidget( categoryPannel, i>>2, i&3 );
}
m_ui->widgetCategories->layout()->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
m_ui->widgetCategories->layout()->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
if( firstCategoryButton )
{
firstCategoryButton->setChecked( true );
selectCategory( firstCategoryId );
}
}
......
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