Convert features.completer to QT_[REQUIRE_]CONFIG

Change-Id: If45a46c08b37d245229a39f3d6ffbb34154934f2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-09-02 20:52:48 +02:00
parent 66d9a2b997
commit 093064fdeb
18 changed files with 74 additions and 68 deletions

View File

@ -63,7 +63,9 @@
#include <QtWidgets/qdialogbuttonbox.h>
#if QT_CONFIG(completer)
#include <private/qcompleter_p.h>
#endif
#include "ui_qprintpropertieswidget.h"
#include "ui_qprintsettingsoutput.h"
#include "ui_qprintwidget.h"
@ -679,7 +681,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter *
}
widget.properties->setEnabled(true);
#if QT_CONFIG(filesystemmodel) && !defined(QT_NO_COMPLETER)
#if QT_CONFIG(filesystemmodel) && QT_CONFIG(completer)
QFileSystemModel *fsm = new QFileSystemModel(widget.filename);
fsm->setRootPath(QDir::homePath());
widget.filename->setCompleter(new QCompleter(fsm, widget.filename));

View File

@ -4130,7 +4130,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const
return parts;
}
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
QT_END_NAMESPACE

View File

@ -69,7 +69,9 @@
#include <qstackedwidget.h>
#include <qdialogbuttonbox.h>
#include <qabstractproxymodel.h>
#if QT_CONFIG(completer)
#include <qcompleter.h>
#endif
#include <qpointer.h>
#include <qdebug.h>
#include "qsidebar_p.h"

View File

@ -143,8 +143,6 @@
#include "qcompleter_p.h"
#ifndef QT_NO_COMPLETER
#include "QtWidgets/qscrollbar.h"
#include "QtCore/qstringlistmodel.h"
#if QT_CONFIG(dirmodel)
@ -1902,5 +1900,3 @@ QT_END_NAMESPACE
#include "moc_qcompleter.cpp"
#include "moc_qcompleter_p.cpp"
#endif // QT_NO_COMPLETER

View File

@ -47,11 +47,10 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qrect.h>
QT_REQUIRE_CONFIG(completer);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_COMPLETER
class QCompleterPrivate;
class QAbstractItemView;
class QAbstractProxyModel;
@ -162,8 +161,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_fileSystemModelDirectoryLoaded(const QString&))
};
#endif // QT_NO_COMPLETER
QT_END_NAMESPACE
#endif // QCOMPLETER_H

View File

@ -55,8 +55,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qobject_p.h"
#ifndef QT_NO_COMPLETER
#include "QtWidgets/qabstractitemview.h"
#include "QtCore/qabstractproxymodel.h"
#include "qcompleter.h"
@ -64,6 +62,8 @@
#include "QtGui/qpainter.h"
#include "private/qabstractproxymodel_p.h"
QT_REQUIRE_CONFIG(completer);
QT_BEGIN_NAMESPACE
class QCompletionModel;
@ -258,6 +258,4 @@ class QCompletionModelPrivate : public QAbstractProxyModelPrivate
QT_END_NAMESPACE
#endif // QT_NO_COMPLETER
#endif // QCOMPLETER_P_H

View File

@ -3,14 +3,19 @@
HEADERS += \
util/qsystemtrayicon.h \
util/qcolormap.h \
util/qcompleter.h \
util/qcompleter_p.h \
util/qsystemtrayicon_p.h
SOURCES += \
util/qsystemtrayicon.cpp \
util/qcolormap.cpp \
util/qcompleter.cpp
util/qcolormap.cpp
qtConfig(completer) {
HEADERS += \
util/qcompleter.h \
util/qcompleter_p.h
SOURCES += util/qcompleter.cpp
}
qtConfig(scroller) {
HEADERS += \

View File

@ -107,7 +107,7 @@ QComboBoxPrivate::QComboBoxPrivate()
#ifdef Q_OS_MAC
, m_platformMenu(0)
#endif
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
, completer(0)
#endif
{
@ -193,7 +193,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
return menuOption;
}
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)
{
Q_Q(QComboBox);
@ -214,7 +214,7 @@ void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)
}
# endif // QT_KEYPAD_NAVIGATION
}
#endif // !QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
void QComboBoxPrivate::updateArrow(QStyle::StateFlag state)
{
@ -1196,7 +1196,7 @@ Qt::MatchFlags QComboBoxPrivate::matchFlags() const
{
// Base how duplicates are determined on the autocompletion case sensitivity
Qt::MatchFlags flags = Qt::MatchFixedString;
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive)
#endif
flags |= Qt::MatchCaseSensitive;
@ -1425,7 +1425,7 @@ int QComboBox::maxCount() const
return d->maxCount;
}
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
/*!
\property QComboBox::autoCompletion
@ -1520,7 +1520,7 @@ void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity
d->lineEdit->completer()->setCaseSensitivity(sensitivity);
}
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
/*!
\property QComboBox::duplicatesEnabled
@ -1802,12 +1802,12 @@ void QComboBox::setLineEdit(QLineEdit *edit)
d->updateFocusPolicy();
d->lineEdit->setFocusProxy(this);
d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
setAutoCompletion(d->autoCompletion);
#endif
#ifdef QT_KEYPAD_NAVIGATION
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (QApplication::keypadNavigationEnabled()) {
// Editable combo boxes will have a completer that is set to UnfilteredPopupCompletion.
// This means that when the user enters edit mode they are immediately presented with a
@ -1871,7 +1871,7 @@ const QValidator *QComboBox::validator() const
}
#endif // QT_NO_VALIDATOR
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
/*!
\fn void QComboBox::setCompleter(QCompleter *completer)
@ -1911,7 +1911,7 @@ QCompleter *QComboBox::completer() const
return d->lineEdit ? d->lineEdit->completer() : 0;
}
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
/*!
Returns the item delegate used by the popup list view.
@ -1977,7 +1977,7 @@ void QComboBox::setModel(QAbstractItemModel *model)
if (model == d->model)
return;
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (d->lineEdit && d->lineEdit->completer()
&& d->lineEdit->completer() == d->completer)
d->lineEdit->completer()->setModel(model);
@ -2123,7 +2123,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
const QString newText = itemText(normalized);
if (lineEdit->text() != newText) {
lineEdit->setText(newText); // may cause lineEdit -> nullptr (QTBUG-54191)
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (lineEdit && lineEdit->completer())
lineEdit->completer()->setCompletionPrefix(newText);
#endif
@ -2574,7 +2574,7 @@ void QComboBox::showPopup()
#endif // Q_OS_MAC
#ifdef QT_KEYPAD_NAVIGATION
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (QApplication::keypadNavigationEnabled() && d->completer) {
// editable combo box is line edit plus completer
setEditFocus(true);
@ -2911,7 +2911,7 @@ void QComboBox::focusInEvent(QFocusEvent *e)
update();
if (d->lineEdit) {
d->lineEdit->event(e);
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (d->lineEdit->completer())
d->lineEdit->completer()->setWidget(this);
#endif
@ -3137,7 +3137,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
{
Q_D(QComboBox);
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (d->lineEdit
&& d->lineEdit->completer()
&& d->lineEdit->completer()->popup()
@ -3473,7 +3473,7 @@ void QComboBox::setModelColumn(int visibleColumn)
QListView *lv = qobject_cast<QListView *>(d->viewContainer()->itemView());
if (lv)
lv->setModelColumn(visibleColumn);
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (d->lineEdit && d->lineEdit->completer()
&& d->lineEdit->completer() == d->completer)
d->lineEdit->completer()->setCompletionColumn(visibleColumn);

View File

@ -71,10 +71,10 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget
Q_PROPERTY(int minimumContentsLength READ minimumContentsLength WRITE setMinimumContentsLength)
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false)
Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity DESIGNABLE false)
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled)
Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
@ -91,7 +91,7 @@ public:
void setMaxCount(int max);
int maxCount() const;
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
bool autoCompletion() const;
void setAutoCompletion(bool enable);
@ -149,7 +149,7 @@ public:
const QValidator *validator() const;
#endif
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
void setCompleter(QCompleter *c);
QCompleter *completer() const;
#endif
@ -262,7 +262,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex & parent, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_modelReset())
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
Q_PRIVATE_SLOT(d_func(), void _q_completerActivated(const QModelIndex &index))
#endif
};

View File

@ -67,7 +67,9 @@
#include "QtCore/qtimer.h"
#include "private/qwidget_p.h"
#include "QtCore/qpointer.h"
#if QT_CONFIG(completer)
#include "QtWidgets/qcompleter.h"
#endif
#include "QtGui/qevent.h"
#include "QtCore/qdebug.h"
@ -355,7 +357,7 @@ public:
void _q_emitCurrentIndexChanged(const QModelIndex &index);
void _q_modelDestroyed();
void _q_modelReset();
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
void _q_completerActivated(const QModelIndex &index);
#endif
void _q_resetButton();
@ -415,7 +417,7 @@ public:
#ifdef Q_OS_MAC
QPlatformMenu *m_platformMenu;
#endif
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
QPointer<QCompleter> completer;
#endif
static QPalette viewContainerPalette(QComboBox *cmb)

View File

@ -615,7 +615,7 @@ void QLineEdit::setValidator(const QValidator *v)
}
#endif // QT_NO_VALIDATOR
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
/*!
\since 4.2
@ -667,7 +667,7 @@ QCompleter *QLineEdit::completer() const
return d->control->completer();
}
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
/*!
Returns a recommended size for the widget.
@ -1742,7 +1742,7 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e)
d->control->processInputMethodEvent(e);
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (!e->commitString().isEmpty())
d->control->complete(Qt::Key_unknown);
#endif
@ -1823,7 +1823,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
d->control->setCancelText(d->control->text());
}
#endif
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (d->control->completer()) {
d->control->completer()->setWidget(this);
QObject::connect(d->control->completer(), SIGNAL(activated(QString)),
@ -1870,7 +1870,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e)
#ifdef QT_KEYPAD_NAVIGATION
d->control->setCancelText(QString());
#endif
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (d->control->completer()) {
QObject::disconnect(d->control->completer(), 0, this, 0);
}

View File

@ -124,7 +124,7 @@ public:
const QValidator * validator() const;
#endif
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
void setCompleter(QCompleter *completer);
QCompleter *completer() const;
#endif
@ -250,7 +250,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate())
Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &))
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int))
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(const QString &))
#endif
#ifdef QT_KEYPAD_NAVIGATION

View File

@ -90,7 +90,7 @@ QRect QLineEditPrivate::cursorRect() const
return adjustedControlRect(control->cursorRect());
}
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
void QLineEditPrivate::_q_completionHighlighted(const QString &newText)
{
@ -111,7 +111,7 @@ void QLineEditPrivate::_q_completionHighlighted(const QString &newText)
}
}
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
void QLineEditPrivate::_q_handleWindowActivate()
{
@ -124,7 +124,7 @@ void QLineEditPrivate::_q_textEdited(const QString &text)
{
Q_Q(QLineEdit);
emit q->textEdited(text);
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (control->completer()
&& control->completer()->completionMode() != QCompleter::InlineCompletion)
control->complete(-1); // update the popup on cut/paste/del

View File

@ -63,7 +63,9 @@
#include "QtGui/qicon.h"
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qbasictimer.h"
#if QT_CONFIG(completer)
#include "QtWidgets/qcompleter.h"
#endif
#include "QtCore/qpointer.h"
#include "QtCore/qmimedata.h"
@ -203,7 +205,7 @@ public:
#endif
void _q_selectionChanged();
void _q_updateNeeded(const QRect &);
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
void _q_completionHighlighted(const QString &);
#endif
QPoint mousePressPos;

View File

@ -1428,7 +1428,7 @@ void QWidgetLineControl::emitCursorPositionChanged()
}
}
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
// iterating forward(dir=1)/backward(dir=-1) from the
// current row based. dir=0 indicates a new completion prefix was set.
bool QWidgetLineControl::advanceToEnabledItem(int dir)
@ -1627,7 +1627,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
{
bool inlineCompletionAccepted = false;
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
if (m_completer) {
QCompleter::CompletionMode completionMode = m_completer->completionMode();
if ((completionMode == QCompleter::PopupCompletion
@ -1672,7 +1672,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
}
}
}
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
if (hasAcceptableInput() || fixup()) {
@ -1774,7 +1774,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
end(1);
}
else if (event == QKeySequence::MoveToNextChar) {
#if defined(QT_NO_COMPLETER)
#if !QT_CONFIG(completer)
const bool inlineCompletion = false;
#else
const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
@ -1791,7 +1791,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
}
else if (event == QKeySequence::MoveToPreviousChar) {
#if defined(QT_NO_COMPLETER)
#if !QT_CONFIG(completer)
const bool inlineCompletion = false;
#else
const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
@ -1886,7 +1886,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
del();
}
break;
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
case Qt::Key_Up:
case Qt::Key_Down:
complete(event->key());
@ -1901,7 +1901,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
case Qt::Key_Backspace:
if (!isReadOnly()) {
backspace();
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
complete(Qt::Key_Backspace);
#endif
}
@ -1941,7 +1941,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
&& !isReadOnly()
&& isAcceptableInput(event)) {
insert(event->text());
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
complete(event->key());
#endif
event->accept();

View File

@ -62,7 +62,9 @@
#include "QtGui/qclipboard.h"
#include "QtGui/qinputmethod.h"
#include "QtCore/qpoint.h"
#if QT_CONFIG(completer)
#include "QtWidgets/qcompleter.h"
#endif
#include "QtCore/qthread.h"
#include "QtGui/private/qinputcontrol_p.h"
@ -289,7 +291,7 @@ public:
void setValidator(const QValidator *v) { m_validator = const_cast<QValidator*>(v); }
#endif
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
QCompleter *completer() const { return m_completer; }
/* Note that you must set the widget for the completer separately */
void setCompleter(const QCompleter *c) { m_completer = const_cast<QCompleter*>(c); }
@ -461,7 +463,7 @@ private:
QPointer<QValidator> m_validator;
#endif
QPointer<QCompleter> m_completer;
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
bool advanceToEnabledItem(int dir);
#endif

View File

@ -83,7 +83,7 @@ private slots:
void customPaperSizeAndMargins();
void customPaperNameSettingBySize();
void customPaperNameSettingByName();
#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog)
#if QT_CONFIG(completer) && QT_CONFIG(filedialog)
void printDialogCompleter();
#endif
void testCurrentPage();
@ -587,7 +587,7 @@ void tst_QPrinter::customPaperSizeAndMargins()
}
}
#if !defined(QT_NO_COMPLETER) && QT_CONFIG(filedialog)
#if QT_CONFIG(completer) && QT_CONFIG(filedialog)
void tst_QPrinter::printDialogCompleter()
{
QPrintDialog dialog;

View File

@ -261,7 +261,7 @@ private slots:
// task-specific tests:
void task180999_focus();
void task174640_editingFinished();
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
void task198789_currentCompletion();
void task210502_caseInsensitiveInlineCompletion();
#endif
@ -3630,7 +3630,7 @@ void tst_QLineEdit::task174640_editingFinished()
QCOMPARE(editingFinishedSpy.count(), 1);
}
#ifndef QT_NO_COMPLETER
#if QT_CONFIG(completer)
class task198789_Widget : public QWidget
{
Q_OBJECT
@ -3689,7 +3689,7 @@ void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion()
QCOMPARE(lineEdit.text(), completion);
}
#endif // QT_NO_COMPLETER
#endif // QT_CONFIG(completer)
void tst_QLineEdit::task229938_dontEmitChangedWhenTextIsNotChanged()