17#include "moc_qgstabwidget.cpp" 
   22  : QTabWidget( parent )
 
   24  QgsTabBar *qgsTabBar = 
new QgsTabBar( 
this );
 
   25  setTabBar( qgsTabBar );
 
   26  mTabBarStyle = 
new QgsTabBarProxyStyle( tabBar() );
 
   27  qgsTabBar->setTabBarStyle( mTabBarStyle );
 
   28  setStyle( mTabBarStyle );
 
 
   37    mSetTabVisibleFlag = 
true;
 
   38    removeTab( info.sourceIndex );
 
   40    mSetTabVisibleFlag = 
false;
 
 
   50    mSetTabVisibleFlag = 
true;
 
   51    insertTab( info.sourceIndex + 1, info.widget, info.label );
 
   53    mSetTabVisibleFlag = 
false;
 
 
   68  const auto constMTabs = mTabs;
 
   69  for ( 
const TabInformation &info : constMTabs )
 
   71    if ( info.widget == widget )
 
 
   80  mTabBarStyle->addStyle( tabIndex, labelStyle );
 
 
   85  if ( !mSetTabVisibleFlag )
 
   87    QWidget *newWidget = widget( index );
 
   91      mTabs.insert( 0, TabInformation( newWidget, tabText( index ) ) );
 
   95      bool inserted = 
false;
 
   96      QList<TabInformation>::iterator it;
 
   98      for ( it = mTabs.begin(); it != mTabs.end(); ++it )
 
  100        if ( it->sourceIndex == index )
 
  102          mTabs.insert( it, TabInformation( newWidget, tabText( index ) ) );
 
  110        mTabs.append( TabInformation( newWidget, tabText( index ) ) );
 
  115  synchronizeIndexes();
 
 
  120  if ( !mSetTabVisibleFlag )
 
  122    QList<TabInformation>::iterator it;
 
  124    for ( it = mTabs.begin(); it != mTabs.end(); ++it )
 
  126      if ( it->sourceIndex == index )
 
  128        mTabs.removeOne( *it );
 
  134  synchronizeIndexes();
 
 
  137void QgsTabWidget::synchronizeIndexes()
 
  141  QWidget *nextWidget = widget( 0 );
 
  143  QList<TabInformation>::iterator it;
 
  145  for ( it = mTabs.begin(); it != mTabs.end(); ++it )
 
  147    if ( it->widget == nextWidget )
 
  150      nextWidget = widget( i + 1 );
 
  153    QgsDebugMsgLevel( QStringLiteral( 
"Tab %1 (%2): %3" ).arg( it->sourceIndex ).arg( it->label ).arg( i ), 3 );
 
  157QgsTabWidget::TabInformation QgsTabWidget::tabInfo( QWidget *widget )
 
  159  const auto constMTabs = mTabs;
 
  160  for ( 
const TabInformation &info : constMTabs )
 
  162    if ( info.widget == widget )
 
  165  return TabInformation();
 
  168bool QgsTabWidget::TabInformation::operator==( 
const QgsTabWidget::TabInformation &other )
 const 
  170  return other.widget == widget && other.sourceIndex == sourceIndex;
 
  173bool QgsTabWidget::TabInformation::operator!=( 
const TabInformation &other )
 const 
  175  return !( *
this == other );
 
#define QgsDebugMsgLevel(str, level)
 
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.