summaryrefslogtreecommitdiffstats
path: root/src/widgets/util
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-07-04 15:19:36 +0200
committerLiang Qi <liang.qi@qt.io>2017-07-04 16:05:53 +0200
commitc2b224a758ce7e6dcf3748444fa8e29ab81904be (patch)
tree277cb99bf054190c935579142506caa4ec9861dd /src/widgets/util
parent10de063ff12cdba07b4620182aced8ed05ee3505 (diff)
parenteaee1209f0ead5be786e81db8aee604ccfea85b0 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
Diffstat (limited to 'src/widgets/util')
-rw-r--r--src/widgets/util/qcompleter.cpp18
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp2
-rw-r--r--src/widgets/util/qundogroup.cpp4
-rw-r--r--src/widgets/util/qundogroup.h7
-rw-r--r--src/widgets/util/qundostack.cpp18
-rw-r--r--src/widgets/util/qundostack.h11
-rw-r--r--src/widgets/util/qundostack_p.h5
-rw-r--r--src/widgets/util/qundoview.cpp20
-rw-r--r--src/widgets/util/qundoview.h9
-rw-r--r--src/widgets/util/util.pri29
10 files changed, 60 insertions, 63 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index e22f0e7f28..96f91188b8 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -148,7 +148,9 @@
#include "QtWidgets/qscrollbar.h"
#include "QtCore/qstringlistmodel.h"
#include "QtWidgets/qdirmodel.h"
+#if QT_CONFIG(filesystemmodel)
#include "QtWidgets/qfilesystemmodel.h"
+#endif
#include "QtWidgets/qheaderview.h"
#include "QtWidgets/qlistview.h"
#include "QtWidgets/qapplication.h"
@@ -467,7 +469,7 @@ QMatchData QCompletionEngine::filterHistory()
const bool isDirModel = false;
#endif
Q_UNUSED(isDirModel)
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
const bool isFsModel = (qobject_cast<QFileSystemModel *>(source) != 0);
#else
const bool isFsModel = false;
@@ -889,7 +891,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
completion += QDir::separator();
}
#endif
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
// add a trailing separator in inline
if (mode == QCompleter::InlineCompletion) {
if (qobject_cast<QFileSystemModel *>(proxy->sourceModel()) && QFileInfo(completion).isDir())
@@ -1061,7 +1063,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
{
Q_D(QCompleter);
QAbstractItemModel *oldModel = d->proxy->sourceModel();
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
if (qobject_cast<const QFileSystemModel *>(oldModel))
setCompletionRole(Qt::EditRole); // QTBUG-54642, clear FileNameRole set by QFileSystemModel
#endif
@@ -1079,7 +1081,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
#endif
}
#endif // QT_NO_DIRMODEL
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model);
if (fsModel) {
#if defined(Q_OS_WIN)
@@ -1090,7 +1092,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
setCompletionRole(QFileSystemModel::FileNameRole);
connect(fsModel, SIGNAL(directoryLoaded(QString)), this, SLOT(_q_fileSystemModelDirectoryLoaded(QString)));
}
-#endif // QT_NO_FILESYSTEMMODEL
+#endif // QT_CONFIG(filesystemmodel)
}
/*!
@@ -1787,7 +1789,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
#ifndef QT_NO_DIRMODEL
isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0;
#endif
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
isFsModel = qobject_cast<QFileSystemModel *>(d->proxy->sourceModel()) != 0;
#endif
if (!isDirModel && !isFsModel)
@@ -1799,7 +1801,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
QString t;
if (isDirModel)
t = sourceModel->data(idx, Qt::EditRole).toString();
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
else
t = sourceModel->data(idx, QFileSystemModel::FileNameRole).toString();
#endif
@@ -1837,7 +1839,7 @@ QStringList QCompleter::splitPath(const QString& path) const
Q_D(const QCompleter);
isDirModel = qobject_cast<QDirModel *>(d->proxy->sourceModel()) != 0;
#endif
-#ifndef QT_NO_FILESYSTEMMODEL
+#if QT_CONFIG(filesystemmodel)
#ifdef QT_NO_DIRMODEL
Q_D(const QCompleter);
#endif
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index cbd5d9eb80..fd9fdfb507 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -210,7 +210,7 @@ bool QSystemTrayIconSys::event(QEvent *e)
case QEvent::ToolTip:
QApplication::sendEvent(q, e);
break;
-#ifndef QT_NO_WHEELEVENT
+#if QT_CONFIG(wheelevent)
case QEvent::Wheel:
return QApplication::sendEvent(q, e);
#endif
diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp
index ec4fc2788a..f9605c7a2f 100644
--- a/src/widgets/util/qundogroup.cpp
+++ b/src/widgets/util/qundogroup.cpp
@@ -41,8 +41,6 @@
#include "qundostack.h"
#include "qundostack_p.h"
-#ifndef QT_NO_UNDOGROUP
-
QT_BEGIN_NAMESPACE
class QUndoGroupPrivate : public QObjectPrivate
@@ -502,5 +500,3 @@ QAction *QUndoGroup::createRedoAction(QObject *parent, const QString &prefix) co
QT_END_NAMESPACE
#include "moc_qundogroup.cpp"
-
-#endif // QT_NO_UNDOGROUP
diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h
index 4e2fdeed26..dba79ea706 100644
--- a/src/widgets/util/qundogroup.h
+++ b/src/widgets/util/qundogroup.h
@@ -44,15 +44,14 @@
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
+QT_REQUIRE_CONFIG(undogroup);
+
QT_BEGIN_NAMESPACE
class QUndoGroupPrivate;
class QUndoStack;
class QAction;
-
-#ifndef QT_NO_UNDOGROUP
-
class Q_WIDGETS_EXPORT QUndoGroup : public QObject
{
Q_OBJECT
@@ -97,8 +96,6 @@ private:
Q_DISABLE_COPY(QUndoGroup)
};
-#endif // QT_NO_UNDOGROUP
-
QT_END_NAMESPACE
#endif // QUNDOGROUP_H
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index dc0b6855ac..b371e903a6 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -39,11 +39,11 @@
#include <QtCore/qdebug.h>
#include "qundostack.h"
+#if QT_CONFIG(undogroup)
#include "qundogroup.h"
+#endif
#include "qundostack_p.h"
-#ifndef QT_NO_UNDOCOMMAND
-
QT_BEGIN_NAMESPACE
/*!
@@ -340,9 +340,7 @@ const QUndoCommand *QUndoCommand::child(int index) const
return d->child_list.at(index);
}
-#endif // QT_NO_UNDOCOMMAND
-
-#ifndef QT_NO_UNDOSTACK
+#if QT_CONFIG(undostack)
/*!
\class QUndoStack
@@ -544,7 +542,7 @@ bool QUndoStackPrivate::checkUndoLimit()
QUndoStack::QUndoStack(QObject *parent)
: QObject(*(new QUndoStackPrivate), parent)
{
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
if (QUndoGroup *group = qobject_cast<QUndoGroup*>(parent))
group->addStack(this);
#endif
@@ -559,7 +557,7 @@ QUndoStack::QUndoStack(QObject *parent)
QUndoStack::~QUndoStack()
{
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
Q_D(QUndoStack);
if (d->group != 0)
d->group->removeStack(this);
@@ -1247,7 +1245,7 @@ int QUndoStack::undoLimit() const
void QUndoStack::setActive(bool active)
{
-#ifdef QT_NO_UNDOGROUP
+#if !QT_CONFIG(undogroup)
Q_UNUSED(active);
#else
Q_D(QUndoStack);
@@ -1263,7 +1261,7 @@ void QUndoStack::setActive(bool active)
bool QUndoStack::isActive() const
{
-#ifdef QT_NO_UNDOGROUP
+#if !QT_CONFIG(undogroup)
return true;
#else
Q_D(const QUndoStack);
@@ -1332,4 +1330,4 @@ QT_END_NAMESPACE
#include "moc_qundostack.cpp"
#include "moc_qundostack_p.cpp"
-#endif // QT_NO_UNDOSTACK
+#endif // QT_CONFIG(undostack)
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h
index 2a8f4decb6..7ab90b507a 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -44,15 +44,14 @@
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(undocommand);
+QT_BEGIN_NAMESPACE
class QAction;
class QUndoCommandPrivate;
class QUndoStackPrivate;
-#ifndef QT_NO_UNDOCOMMAND
-
class Q_WIDGETS_EXPORT QUndoCommand
{
QUndoCommandPrivate *d;
@@ -83,9 +82,7 @@ private:
friend class QUndoStack;
};
-#endif // QT_NO_UNDOCOMMAND
-
-#ifndef QT_NO_UNDOSTACK
+#if QT_CONFIG(undostack)
class Q_WIDGETS_EXPORT QUndoStack : public QObject
{
@@ -150,7 +147,7 @@ private:
friend class QUndoGroup;
};
-#endif // QT_NO_UNDOSTACK
+#endif // QT_CONFIG(undostack)
QT_END_NAMESPACE
diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h
index e92a1fe620..04bc381114 100644
--- a/src/widgets/util/qundostack_p.h
+++ b/src/widgets/util/qundostack_p.h
@@ -74,7 +74,7 @@ public:
bool obsolete;
};
-#ifndef QT_NO_UNDOSTACK
+#if QT_CONFIG(undostack)
class QUndoStackPrivate : public QObjectPrivate
{
@@ -108,7 +108,6 @@ private:
};
#endif // QT_NO_ACTION
-
QT_END_NAMESPACE
-#endif // QT_NO_UNDOSTACK
+#endif // QT_CONFIG(undostack)
#endif // QUNDOSTACK_P_H
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index 93c1778ea2..b56aa42aed 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -40,9 +40,9 @@
#include "qundostack.h"
#include "qundoview.h"
-#ifndef QT_NO_UNDOVIEW
-
+#if QT_CONFIG(undogroup)
#include "qundogroup.h"
+#endif
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qpointer.h>
#include <QtGui/qicon.h>
@@ -273,12 +273,12 @@ class QUndoViewPrivate : public QListViewPrivate
Q_DECLARE_PUBLIC(QUndoView)
public:
QUndoViewPrivate() :
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
group(0),
#endif
model(0) {}
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
QPointer<QUndoGroup> group;
#endif
QUndoModel *model;
@@ -318,7 +318,7 @@ QUndoView::QUndoView(QUndoStack *stack, QWidget *parent)
setStack(stack);
}
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
/*!
Constructs a new view with parent \a parent and sets the observed group to \a group.
@@ -334,7 +334,7 @@ QUndoView::QUndoView(QUndoGroup *group, QWidget *parent)
setGroup(group);
}
-#endif // QT_NO_UNDOGROUP
+#endif // QT_CONFIG(undogroup)
/*!
Destroys this view.
@@ -369,13 +369,13 @@ QUndoStack *QUndoView::stack() const
void QUndoView::setStack(QUndoStack *stack)
{
Q_D(QUndoView);
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
setGroup(0);
#endif
d->model->setStack(stack);
}
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
/*!
Sets the group displayed by this view to \a group. If \a group is 0, the view will
@@ -423,7 +423,7 @@ QUndoGroup *QUndoView::group() const
return d->group;
}
-#endif // QT_NO_UNDOGROUP
+#endif // QT_CONFIG(undogroup)
/*!
\property QUndoView::emptyLabel
@@ -473,5 +473,3 @@ QT_END_NAMESPACE
#include "qundoview.moc"
#include "moc_qundoview.cpp"
-
-#endif // QT_NO_UNDOVIEW
diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h
index 3ed9ea5989..0bfcdd0c18 100644
--- a/src/widgets/util/qundoview.h
+++ b/src/widgets/util/qundoview.h
@@ -44,7 +44,7 @@
#include <QtWidgets/qlistview.h>
#include <QtCore/qstring.h>
-#ifndef QT_NO_UNDOVIEW
+QT_REQUIRE_CONFIG(undoview);
QT_BEGIN_NAMESPACE
@@ -64,13 +64,13 @@ class Q_WIDGETS_EXPORT QUndoView : public QListView
public:
explicit QUndoView(QWidget *parent = Q_NULLPTR);
explicit QUndoView(QUndoStack *stack, QWidget *parent = Q_NULLPTR);
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
explicit QUndoView(QUndoGroup *group, QWidget *parent = Q_NULLPTR);
#endif
~QUndoView();
QUndoStack *stack() const;
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
QUndoGroup *group() const;
#endif
@@ -82,7 +82,7 @@ public:
public Q_SLOTS:
void setStack(QUndoStack *stack);
-#ifndef QT_NO_UNDOGROUP
+#if QT_CONFIG(undogroup)
void setGroup(QUndoGroup *group);
#endif
@@ -92,5 +92,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_UNDOVIEW
#endif // QUNDOVIEW_H
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index 6abf6c8809..701758a406 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -5,19 +5,12 @@ HEADERS += \
util/qcolormap.h \
util/qcompleter.h \
util/qcompleter_p.h \
- util/qsystemtrayicon_p.h \
- util/qundogroup.h \
- util/qundostack.h \
- util/qundostack_p.h \
- util/qundoview.h
+ util/qsystemtrayicon_p.h
SOURCES += \
util/qsystemtrayicon.cpp \
util/qcolormap.cpp \
- util/qcompleter.cpp \
- util/qundogroup.cpp \
- util/qundostack.cpp \
- util/qundoview.cpp
+ util/qcompleter.cpp
qtConfig(scroller) {
HEADERS += \
@@ -33,6 +26,24 @@ qtConfig(scroller) {
util/qflickgesture.cpp \
}
+qtConfig(undocommand) {
+ HEADERS += \
+ util/qundostack.h \
+ util/qundostack_p.h
+
+ SOURCES += util/qundostack.cpp
+}
+
+qtConfig(undogroup) {
+ HEADERS += util/qundogroup.h
+ SOURCES += util/qundogroup.cpp
+}
+
+qtConfig(undoview) {
+ HEADERS += util/qundoview.h
+ SOURCES += util/qundoview.cpp
+}
+
qtConfig(xcb) {
SOURCES += util/qsystemtrayicon_x11.cpp
} else {