From 5da15f81a77c0209fabc86fe6b2866ef8c127e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Tue, 20 May 2014 08:46:25 +0200 Subject: Fix crash on populating style data to tabbar without parent This resolves Bug 1966 --- src/styles/qcommonstyle.cpp | 72 +++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 35 deletions(-) (limited to 'src/styles') diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index 17d94e4d5..5cb1699df 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -468,41 +468,43 @@ const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWi ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier()); } } - updateObjectTypeListIfNeeded(tb->parent()); - if ((const_cast(tb->parent())->controlElementDataPrivateObject())->isTQTabWidget) { - const TQTabWidget *tw = static_cast(tb->parent()); - TQWidget *cw; - cw = tw->cornerWidget(TQt::TopLeft); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos(); - } - cw = tw->cornerWidget(TQt::TopRight); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos(); - } - cw = tw->cornerWidget(TQt::BottomLeft); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos(); - } - cw = tw->cornerWidget(TQt::BottomRight); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect(); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos(); + if ( tb->parent() ) { + updateObjectTypeListIfNeeded(tb->parent()); + if ((const_cast(tb->parent())->controlElementDataPrivateObject())->isTQTabWidget) { + const TQTabWidget *tw = static_cast(tb->parent()); + TQWidget *cw; + cw = tw->cornerWidget(TQt::TopLeft); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos(); + } + cw = tw->cornerWidget(TQt::TopRight); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos(); + } + cw = tw->cornerWidget(TQt::BottomLeft); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos(); + } + cw = tw->cornerWidget(TQt::BottomRight); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = (const_cast(cw)->controlElementDataObject())->widgetObjectTypes; + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos(); + } } } } -- cgit v1.2.1