21 : QTabWidget( parent )
23 QgsTabBar *qgsTabBar =
new QgsTabBar(
this );
24 setTabBar( qgsTabBar );
25 mTabBarStyle =
new QgsTabBarProxyStyle( tabBar() );
26 qgsTabBar->setTabBarStyle( mTabBarStyle );
27 setStyle( mTabBarStyle );
36 mSetTabVisibleFlag =
true;
37 removeTab( info.sourceIndex );
39 mSetTabVisibleFlag =
false;
49 mSetTabVisibleFlag =
true;
50 insertTab( info.sourceIndex + 1, info.widget, info.label );
52 mSetTabVisibleFlag =
false;
67 const auto constMTabs = mTabs;
68 for (
const TabInformation &info : constMTabs )
70 if ( info.widget == widget )
79 mTabBarStyle->addStyle( tabIndex, labelStyle );
84 if ( !mSetTabVisibleFlag )
86 QWidget *newWidget = widget( index );
90 mTabs.insert( 0, TabInformation( newWidget, tabText( index ) ) );
94 bool inserted =
false;
95 QList<TabInformation>::iterator it;
97 for ( it = mTabs.begin(); it != mTabs.end(); ++it )
99 if ( it->sourceIndex == index )
101 mTabs.insert( it, TabInformation( newWidget, tabText( index ) ) );
109 mTabs.append( TabInformation( newWidget, tabText( index ) ) );
114 synchronizeIndexes();
119 if ( !mSetTabVisibleFlag )
121 QList<TabInformation>::iterator it;
123 for ( it = mTabs.begin(); it != mTabs.end(); ++it )
125 if ( it->sourceIndex == index )
127 mTabs.removeOne( *it );
133 synchronizeIndexes();
136void QgsTabWidget::synchronizeIndexes()
140 QWidget *nextWidget = widget( 0 );
142 QList<TabInformation>::iterator it;
144 for ( it = mTabs.begin(); it != mTabs.end(); ++it )
146 if ( it->widget == nextWidget )
149 nextWidget = widget( i + 1 );
152 QgsDebugMsgLevel( QStringLiteral(
"Tab %1 (%2): %3" ).arg( it->sourceIndex ).arg( it->label ).arg( i ), 3 );
156QgsTabWidget::TabInformation QgsTabWidget::tabInfo( QWidget *widget )
158 const auto constMTabs = mTabs;
159 for (
const TabInformation &info : constMTabs )
161 if ( info.widget == widget )
164 return TabInformation();
167bool QgsTabWidget::TabInformation::operator ==(
const QgsTabWidget::TabInformation &other )
const
169 return other.widget == widget && other.sourceIndex == sourceIndex;
172bool QgsTabWidget::TabInformation::operator !=(
const TabInformation &other )
const
174 return !( *
this == other );
#define QgsDebugMsgLevel(str, level)
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.