summaryrefslogtreecommitdiffstats
path: root/src/widgets/qtabbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/qtabbar.cpp')
-rw-r--r--src/widgets/qtabbar.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/widgets/qtabbar.cpp b/src/widgets/qtabbar.cpp
index fca4957..383285d 100644
--- a/src/widgets/qtabbar.cpp
+++ b/src/widgets/qtabbar.cpp
@@ -335,7 +335,7 @@ private:
*/
QTabBar::QTabBar( QWidget * parent, const char *name )
- : QWidget( parent, name, WNoAutoErase | WNoMousePropagation )
+ : QWidget( parent, name, WNoAutoErase | WNoMousePropagation ), l(NULL)
{
d = new QTabPrivate;
d->pressed = 0;
@@ -839,7 +839,10 @@ void QTabBar::show()
int QTabBar::currentTab() const
{
- const QTab * t = l->getLast();
+ const QTab * t = 0;
+ if (l) {
+ t = l->getLast();
+ }
return t ? t->id : -1;
}
@@ -965,10 +968,12 @@ void QTabBar::keyPressEvent( QKeyEvent * e )
QTab * QTabBar::tab( int id ) const
{
- QTab * t;
- for( t = l->first(); t; t = l->next() )
- if ( t && t->id == id )
- return t;
+ if (l) {
+ QTab * t;
+ for( t = l->first(); t; t = l->next() )
+ if ( t && t->id == id )
+ return t;
+ }
return 0;
}
@@ -982,7 +987,8 @@ QTab * QTabBar::tab( int id ) const
QTab * QTabBar::tabAt( int index ) const
{
QTab * t;
- t = lstatic->at( index );
+ QPtrList<QTab> internalList = *lstatic;
+ t = internalList.at( index );
return t;
}
@@ -996,8 +1002,9 @@ QTab * QTabBar::tabAt( int index ) const
int QTabBar::indexOf( int id ) const
{
QTab * t;
+ QPtrList<QTab> internalList = *lstatic;
int idx = 0;
- for( t = lstatic->first(); t; t = lstatic->next() ) {
+ for( t = internalList.first(); t; t = internalList.next() ) {
if ( t && t->id == id )
return idx;
idx++;
@@ -1014,7 +1021,10 @@ int QTabBar::indexOf( int id ) const
*/
int QTabBar::count() const
{
- return l->count();
+ if (l) {
+ return l->count();
+ }
+ return 0;
}