7835_options-tab-out-of-range_patch.diff

Larry Shaffer, 2013-05-16 11:44 AM

Download (1.13 KB)

View differences:

src/gui/qgsoptionsdialogbase.cpp
96 96
  mOptSplitter->restoreState( settings.value( QString( "/Windows/%1/splitState" ).arg( mOptsKey ) ).toByteArray() );
97 97
  int curIndx = settings.value( QString( "/Windows/%1/tab" ).arg( mOptsKey ), 0 ).toInt();
98 98

  
99
  // if the last used tab is not enabled, or is missing, display the first enabled one
100
  if ( !mOptStackedWidget->widget( curIndx )->isEnabled()
101
       || mOptStackedWidget->count() < ( curIndx + 1 ) )
99
  // if the last used tab is out of range or not enabled display the first enabled one
100
  if ( mOptStackedWidget->count() < ( curIndx + 1 )
101
       || !mOptStackedWidget->widget( curIndx )->isEnabled() )
102 102
  {
103 103
    curIndx = 0;
104 104
    for ( int i = 0; i < mOptStackedWidget->count(); i++ )
......
109 109
        break;
110 110
      }
111 111
    }
112
    curIndx = -1; // default fallback
113 112
  }
114 113

  
115 114
  mOptStackedWidget->setCurrentIndex( curIndx );