Fix style compilation with -no-feature-...
Change-Id: Ic7fadf0622f98d339322a4a1d4d5c36908f4f7f6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>bb10
parent
7cafa85a49
commit
27792ea098
|
|
@ -5224,9 +5224,11 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
|||
case SH_Splitter_OpaqueResize:
|
||||
ret = true;
|
||||
break;
|
||||
#if QT_CONFIG(itemviews)
|
||||
case SH_ItemView_ScrollMode:
|
||||
ret = QAbstractItemView::ScrollPerItem;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1097,6 +1097,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
}
|
||||
painter->restore();
|
||||
break;
|
||||
#if QT_CONFIG(toolbar)
|
||||
case CE_ToolBar:
|
||||
if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
|
||||
// Reserve the beveled appearance only for mainwindow toolbars
|
||||
|
|
@ -1217,6 +1218,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
painter->setPen(oldPen);
|
||||
}
|
||||
break;
|
||||
#endif // QT_CONFIG(toolbar)
|
||||
case CE_DockWidgetTitle:
|
||||
painter->save();
|
||||
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
|
||||
|
|
@ -1550,7 +1552,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
bool ignoreCheckMark = false;
|
||||
int checkcol = qMax(menuItem->maxIconWidth, 20);
|
||||
|
||||
if (qobject_cast<const QComboBox*>(widget) ||
|
||||
if (
|
||||
#if QT_CONFIG(combobox)
|
||||
qobject_cast<const QComboBox*>(widget) ||
|
||||
#endif
|
||||
(option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool()))
|
||||
ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate
|
||||
|
||||
|
|
@ -1607,8 +1612,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
|
|||
|
||||
int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
|
||||
QSize iconSize(smallIconSize, smallIconSize);
|
||||
#if QT_CONFIG(combobox)
|
||||
if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
|
||||
iconSize = combo->iconSize();
|
||||
#endif
|
||||
if (checked)
|
||||
pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On);
|
||||
else
|
||||
|
|
@ -3018,10 +3025,12 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
|
|||
painter->setPen(oldPen);
|
||||
}
|
||||
break;
|
||||
#if QT_CONFIG(dial)
|
||||
case CC_Dial:
|
||||
if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
|
||||
QStyleHelper::drawDial(dial, painter);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
QCommonStyle::drawComplexControl(control, option, painter, widget);
|
||||
break;
|
||||
|
|
@ -3217,9 +3226,11 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti
|
|||
}
|
||||
}
|
||||
else if (!menuItem->icon.isNull()) {
|
||||
#if QT_CONFIG(combobox)
|
||||
if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) {
|
||||
newSize.setHeight(qMax(combo->iconSize().height() + 2, newSize.height()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
newSize.setWidth(newSize.width() + 12);
|
||||
newSize.setWidth(qMax(newSize.width(), 120));
|
||||
|
|
@ -3252,7 +3263,9 @@ void QFusionStyle::polish(QWidget *widget)
|
|||
{
|
||||
QCommonStyle::polish(widget);
|
||||
if (qobject_cast<QAbstractButton*>(widget)
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox *>(widget)
|
||||
#endif
|
||||
|| qobject_cast<QProgressBar *>(widget)
|
||||
|| qobject_cast<QScrollBar *>(widget)
|
||||
|| qobject_cast<QSplitterHandle *>(widget)
|
||||
|
|
@ -3281,7 +3294,9 @@ void QFusionStyle::unpolish(QWidget *widget)
|
|||
{
|
||||
QCommonStyle::unpolish(widget);
|
||||
if (qobject_cast<QAbstractButton*>(widget)
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox *>(widget)
|
||||
#endif
|
||||
|| qobject_cast<QProgressBar *>(widget)
|
||||
|| qobject_cast<QScrollBar *>(widget)
|
||||
|| qobject_cast<QSplitterHandle *>(widget)
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ void QPixmapStyle::polish(QWidget *widget)
|
|||
if (qobject_cast<QSlider*>(widget))
|
||||
widget->installEventFilter(this);
|
||||
|
||||
#if QT_CONFIG(combobox)
|
||||
if (QComboBox *cb = qobject_cast<QComboBox*>(widget)) {
|
||||
widget->installEventFilter(this);
|
||||
// NOTE: This will break if the private API of QComboBox changes drastically
|
||||
|
|
@ -177,16 +178,18 @@ void QPixmapStyle::polish(QWidget *widget)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(combobox)
|
||||
if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
|
||||
widget->installEventFilter(this);
|
||||
|
||||
if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget)) {
|
||||
scrollArea->viewport()->setAutoFillBackground(false);
|
||||
#if QT_CONFIG(itemviews)
|
||||
if (QAbstractItemView *view = qobject_cast<QAbstractItemView*>(scrollArea)) {
|
||||
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
}
|
||||
#endif
|
||||
#if QT_CONFIG(gestures)
|
||||
QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture);
|
||||
#endif
|
||||
|
|
@ -211,8 +214,11 @@ void QPixmapStyle::unpolish(QApplication *application)
|
|||
*/
|
||||
void QPixmapStyle::unpolish(QWidget *widget)
|
||||
{
|
||||
if (qobject_cast<QSlider*>(widget) ||
|
||||
qobject_cast<QComboBox*>(widget)) {
|
||||
if (qobject_cast<QSlider*>(widget)
|
||||
#if QT_CONFIG(combobox)
|
||||
|| qobject_cast<QComboBox*>(widget)
|
||||
#endif
|
||||
) {
|
||||
widget->removeEventFilter(this);
|
||||
}
|
||||
|
||||
|
|
@ -256,9 +262,11 @@ void QPixmapStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *o
|
|||
drawRadioButton(option, painter, widget);
|
||||
break;
|
||||
case PE_PanelItemViewItem:
|
||||
#if QT_CONFIG(listview)
|
||||
if (qobject_cast<const QListView*>(widget))
|
||||
drawPanelItemViewItem(option, painter, widget);
|
||||
else
|
||||
#endif
|
||||
QCommonStyle::drawPrimitive(element, option, painter, widget);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -532,6 +540,7 @@ bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
#if QT_CONFIG(combobox)
|
||||
if (QComboBox *comboBox = qobject_cast<QComboBox*>(watched)) {
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
|
|
@ -552,6 +561,7 @@ bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event)
|
|||
default: ;
|
||||
}
|
||||
}
|
||||
#endif // QT_CONFIG(combobox)
|
||||
|
||||
if (qstrcmp(watched->metaObject()->className(),"QComboBoxPrivateContainer") == 0) {
|
||||
if (event->type() == QEvent::Show) {
|
||||
|
|
@ -701,9 +711,10 @@ void QPixmapStyle::drawLineEdit(const QStyleOption *option,
|
|||
QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
// Don't draw for the line edit inside a combobox
|
||||
#if QT_CONFIG(combobox)
|
||||
if (widget && qobject_cast<const QComboBox*>(widget->parentWidget()))
|
||||
return;
|
||||
|
||||
#endif
|
||||
const bool enabled = option->state & State_Enabled;
|
||||
const bool focused = option->state & State_HasFocus;
|
||||
ControlDescriptor control = enabled ? (focused ? LE_Focused : LE_Enabled) : LE_Disabled;
|
||||
|
|
|
|||
|
|
@ -4415,14 +4415,18 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
|
|||
break;
|
||||
|
||||
case PE_IndicatorColumnViewArrow:
|
||||
#if QT_CONFIG(itemviews)
|
||||
if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
|
||||
bool reverse = (viewOpt->direction == Qt::RightToLeft);
|
||||
pseudoElement = reverse ? PseudoElement_LeftArrow : PseudoElement_RightArrow;
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
pseudoElement = PseudoElement_RightArrow;
|
||||
}
|
||||
break;
|
||||
|
||||
#if QT_CONFIG(itemviews)
|
||||
case PE_IndicatorBranch:
|
||||
if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
|
||||
QRenderRule subRule = renderRule(w, opt, PseudoElement_TreeViewBranch);
|
||||
|
|
@ -4437,6 +4441,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
|
|||
}
|
||||
}
|
||||
return;
|
||||
#endif // QT_CONFIG(itemviews)
|
||||
|
||||
case PE_PanelTipLabel:
|
||||
if (!rule.hasDrawable())
|
||||
|
|
|
|||
|
|
@ -815,6 +815,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
|
|||
p->save();
|
||||
doRestore = true;
|
||||
}
|
||||
#if QT_CONFIG(itemviews)
|
||||
if (pe == PE_IndicatorViewItemCheck) {
|
||||
const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt);
|
||||
p->setPen(itemViewOpt
|
||||
|
|
@ -826,6 +827,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
|
|||
p->setBrush(opt->palette.brush(QPalette::Button));
|
||||
p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, 11, 11);
|
||||
}
|
||||
#endif // QT_CONFIG(itemviews)
|
||||
if (!(opt->state & State_Off)) {
|
||||
QLineF lines[7];
|
||||
int i, xx, yy;
|
||||
|
|
|
|||
Loading…
Reference in New Issue