diff options
author | Liang Qi <liang.qi@qt.io> | 2017-09-20 11:37:26 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-09-20 11:58:32 +0200 |
commit | 01bc69f99f189b03d0b9cad77cc300798937cad1 (patch) | |
tree | 730f3b691cfc1830ec617b3c2ad8df16180de724 /src/widgets/itemviews | |
parent | c23c4a921d0e9e2d18a62af82d38ca27eac7bcb3 (diff) | |
parent | 6d699d08200b1fe3a616dfbc275d46c98b77fcbd (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
src/plugins/styles/mac/qmacstyle_mac.mm
src/widgets/util/qcompleter.cpp
src/widgets/widgets/qmainwindowlayout.cpp
src/widgets/widgets/qmdisubwindow.cpp
Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qabstractitemdelegate.cpp | 13 | ||||
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 8 | ||||
-rw-r--r-- | src/widgets/itemviews/qitemeditorfactory.cpp | 22 | ||||
-rw-r--r-- | src/widgets/itemviews/qitemeditorfactory_p.h | 6 | ||||
-rw-r--r-- | src/widgets/itemviews/qstyleditemdelegate.cpp | 6 |
5 files changed, 36 insertions, 19 deletions
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index fd4699409c..d532221092 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -49,10 +49,15 @@ #include <qevent.h> #include <qstring.h> #include <qdebug.h> +#if QT_CONFIG(lineedit) #include <qlineedit.h> +#endif +#if QT_CONFIG(textedit) #include <qtextedit.h> #include <qplaintextedit.h> +#endif #include <qapplication.h> +#include <qvalidator.h> #include <private/qtextengine_p.h> #include <private/qabstractitemdelegate_p.h> @@ -432,7 +437,7 @@ QAbstractItemDelegatePrivate::QAbstractItemDelegatePrivate() static bool editorHandlesKeyEvent(QWidget *editor, const QKeyEvent *event) { -#ifndef QT_NO_TEXTEDIT +#if QT_CONFIG(textedit) // do not filter enter / return / tab / backtab for QTextEdit or QPlainTextEdit if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor)) { switch (event->key()) { @@ -446,7 +451,7 @@ static bool editorHandlesKeyEvent(QWidget *editor, const QKeyEvent *event) break; } } -#endif // QT_NO_TEXTEDIT +#endif // QT_CONFIG(textedit) Q_UNUSED(editor); Q_UNUSED(event); @@ -535,7 +540,7 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor) { -#ifndef QT_NO_LINEEDIT +#if QT_CONFIG(lineedit) if (QLineEdit *e = qobject_cast<QLineEdit*>(editor)) { if (!e->hasAcceptableInput()) { #if QT_CONFIG(validator) @@ -550,7 +555,7 @@ bool QAbstractItemDelegatePrivate::tryFixup(QWidget *editor) } #else Q_UNUSED(editor) -#endif // QT_NO_LINEEDIT +#endif // QT_CONFIG(lineedit) return true; } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index ed87de4e18..fe27be8522 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -49,8 +49,12 @@ #include <qscrollbar.h> #include <qtooltip.h> #include <qdatetime.h> +#if QT_CONFIG(lineedit) #include <qlineedit.h> +#endif +#if QT_CONFIG(spinbox) #include <qspinbox.h> +#endif #include <qheaderview.h> #include <qstyleditemdelegate.h> #include <private/qabstractitemview_p.h> @@ -4228,11 +4232,11 @@ QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index, QWidget *focusWidget = w; while (QWidget *fp = focusWidget->focusProxy()) focusWidget = fp; -#ifndef QT_NO_LINEEDIT +#if QT_CONFIG(lineedit) if (QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget)) le->selectAll(); #endif -#ifndef QT_NO_SPINBOX +#if QT_CONFIG(spinbox) if (QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget)) sb->selectAll(); else if (QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget)) diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index 54b7c6666f..b580f0e840 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -50,8 +50,12 @@ #if QT_CONFIG(label) #include <qlabel.h> #endif +#if QT_CONFIG(lineedit) #include <qlineedit.h> +#endif +#if QT_CONFIG(spinbox) #include <qspinbox.h> +#endif #include <qstyle.h> #include <qstyleoption.h> #include <limits.h> @@ -80,7 +84,7 @@ public: #endif // QT_CONFIG(combobox) -#ifndef QT_NO_SPINBOX +#if QT_CONFIG(spinbox) class QUIntSpinBox : public QSpinBox { @@ -107,7 +111,7 @@ Q_SIGNALS: void uintValueChanged(); }; -#endif // QT_NO_SPINBOX +#endif // QT_CONFIG(spinbox) /*! \class QItemEditorFactory @@ -242,7 +246,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) cb->setFrame(false); return cb; } #endif -#ifndef QT_NO_SPINBOX +#if QT_CONFIG(spinbox) case QVariant::UInt: { QSpinBox *sb = new QUIntSpinBox(parent); sb->setFrame(false); @@ -274,7 +278,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) case QVariant::Pixmap: return new QLabel(parent); #endif -#ifndef QT_NO_SPINBOX +#if QT_CONFIG(spinbox) case QVariant::Double: { QDoubleSpinBox *sb = new QDoubleSpinBox(parent); sb->setFrame(false); @@ -282,7 +286,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) sb->setMaximum(DBL_MAX); return sb; } #endif -#ifndef QT_NO_LINEEDIT +#if QT_CONFIG(lineedit) case QVariant::String: default: { // the default editor is a lineedit @@ -306,7 +310,7 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const case QVariant::Bool: return "currentIndex"; #endif -#ifndef QT_NO_SPINBOX +#if QT_CONFIG(spinbox) case QVariant::UInt: case QVariant::Int: case QVariant::Double: @@ -535,7 +539,7 @@ QItemEditorCreatorBase::~QItemEditorCreatorBase() \reimp */ -#ifndef QT_NO_LINEEDIT +#if QT_CONFIG(lineedit) QExpandingLineEdit::QExpandingLineEdit(QWidget *parent) : QLineEdit(parent), originalWidth(-1), widgetOwnsGeometry(false) @@ -595,7 +599,7 @@ void QExpandingLineEdit::resizeToContents() } } -#endif // QT_NO_LINEEDIT +#endif // QT_CONFIG(lineedit) #if QT_CONFIG(combobox) @@ -620,7 +624,7 @@ bool QBooleanComboBox::value() const QT_END_NAMESPACE -#if !defined(QT_NO_LINEEDIT) || QT_CONFIG(combobox) +#if QT_CONFIG(lineedit) || QT_CONFIG(combobox) #include "qitemeditorfactory.moc" #endif diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h index 409ecc684f..46a8da1d8f 100644 --- a/src/widgets/itemviews/qitemeditorfactory_p.h +++ b/src/widgets/itemviews/qitemeditorfactory_p.h @@ -53,9 +53,9 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> -#include <qlineedit.h> -#ifndef QT_NO_LINEEDIT +#if QT_CONFIG(lineedit) +#include <qlineedit.h> QT_REQUIRE_CONFIG(itemviews); @@ -89,6 +89,6 @@ private: QT_END_NAMESPACE -#endif // QT_NO_LINEEDIT +#endif // QT_CONFIG(lineedit) #endif //QITEMEDITORFACTORY_P_H diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index bda3325adb..716df2c729 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -42,9 +42,13 @@ #include <qabstractitemmodel.h> #include <qapplication.h> #include <qbrush.h> +#if QT_CONFIG(lineedit) #include <qlineedit.h> +#endif +#if QT_CONFIG(textedit) #include <qtextedit.h> #include <qplaintextedit.h> +#endif #include <qpainter.h> #include <qpalette.h> #include <qpoint.h> @@ -501,7 +505,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor, // let the editor take up all available space //if the editor is not a QLineEdit //or it is in a QTableView -#if QT_CONFIG(tableview) && !defined(QT_NO_LINEEDIT) +#if QT_CONFIG(tableview) && QT_CONFIG(lineedit) if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget)) opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor); else |