Fix styles compilation with features removed, round 2
Change-Id: I8f09a8844e5edc1ad3e3dfd39eca9f3b42c5c828 Reviewed-by: Lars Knoll <lars.knoll@qt.io>bb10
parent
cabf2950f7
commit
2ac7fb78b9
|
|
@ -453,6 +453,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
|
|||
drawPrimitive(PE_IndicatorArrowRight, option, painter, widget);
|
||||
break;
|
||||
}
|
||||
#if QT_CONFIG(tabbar)
|
||||
case PE_FrameTabBarBase:
|
||||
if (const QStyleOptionTabBarBase *tbb
|
||||
= qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
|
||||
|
|
@ -489,6 +490,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
|
|||
painter->restore();
|
||||
}
|
||||
return;
|
||||
#endif // QT_CONFIG(tabbar)
|
||||
case PE_PanelScrollAreaCorner: {
|
||||
painter->save();
|
||||
QColor alphaOutline = outline;
|
||||
|
|
@ -938,6 +940,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
|
|||
case PE_FrameTabWidget:
|
||||
painter->save();
|
||||
painter->fillRect(option->rect.adjusted(0, 0, -1, -1), tabFrameColor);
|
||||
#if QT_CONFIG(tabwidget)
|
||||
if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
|
||||
QColor borderColor = outline.lighter(110);
|
||||
QRect rect = option->rect.adjusted(0, 0, -1, -1);
|
||||
|
|
@ -960,6 +963,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
|
|||
painter->drawRect(rect.adjusted(1, 1, -1, -1));
|
||||
|
||||
}
|
||||
#endif // QT_CONFIG(tabwidget)
|
||||
painter->restore();
|
||||
break ;
|
||||
|
||||
|
|
@ -1057,6 +1061,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
}
|
||||
break;
|
||||
}
|
||||
#if QT_CONFIG(rubberband)
|
||||
case CE_RubberBand:
|
||||
if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
|
||||
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
|
||||
|
|
@ -1082,6 +1087,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
painter->restore();
|
||||
}
|
||||
break;
|
||||
#endif //QT_CONFIG(rubberband)
|
||||
case CE_SizeGrip:
|
||||
painter->save();
|
||||
{
|
||||
|
|
@ -1800,6 +1806,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
}
|
||||
painter->restore();
|
||||
break;
|
||||
#if QT_CONFIG(tabbar)
|
||||
case CE_TabBarTabShape:
|
||||
painter->save();
|
||||
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
|
||||
|
|
@ -1915,6 +1922,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
}
|
||||
painter->restore();
|
||||
break;
|
||||
#endif //QT_CONFIG(tabbar)
|
||||
default:
|
||||
QCommonStyle::drawControl(element,option,painter,widget);
|
||||
break;
|
||||
|
|
@ -2000,6 +2008,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||
}
|
||||
painter->restore();
|
||||
break;
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
|
||||
QPixmap cache;
|
||||
|
|
@ -2150,6 +2159,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||
painter->drawPixmap(spinBox->rect.topLeft(), cache);
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
case CC_TitleBar:
|
||||
painter->save();
|
||||
if (const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
|
||||
|
|
@ -2410,6 +2420,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||
}
|
||||
painter->restore();
|
||||
break;
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_ScrollBar:
|
||||
painter->save();
|
||||
if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
|
||||
|
|
@ -2718,6 +2729,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||
}
|
||||
painter->restore();
|
||||
break;;
|
||||
#endif // QT_CONFIG(slider)
|
||||
case CC_ComboBox:
|
||||
painter->save();
|
||||
if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
|
||||
|
|
@ -2815,6 +2827,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||
}
|
||||
painter->restore();
|
||||
break;
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
|
||||
QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
|
||||
|
|
@ -3025,6 +3038,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||
painter->setPen(oldPen);
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(dial)
|
||||
case CC_Dial:
|
||||
if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
|
||||
|
|
@ -3266,11 +3280,19 @@ void QFusionStyle::polish(QWidget *widget)
|
|||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox *>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(progressbar)
|
||||
|| qobject_cast<QProgressBar *>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(scrollbar)
|
||||
|| qobject_cast<QScrollBar *>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(splitter)
|
||||
|| qobject_cast<QSplitterHandle *>(widget)
|
||||
#endif
|
||||
|| qobject_cast<QAbstractSlider *>(widget)
|
||||
#if QT_CONFIG(spinbox)
|
||||
|| qobject_cast<QAbstractSpinBox *>(widget)
|
||||
#endif
|
||||
|| (widget->inherits("QDockSeparator"))
|
||||
|| (widget->inherits("QDockWidgetSeparator"))
|
||||
) {
|
||||
|
|
@ -3297,11 +3319,19 @@ void QFusionStyle::unpolish(QWidget *widget)
|
|||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox *>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(progressbar)
|
||||
|| qobject_cast<QProgressBar *>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(scrollbar)
|
||||
|| qobject_cast<QScrollBar *>(widget)
|
||||
#endif
|
||||
#if QT_CONFIG(splitter)
|
||||
|| qobject_cast<QSplitterHandle *>(widget)
|
||||
#endif
|
||||
|| qobject_cast<QAbstractSlider *>(widget)
|
||||
#if QT_CONFIG(spinbox)
|
||||
|| qobject_cast<QAbstractSpinBox *>(widget)
|
||||
#endif
|
||||
|| (widget->inherits("QDockSeparator"))
|
||||
|| (widget->inherits("QDockWidgetSeparator"))
|
||||
) {
|
||||
|
|
@ -3326,6 +3356,7 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
|
|||
QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget);
|
||||
|
||||
switch (control) {
|
||||
#if QT_CONFIG(slider)
|
||||
case CC_Slider:
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
|
||||
int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
|
||||
|
|
@ -3376,6 +3407,8 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CC_SpinBox:
|
||||
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
|
||||
int center = spinbox->rect.height() / 2;
|
||||
|
|
@ -3413,7 +3446,7 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
|
|||
rect = visualRect(spinbox->direction, spinbox->rect, rect);
|
||||
}
|
||||
break;
|
||||
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
case CC_GroupBox:
|
||||
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
|
||||
rect = option->rect;
|
||||
|
|
|
|||
|
|
@ -129,12 +129,14 @@ void QPixmapStyle::polish(QWidget *widget)
|
|||
Q_D(QPixmapStyle);
|
||||
|
||||
// Don't fill the interior of the QTextEdit
|
||||
#if QT_CONFIG(textedit)
|
||||
if (qobject_cast<QTextEdit*>(widget)) {
|
||||
QPalette p = widget->palette();
|
||||
p.setBrush(QPalette::Base, Qt::NoBrush);
|
||||
widget->setPalette(p);
|
||||
}
|
||||
|
||||
#endif
|
||||
#if QT_CONFIG(progressbar)
|
||||
if (QProgressBar *pb = qobject_cast<QProgressBar*>(widget)) {
|
||||
// Center the text in the progress bar
|
||||
pb->setAlignment(Qt::AlignCenter);
|
||||
|
|
@ -143,10 +145,11 @@ void QPixmapStyle::polish(QWidget *widget)
|
|||
font.setPixelSize(d->descriptors.value(PB_HBackground).size.height()/2);
|
||||
pb->setFont(font);
|
||||
}
|
||||
|
||||
#endif
|
||||
#if QT_CONFIG(slider)
|
||||
if (qobject_cast<QSlider*>(widget))
|
||||
widget->installEventFilter(this);
|
||||
|
||||
#endif
|
||||
#if QT_CONFIG(combobox)
|
||||
if (QComboBox *cb = qobject_cast<QComboBox*>(widget)) {
|
||||
widget->installEventFilter(this);
|
||||
|
|
@ -182,6 +185,7 @@ void QPixmapStyle::polish(QWidget *widget)
|
|||
if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
|
||||
widget->installEventFilter(this);
|
||||
|
||||
#if QT_CONFIG(scrollarea)
|
||||
if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget)) {
|
||||
scrollArea->viewport()->setAutoFillBackground(false);
|
||||
#if QT_CONFIG(itemviews)
|
||||
|
|
@ -194,10 +198,11 @@ void QPixmapStyle::polish(QWidget *widget)
|
|||
QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(scrollarea)
|
||||
#if QT_CONFIG(scrollbar)
|
||||
if (qobject_cast<QScrollBar*>(widget))
|
||||
widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
|
||||
#endif
|
||||
QCommonStyle::polish(widget);
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +219,12 @@ void QPixmapStyle::unpolish(QApplication *application)
|
|||
*/
|
||||
void QPixmapStyle::unpolish(QWidget *widget)
|
||||
{
|
||||
if (qobject_cast<QSlider*>(widget)
|
||||
if (
|
||||
#if QT_CONFIG(slider)
|
||||
qobject_cast<QSlider*>(widget)
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox*>(widget)
|
||||
#endif
|
||||
|
|
@ -225,7 +235,7 @@ void QPixmapStyle::unpolish(QWidget *widget)
|
|||
if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
|
||||
widget->removeEventFilter(this);
|
||||
|
||||
#if QT_CONFIG(gestures)
|
||||
#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea)
|
||||
if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget))
|
||||
QScroller::ungrabGesture(scrollArea->viewport());
|
||||
#endif
|
||||
|
|
@ -251,10 +261,12 @@ void QPixmapStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *o
|
|||
drawLineEdit(option, painter, widget);
|
||||
break;
|
||||
case PE_Frame:
|
||||
#if QT_CONFIG(textedit)
|
||||
case PE_FrameDefaultButton:
|
||||
if (qobject_cast<const QTextEdit*>(widget))
|
||||
drawTextEdit(option, painter, widget);
|
||||
break;
|
||||
#endif
|
||||
case PE_IndicatorCheckBox:
|
||||
drawCheckBox(option, painter, widget);
|
||||
break;
|
||||
|
|
@ -412,11 +424,13 @@ int QPixmapStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
|
|||
case PM_ButtonShiftVertical:
|
||||
return 0;
|
||||
case PM_DefaultFrameWidth:
|
||||
#if QT_CONFIG(textedit)
|
||||
if (qobject_cast<const QTextEdit*>(widget)) {
|
||||
const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled);
|
||||
return qMax(qMax(desc.margins.left(), desc.margins.right()),
|
||||
qMax(desc.margins.top(), desc.margins.bottom()));
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
case PM_IndicatorWidth:
|
||||
return d->pixmaps.value(CB_Enabled).pixmap.width();
|
||||
|
|
@ -438,6 +452,7 @@ int QPixmapStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
|
|||
return qMax(qMax(pix.margins.left(), pix.margins.right()),
|
||||
qMax(pix.margins.top(), pix.margins.bottom()));
|
||||
}
|
||||
#if QT_CONFIG(slider)
|
||||
case PM_SliderThickness:
|
||||
if (const QStyleOptionSlider *slider =
|
||||
qstyleoption_cast<const QStyleOptionSlider*>(option)) {
|
||||
|
|
@ -478,6 +493,7 @@ int QPixmapStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
|
|||
? desc.size.height() : desc.size.width();
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(slider)
|
||||
case PM_ScrollBarSliderMin:
|
||||
return 0;
|
||||
default: ;
|
||||
|
|
@ -528,7 +544,7 @@ QStyle::SubControl QPixmapStyle::hitTestComplexControl(QStyle::ComplexControl co
|
|||
bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
Q_D(QPixmapStyle);
|
||||
|
||||
#if QT_CONFIG(slider)
|
||||
if (QSlider *slider = qobject_cast<QSlider*>(watched)) {
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
|
|
@ -539,7 +555,7 @@ bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event)
|
|||
default: ;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(slider)
|
||||
#if QT_CONFIG(combobox)
|
||||
if (QComboBox *comboBox = qobject_cast<QComboBox*>(watched)) {
|
||||
switch (event->type()) {
|
||||
|
|
@ -859,6 +875,7 @@ void QPixmapStyle::drawProgressBarFill(const QStyleOption *option,
|
|||
void QPixmapStyle::drawSlider(const QStyleOptionComplex *option,
|
||||
QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
#if QT_CONFIG(slider)
|
||||
Q_D(const QPixmapStyle);
|
||||
|
||||
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option);
|
||||
|
|
@ -908,6 +925,7 @@ void QPixmapStyle::drawSlider(const QStyleOptionComplex *option,
|
|||
painter->drawPixmap(handle, d->pixmaps.value(pix).pixmap);
|
||||
}
|
||||
}
|
||||
#endif // QT_CONFIG(slider)
|
||||
}
|
||||
|
||||
void QPixmapStyle::drawComboBox(const QStyleOptionComplex *option,
|
||||
|
|
@ -934,6 +952,7 @@ void QPixmapStyle::drawComboBox(const QStyleOptionComplex *option,
|
|||
void QPixmapStyle::drawScrollBar(const QStyleOptionComplex *option,
|
||||
QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
#if QT_CONFIG(slider)
|
||||
if (const QStyleOptionSlider *slider =
|
||||
qstyleoption_cast<const QStyleOptionSlider*>(option)) {
|
||||
// Do not draw the scrollbar
|
||||
|
|
@ -945,6 +964,7 @@ void QPixmapStyle::drawScrollBar(const QStyleOptionComplex *option,
|
|||
? SB_Horizontal : SB_Vertical;
|
||||
drawCachedPixmap(control, rect, painter);
|
||||
}
|
||||
#endif // QT_CONFIG(slider)
|
||||
}
|
||||
|
||||
QSize QPixmapStyle::pushButtonSizeFromContents(const QStyleOption *option,
|
||||
|
|
@ -1003,6 +1023,7 @@ QSize QPixmapStyle::sliderSizeFromContents(const QStyleOption *option,
|
|||
const QSize &contentsSize,
|
||||
const QWidget *widget) const
|
||||
{
|
||||
#if QT_CONFIG(slider)
|
||||
Q_D(const QPixmapStyle);
|
||||
|
||||
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option);
|
||||
|
|
@ -1018,6 +1039,9 @@ QSize QPixmapStyle::sliderSizeFromContents(const QStyleOption *option,
|
|||
return QSize(result.width(), desc.size.height());
|
||||
else
|
||||
return QSize(desc.size.width(), result.height());
|
||||
#else // QT_CONFIG(slider)
|
||||
return QSize();
|
||||
#endif // QT_CONFIG(slider)
|
||||
}
|
||||
|
||||
QSize QPixmapStyle::comboBoxSizeFromContents(const QStyleOption *option,
|
||||
|
|
@ -1085,6 +1109,7 @@ QRect QPixmapStyle::comboBoxSubControlRect(const QStyleOptionComplex *option,
|
|||
QRect QPixmapStyle::scrollBarSubControlRect(const QStyleOptionComplex *option,
|
||||
QStyle::SubControl sc, const QWidget *) const
|
||||
{
|
||||
#if QT_CONFIG(slider)
|
||||
if (const QStyleOptionSlider *slider =
|
||||
qstyleoption_cast<const QStyleOptionSlider*>(option)) {
|
||||
int length = (slider->orientation == Qt::Horizontal)
|
||||
|
|
@ -1131,6 +1156,7 @@ QRect QPixmapStyle::scrollBarSubControlRect(const QStyleOptionComplex *option,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // QT_CONFIG(slider)
|
||||
return QRect();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec
|
|||
|
||||
QColor backgroundColor(const QPalette &pal, const QWidget* widget)
|
||||
{
|
||||
#ifndef QT_NO_SCROLLBAR
|
||||
#if QT_CONFIG(scrollarea)
|
||||
if (qobject_cast<const QScrollBar *>(widget) && widget->parent() &&
|
||||
qobject_cast<const QAbstractScrollArea *>(widget->parent()->parent()))
|
||||
return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base);
|
||||
|
|
|
|||
|
|
@ -4903,6 +4903,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
|
|||
QSize sz = rule.adjustSize(csz);
|
||||
|
||||
switch (ct) {
|
||||
#if QT_CONFIG(spinbox)
|
||||
case CT_SpinBox: // ### hopelessly broken QAbstractSpinBox (part 1)
|
||||
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
|
||||
// Add some space for the up/down buttons
|
||||
|
|
@ -4920,6 +4921,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
|
|||
return sz;
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(spinbox)
|
||||
case CT_ToolButton:
|
||||
if (rule.hasBox() || !rule.hasNativeBorder() || !rule.baseStyleCanDraw())
|
||||
sz += QSize(3, 3); // ### broken QToolButton
|
||||
|
|
|
|||
Loading…
Reference in New Issue