Fix build without feature.dockwidget and tabwidget

Change-Id: I621664f646475c1b5cfde47b7087c0c9f5ad8e4d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Tasuku Suzuki 2019-05-30 23:44:44 +09:00
parent 57fccd6f21
commit b727d2f0e1
2 changed files with 11 additions and 4 deletions

View File

@ -233,6 +233,7 @@ static QLinearGradient titlebarGradientInactive()
return qt_mac_applicationIsInDarkMode() ? darkGradient : lightGradient;
}
#if QT_CONFIG(tabwidget)
static void clipTabBarFrame(const QStyleOption *option, const QMacStyle *style, CGContextRef ctx)
{
Q_ASSERT(option);
@ -252,6 +253,7 @@ static void clipTabBarFrame(const QStyleOption *option, const QMacStyle *style,
CGContextClipToRects(ctx, &cgRects[0], size_t(cgRects.size()));
}
}
#endif
static const QColor titlebarSeparatorLineActive(111, 111, 111);
static const QColor titlebarSeparatorLineInactive(131, 131, 131);
@ -2949,7 +2951,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->restore();
return;
}
#if QT_CONFIG(tabwidget)
QRegion region(tbb->rect);
region -= tbb->tabBarRect;
p->save();
@ -2973,6 +2975,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
}
proxy()->drawPrimitive(PE_FrameTabWidget, &twf, p, w);
p->restore();
#endif
}
break;
#endif
@ -3019,8 +3022,10 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
needTranslation = true;
}
d->drawNSViewInRect(box, adjustedRect, p, ^(CGContextRef ctx, const CGRect &rect) {
#if QT_CONFIG(tabwidget)
if (QTabWidget *tabWidget = qobject_cast<QTabWidget *>(opt->styleObject))
clipTabBarFrame(opt, this, ctx);
#endif
CGContextTranslateCTM(ctx, 0, rect.origin.y + rect.size.height);
CGContextScaleCTM(ctx, 1, -1);
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::MacOSMojave

View File

@ -2413,7 +2413,7 @@ static bool unplugGroup(QMainWindowLayout *layout, QLayoutItem **item,
*/
QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
{
#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar)
#if QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget)
auto *groupWindow = qobject_cast<const QDockWidgetGroupWindow *>(widget->parentWidget());
if (!widget->isWindow() && groupWindow) {
if (group && groupWindow->tabLayoutInfo()) {
@ -2525,10 +2525,10 @@ void QMainWindowLayout::updateGapIndicator()
#endif // QT_CONFIG(rubberband)
}
#if QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget)
static QTabBar::Shape tabwidgetPositionToTabBarShape(QWidget *w)
{
QTabBar::Shape result = QTabBar::RoundedSouth;
#if QT_CONFIG(tabwidget)
if (qobject_cast<QDockWidget *>(w)) {
switch (static_cast<QDockWidgetPrivate *>(qt_widget_private(w))->tabPosition) {
case QTabWidget::North:
@ -2545,9 +2545,9 @@ static QTabBar::Shape tabwidgetPositionToTabBarShape(QWidget *w)
break;
}
}
#endif // tabwidget
return result;
}
#endif // QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget)
void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
{
@ -2591,6 +2591,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
if (!w->geometry().contains(mousePos))
continue;
#if QT_CONFIG(tabwidget)
if (auto dropTo = qobject_cast<QDockWidget *>(w)) {
// dropping to a normal widget, we mutate it in a QDockWidgetGroupWindow with two
// tabs
@ -2612,6 +2613,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
w = floatingTabs;
widget->raise(); // raise, as our newly created drop target is now on top
}
#endif
Q_ASSERT(qobject_cast<QDockWidgetGroupWindow *>(w));
auto group = static_cast<QDockWidgetGroupWindow *>(w);
if (group->hover(widgetItem, group->mapFromGlobal(mousePos))) {