diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2014-05-20 08:46:25 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2014-05-20 08:46:25 +0200 |
commit | 5da15f81a77c0209fabc86fe6b2866ef8c127e76 (patch) | |
tree | 806f7832c3a46020830269c7b7977de48c858294 | |
parent | d5059601e64882a848f6e6730690c270c7b120c2 (diff) | |
download | tqt3-5da15f81a77c0209fabc86fe6b2866ef8c127e76.tar.gz tqt3-5da15f81a77c0209fabc86fe6b2866ef8c127e76.zip |
Fix crash on populating style data to tabbar without parent
This resolves Bug 1966
-rw-r--r-- | src/styles/qcommonstyle.cpp | 72 |
1 files changed, 37 insertions, 35 deletions
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<TQObject*>(tb->parent())->controlElementDataPrivateObject())->isTQTabWidget) { - const TQTabWidget *tw = static_cast<const TQTabWidget*>(tb->parent()); - TQWidget *cw; - cw = tw->cornerWidget(TQt::TopLeft); - if (cw) { - updateObjectTypeListIfNeeded(cw); - ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast<TQWidget*>(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<TQWidget*>(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<TQWidget*>(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<TQWidget*>(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<TQObject*>(tb->parent())->controlElementDataPrivateObject())->isTQTabWidget) { + const TQTabWidget *tw = static_cast<const TQTabWidget*>(tb->parent()); + TQWidget *cw; + cw = tw->cornerWidget(TQt::TopLeft); + if (cw) { + updateObjectTypeListIfNeeded(cw); + ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast<TQWidget*>(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<TQWidget*>(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<TQWidget*>(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<TQWidget*>(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(); + } } } } |