author | zecke <zecke> | 2004-09-12 23:02:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-12 23:02:35 (UTC) |
commit | 8123b75c55cb5140ae5b0c5aeddb4644a0a8ffbb (patch) (unidiff) | |
tree | 2ada329a539b5143bd732be361b9bcb5e7784ec4 /libopie2 | |
parent | 0f705db7c338e9642294823333e5f4410aa0573f (diff) | |
download | opie-8123b75c55cb5140ae5b0c5aeddb4644a0a8ffbb.zip opie-8123b75c55cb5140ae5b0c5aeddb4644a0a8ffbb.tar.gz opie-8123b75c55cb5140ae5b0c5aeddb4644a0a8ffbb.tar.bz2 |
Remove memory leak
-rw-r--r-- | libopie2/opieui/otabwidget.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp index a9f7da9..d23b1c9 100644 --- a/libopie2/opieui/otabwidget.cpp +++ b/libopie2/opieui/otabwidget.cpp | |||
@@ -59,65 +59,68 @@ OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPositi | |||
59 | if ( pos == "Bottom" ) | 59 | if ( pos == "Bottom" ) |
60 | { | 60 | { |
61 | p = Bottom; | 61 | p = Bottom; |
62 | } | 62 | } |
63 | else | 63 | else |
64 | { | 64 | { |
65 | p = Top; | 65 | p = Top; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | widgetStack = new QWidgetStack( this, "widgetstack" ); | 69 | widgetStack = new QWidgetStack( this, "widgetstack" ); |
70 | widgetStack->setFrameStyle( QFrame::NoFrame ); | 70 | widgetStack->setFrameStyle( QFrame::NoFrame ); |
71 | widgetStack->setLineWidth( style().defaultFrameWidth() ); | 71 | widgetStack->setLineWidth( style().defaultFrameWidth() ); |
72 | 72 | ||
73 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); | 73 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); |
74 | 74 | ||
75 | tabBar = new OTabBar( tabBarStack, "tabbar" ); | 75 | tabBar = new OTabBar( tabBarStack, "tabbar" ); |
76 | tabBarStack->addWidget( tabBar, 0 ); | 76 | tabBarStack->addWidget( tabBar, 0 ); |
77 | connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) ); | 77 | connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) ); |
78 | 78 | ||
79 | tabList = new QComboBox( false, tabBarStack, "tablist" ); | 79 | tabList = new QComboBox( false, tabBarStack, "tablist" ); |
80 | tabBarStack->addWidget( tabList, 1 ); | 80 | tabBarStack->addWidget( tabList, 1 ); |
81 | connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) ); | 81 | connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) ); |
82 | 82 | ||
83 | tabBarPosition = p; | 83 | tabBarPosition = p; |
84 | setTabStyle( s ); | 84 | setTabStyle( s ); |
85 | setTabPosition( p ); | 85 | setTabPosition( p ); |
86 | 86 | ||
87 | currTab= 0x0; | 87 | currTab= 0x0; |
88 | } | 88 | } |
89 | 89 | ||
90 | OTabWidget::~OTabWidget() | 90 | OTabWidget::~OTabWidget() |
91 | {} | 91 | { |
92 | tabs.setAutoDelete( true ); | ||
93 | tabs.clear(); | ||
94 | } | ||
92 | 95 | ||
93 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) | 96 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) |
94 | { | 97 | { |
95 | QPixmap iconset = loadSmooth( icon ); | 98 | QPixmap iconset = loadSmooth( icon ); |
96 | 99 | ||
97 | QTab *tab = new QTab(); | 100 | QTab *tab = new QTab(); |
98 | if ( tabBarStyle == IconTab ) | 101 | if ( tabBarStyle == IconTab ) |
99 | { | 102 | { |
100 | tab->label = QString::null; | 103 | tab->label = QString::null; |
101 | } | 104 | } |
102 | else | 105 | else |
103 | { | 106 | { |
104 | tab->label = label; | 107 | tab->label = label; |
105 | } | 108 | } |
106 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 109 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
107 | { | 110 | { |
108 | tab->iconset = new QIconSet( iconset ); | 111 | tab->iconset = new QIconSet( iconset ); |
109 | } | 112 | } |
110 | int tabid = tabBar->addTab( tab ); | 113 | int tabid = tabBar->addTab( tab ); |
111 | 114 | ||
112 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 115 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
113 | { | 116 | { |
114 | tabList->insertItem( iconset, label, -1 ); | 117 | tabList->insertItem( iconset, label, -1 ); |
115 | } | 118 | } |
116 | else | 119 | else |
117 | { | 120 | { |
118 | tabList->insertItem( label ); | 121 | tabList->insertItem( label ); |
119 | } | 122 | } |
120 | 123 | ||
121 | widgetStack->addWidget( child, tabid ); | 124 | widgetStack->addWidget( child, tabid ); |
122 | widgetStack->raiseWidget( child ); | 125 | widgetStack->raiseWidget( child ); |
123 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); | 126 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); |