Convert features.tabbar to QT_[REQUIRE_]CONFIG

Change-Id: Id21a95cbc61b2559a8f517ee60548b61536e3cc4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-07-23 11:37:00 +02:00
parent 2d02c4c799
commit 7964b7468d
28 changed files with 219 additions and 208 deletions

View File

@ -45,7 +45,10 @@
#if QT_CONFIG(itemviews)
#include <qheaderview.h>
#endif
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
#include <private/qtabbar_p.h>
#endif
#if QT_CONFIG(combobox)
#include <qcombobox.h>
#endif
@ -56,7 +59,6 @@
#if QT_CONFIG(whatsthis)
#include <qwhatsthis.h>
#endif
#include <private/qtabbar_p.h>
#include <QAbstractScrollArea>
#include <QScrollArea>
#include <QScrollBar>
@ -69,7 +71,7 @@ QT_BEGIN_NAMESPACE
QString qt_accStripAmp(const QString &text);
QString qt_accHotKey(const QString &text);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
/*!
\class QAccessibleTabBar
\brief The QAccessibleTabBar class implements the QAccessibleInterface for tab bars.
@ -262,7 +264,7 @@ QString QAccessibleTabBar::text(QAccessible::Text t) const
return QString();
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#if QT_CONFIG(combobox)
/*!

View File

@ -107,7 +107,7 @@ public:
};
#endif // QT_NO_SCROLLAREA
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
class QAccessibleTabBar : public QAccessibleWidget
{
public:
@ -124,7 +124,7 @@ protected:
QTabBar *tabBar() const;
mutable QHash<int, QAccessible::Id> m_childInterfaces;
};
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#if QT_CONFIG(combobox)
class QAccessibleComboBox : public QAccessibleWidget

View File

@ -153,7 +153,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
iface = new QAccessibleTable(widget);
// ### This should be cleaned up. We return the parent for the scrollarea to hide it.
#endif // QT_CONFIG(itemviews)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
} else if (classname == QLatin1String("QTabBar")) {
iface = new QAccessibleTabBar(widget);
#endif

View File

@ -69,7 +69,9 @@
#include <qpainterpath.h>
#include <qslider.h>
#include <qstyleoption.h>
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
#endif
#if QT_CONFIG(tabwidget)
#include <qtabwidget.h>
#endif
@ -368,7 +370,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->setPen(oldPen);
}
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case PE_FrameTabBarBase:
if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
@ -431,7 +433,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
}
#else
Q_UNUSED(d);
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
case PE_FrameTabWidget:
case PE_FrameWindow:
qDrawWinPanel(p, opt->rect, opt->palette, false, 0);
@ -575,7 +577,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->setBrush(oldBrush);
break;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case PE_IndicatorTabTear:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
bool rtl = tab->direction == Qt::RightToLeft;
@ -609,7 +611,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->drawPath(path);
}
break;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#ifndef QT_NO_LINEEDIT
case PE_PanelLineEdit:
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
@ -1104,7 +1106,7 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItem *opt, QRect
#endif // QT_CONFIG(itemviews)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
/*! \internal
Compute the textRect and the pixmapRect from the opt rect
@ -1171,7 +1173,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
*textRect = tr;
}
#endif //QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#ifndef QT_NO_ANIMATION
/*! \internal */
@ -1718,7 +1720,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
break;
#endif // QT_NO_TOOLBOX
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case CE_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
proxy()->drawControl(CE_TabBarTabShape, tab, p, widget);
@ -1938,7 +1940,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
}
break;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#ifndef QT_NO_SIZEGRIP
case CE_SizeGrip: {
p->save();
@ -2813,7 +2815,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
#endif // QT_CONFIG(tabwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case SE_TabBarTearIndicator:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
switch (tab->shape) {
@ -4581,7 +4583,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
#endif // QT_NO_TOOLBAR
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case PM_TabBarTabOverlap:
ret = 3;
break;
@ -5225,7 +5227,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_ItemView_DrawDelegateFrame:
ret = 0;
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case SH_TabBar_CloseButtonPosition:
ret = QTabBar::RightSide;
break;

View File

@ -110,7 +110,7 @@ public:
}
#endif
mutable QIcon tabBarcloseButtonIcon;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const;
#endif

View File

@ -51,7 +51,9 @@
//#define DEBUG_SIZE_CONSTRAINT
#include <private/qcore_mac_p.h>
#if QT_CONFIG(tabbar)
#include <private/qtabbar_p.h>
#endif
#include <private/qpainter_p.h>
#include <qapplication.h>
#include <qbitmap.h>
@ -232,7 +234,7 @@ static const qreal closeButtonCornerRadius = 2.0;
typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
static bool isVerticalTabs(const QTabBar::Shape shape) {
return (shape == QTabBar::RoundedEast
|| shape == QTabBar::TriangularEast
@ -291,7 +293,7 @@ static void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pres
p->drawLine(margin, height - margin, width - margin, margin);
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect)
{
if (isVerticalTabs(shape)) {
@ -435,7 +437,7 @@ static inline bool isTreeView(const QWidget *widget)
}
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape)
{
ThemeTabDirection ttd;
@ -1077,7 +1079,7 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h
QRect(focusRingPixmap.width() - shCornerSize, svCornerSize, shCornerSize, focusRingPixmap.width() - 2 * svCornerSize));
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const
{
Q_ASSERT(textRect);
@ -1140,7 +1142,7 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
*textRect = tr;
}
#endif //QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
QAquaWidgetSize QMacStylePrivate::effectiveAquaSizeConstrain(const QStyleOption *option,
const QWidget *widg,
@ -2293,7 +2295,7 @@ void QMacStyle::polish(QWidget* w)
}
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (QTabBar *tb = qobject_cast<QTabBar*>(w)) {
if (tb->documentMode()) {
w->setAttribute(Qt::WA_Hover);
@ -2345,7 +2347,7 @@ void QMacStyle::unpolish(QWidget* w)
}
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (qobject_cast<QTabBar*>(w)) {
if (!w->testAttribute(Qt::WA_SetFont))
w->setFont(qApp->font(w));
@ -2870,7 +2872,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = QEvent::MouseButtonRelease;
break;
case SH_TabBar_SelectMouseType:
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
ret = opt2->documentMode ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease;
} else
@ -2903,7 +2905,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
}
}
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (const QTabBar *tab = qobject_cast<const QTabBar*>(w)) {
if (tab->documentMode()) {
ret = Qt::AlignLeft;
@ -3080,7 +3082,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_ItemView_PaintAlternatingRowColorsForEmptyArea:
ret = true;
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case SH_TabBar_CloseButtonPosition:
ret = QTabBar::LeftSide;
break;
@ -3236,7 +3238,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->drawPath(path);
p->restore();
break; }
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case PE_FrameTabBarBase:
if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
@ -4135,7 +4137,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w);
}
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case CE_TabBarTabShape:
if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
if (tabOpt->documentMode) {
@ -6663,7 +6665,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
#endif
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case QStyle::CT_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget);

View File

@ -244,7 +244,7 @@ public:
void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const;
#endif

View File

@ -1231,7 +1231,7 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version)
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
/*!
\class QStyleOptionTab
\brief The QStyleOptionTab class is used to describe the
@ -1479,7 +1479,7 @@ QStyleOptionTab::QStyleOptionTab(int version)
The default value is QSize(-1, -1), i.e. an invalid size;
*/
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
/*!
\class QStyleOptionProgressBar
@ -3436,7 +3436,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
#endif // QT_CONFIG(tabwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
/*!
\class QStyleOptionTabBarBase
@ -3556,7 +3556,7 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
The default value is false;
*/
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#ifndef QT_NO_SIZEGRIP
/*!

View File

@ -47,7 +47,9 @@
#include <QtGui/qmatrix.h>
#include <QtWidgets/qslider.h>
#include <QtWidgets/qstyle.h>
#if QT_CONFIG(tabbar)
#include <QtWidgets/qtabbar.h>
#endif
#if QT_CONFIG(tabwidget)
#include <QtWidgets/qtabwidget.h>
#endif
@ -173,7 +175,7 @@ typedef Q_DECL_DEPRECATED QStyleOptionTabWidgetFrame QStyleOptionTabWidgetFrameV
#endif // QT_CONFIG(tabwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
class Q_WIDGETS_EXPORT QStyleOptionTabBarBase : public QStyleOption
{
public:
@ -193,7 +195,7 @@ protected:
};
typedef Q_DECL_DEPRECATED QStyleOptionTabBarBase QStyleOptionTabBarBaseV2;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
class Q_WIDGETS_EXPORT QStyleOptionHeader : public QStyleOption
{
@ -247,7 +249,7 @@ protected:
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionButton::ButtonFeatures)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
class Q_WIDGETS_EXPORT QStyleOptionTab : public QStyleOption
{
public:
@ -286,7 +288,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets)
typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV2;
typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV3;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#ifndef QT_NO_TOOLBAR

View File

@ -76,7 +76,9 @@
#endif
#include <private/qwindowsstyle_p_p.h>
#include <private/qstyleanimation_p.h>
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
#endif
#include <QMetaProperty>
#include <qmainwindow.h>
#if QT_CONFIG(dockwidget)
@ -1912,7 +1914,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
break;
}
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
} else if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
if (tab->position == QStyleOptionTab::OnlyOneTab)
extraClass |= PseudoClass_OnlyOne;
@ -1948,7 +1950,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
default:
break;
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
} else if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
if (btn->features & QStyleOptionButton::Flat)
extraClass |= PseudoClass_Flat;
@ -2425,7 +2427,7 @@ static bool unstylable(const QWidget *w)
}
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (w->metaObject() == &QWidget::staticMetaObject
&& qobject_cast<const QTabBar*>(w->parentWidget()))
return true; // The moving tab of a QTabBar
@ -2812,7 +2814,7 @@ void QStyleSheetStyle::polish(QWidget *w)
#if QT_CONFIG(itemviews)
|| qobject_cast<QHeaderView *>(w)
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
|| qobject_cast<QTabBar *>(w)
#endif
#ifndef QT_NO_FRAME
@ -2916,7 +2918,7 @@ void QStyleSheetStyle::unpolish(QApplication *app)
styleSheetCaches->styleSheetCache.remove(qApp);
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
inline static bool verticalTabs(QTabBar::Shape shape)
{
return shape == QTabBar::RoundedWest
@ -2924,7 +2926,7 @@ inline static bool verticalTabs(QTabBar::Shape shape)
|| shape == QTabBar::TriangularWest
|| shape == QTabBar::TriangularEast;
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
const QWidget *w) const
@ -4092,7 +4094,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
break;
#endif // QT_CONFIG(itemviews)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case CE_TabBarTab:
if (hasStyleRule(w, PseudoElement_TabBarTab)) {
QWindowsStyle::drawControl(ce, opt, p, w);
@ -4127,7 +4129,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
return;
}
break;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
case CE_ColumnViewGrip:
if (rule.hasDrawable()) {
@ -4534,7 +4536,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
case PE_IndicatorSpinPlus:
pseudoElement = PseudoElement_SpinBoxUpArrow;
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case PE_IndicatorTabClose:
if (w)
w = w->parentWidget(); //match on the QTabBar instead of the CloseButton
@ -5055,7 +5057,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
return rule.boxSize(sz);
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case CT_TabBarTab: {
QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);
if (subRule.hasBox() || !subRule.hasNativeBorder()) {
@ -5079,7 +5081,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
sz = subRule.adjustSize(csz);
break;
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
case CT_MdiControls:
if (const QStyleOptionComplex *ccOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
@ -5288,7 +5290,7 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
#endif // QT_CONFIG(tabwidget)
s = QLatin1String("alignment");
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case SH_TabBar_CloseButtonPosition:
rule = renderRule(w, opt, PseudoElement_TabBarTabCloseButton);
if (rule.hasPosition()) {
@ -5694,7 +5696,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
RECURSION_GUARD(return baseStyle()->subElementRect(se, opt, w))
QRenderRule rule = renderRule(w, opt);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
int pe = PseudoElement_None;
#endif
@ -5822,7 +5824,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
}
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case SE_TabWidgetLeftCorner:
pe = PseudoElement_TabWidgetLeftCorner;
// intentionally falls through
@ -5889,7 +5891,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
}
break;
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
case SE_DockWidgetCloseButton:
case SE_DockWidgetFloatButton: {

View File

@ -55,7 +55,9 @@
#include "qrubberband.h"
#endif
#include "qstyleoption.h"
#if QT_CONFIG(tabbar)
#include "qtabbar.h"
#endif
#include "qwidget.h"
#include "qdebug.h"
#include "qmainwindow.h"
@ -334,7 +336,7 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
break;
case QStyle::PM_DockWidgetSeparatorExtent:
return 4;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case QStyle::PM_TabBarTabShiftHorizontal:
return 0;
case QStyle::PM_TabBarTabShiftVertical:
@ -1283,7 +1285,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
}
break;
#endif // QT_NO_MENUBAR
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
bool rtlHorTabs = (tab->direction == Qt::RightToLeft
@ -1486,7 +1488,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
}
}
break;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
case CE_ToolBoxTabShape:
qDrawShadePanel(p, opt->rect, opt->palette,
opt->state & (State_Sunken | State_On), 1,

View File

@ -58,7 +58,9 @@
#include <qdesktopwidget.h>
#include <qtoolbutton.h>
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
#endif
#if QT_CONFIG(combobox)
#include <qcombobox.h>
#endif

View File

@ -40,7 +40,9 @@
#include "QtWidgets/qapplication.h"
#include "QtWidgets/qwidget.h"
#if QT_CONFIG(tabbar)
#include "QtWidgets/qtabbar.h"
#endif
#include "QtWidgets/qstyle.h"
#include "QtWidgets/qdesktopwidget.h"
#include "QtWidgets/qapplication.h"
@ -212,7 +214,7 @@ QDockAreaLayoutItem
** QDockAreaLayoutInfo
*/
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
static quintptr tabId(const QDockAreaLayoutItem &item)
{
if (item.widgetItem == 0)
@ -225,7 +227,7 @@ static const int zero = 0;
QDockAreaLayoutInfo::QDockAreaLayoutInfo()
: sep(&zero), dockPos(QInternal::LeftDock), o(Qt::Horizontal), mainWindow(0)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
, tabbed(false), tabBar(0), tabBarShape(QTabBar::RoundedSouth)
#endif
{
@ -235,11 +237,11 @@ QDockAreaLayoutInfo::QDockAreaLayoutInfo(const int *_sep, QInternal::DockPositio
Qt::Orientation _o, int tbshape,
QMainWindow *window)
: sep(_sep), dockPos(_dockPos), o(_o), mainWindow(window)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
, tabbed(false), tabBar(0), tabBarShape(static_cast<QTabBar::Shape>(tbshape))
#endif
{
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
Q_UNUSED(tbshape);
#endif
}
@ -253,7 +255,7 @@ void QDockAreaLayoutInfo::clear()
{
item_list.clear();
rect = QRect();
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
tabbed = false;
tabBar = 0;
#endif
@ -287,7 +289,7 @@ QSize QDockAreaLayoutInfo::minimumSize() const
continue;
QSize min_size = item.minimumSize();
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
a = qMax(a, pick(o, min_size));
} else
@ -306,7 +308,7 @@ QSize QDockAreaLayoutInfo::minimumSize() const
rpick(o, result) = a;
rperp(o, result) = b;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QSize tbm = tabBarMinimumSize();
if (!tbm.isNull()) {
switch (tabBarShape) {
@ -328,7 +330,7 @@ QSize QDockAreaLayoutInfo::minimumSize() const
break;
}
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
return result;
}
@ -339,7 +341,7 @@ QSize QDockAreaLayoutInfo::maximumSize() const
return QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
int a = 0, b = QWIDGETSIZE_MAX;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed)
a = QWIDGETSIZE_MAX;
#endif
@ -355,7 +357,7 @@ QSize QDockAreaLayoutInfo::maximumSize() const
QSize max_size = item.maximumSize();
min_perp = qMax(min_perp, perp(o, item.minimumSize()));
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
a = qMin(a, pick(o, max_size));
} else
@ -379,7 +381,7 @@ QSize QDockAreaLayoutInfo::maximumSize() const
rpick(o, result) = a;
rperp(o, result) = b;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QSize tbh = tabBarSizeHint();
if (!tbh.isNull()) {
switch (tabBarShape) {
@ -395,7 +397,7 @@ QSize QDockAreaLayoutInfo::maximumSize() const
break;
}
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
return result;
}
@ -420,7 +422,7 @@ QSize QDockAreaLayoutInfo::sizeHint() const
min_perp = qMax(min_perp, perp(o, item.minimumSize()));
max_perp = qMin(max_perp, perp(o, item.maximumSize()));
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
a = qMax(a, gap ? item.size : pick(o, size_hint));
} else
@ -445,7 +447,7 @@ QSize QDockAreaLayoutInfo::sizeHint() const
rpick(o, result) = a;
rperp(o, result) = b;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
QSize tbh = tabBarSizeHint();
switch (tabBarShape) {
@ -467,7 +469,7 @@ QSize QDockAreaLayoutInfo::sizeHint() const
break;
}
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
return result;
}
@ -543,7 +545,7 @@ static int realMaxSize(const QDockAreaLayoutInfo &info)
void QDockAreaLayoutInfo::fitItems()
{
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
return;
}
@ -757,7 +759,7 @@ QList<int> QDockAreaLayoutInfo::gapIndex(const QPoint& _pos,
QRect item_rect;
int item_index = 0;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
item_rect = tabContentRect();
} else
@ -777,7 +779,7 @@ QList<int> QDockAreaLayoutInfo::gapIndex(const QPoint& _pos,
continue;
if (item.subinfo != 0
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
&& !item.subinfo->tabbed
#endif
) {
@ -939,7 +941,7 @@ static int separatorMoveHelper(QVector<QLayoutStruct> &list, int index, int delt
int QDockAreaLayoutInfo::separatorMove(int index, int delta)
{
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
Q_ASSERT(!tabbed);
#endif
@ -1045,7 +1047,7 @@ QLayoutItem *QDockAreaLayoutInfo::plug(const QList<int> &path)
QRect result;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
} else
#endif
@ -1090,7 +1092,7 @@ QLayoutItem *QDockAreaLayoutInfo::unplug(const QList<int> &path)
Q_ASSERT(!(item.flags & QDockAreaLayoutItem::GapItem));
item.flags |= QDockAreaLayoutItem::GapItem;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
} else
#endif
@ -1106,7 +1108,7 @@ QLayoutItem *QDockAreaLayoutInfo::unplug(const QList<int> &path)
return item.widgetItem;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
quintptr QDockAreaLayoutInfo::currentTabId() const
{
@ -1138,7 +1140,7 @@ void QDockAreaLayoutInfo::setCurrentTabId(quintptr id)
}
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
static QRect dockedGeometry(QWidget *widget)
{
@ -1171,7 +1173,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
QDockAreaLayoutItem &item = item_list[index];
if (item.subinfo == 0
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
|| (item.subinfo->tabbed && !insert_tabbed)
#endif
) {
@ -1184,7 +1186,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
QRect r = subinfo == 0 ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect;
Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal;
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
const int tabBarShape = 0;
#endif
QDockAreaLayoutInfo *new_info
@ -1202,7 +1204,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
new_item.size = pick(opposite, r.size());
new_item.pos = pick(opposite, r.topLeft());
new_info->item_list.append(new_item);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (insert_tabbed) {
new_info->tabbed = true;
}
@ -1217,7 +1219,7 @@ bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWid
gap_item.flags |= QDockAreaLayoutItem::GapItem;
gap_item.widgetItem = dockWidgetItem; // so minimumSize(), maximumSize() and
// sizeHint() will work
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (!tabbed)
#endif
{
@ -1292,7 +1294,7 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(QWidget *widget)
if (item.skip())
continue;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed && widget == tabBar)
return this;
#endif
@ -1330,7 +1332,7 @@ QRect QDockAreaLayoutInfo::itemRect(int index) const
QRect result;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
if (tabId(item) == currentTabId())
result = tabContentRect();
@ -1365,7 +1367,7 @@ QRect QDockAreaLayoutInfo::itemRect(const QList<int> &path) const
QRect QDockAreaLayoutInfo::separatorRect(int index) const
{
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed)
return QRect();
#endif
@ -1397,7 +1399,7 @@ QRect QDockAreaLayoutInfo::separatorRect(const QList<int> &path) const
QList<int> QDockAreaLayoutInfo::findSeparator(const QPoint &_pos) const
{
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed)
return QList<int>();
#endif
@ -1508,7 +1510,7 @@ QDockWidget *QDockAreaLayoutInfo::apply(bool animate)
{
QWidgetAnimator &widgetAnimator = mainWindowLayout()->widgetAnimator;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
QRect tab_rect;
QSize tbh = tabBarSizeHint();
@ -1541,7 +1543,7 @@ QDockWidget *QDockAreaLayoutInfo::apply(bool animate)
widgetAnimator.animate(tabBar, tab_rect, animate);
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
QDockWidget *activated = nullptr;
@ -1577,10 +1579,10 @@ QDockWidget *QDockAreaLayoutInfo::apply(bool animate)
}
}
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (*sep == 1)
updateSeparatorWidgets();
#endif //QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
return activated;
}
@ -1607,7 +1609,7 @@ QRegion QDockAreaLayoutInfo::separatorRegion() const
if (isEmpty())
return result;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed)
return result;
#endif
@ -1637,7 +1639,7 @@ void QDockAreaLayoutInfo::paintSeparators(QPainter *p, QWidget *widget,
{
if (isEmpty())
return;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed)
return;
#endif
@ -1686,7 +1688,7 @@ int QDockAreaLayoutInfo::prev(int index) const
void QDockAreaLayoutInfo::tab(int index, QLayoutItem *dockWidgetItem)
{
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
Q_UNUSED(index);
Q_UNUSED(dockWidgetItem);
#else
@ -1705,7 +1707,7 @@ void QDockAreaLayoutInfo::tab(int index, QLayoutItem *dockWidgetItem)
new_info->updateTabBar();
new_info->setCurrentTab(dockWidgetItem->widget());
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
}
void QDockAreaLayoutInfo::split(int index, Qt::Orientation orientation,
@ -1714,7 +1716,7 @@ void QDockAreaLayoutInfo::split(int index, Qt::Orientation orientation,
if (orientation == o) {
item_list.insert(index + 1, QDockAreaLayoutItem(dockWidgetItem));
} else {
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
const int tabBarShape = 0;
#endif
QDockAreaLayoutInfo *new_info
@ -1795,7 +1797,7 @@ void QDockAreaLayoutInfo::deleteAllLayoutItems()
void QDockAreaLayoutInfo::saveState(QDataStream &stream) const
{
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabbed) {
stream << (uchar) TabMarker;
@ -1810,7 +1812,7 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const
}
stream << index;
} else
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
{
stream << (uchar) SequenceMarker;
}
@ -1884,7 +1886,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
if (marker != TabMarker && marker != SequenceMarker)
return false;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
tabbed = marker == TabMarker;
int index = -1;
@ -1989,7 +1991,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
}
} else if (nextMarker == SequenceMarker) {
int dummy;
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
const int tabBarShape = 0;
#endif
QDockAreaLayoutItem item(new QDockAreaLayoutInfo(sep, dockPos, o,
@ -2010,7 +2012,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
}
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (!testing && tabbed && index >= 0 && index < item_list.count()) {
updateTabBar();
setCurrentTabId(tabId(item_list.at(index)));
@ -2022,7 +2024,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
return true;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void QDockAreaLayoutInfo::updateSeparatorWidgets() const
{
if (tabbed) {
@ -2073,9 +2075,7 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const
separatorWidgets.resize(j);
Q_ASSERT(separatorWidgets.size() == j);
}
#endif //QT_NO_TABBAR
#ifndef QT_NO_TABBAR
/*! \internal
reparent all the widgets contained in this layout portion to the
specified parent. This is used to reparent dock widgets and tabbars
@ -2301,7 +2301,7 @@ void QDockAreaLayoutInfo::moveTab(int from, int to)
{
item_list.move(tabIndexToListIndex(from), tabIndexToListIndex(to));
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
/******************************************************************************
** QDockAreaLayout
@ -2311,7 +2311,7 @@ QDockAreaLayout::QDockAreaLayout(QMainWindow *win) : fallbackToSizeHints(true)
{
mainWindow = win;
sep = win->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, win);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
const int tabShape = QTabBar::RoundedSouth;
#else
const int tabShape = 0;
@ -2431,7 +2431,7 @@ QList<int> QDockAreaLayout::gapIndex(const QPoint &pos) const
QMainWindow::DockOptions opts = mainWindow->dockOptions();
bool nestingEnabled = opts & QMainWindow::AllowNestedDocks;
QDockAreaLayoutInfo::TabMode tabMode = QDockAreaLayoutInfo::NoTabs;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (opts & QMainWindow::AllowTabbedDocks
|| opts & QMainWindow::VerticalTabs)
tabMode = QDockAreaLayoutInfo::AllowTabs;
@ -3122,14 +3122,14 @@ void QDockAreaLayout::addDockWidget(QInternal::DockPosition pos, QDockWidget *do
QDockAreaLayoutItem new_item(dockWidgetItem);
info.item_list.append(new_item);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (info.tabbed && !new_item.skip()) {
info.updateTabBar();
info.setCurrentTabId(tabId(new_item));
}
#endif
} else {
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
int tbshape = info.tabBarShape;
#else
int tbshape = 0;
@ -3230,10 +3230,10 @@ void QDockAreaLayout::apply(bool animate)
widgetAnimator.animate(centralWidgetItem->widget(), centralWidgetRect,
animate);
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (sep == 1)
updateSeparatorWidgets();
#endif //QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
}
void QDockAreaLayout::paintSeparators(QPainter *p, QWidget *widget,
@ -3311,7 +3311,7 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or
return delta;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
// Sets the correct positions for the separator widgets
// Allocates new sepearator widgets with getSeparatorWidget
void QDockAreaLayout::updateSeparatorWidgets() const
@ -3345,7 +3345,7 @@ void QDockAreaLayout::updateSeparatorWidgets() const
separatorWidgets.resize(j);
}
#endif //QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
QLayoutItem *QDockAreaLayout::itemAt(int *x, int index) const
{
@ -3388,7 +3388,7 @@ void QDockAreaLayout::deleteAllLayoutItems()
docks[i].deleteAllLayoutItems();
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QSet<QTabBar*> QDockAreaLayout::usedTabBars() const
{
QSet<QTabBar*> result;
@ -3431,7 +3431,7 @@ QRect QDockAreaLayout::gapRect(const QList<int> &path) const
QRect result;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (info->tabbed) {
result = info->tabContentRect();
} else

View File

@ -196,12 +196,10 @@ public:
QRect rect;
QMainWindow *mainWindow;
QList<QDockAreaLayoutItem> item_list;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void updateSeparatorWidgets() const;
QSet<QWidget*> usedSeparatorWidgets() const;
#endif //QT_NO_TABBAR
#ifndef QT_NO_TABBAR
quintptr currentTabId() const;
void setCurrentTab(QWidget *widget);
void setCurrentTabId(quintptr id);
@ -220,7 +218,7 @@ public:
int tabIndexToListIndex(int) const;
void moveTab(int from, int to);
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
};
class Q_AUTOTEST_EXPORT QDockAreaLayout
@ -285,9 +283,9 @@ public:
const QPoint &mouse) const;
QRegion separatorRegion() const;
int separatorMove(const QList<int> &separator, const QPoint &origin, const QPoint &dest);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void updateSeparatorWidgets() const;
#endif //QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
QLayoutItem *itemAt(int *x, int index) const;
QLayoutItem *takeAt(int *x, int index);
@ -301,10 +299,10 @@ public:
QRect gapRect(const QList<int> &path) const;
void keepSize(QDockWidget *w);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QSet<QTabBar*> usedTabBars() const;
QSet<QWidget*> usedSeparatorWidgets() const;
#endif //QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
void styleChangedEvent();
};

View File

@ -1397,14 +1397,14 @@ void QDockWidget::changeEvent(QEvent *event)
d->fixedWindowTitle = qt_setWindowTitle_helperHelper(windowTitle(), this);
d->toggleViewAction->setText(d->fixedWindowTitle);
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
{
if (QMainWindowLayout *winLayout = qt_mainwindow_layout_from_dock(this)) {
if (QDockAreaLayoutInfo *info = winLayout->layoutState.dockAreaLayout.info(this))
info->updateTabBar();
}
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
break;
default:
break;

View File

@ -1019,7 +1019,7 @@ static bool checkDockWidgetArea(Qt::DockWidgetArea area, const char *where)
return false;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
/*!
\property QMainWindow::documentMode
\brief whether the tab bar for tabbed dockwidgets is set to document mode.
@ -1038,7 +1038,7 @@ void QMainWindow::setDocumentMode(bool enabled)
{
d_func()->layout->setDocumentMode(enabled);
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#if QT_CONFIG(tabwidget)
/*!
@ -1210,7 +1210,7 @@ void QMainWindow::tabifyDockWidget(QDockWidget *first, QDockWidget *second)
QList<QDockWidget*> QMainWindow::tabifiedDockWidgets(QDockWidget *dockwidget) const
{
QList<QDockWidget*> ret;
#if defined(QT_NO_TABBAR)
#if !QT_CONFIG(tabbar)
Q_UNUSED(dockwidget);
#else
const QDockAreaLayoutInfo *info = d_func()->layout->layoutState.dockAreaLayout.info(dockwidget);

View File

@ -66,9 +66,9 @@ class Q_WIDGETS_EXPORT QMainWindow : public QWidget
Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle)
#if QT_CONFIG(dockwidget)
Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode)
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#if QT_CONFIG(tabwidget)
Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape)
#endif // QT_CONFIG(tabwidget)
@ -106,7 +106,7 @@ public:
bool isDockNestingEnabled() const;
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
bool documentMode() const;
void setDocumentMode(bool enabled);
#endif

View File

@ -54,7 +54,9 @@
#if QT_CONFIG(rubberband)
#include "qrubberband.h"
#endif
#if QT_CONFIG(tabbar)
#include "qtabbar_p.h"
#endif
#include <qapplication.h>
#include <qstatusbar.h>
@ -883,7 +885,7 @@ void QMainWindowLayoutState::saveState(QDataStream &stream) const
{
#if QT_CONFIG(dockwidget)
dockAreaLayout.saveState(stream);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QList<QDockWidgetGroupWindow *> floatingTabs =
mainWindow->findChildren<QDockWidgetGroupWindow *>(QString(), Qt::FindDirectChildrenOnly);
@ -963,7 +965,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
}
}
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case QDockAreaLayout::FloatingDockWidgetTabMarker:
{
QRect geom;
@ -974,7 +976,7 @@ bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
return false;
}
break;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#endif // QT_CONFIG(dockwidget)
default:
//there was an error during the parsing
@ -1444,7 +1446,7 @@ bool QMainWindowLayout::restoreDockWidget(QDockWidget *dockwidget)
return true;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
bool QMainWindowLayout::documentMode() const
{
return _documentMode;
@ -1463,11 +1465,11 @@ void QMainWindowLayout::setDocumentMode(bool enabled)
foreach (QTabBar *bar, unusedTabBars)
bar->setDocumentMode(_documentMode);
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
void QMainWindowLayout::setVerticalTabsEnabled(bool enabled)
{
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
Q_UNUSED(enabled);
#else
if (verticalTabsEnabled == enabled)
@ -1476,7 +1478,7 @@ void QMainWindowLayout::setVerticalTabsEnabled(bool enabled)
verticalTabsEnabled = enabled;
updateTabBarShapes();
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
}
#if QT_CONFIG(tabwidget)
@ -1537,7 +1539,7 @@ static inline QTabBar::Shape tabBarShapeFrom(QTabWidget::TabShape shape, QTabWid
}
#endif // QT_CONFIG(tabwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void QMainWindowLayout::updateTabBarShapes()
{
#if QT_CONFIG(tabwidget)
@ -1568,7 +1570,7 @@ void QMainWindowLayout::updateTabBarShapes()
layout.docks[i].setTabBarShape(shape);
}
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
void QMainWindowLayout::splitDockWidget(QDockWidget *after,
QDockWidget *dockwidget,
@ -1593,7 +1595,7 @@ void QMainWindowLayout::keepSize(QDockWidget *w)
layoutState.dockAreaLayout.keepSize(w);
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
// Handle custom tooltip, and allow to drag tabs away.
class QMainWindowTabBar : public QTabBar
@ -1778,7 +1780,7 @@ void QMainWindowLayout::tabMoved(int from, int to)
info->moveTab(from, to);
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
bool QMainWindowLayout::startSeparatorMove(const QPoint &pos)
{
@ -1815,7 +1817,7 @@ bool QMainWindowLayout::endSeparatorMove(const QPoint&)
void QMainWindowLayout::raise(QDockWidget *widget)
{
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QDockAreaLayoutInfo *info = dockInfo(widget);
if (info == 0)
return;
@ -2220,7 +2222,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
layoutState.apply(false);
#if QT_CONFIG(dockwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (qobject_cast<QDockWidget*>(widget) != 0) {
// info() might return null if the widget is destroyed while
// animating but before the animationFinished signal is received.
@ -2235,10 +2237,10 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
//all animations are finished
#if QT_CONFIG(dockwidget)
parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
foreach (QTabBar *tab_bar, usedTabBars)
tab_bar->show();
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#endif // QT_CONFIG(dockwidget)
}
@ -2266,7 +2268,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay
, dockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks)
, statusbar(0)
#if QT_CONFIG(dockwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
, _documentMode(false)
, verticalTabsEnabled(false)
#if QT_CONFIG(tabwidget)
@ -2284,7 +2286,7 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow, QLayout *parentLay
setParent(parentLayout);
#if QT_CONFIG(dockwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
sep = mainwindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainwindow);
#endif
@ -2371,7 +2373,7 @@ void QMainWindowLayout::setCentralWidget(QWidget *widget)
*/
QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
{
#if QT_CONFIG(dockwidget) && !defined(QT_NO_TABBAR)
#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar)
if (!widget->isWindow() && qobject_cast<const QDockWidgetGroupWindow *>(widget->parentWidget())) {
if (group) {
// We are just dragging a floating window as it, not need to do anything, we just have to
@ -2670,7 +2672,7 @@ bool QMainWindowLayout::restoreState(QDataStream &stream)
#if QT_CONFIG(dockwidget)
if (parentWidget()->isVisible()) {
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
foreach (QTabBar *tab_bar, usedTabBars)
tab_bar->show();

View File

@ -57,7 +57,9 @@
#ifndef QT_NO_MAINWINDOW
#include "QtWidgets/qlayout.h"
#if QT_CONFIG(tabbar)
#include "QtWidgets/qtabbar.h"
#endif
#include "QtCore/qvector.h"
#include "QtCore/qset.h"
#include "QtCore/qbasictimer.h"
@ -234,7 +236,7 @@ public:
void setVerticalTabsEnabled(bool enabled);
bool restoreDockWidget(QDockWidget *dockwidget);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
QDockAreaLayoutInfo *dockInfo(QWidget *w);
bool _documentMode;
bool documentMode() const;
@ -261,7 +263,7 @@ public:
QDockWidgetGroupWindow *createTabbedDockWindow();
#endif // QT_CONFIG(tabwidget)
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
// separators
@ -324,13 +326,13 @@ public:
private Q_SLOTS:
void updateGapIndicator();
#if QT_CONFIG(dockwidget)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void tabChanged();
void tabMoved(int from, int to);
#endif
#endif
private:
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void updateTabBarShapes();
#endif
#if 0 // Used to be included in Qt4 for Q_WS_MAC

View File

@ -564,7 +564,7 @@ QPoint MinOverlapPlacer::place(const QSize &size, const QVector<QRect> &rects,
return findBestPlacement(domain, rects, candidates);
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
class QMdiAreaTabBar : public QTabBar
{
public:
@ -662,7 +662,7 @@ QMdiSubWindow *QMdiAreaTabBar::subWindowFromIndex(int index) const
return subWindow;
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
/*!
\internal
@ -675,12 +675,12 @@ QMdiAreaPrivate::QMdiAreaPrivate()
#if QT_CONFIG(rubberband)
rubberBand(0),
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
tabBar(0),
#endif
activationOrder(QMdiArea::CreationOrder),
viewMode(QMdiArea::SubWindowView),
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
documentMode(false),
tabsClosable(false),
tabsMovable(false),
@ -780,7 +780,7 @@ void QMdiAreaPrivate::_q_processWindowStateChanged(Qt::WindowStates oldState,
void QMdiAreaPrivate::_q_currentTabChanged(int index)
{
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
Q_UNUSED(index);
#else
if (!tabBar || index < 0)
@ -799,28 +799,28 @@ void QMdiAreaPrivate::_q_currentTabChanged(int index)
QMdiSubWindow *subWindow = childWindows.at(index);
Q_ASSERT(subWindow);
activateWindow(subWindow);
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
}
void QMdiAreaPrivate::_q_closeTab(int index)
{
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
Q_UNUSED(index);
#else
QMdiSubWindow *subWindow = childWindows.at(index);
Q_ASSERT(subWindow);
subWindow->close();
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
}
void QMdiAreaPrivate::_q_moveTab(int from, int to)
{
#ifdef QT_NO_TABBAR
#if !QT_CONFIG(tabbar)
Q_UNUSED(from);
Q_UNUSED(to);
#else
childWindows.move(from, to);
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
}
/*!
@ -858,7 +858,7 @@ void QMdiAreaPrivate::appendChild(QMdiSubWindow *child)
indicesToActivatedChildren.prepend(childWindows.size() - 1);
Q_ASSERT(indicesToActivatedChildren.size() == childWindows.size());
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabBar) {
tabBar->addTab(child->windowIcon(), tabTextFor(child));
updateTabBarGeometry();
@ -1082,7 +1082,7 @@ void QMdiAreaPrivate::emitWindowActivated(QMdiSubWindow *activeWindow)
aboutToBecomeActive = 0;
Q_ASSERT(active->d_func()->isActive);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabBar && tabBar->currentIndex() != indexToActiveWindow)
tabBar->setCurrentIndex(indexToActiveWindow);
#endif
@ -1125,7 +1125,7 @@ void QMdiAreaPrivate::updateActiveWindow(int removedIndex, bool activeRemoved)
{
Q_ASSERT(indicesToActivatedChildren.size() == childWindows.size());
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (tabBar && removedIndex >= 0) {
const QSignalBlocker blocker(tabBar);
tabBar->removeTab(removedIndex);
@ -1563,7 +1563,7 @@ void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode)
// Just a guard since we cannot set viewMode = mode here.
inViewModeChange = true;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (mode == QMdiArea::TabbedView) {
Q_ASSERT(!tabBar);
tabBar = new QMdiAreaTabBar(q);
@ -1604,12 +1604,12 @@ void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode)
QObject::connect(tabBar, SIGNAL(tabCloseRequested(int)), q, SLOT(_q_closeTab(int)));
QObject::connect(tabBar, SIGNAL(tabMoved(int,int)), q, SLOT(_q_moveTab(int,int)));
} else
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
{ // SubWindowView
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
delete tabBar;
tabBar = 0;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
viewMode = mode;
q->setViewportMargins(0, 0, 0, 0);
@ -1624,7 +1624,7 @@ void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode)
inViewModeChange = false;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
/*!
\internal
*/
@ -1696,7 +1696,7 @@ void QMdiAreaPrivate::refreshTabBar()
#endif
updateTabBarGeometry();
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
/*!
Constructs an empty mdi area. \a parent is passed to QWidget's
@ -2141,7 +2141,7 @@ void QMdiArea::setViewMode(ViewMode mode)
d->setViewMode(mode);
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
/*!
\property QMdiArea::documentMode
\brief whether the tab bar is set to document mode in tabbed view mode.
@ -2216,7 +2216,7 @@ void QMdiArea::setTabsMovable(bool movable)
d->tabsMovable = movable;
d->refreshTabBar();
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
#if QT_CONFIG(tabwidget)
/*!
@ -2297,7 +2297,7 @@ void QMdiArea::resizeEvent(QResizeEvent *resizeEvent)
return;
}
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
d->updateTabBarGeometry();
#endif
@ -2535,7 +2535,7 @@ bool QMdiArea::event(QEvent *event)
d->setActive(d->active, false, false);
d->setChildActivationEnabled(false);
break;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case QEvent::LayoutDirectionChange:
d->updateTabBarGeometry();
break;
@ -2632,13 +2632,13 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
d->isSubWindowsTiled = false;
break;
case QEvent::Show:
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
if (d->tabBar) {
const int tabIndex = d->childWindows.indexOf(subWindow);
if (!d->tabBar->isTabEnabled(tabIndex))
d->tabBar->setTabEnabled(tabIndex, true);
}
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
// fall through
case QEvent::Hide:
d->isSubWindowsTiled = false;
@ -2649,7 +2649,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
d->hideRubberBand();
break;
#endif
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
case QEvent::WindowTitleChange:
case QEvent::ModifiedChange:
if (d->tabBar)
@ -2659,7 +2659,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
if (d->tabBar)
d->tabBar->setTabIcon(d->childWindows.indexOf(subWindow), subWindow->windowIcon());
break;
#endif // QT_NO_TABBAR
#endif // QT_CONFIG(tabbar)
default:
break;
}

View File

@ -60,7 +60,7 @@ class Q_WIDGETS_EXPORT QMdiArea : public QAbstractScrollArea
Q_PROPERTY(QBrush background READ background WRITE setBackground)
Q_PROPERTY(WindowOrder activationOrder READ activationOrder WRITE setActivationOrder)
Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode)
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode)
Q_PROPERTY(bool tabsClosable READ tabsClosable WRITE setTabsClosable)
Q_PROPERTY(bool tabsMovable READ tabsMovable WRITE setTabsMovable)
@ -113,7 +113,7 @@ public:
void setViewMode(ViewMode mode);
ViewMode viewMode() const;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
bool documentMode() const;
void setDocumentMode(bool enabled);

View File

@ -158,7 +158,7 @@ public:
QMdiArea::WindowOrder activationOrder;
QMdiArea::AreaOptions options;
QMdiArea::ViewMode viewMode;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
bool documentMode;
bool tabsClosable;
bool tabsMovable;
@ -213,7 +213,7 @@ public:
QList<QMdiSubWindow *> subWindowList(QMdiArea::WindowOrder, bool reversed = false) const;
void disconnectSubWindow(QObject *subWindow);
void setViewMode(QMdiArea::ViewMode mode);
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
void updateTabBarGeometry();
void refreshTabBar();
#endif

View File

@ -138,7 +138,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode())
Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *))
friend class QMdiAreaPrivate;
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
friend class QMdiAreaTabBar;
#endif
friend class QMdi::ControlContainer;

View File

@ -67,8 +67,6 @@
#include "qdebug.h"
#include "private/qtabbar_p.h"
#ifndef QT_NO_TABBAR
#if 0 // Used to be included in Qt4 for Q_WS_MAC
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
@ -2694,6 +2692,4 @@ QT_END_NAMESPACE
#include "moc_qtabbar.cpp"
#endif // QT_NO_TABBAR
#include "moc_qtabbar_p.cpp"

View File

@ -43,11 +43,10 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_REQUIRE_CONFIG(tabbar);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TABBAR
class QIcon;
class QTabBarPrivate;
class QStyleOptionTab;
@ -221,8 +220,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_closeTab())
};
#endif // QT_NO_TABBAR
QT_END_NAMESPACE
#endif // QTABBAR_H

View File

@ -60,12 +60,12 @@
#include <qdebug.h>
#include <qvariantanimation.h>
#ifndef QT_NO_TABBAR
#define ANIMATION_DURATION 250
#include <qstyleoption.h>
QT_REQUIRE_CONFIG(tabbar);
QT_BEGIN_NAMESPACE
class QMovableTabWidget : public QWidget
@ -286,9 +286,6 @@ public:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
#endif
#endif

View File

@ -34,8 +34,6 @@ HEADERS += \
widgets/qsplitter_p.h \
widgets/qstackedwidget.h \
widgets/qstatusbar.h \
widgets/qtabbar.h \
widgets/qtabbar_p.h \
widgets/qtextedit.h \
widgets/qtextedit_p.h \
widgets/qtextbrowser.h \
@ -81,7 +79,6 @@ SOURCES += \
widgets/qsplitter.cpp \
widgets/qstackedwidget.cpp \
widgets/qstatusbar.cpp \
widgets/qtabbar.cpp \
widgets/qtextedit.cpp \
widgets/qtextbrowser.cpp \
widgets/qtoolbar.cpp \
@ -226,6 +223,14 @@ qtConfig(splashscreen) {
widgets/qsplashscreen.cpp
}
qtConfig(tabbar) {
HEADERS += \
widgets/qtabbar.h \
widgets/qtabbar_p.h
SOURCES += widgets/qtabbar.cpp
}
qtConfig(tabwidget) {
HEADERS += widgets/qtabwidget.h
SOURCES += widgets/qtabwidget.cpp

View File

@ -47,7 +47,7 @@
#include <private/qmainwindowlayout_p.h>
#include <private/qdockarealayout_p.h>
#ifndef QT_NO_TABBAR
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
#endif
@ -150,7 +150,7 @@ private slots:
void QTBUG21378_animationFinished();
void resizeDocks();
void resizeDocks_data();
#if QT_CONFIG(dockwidget) && !defined(QT_NO_TABBAR)
#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar)
void QTBUG52175_tabifiedDockWidgetActivated();
#endif
};
@ -2046,7 +2046,7 @@ void tst_QMainWindow::resizeDocks()
}
}
#if QT_CONFIG(dockwidget) && !defined(QT_NO_TABBAR)
#if QT_CONFIG(dockwidget) && QT_CONFIG(tabbar)
void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated()
{
QMainWindow w;