.:saeed:.
16th January 2011, 21:29
Hello every one .
I try to write English carefully. sorry for my English mistakes(probably ):o
5767
In the attached photo you can see that I have a treewidget in the left and a stackedwidget in the right. what is the best solution for connecting them together? Is there better widget instead of stackedwidget ?I want for example when somebody clicks "Interface" item from treewidget the right page is selected from stackedwidget
I have used this code:
void FirewallSettings::on_trew_settings_clicked(QModelI ndex index)
{
int row;
if( index.parent() == QModelIndex())
row = index.row();
else
row = index.parent().row();
int pageNumber = 0;
for( int rowIndex = 0; rowIndex < row; rowIndex++ ){
pageNumber += ui.trew_settings->topLevelItem( rowIndex )->childCount();
pageNumber ++;
}
if( index.parent() != QModelIndex()){
pageNumber += index.row();
pageNumber ++;
}
ui.sckw_settings->setCurrentIndex( pageNumber );
}
But I think this is not the best solution for this situation. Help me please .
thanks
I try to write English carefully. sorry for my English mistakes(probably ):o
5767
In the attached photo you can see that I have a treewidget in the left and a stackedwidget in the right. what is the best solution for connecting them together? Is there better widget instead of stackedwidget ?I want for example when somebody clicks "Interface" item from treewidget the right page is selected from stackedwidget
I have used this code:
void FirewallSettings::on_trew_settings_clicked(QModelI ndex index)
{
int row;
if( index.parent() == QModelIndex())
row = index.row();
else
row = index.parent().row();
int pageNumber = 0;
for( int rowIndex = 0; rowIndex < row; rowIndex++ ){
pageNumber += ui.trew_settings->topLevelItem( rowIndex )->childCount();
pageNumber ++;
}
if( index.parent() != QModelIndex()){
pageNumber += index.row();
pageNumber ++;
}
ui.sckw_settings->setCurrentIndex( pageNumber );
}
But I think this is not the best solution for this situation. Help me please .
thanks