author | drw <drw> | 2003-06-03 22:11:32 (UTC) |
---|---|---|
committer | drw <drw> | 2003-06-03 22:11:32 (UTC) |
commit | 41ffd8ca271b6803558389d0c10ecb289517c896 (patch) (unidiff) | |
tree | 3d858b42989219ca7f38db0d01e7d88a0bff01c0 | |
parent | 94223c1a074b98d636b546b5a6b237ba91ee1f51 (diff) | |
download | opie-41ffd8ca271b6803558389d0c10ecb289517c896.zip opie-41ffd8ca271b6803558389d0c10ecb289517c896.tar.gz opie-41ffd8ca271b6803558389d0c10ecb289517c896.tar.bz2 |
Make sure tabPosition is initialized properly, thanks zecke for finding
-rw-r--r-- | libopie/otabwidget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index 05aafd4..fe2c60f 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp | |||
@@ -30,96 +30,97 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "otabwidget.h" | 32 | #include "otabwidget.h" |
33 | 33 | ||
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <opie/otabbar.h> | 36 | #include <opie/otabbar.h> |
37 | 37 | ||
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | #include <qwidgetstack.h> | 39 | #include <qwidgetstack.h> |
40 | 40 | ||
41 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) | 41 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) |
42 | : QWidget( parent, name ) | 42 | : QWidget( parent, name ) |
43 | { | 43 | { |
44 | if ( s == Global ) | 44 | if ( s == Global ) |
45 | { | 45 | { |
46 | Config config( "qpe" ); | 46 | Config config( "qpe" ); |
47 | config.setGroup( "Appearance" ); | 47 | config.setGroup( "Appearance" ); |
48 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); | 48 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); |
49 | if ( s <= Global || s > IconList) | 49 | if ( s <= Global || s > IconList) |
50 | { | 50 | { |
51 | s = IconTab; | 51 | s = IconTab; |
52 | } | 52 | } |
53 | QString pos = config.readEntry( "TabPosition", "Top"); | 53 | QString pos = config.readEntry( "TabPosition", "Top"); |
54 | if ( pos == "Bottom" ) | 54 | if ( pos == "Bottom" ) |
55 | { | 55 | { |
56 | p = Bottom; | 56 | p = Bottom; |
57 | } | 57 | } |
58 | else | 58 | else |
59 | { | 59 | { |
60 | p = Top; | 60 | p = Top; |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | widgetStack = new QWidgetStack( this, "widgetstack" ); | 64 | widgetStack = new QWidgetStack( this, "widgetstack" ); |
65 | widgetStack->setFrameStyle( QFrame::NoFrame ); | 65 | widgetStack->setFrameStyle( QFrame::NoFrame ); |
66 | widgetStack->setLineWidth( style().defaultFrameWidth() ); | 66 | widgetStack->setLineWidth( style().defaultFrameWidth() ); |
67 | 67 | ||
68 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); | 68 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); |
69 | 69 | ||
70 | tabBar = new OTabBar( tabBarStack, "tabbar" ); | 70 | tabBar = new OTabBar( tabBarStack, "tabbar" ); |
71 | tabBarStack->addWidget( tabBar, 0 ); | 71 | tabBarStack->addWidget( tabBar, 0 ); |
72 | connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); | 72 | connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); |
73 | 73 | ||
74 | tabList = new QComboBox( false, tabBarStack, "tablist" ); | 74 | tabList = new QComboBox( false, tabBarStack, "tablist" ); |
75 | tabBarStack->addWidget( tabList, 1 ); | 75 | tabBarStack->addWidget( tabList, 1 ); |
76 | connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); | 76 | connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); |
77 | 77 | ||
78 | tabBarPosition = p; | ||
78 | setTabStyle( s ); | 79 | setTabStyle( s ); |
79 | setTabPosition( p ); | 80 | setTabPosition( p ); |
80 | 81 | ||
81 | currTab= 0x0; | 82 | currTab= 0x0; |
82 | } | 83 | } |
83 | 84 | ||
84 | OTabWidget::~OTabWidget() | 85 | OTabWidget::~OTabWidget() |
85 | { | 86 | { |
86 | } | 87 | } |
87 | 88 | ||
88 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) | 89 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) |
89 | { | 90 | { |
90 | QPixmap iconset = loadSmooth( icon ); | 91 | QPixmap iconset = loadSmooth( icon ); |
91 | 92 | ||
92 | QTab *tab = new QTab(); | 93 | QTab *tab = new QTab(); |
93 | if ( tabBarStyle == IconTab ) | 94 | if ( tabBarStyle == IconTab ) |
94 | { | 95 | { |
95 | tab->label = QString::null; | 96 | tab->label = QString::null; |
96 | } | 97 | } |
97 | else | 98 | else |
98 | { | 99 | { |
99 | tab->label = label; | 100 | tab->label = label; |
100 | } | 101 | } |
101 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 102 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
102 | { | 103 | { |
103 | tab->iconset = new QIconSet( iconset ); | 104 | tab->iconset = new QIconSet( iconset ); |
104 | } | 105 | } |
105 | int tabid = tabBar->addTab( tab ); | 106 | int tabid = tabBar->addTab( tab ); |
106 | 107 | ||
107 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 108 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
108 | { | 109 | { |
109 | tabList->insertItem( iconset, label, -1 ); | 110 | tabList->insertItem( iconset, label, -1 ); |
110 | } | 111 | } |
111 | else | 112 | else |
112 | { | 113 | { |
113 | tabList->insertItem( label ); | 114 | tabList->insertItem( label ); |
114 | } | 115 | } |
115 | 116 | ||
116 | widgetStack->addWidget( child, tabid ); | 117 | widgetStack->addWidget( child, tabid ); |
117 | widgetStack->raiseWidget( child ); | 118 | widgetStack->raiseWidget( child ); |
118 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); | 119 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); |
119 | 120 | ||
120 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); | 121 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); |
121 | tabs.append( tabinfo ); | 122 | tabs.append( tabinfo ); |
122 | selectTab( tabinfo ); | 123 | selectTab( tabinfo ); |
123 | } | 124 | } |
124 | 125 | ||
125 | void OTabWidget::removePage( QWidget *childwidget ) | 126 | void OTabWidget::removePage( QWidget *childwidget ) |