Convert features.sizegrip to QT_[REQUIRE_]CONFIG

Change-Id: Ieac4ae1f0b8b84e943c00da9903346a44e57138c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-09-02 20:49:54 +02:00
parent ba1b73175b
commit bef8b905af
15 changed files with 69 additions and 57 deletions

View File

@ -52,7 +52,9 @@
#include "qdesktopwidget.h"
#include "qapplication.h"
#include "qlayout.h"
#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
#endif
#if QT_CONFIG(whatsthis)
#include "qwhatsthis.h"
#endif
@ -1005,7 +1007,7 @@ void QDialog::showExtension(bool showIt)
setFixedSize(w, height() + s.height());
}
d->extension->show();
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
const bool sizeGripEnabled = isSizeGripEnabled();
setSizeGripEnabled(false);
d->sizeGripEnabled = sizeGripEnabled;
@ -1018,7 +1020,7 @@ void QDialog::showExtension(bool showIt)
resize(d->size);
if (layout())
layout()->setEnabled(true);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
setSizeGripEnabled(d->sizeGripEnabled);
#endif
}
@ -1079,7 +1081,7 @@ void QDialog::setModal(bool modal)
bool QDialog::isSizeGripEnabled() const
{
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
Q_D(const QDialog);
return !!d->resizer;
#else
@ -1090,11 +1092,11 @@ bool QDialog::isSizeGripEnabled() const
void QDialog::setSizeGripEnabled(bool enabled)
{
#ifdef QT_NO_SIZEGRIP
#if !QT_CONFIG(sizegrip)
Q_UNUSED(enabled);
#else
Q_D(QDialog);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
d->sizeGripEnabled = enabled;
if (enabled && d->doShowExtension)
return;
@ -1115,7 +1117,7 @@ void QDialog::setSizeGripEnabled(bool enabled)
d->resizer = 0;
}
}
#endif //QT_NO_SIZEGRIP
#endif // QT_CONFIG(sizegrip)
}
@ -1123,7 +1125,7 @@ void QDialog::setSizeGripEnabled(bool enabled)
/*! \reimp */
void QDialog::resizeEvent(QResizeEvent *)
{
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
Q_D(QDialog);
if (d->resizer) {
if (isRightToLeft())

View File

@ -78,7 +78,7 @@ public:
mainDef(0),
#endif
orientation(Qt::Horizontal),extension(0), doShowExtension(false),
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
resizer(0),
sizeGripEnabled(false),
#endif
@ -99,7 +99,7 @@ public:
QWidget *extension;
bool doShowExtension;
QSize size, min, max;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QSizeGrip *resizer;
bool sizeGripEnabled;
#endif

View File

@ -45,7 +45,9 @@
#include "qmenubar.h"
#endif
#include "qtoolbar.h"
#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
#endif
#include "qevent.h"
#include "qstyle.h"
#include "qvariant.h"

View File

@ -1940,7 +1940,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
break;
#endif // QT_CONFIG(tabbar)
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
case CE_SizeGrip: {
p->save();
int x, y, w, h;
@ -2013,7 +2013,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
p->restore();
break; }
#endif // QT_NO_SIZEGRIP
#endif // QT_CONFIG(sizegrip)
#if QT_CONFIG(rubberband)
case CE_RubberBand: {
if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {

View File

@ -100,7 +100,9 @@
#if QT_CONFIG(scrollbar)
#include <qscrollbar.h>
#endif
#if QT_CONFIG(sizegrip)
#include <qsizegrip.h>
#endif
#include <qstyleoption.h>
#include <qtoolbar.h>
#if QT_CONFIG(toolbutton)
@ -687,7 +689,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
else if (qobject_cast<const QMenuBar *>(widg))
ct = QStyle::CT_MenuBar;
#endif
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
else if (qobject_cast<const QSizeGrip *>(widg))
ct = QStyle::CT_SizeGrip;
#endif

View File

@ -99,7 +99,9 @@
#if QT_CONFIG(rubberband)
#include <qrubberband.h>
#endif
#if QT_CONFIG(sizegrip)
#include <qsizegrip.h>
#endif
#include <qspinbox.h>
#if QT_CONFIG(splitter)
#include <qsplitter.h>

View File

@ -3558,7 +3558,7 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
#endif // QT_CONFIG(tabbar)
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
/*!
\class QStyleOptionSizeGrip
\brief The QStyleOptionSizeGrip class is used to describe the
@ -3638,7 +3638,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
\sa StyleOptionType
*/
#endif // QT_NO_SIZEGRIP
#endif // QT_CONFIG(sizegrip)
/*!
\class QStyleOptionGraphicsItem

View File

@ -862,7 +862,7 @@ QMdiSubWindowPrivate::QMdiSubWindowPrivate()
: baseWidget(0),
restoreFocusWidget(0),
controlContainer(0),
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
sizeGrip(0),
#endif
#if QT_CONFIG(rubberband)
@ -1303,7 +1303,7 @@ void QMdiSubWindowPrivate::setNormalMode()
restoreSize.setWidth(-1);
restoreSize.setHeight(-1);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
setSizeGripVisible(true);
#endif
@ -1350,7 +1350,7 @@ void QMdiSubWindowPrivate::setMaximizeMode()
storeFocusWidget();
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
setSizeGripVisible(false);
#endif
@ -2118,7 +2118,7 @@ void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags)
}
#endif
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if ((windowFlags & Qt::FramelessWindowHint) && sizeGrip)
delete sizeGrip;
#endif
@ -2179,7 +2179,7 @@ QSize QMdiSubWindowPrivate::iconSize() const
return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());
}
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
/*!
\internal
@ -2223,7 +2223,7 @@ void QMdiSubWindowPrivate::setSizeGripVisible(bool visible) const
grip->setVisible(visible);
}
#endif // QT_NO_SIZEGRIP
#endif // QT_CONFIG(sizegrip)
/*!
\internal
@ -2334,7 +2334,7 @@ void QMdiSubWindow::setWidget(QWidget *widget)
else
widget->setParent(this);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QSizeGrip *sizeGrip = widget->findChild<QSizeGrip *>();
if (sizeGrip)
sizeGrip->installEventFilter(this);
@ -2639,7 +2639,7 @@ void QMdiSubWindow::showShaded()
if (hasFocus() || isAncestorOf(QApplication::focusWidget()))
d->ensureWindowState(Qt::WindowActive);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
d->setSizeGripVisible(false);
#endif
@ -2715,7 +2715,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
}
#endif
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if (object != d->baseWidget && parent() && qobject_cast<QSizeGrip *>(object)) {
if (event->type() != QEvent::MouseButtonPress || !testOption(QMdiSubWindow::RubberBandResize))
return QWidget::eventFilter(object, event);
@ -2846,7 +2846,7 @@ bool QMdiSubWindow::event(QEvent *event)
d->isMaximizeMode = false;
d->isWidgetHiddenByUs = false;
if (!parent()) {
#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac)
#if QT_CONFIG(sizegrip) && QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(style()))
delete d->sizeGrip;
#endif
@ -2941,7 +2941,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
return;
}
#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac)
#if QT_CONFIG(sizegrip) && QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip
&& !(windowFlags() & Qt::FramelessWindowHint)) {
d->setSizeGrip(new QSizeGrip(this));
@ -3079,7 +3079,7 @@ void QMdiSubWindow::leaveEvent(QEvent * /*leaveEvent*/)
void QMdiSubWindow::resizeEvent(QResizeEvent *resizeEvent)
{
Q_D(QMdiSubWindow);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if (d->sizeGrip) {
d->sizeGrip->move(isLeftToRight() ? width() - d->sizeGrip->width() : 0,
height() - d->sizeGrip->height());
@ -3483,7 +3483,7 @@ void QMdiSubWindow::childEvent(QChildEvent *childEvent)
{
if (childEvent->type() != QEvent::ChildPolished)
return;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if (QSizeGrip *sizeGrip = qobject_cast<QSizeGrip *>(childEvent->child()))
d_func()->setSizeGrip(sizeGrip);
#endif
@ -3541,7 +3541,7 @@ QSize QMdiSubWindow::minimumSizeHint() const
}
}
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
// SizeGrip
int sizeGripHeight = 0;
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))

View File

@ -59,7 +59,9 @@
#if QT_CONFIG(menubar)
#include <QMenuBar>
#endif
#if QT_CONFIG(sizegrip)
#include <QSizeGrip>
#endif
#include <QPointer>
#include <QDebug>
#include <private/qwidget_p.h>
@ -178,7 +180,7 @@ public:
QPointer<QWidget> baseWidget;
QPointer<QWidget> restoreFocusWidget;
QPointer<QMdi::ControlContainer> controlContainer;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QPointer<QSizeGrip> sizeGrip;
#endif
#if QT_CONFIG(rubberband)
@ -278,7 +280,7 @@ public:
#endif
#endif // QT_NO_ACTION
QSize iconSize() const;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
void setSizeGrip(QSizeGrip *sizeGrip);
void setSizeGripVisible(bool visible = true) const;
#endif

View File

@ -39,8 +39,6 @@
#include "qsizegrip.h"
#ifndef QT_NO_SIZEGRIP
#include "qapplication.h"
#include "qevent.h"
#include "qpainter.h"
@ -507,5 +505,3 @@ bool QSizeGrip::event(QEvent *event)
QT_END_NAMESPACE
#include "moc_qsizegrip.cpp"
#endif //QT_NO_SIZEGRIP

View File

@ -43,10 +43,10 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_REQUIRE_CONFIG(sizegrip);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SIZEGRIP
class QSizeGripPrivate;
class Q_WIDGETS_EXPORT QSizeGrip : public QWidget
{
@ -76,7 +76,6 @@ private:
Q_DISABLE_COPY(QSizeGrip)
Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden())
};
#endif // QT_NO_SIZEGRIP
QT_END_NAMESPACE

View File

@ -47,7 +47,9 @@
#include "qtimer.h"
#include "qstyle.h"
#include "qstyleoption.h"
#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
#endif
#if QT_CONFIG(mainwindow)
#include "qmainwindow.h"
#endif
@ -81,7 +83,7 @@ public:
QBoxLayout * box;
QTimer * timer;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QSizeGrip * resizer;
bool showSizeGrip;
#endif
@ -103,7 +105,7 @@ public:
return i;
}
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
void tryToShowSizeGrip()
{
if (!showSizeGrip)
@ -129,7 +131,7 @@ QRect QStatusBarPrivate::messageRect() const
int left = 6;
int right = q->width() - 12;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if (resizer && resizer->isVisible()) {
if (rtl)
left = resizer->x() + resizer->width();
@ -234,7 +236,7 @@ QStatusBar::QStatusBar(QWidget * parent)
d->box = 0;
d->timer = 0;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
d->resizer = 0;
setSizeGripEnabled(true); // causes reformat()
#else
@ -431,7 +433,7 @@ void QStatusBar::removeWidget(QWidget *widget)
bool QStatusBar::isSizeGripEnabled() const
{
#ifdef QT_NO_SIZEGRIP
#if !QT_CONFIG(sizegrip)
return false;
#else
Q_D(const QStatusBar);
@ -441,7 +443,7 @@ bool QStatusBar::isSizeGripEnabled() const
void QStatusBar::setSizeGripEnabled(bool enabled)
{
#ifdef QT_NO_SIZEGRIP
#if !QT_CONFIG(sizegrip)
Q_UNUSED(enabled);
#else
Q_D(QStatusBar);
@ -477,7 +479,7 @@ void QStatusBar::reformat()
delete d->box;
QBoxLayout *vbox;
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if (d->resizer) {
d->box = new QHBoxLayout(this);
d->box->setMargin(0);
@ -518,7 +520,7 @@ void QStatusBar::reformat()
int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
maxH = qMax(maxH, itemH);
}
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if (d->resizer) {
maxH = qMax(maxH, d->resizer->sizeHint().height());
d->box->addSpacing(1);
@ -649,7 +651,7 @@ void QStatusBar::hideOrShow()
*/
void QStatusBar::showEvent(QShowEvent *)
{
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
Q_D(QStatusBar);
if (d->resizer && d->showSizeGrip)
d->tryToShowSizeGrip();
@ -722,7 +724,7 @@ bool QStatusBar::event(QEvent *e)
maxH = qMax(maxH, itemH);
}
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
if (d->resizer)
maxH = qMax(maxH, d->resizer->sizeHint().height());
#endif

View File

@ -43,7 +43,9 @@
#include "qapplication.h"
#include "qdesktopwidget.h"
#include "qcursor.h"
#if QT_CONFIG(sizegrip)
#include "qsizegrip.h"
#endif
#include "qevent.h"
#include "qdebug.h"
#include "private/qlayoutengine_p.h"

View File

@ -9,7 +9,6 @@ HEADERS += \
widgets/qlineedit_p.h \
widgets/qmenu.h \
widgets/qmenu_p.h \
widgets/qsizegrip.h \
widgets/qslider.h \
widgets/qspinbox.h \
widgets/qtextedit.h \
@ -33,7 +32,6 @@ SOURCES += \
widgets/qlineedit_p.cpp \
widgets/qlineedit.cpp \
widgets/qmenu.cpp \
widgets/qsizegrip.cpp \
widgets/qslider.cpp \
widgets/qspinbox.cpp \
widgets/qtextedit.cpp \
@ -253,6 +251,11 @@ qtConfig(scrollbar) {
SOURCES += widgets/qscrollbar.cpp
}
qtConfig(sizegrip) {
HEADERS += widgets/qsizegrip.h
SOURCES += widgets/qsizegrip.cpp
}
qtConfig(splashscreen) {
HEADERS += \
widgets/qsplashscreen.h

View File

@ -73,7 +73,7 @@ private slots:
void toolDialogPosition();
void deleteMainDefault();
void deleteInExec();
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
void showSizeGrip();
#endif
void setVisible();
@ -235,7 +235,7 @@ void tst_QDialog::showMaximized()
{
QDialog dialog(0);
dialog.setSizeGripEnabled(true);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QSizeGrip *sizeGrip = dialog.findChild<QSizeGrip *>();
QVERIFY(sizeGrip);
#endif
@ -243,14 +243,14 @@ void tst_QDialog::showMaximized()
dialog.showMaximized();
QVERIFY(dialog.isMaximized());
QVERIFY(dialog.isVisible());
#if !defined(QT_NO_SIZEGRIP) && !defined(Q_OS_MAC) && !defined(Q_OS_IRIX) && !defined(Q_OS_HPUX)
#if QT_CONFIG(sizegrip) && !defined(Q_OS_DARWIN) && !defined(Q_OS_IRIX) && !defined(Q_OS_HPUX)
QVERIFY(!sizeGrip->isVisible());
#endif
dialog.showNormal();
QVERIFY(!dialog.isMaximized());
QVERIFY(dialog.isVisible());
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QVERIFY(sizeGrip->isVisible());
#endif
@ -312,7 +312,7 @@ void tst_QDialog::showFullScreen()
{
QDialog dialog(0, Qt::X11BypassWindowManagerHint);
dialog.setSizeGripEnabled(true);
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QSizeGrip *sizeGrip = dialog.findChild<QSizeGrip *>();
QVERIFY(sizeGrip);
#endif
@ -320,14 +320,14 @@ void tst_QDialog::showFullScreen()
dialog.showFullScreen();
QVERIFY(dialog.isFullScreen());
QVERIFY(dialog.isVisible());
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QVERIFY(!sizeGrip->isVisible());
#endif
dialog.showNormal();
QVERIFY(!dialog.isFullScreen());
QVERIFY(dialog.isVisible());
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
QVERIFY(sizeGrip->isVisible());
#endif
@ -414,7 +414,7 @@ void tst_QDialog::deleteInExec()
QCOMPARE(dialog->exec(), int(QDialog::Rejected));
}
#ifndef QT_NO_SIZEGRIP
#if QT_CONFIG(sizegrip)
// From Task 124269
void tst_QDialog::showSizeGrip()
{