diff options
author | Darrell Anderson <[email protected]> | 2012-10-19 22:51:12 -0500 |
---|---|---|
committer | Darrell Anderson <[email protected]> | 2012-10-19 22:51:12 -0500 |
commit | f175db0cdb14fe5e62b3fbdc785cd3b09576ef1d (patch) | |
tree | 8b690a0a04d4143e087324a425621cd12b38d8f1 /src/styles | |
parent | 41e5b784ee48d2cb403bb551bcbe7cbd322c4336 (diff) | |
parent | 4037eb7e84eda2b72a456cf7ff19182c2d4a1f7a (diff) | |
download | qt3-f175db0cdb14fe5e62b3fbdc785cd3b09576ef1d.tar.gz qt3-f175db0cdb14fe5e62b3fbdc785cd3b09576ef1d.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/qt3
Diffstat (limited to 'src/styles')
-rw-r--r-- | src/styles/qcommonstyle.cpp | 35 | ||||
-rw-r--r-- | src/styles/qmotifplusstyle.cpp | 31 |
2 files changed, 42 insertions, 24 deletions
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index 3e61282..2614bbf 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -49,6 +49,7 @@ #include "qpixmap.h" #include "qpushbutton.h" #include "qtabbar.h" +#include "qtabwidget.h" #include "qlineedit.h" #include "qscrollbar.h" #include "qtoolbutton.h" @@ -226,6 +227,7 @@ QStyle::ControlElementFlags getControlElementFlagsForObject(const QObject* objec if (widget->parentWidget()) cef = cef | QStyle::CEF_HasParentWidget; if (widget->focusProxy()) cef = cef | QStyle::CEF_HasFocusProxy; if (widget->hasFocus()) cef = cef | QStyle::CEF_HasFocus; + if (widget->hasMouse()) cef = cef | QStyle::CEF_HasMouse; if (populateReliantFields) { if (widget->isActiveWindow()) cef = cef | QStyle::CEF_IsActiveWindow; if (widget->isTopLevel()) cef = cef | QStyle::CEF_IsTopLevel; @@ -332,6 +334,7 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid const QTabBar *tb = dynamic_cast<const QTabBar*>(widget); if (tb) { ceData.tabBarData.tabCount = tb->count(); + ceData.tabBarData.currentTabIndex = tb->currentTab(); ceData.tabBarData.shape = tb->shape(); ceData.tabBarData.identIndexMap.clear(); const QTab* currentTab; @@ -341,6 +344,38 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier()); } } + const QTabWidget *tw = dynamic_cast<const QTabWidget*>(tb->parent()); + if (tw) { + QWidget *cw; + cw = tw->cornerWidget(Qt::TopLeft); + if(cw) { + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = getObjectTypeListForObject(cw); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos(); + } + cw = tw->cornerWidget(Qt::TopRight); + if(cw) { + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = getObjectTypeListForObject(cw); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos(); + } + cw = tw->cornerWidget(Qt::BottomLeft); + if(cw) { + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = getObjectTypeListForObject(cw); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos(); + } + cw = tw->cornerWidget(Qt::BottomRight); + if(cw) { + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = getObjectTypeListForObject(cw); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect(); + ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos(); + } + } } } if (ceData.widgetObjectTypes.contains("QToolBox")) { diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp index 86a2558..72e28a8 100644 --- a/src/styles/qmotifplusstyle.cpp +++ b/src/styles/qmotifplusstyle.cpp @@ -65,13 +65,10 @@ struct QMotifPlusStylePrivate { QMotifPlusStylePrivate() - : hoverWidget(0), hovering(FALSE), sliderActive(FALSE), mousePressed(FALSE), + : hovering(FALSE), sliderActive(FALSE), mousePressed(FALSE), scrollbarElement(0), lastElement(0), ref(1) { ; } - void* hoverWidget; - QStyleControlElementData hoverWidgetData; - QStyle::ControlElementFlags hoverWidgetFlags; bool hovering, sliderActive, mousePressed; int scrollbarElement, lastElement, ref; QPoint mousePos; @@ -660,9 +657,6 @@ void QMotifPlusStyle::drawControl( ControlElement element, const QStyleOption& opt, const QWidget *widget) const { - if (widget == singleton->hoverWidget) - flags |= Style_MouseOver; - switch (element) { case CE_PushButton: { @@ -1108,9 +1102,6 @@ void QMotifPlusStyle::drawComplexControl(ComplexControl control, const QStyleOption& opt, const QWidget *widget ) const { - if (widget == singleton->hoverWidget) - flags |= Style_MouseOver; - switch (control) { case CC_ScrollBar: { @@ -1516,30 +1507,22 @@ bool QMotifPlusStyle::objectEventHandler( QStyleControlElementData ceData, Contr if (!ceData.widgetObjectTypes.contains("QWidget")) break; - singleton->hoverWidget = source; - singleton->hoverWidgetData = ceData; - singleton->hoverWidgetFlags = elementFlags; - if (!(singleton->hoverWidgetFlags & CEF_IsEnabled)) { - singleton->hoverWidget = 0; - break; - } - widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint); + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); break; } case QEvent::Leave: { - if (source != singleton->hoverWidget) + if (!ceData.widgetObjectTypes.contains("QWidget")) break; - void *w = singleton->hoverWidget; - singleton->hoverWidget = 0; - widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, w, WAR_Repaint); + + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); break; } case QEvent::MouseMove: { - if ((!ceData.widgetObjectTypes.contains("QWidget")) || source != singleton->hoverWidget) + if ((!ceData.widgetObjectTypes.contains("QWidget"))) break; if ((!ceData.widgetObjectTypes.contains("QScrollBar")) && (!ceData.widgetObjectTypes.contains("QSlider"))) @@ -1548,7 +1531,7 @@ bool QMotifPlusStyle::objectEventHandler( QStyleControlElementData ceData, Contr singleton->mousePos = ((QMouseEvent *) event)->pos(); if (! singleton->mousePressed) { singleton->hovering = TRUE; - widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint); + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); singleton->hovering = FALSE; } |