21 : QTabWidget( parent )
31 mSetTabVisibleFlag =
true;
32 removeTab( info.sourceIndex );
34 mSetTabVisibleFlag =
false;
44 mSetTabVisibleFlag =
true;
45 insertTab( info.sourceIndex + 1, info.widget, info.label );
47 mSetTabVisibleFlag =
false;
62 const auto constMTabs = mTabs;
63 for (
const TabInformation &info : constMTabs )
65 if ( info.widget == widget )
74 if ( !mSetTabVisibleFlag )
76 QWidget *newWidget = widget( index );
80 mTabs.insert( 0, TabInformation( newWidget, tabText( index ) ) );
84 bool inserted =
false;
85 QList<TabInformation>::iterator it;
87 for ( it = mTabs.begin(); it != mTabs.end(); ++it )
89 if ( it->sourceIndex == index )
91 mTabs.insert( it, TabInformation( newWidget, tabText( index ) ) );
99 mTabs.append( TabInformation( newWidget, tabText( index ) ) );
104 synchronizeIndexes();
109 if ( !mSetTabVisibleFlag )
111 QList<TabInformation>::iterator it;
113 for ( it = mTabs.begin(); it != mTabs.end(); ++it )
115 if ( it->sourceIndex == index )
117 mTabs.removeOne( *it );
123 synchronizeIndexes();
126 void QgsTabWidget::synchronizeIndexes()
130 QWidget *nextWidget = widget( 0 );
132 QList<TabInformation>::iterator it;
134 for ( it = mTabs.begin(); it != mTabs.end(); ++it )
136 if ( it->widget == nextWidget )
139 nextWidget = widget( i + 1 );
142 QgsDebugMsg( QStringLiteral(
"Tab %1 (%2): %3" ).arg( it->sourceIndex ).arg( it->label ).arg( i ) );
146 QgsTabWidget::TabInformation QgsTabWidget::tabInfo( QWidget *widget )
148 const auto constMTabs = mTabs;
149 for (
const TabInformation &info : constMTabs )
151 if ( info.widget == widget )
154 return TabInformation();
159 return other.widget == widget && other.sourceIndex == sourceIndex;