Widgets/Painting examples: inherit ArthurStyle from QCommonStyle
The QStyle specializations are being made internal. The ArthurStyle does not seem to require anything from QWindowsStyle, but QCommonStyle as a base class gives just as nice looks. Change-Id: I5ad8dd881e03f166ae5d3aedccb2688952dc0a28 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
parent
2d795717fc
commit
c00d4373c5
@ -66,7 +66,7 @@ QPixmap cached(const QString &img)
|
|||||||
|
|
||||||
|
|
||||||
ArthurStyle::ArthurStyle()
|
ArthurStyle::ArthurStyle()
|
||||||
: QWindowsStyle()
|
: QCommonStyle()
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(shared);
|
Q_INIT_RESOURCE(shared);
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ void ArthurStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *op
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
QWindowsStyle::drawPrimitive(element, option, painter, widget);
|
QCommonStyle::drawPrimitive(element, option, painter, widget);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -278,7 +278,7 @@ void ArthurStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
|
|||||||
= qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
|
= qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
|
||||||
QStyleOptionGroupBox groupBoxCopy(*groupBox);
|
QStyleOptionGroupBox groupBoxCopy(*groupBox);
|
||||||
groupBoxCopy.subControls &= ~SC_GroupBoxLabel;
|
groupBoxCopy.subControls &= ~SC_GroupBoxLabel;
|
||||||
QWindowsStyle::drawComplexControl(control, &groupBoxCopy, painter, widget);
|
QCommonStyle::drawComplexControl(control, &groupBoxCopy, painter, widget);
|
||||||
|
|
||||||
if (groupBox->subControls & SC_GroupBoxLabel) {
|
if (groupBox->subControls & SC_GroupBoxLabel) {
|
||||||
const QRect &r = groupBox->rect;
|
const QRect &r = groupBox->rect;
|
||||||
@ -305,7 +305,7 @@ void ArthurStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
QWindowsStyle::drawComplexControl(control, option, painter, widget);
|
QCommonStyle::drawComplexControl(control, option, painter, widget);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -318,17 +318,17 @@ QRect ArthurStyle::subControlRect(ComplexControl control, const QStyleOptionComp
|
|||||||
|
|
||||||
switch (control) {
|
switch (control) {
|
||||||
default:
|
default:
|
||||||
rect = QWindowsStyle::subControlRect(control, option, subControl, widget);
|
rect = QCommonStyle::subControlRect(control, option, subControl, widget);
|
||||||
break;
|
break;
|
||||||
case CC_GroupBox:
|
case CC_GroupBox:
|
||||||
if (const QStyleOptionGroupBox *group
|
if (const QStyleOptionGroupBox *group
|
||||||
= qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
|
= qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
|
||||||
switch (subControl) {
|
switch (subControl) {
|
||||||
default:
|
default:
|
||||||
rect = QWindowsStyle::subControlRect(control, option, subControl, widget);
|
rect = QCommonStyle::subControlRect(control, option, subControl, widget);
|
||||||
break;
|
break;
|
||||||
case SC_GroupBoxContents:
|
case SC_GroupBoxContents:
|
||||||
rect = QWindowsStyle::subControlRect(control, option, subControl, widget);
|
rect = QCommonStyle::subControlRect(control, option, subControl, widget);
|
||||||
rect.adjust(0, -8, 0, 0);
|
rect.adjust(0, -8, 0, 0);
|
||||||
break;
|
break;
|
||||||
case SC_GroupBoxFrame:
|
case SC_GroupBoxFrame:
|
||||||
@ -361,7 +361,7 @@ QRect ArthurStyle::subControlRect(ComplexControl control, const QStyleOptionComp
|
|||||||
QSize ArthurStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
|
QSize ArthurStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
|
||||||
const QSize &size, const QWidget *widget) const
|
const QSize &size, const QWidget *widget) const
|
||||||
{
|
{
|
||||||
QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
|
QSize newSize = QCommonStyle::sizeFromContents(type, option, size, widget);
|
||||||
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -388,7 +388,7 @@ int ArthurStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWid
|
|||||||
{
|
{
|
||||||
if (pm == PM_SliderLength)
|
if (pm == PM_SliderLength)
|
||||||
return 13;
|
return 13;
|
||||||
return QWindowsStyle::pixelMetric(pm, opt, widget);
|
return QCommonStyle::pixelMetric(pm, opt, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArthurStyle::polish(QWidget *widget)
|
void ArthurStyle::polish(QWidget *widget)
|
||||||
@ -441,7 +441,7 @@ QRect ArthurStyle::subElementRect(SubElement element, const QStyleOption *option
|
|||||||
r = widget->rect().adjusted(20, 0, 0, 0);
|
r = widget->rect().adjusted(20, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
r = QWindowsStyle::subElementRect(element, option, widget);
|
r = QCommonStyle::subElementRect(element, option, widget);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@
|
|||||||
#ifndef ARTHURSTYLE_H
|
#ifndef ARTHURSTYLE_H
|
||||||
#define ARTHURSTYLE_H
|
#define ARTHURSTYLE_H
|
||||||
|
|
||||||
#include <QWindowsStyle>
|
#include <QCommonStyle>
|
||||||
|
|
||||||
QT_USE_NAMESPACE
|
QT_USE_NAMESPACE
|
||||||
|
|
||||||
class ArthurStyle : public QWindowsStyle
|
class ArthurStyle : public QCommonStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArthurStyle();
|
ArthurStyle();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user