summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2012-03-20 20:21:30 -0700
committerQt by Nokia <qt-info@nokia.com>2012-03-23 13:22:10 +0100
commit2f2b78321427daa8c7f0702140c297d22b0bf3c8 (patch)
treeed358dc4de958dc7e52be1dc8282237c3f073969 /src/widgets/styles
parentf31e614245e796c7f82ec33eed708902d4d01521 (diff)
Remove QWorkspace.
QWorkspace had been called Q3Workspace before Qt4.0 finally released. In a sense, it is a Qt3 support Widget. And QWorkspace has been deprecated and replaced by QMdiArea at Qt4.3. Change-Id: Iea1bf831c9960c23c2b21d51fdc7c13b303642ea Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qcleanlooksstyle.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp107
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm10
-rw-r--r--src/widgets/styles/qplastiquestyle.cpp7
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp101
5 files changed, 8 insertions, 219 deletions
diff --git a/src/widgets/styles/qcleanlooksstyle.cpp b/src/widgets/styles/qcleanlooksstyle.cpp
index 67b3c59b29..d617ee7e6f 100644
--- a/src/widgets/styles/qcleanlooksstyle.cpp
+++ b/src/widgets/styles/qcleanlooksstyle.cpp
@@ -3906,7 +3906,6 @@ void QCleanlooksStyle::polish(QWidget *widget)
#ifndef QT_NO_SPINBOX
|| qobject_cast<QAbstractSpinBox *>(widget)
#endif
- || (widget->inherits("QWorkspaceChild"))
|| (widget->inherits("QDockSeparator"))
|| (widget->inherits("QDockWidgetSeparator"))
) {
@@ -3953,7 +3952,6 @@ void QCleanlooksStyle::unpolish(QWidget *widget)
#ifndef QT_NO_SPINBOX
|| qobject_cast<QAbstractSpinBox *>(widget)
#endif
- || (widget->inherits("QWorkspaceChild"))
|| (widget->inherits("QDockSeparator"))
|| (widget->inherits("QDockWidgetSeparator"))
) {
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index ca06cda2b0..148d7bcfb5 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -3568,69 +3568,6 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
break;
#endif // QT_NO_GROUPBOX
-#ifndef QT_NO_WORKSPACE
- case CC_MdiControls:
- {
- QStyleOptionButton btnOpt;
- btnOpt.QStyleOption::operator=(*opt);
- btnOpt.state &= ~State_MouseOver;
- int bsx = 0;
- int bsy = 0;
- if (opt->subControls & QStyle::SC_MdiCloseButton) {
- if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) {
- btnOpt.state |= State_Sunken;
- btnOpt.state &= ~State_Raised;
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
- } else {
- btnOpt.state |= State_Raised;
- btnOpt.state &= ~State_Sunken;
- bsx = 0;
- bsy = 0;
- }
- btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget);
- proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
- QPixmap pm = standardIcon(SP_TitleBarCloseButton).pixmap(16, 16);
- proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
- }
- if (opt->subControls & QStyle::SC_MdiNormalButton) {
- if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) {
- btnOpt.state |= State_Sunken;
- btnOpt.state &= ~State_Raised;
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
- } else {
- btnOpt.state |= State_Raised;
- btnOpt.state &= ~State_Sunken;
- bsx = 0;
- bsy = 0;
- }
- btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget);
- proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
- QPixmap pm = standardIcon(SP_TitleBarNormalButton).pixmap(16, 16);
- proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
- }
- if (opt->subControls & QStyle::SC_MdiMinButton) {
- if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) {
- btnOpt.state |= State_Sunken;
- btnOpt.state &= ~State_Raised;
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
- } else {
- btnOpt.state |= State_Raised;
- btnOpt.state &= ~State_Sunken;
- bsx = 0;
- bsy = 0;
- }
- btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget);
- proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
- QPixmap pm = standardIcon(SP_TitleBarMinButton).pixmap(16, 16);
- proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
- }
- }
- break;
-#endif // QT_NO_WORKSPACE
-
default:
qWarning("QCommonStyle::drawComplexControl: Control %d not handled", cc);
}
@@ -4155,50 +4092,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
break;
}
#endif // QT_NO_GROUPBOX
-#ifndef QT_NO_WORKSPACE
- case CC_MdiControls:
- {
- int numSubControls = 0;
- if (opt->subControls & SC_MdiCloseButton)
- ++numSubControls;
- if (opt->subControls & SC_MdiMinButton)
- ++numSubControls;
- if (opt->subControls & SC_MdiNormalButton)
- ++numSubControls;
- if (numSubControls == 0)
- break;
-
- int buttonWidth = opt->rect.width()/ numSubControls - 1;
- int offset = 0;
- switch (sc) {
- case SC_MdiCloseButton:
- // Only one sub control, no offset needed.
- if (numSubControls == 1)
- break;
- offset += buttonWidth + 2;
- //FALL THROUGH
- case SC_MdiNormalButton:
- // No offset needed if
- // 1) There's only one sub control
- // 2) We have a close button and a normal button (offset already added in SC_MdiClose)
- if (numSubControls == 1 || (numSubControls == 2 && !(opt->subControls & SC_MdiMinButton)))
- break;
- if (opt->subControls & SC_MdiNormalButton)
- offset += buttonWidth;
- break;
- default:
- break;
- }
-
- // Subtract one pixel if we only have one sub control. At this point
- // buttonWidth is the actual width + 1 pixel margin, but we don't want the
- // margin when there are no other controllers.
- if (numSubControls == 1)
- --buttonWidth;
- ret = QRect(offset, 0, buttonWidth, opt->rect.height());
- break;
- }
-#endif // QT_NO_WORKSPACE
default:
qWarning("QCommonStyle::subControlRect: Case %d not handled", cc);
}
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 55c603896b..ef6947088e 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2184,8 +2184,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
if (widget && (widget->isWindow() || !widget->parentWidget()
|| (qobject_cast<const QMainWindow*>(widget->parentWidget())
&& static_cast<QMainWindow *>(widget->parentWidget())->centralWidget() == widget))
- && (qobject_cast<const QAbstractScrollArea *>(widget)
- || widget->inherits("QWorkspaceChild")))
+ && qobject_cast<const QAbstractScrollArea *>(widget))
ret = 0;
else
#endif
@@ -2547,12 +2546,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = Qt::AlignTop;
break;
case SH_ScrollView_FrameOnlyAroundContents:
- if (w && (w->isWindow() || !w->parentWidget() || w->parentWidget()->isWindow())
- && (w->inherits("QWorkspaceChild")
- ))
- ret = true;
- else
- ret = QWindowsStyle::styleHint(sh, opt, w, hret);
+ ret = QWindowsStyle::styleHint(sh, opt, w, hret);
break;
case SH_Menu_FillScreenWithScroll:
ret = false;
diff --git a/src/widgets/styles/qplastiquestyle.cpp b/src/widgets/styles/qplastiquestyle.cpp
index 0bf443fe00..cae015ff82 100644
--- a/src/widgets/styles/qplastiquestyle.cpp
+++ b/src/widgets/styles/qplastiquestyle.cpp
@@ -83,7 +83,6 @@ static const int blueFrameWidth = 2; // with of line edit focus frame
#include <qtoolbar.h>
#include <qtoolbox.h>
#include <qtoolbutton.h>
-#include <qworkspace.h>
#include <qprocess.h>
#include <qvarlengtharray.h>
#include <limits.h>
@@ -5629,8 +5628,7 @@ void QPlastiqueStyle::polish(QWidget *widget)
widget->setAttribute(Qt::WA_Hover);
}
- if (widget->inherits("QWorkspaceTitleBar")
- || widget->inherits("QDockSeparator")
+ if (widget->inherits("QDockSeparator")
|| widget->inherits("QDockWidgetSeparator")) {
widget->setAttribute(Qt::WA_Hover);
}
@@ -5684,8 +5682,7 @@ void QPlastiqueStyle::unpolish(QWidget *widget)
widget->setAttribute(Qt::WA_Hover, false);
}
- if (widget->inherits("QWorkspaceTitleBar")
- || widget->inherits("QDockSeparator")
+ if (widget->inherits("QDockSeparator")
|| widget->inherits("QDockWidgetSeparator")) {
widget->setAttribute(Qt::WA_Hover, false);
}
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index a342486339..f57da855fb 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1178,8 +1178,9 @@ void QWindowsXPStyle::polish(QWidget *widget)
|| qobject_cast<QAbstractSpinBox*>(widget)
|| qobject_cast<QSpinBox*>(widget)
#endif // QT_NO_SPINBOX
- || widget->inherits("QWorkspaceChild"))
+ ) {
widget->setAttribute(Qt::WA_Hover);
+ }
#ifndef QT_NO_RUBBERBAND
if (qobject_cast<QRubberBand*>(widget)) {
@@ -1249,8 +1250,9 @@ void QWindowsXPStyle::unpolish(QWidget *widget)
|| qobject_cast<QAbstractSpinBox*>(widget)
|| qobject_cast<QSpinBox*>(widget)
#endif // QT_NO_SPINBOX
- || widget->inherits("QWorkspaceChild"))
+ ) {
widget->setAttribute(Qt::WA_Hover, false);
+ }
QWindowsStyle::unpolish(widget);
}
@@ -3225,63 +3227,6 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
break;
-#ifndef QT_NO_WORKSPACE
- case CC_MdiControls:
- {
- QRect buttonRect;
- XPThemeData theme(widget, p, QLatin1String("WINDOW"), WP_MDICLOSEBUTTON, CBS_NORMAL);
-
- if (option->subControls & SC_MdiCloseButton) {
- buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget);
- if (theme.isValid()) {
- theme.partId = WP_MDICLOSEBUTTON;
- theme.rect = buttonRect;
- if (!(flags & State_Enabled))
- theme.stateId = CBS_INACTIVE;
- else if (flags & State_Sunken && (option->activeSubControls & SC_MdiCloseButton))
- theme.stateId = CBS_PUSHED;
- else if (flags & State_MouseOver && (option->activeSubControls & SC_MdiCloseButton))
- theme.stateId = CBS_HOT;
- else
- theme.stateId = CBS_NORMAL;
- d->drawBackground(theme);
- }
- }
- if (option->subControls & SC_MdiNormalButton) {
- buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget);
- if (theme.isValid()) {
- theme.partId = WP_MDIRESTOREBUTTON;
- theme.rect = buttonRect;
- if (!(flags & State_Enabled))
- theme.stateId = CBS_INACTIVE;
- else if (flags & State_Sunken && (option->activeSubControls & SC_MdiNormalButton))
- theme.stateId = CBS_PUSHED;
- else if (flags & State_MouseOver && (option->activeSubControls & SC_MdiNormalButton))
- theme.stateId = CBS_HOT;
- else
- theme.stateId = CBS_NORMAL;
- d->drawBackground(theme);
- }
- }
- if (option->subControls & QStyle::SC_MdiMinButton) {
- buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget);
- if (theme.isValid()) {
- theme.partId = WP_MDIMINBUTTON;
- theme.rect = buttonRect;
- if (!(flags & State_Enabled))
- theme.stateId = CBS_INACTIVE;
- else if (flags & State_Sunken && (option->activeSubControls & SC_MdiMinButton))
- theme.stateId = CBS_PUSHED;
- else if (flags & State_MouseOver && (option->activeSubControls & SC_MdiMinButton))
- theme.stateId = CBS_HOT;
- else
- theme.stateId = CBS_NORMAL;
- d->drawBackground(theme);
- }
- }
- }
- break;
-#endif //QT_NO_WORKSPACE
#ifndef QT_NO_DIAL
case CC_Dial:
if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
@@ -3667,44 +3612,6 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
}
}
break;
-#ifndef QT_NO_WORKSPACE
- case CC_MdiControls:
- {
- int numSubControls = 0;
- if (option->subControls & SC_MdiCloseButton)
- ++numSubControls;
- if (option->subControls & SC_MdiMinButton)
- ++numSubControls;
- if (option->subControls & SC_MdiNormalButton)
- ++numSubControls;
- if (numSubControls == 0)
- break;
-
- int buttonWidth = option->rect.width()/ numSubControls;
- int offset = 0;
- switch (subControl) {
- case SC_MdiCloseButton:
- // Only one sub control, no offset needed.
- if (numSubControls == 1)
- break;
- offset += buttonWidth;
- //FALL THROUGH
- case SC_MdiNormalButton:
- // No offset needed if
- // 1) There's only one sub control
- // 2) We have a close button and a normal button (offset already added in SC_MdiClose)
- if (numSubControls == 1 || (numSubControls == 2 && !(option->subControls & SC_MdiMinButton)))
- break;
- if (option->subControls & SC_MdiNormalButton)
- offset += buttonWidth;
- break;
- default:
- break;
- }
- rect = QRect(offset, 0, buttonWidth, option->rect.height());
- break;
- }
-#endif // QT_NO_WORKSPACE
default:
rect = visualRect(option->direction, option->rect,