summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qcombobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qcombobox.cpp')
-rw-r--r--src/widgets/widgets/qcombobox.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 9a375ae420..cd2e20694e 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -52,7 +52,9 @@
#endif
#include <qitemdelegate.h>
#include <qmap.h>
+#if QT_CONFIG(menu)
#include <qmenu.h>
+#endif
#include <qevent.h>
#include <qlayout.h>
#include <qscrollbar.h>
@@ -71,7 +73,7 @@
#include <private/qabstractscrollarea_p.h>
#include <private/qlineedit_p.h>
#include <qdebug.h>
-#ifndef QT_NO_EFFECTS
+#if QT_CONFIG(effects)
# include <private/qeffects_p.h>
#endif
#ifndef QT_NO_ACCESSIBILITY
@@ -103,7 +105,7 @@ QComboBoxPrivate::QComboBoxPrivate()
#ifdef Q_OS_MAC
, m_platformMenu(0)
#endif
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
, completer(0)
#endif
{
@@ -189,7 +191,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);
@@ -224,7 +226,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)
{
@@ -1128,7 +1130,7 @@ void QComboBoxPrivate::updateViewContainerPaletteAndOpacity()
Q_Q(QComboBox);
QStyleOptionComboBox opt;
q->initStyleOption(&opt);
-#ifndef QT_NO_MENU
+#if QT_CONFIG(menu)
if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) {
QMenu menu;
menu.ensurePolished();
@@ -1214,7 +1216,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;
@@ -1443,7 +1445,7 @@ int QComboBox::maxCount() const
return d->maxCount;
}
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
/*!
\property QComboBox::autoCompletion
@@ -1538,7 +1540,7 @@ void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity
d->lineEdit->completer()->setCaseSensitivity(sensitivity);
}
-#endif // QT_NO_COMPLETER
+#endif // QT_CONFIG(completer)
/*!
\property QComboBox::duplicatesEnabled
@@ -1820,12 +1822,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
@@ -1889,7 +1891,7 @@ const QValidator *QComboBox::validator() const
}
#endif // QT_NO_VALIDATOR
-#ifndef QT_NO_COMPLETER
+#if QT_CONFIG(completer)
/*!
\fn void QComboBox::setCompleter(QCompleter *completer)
@@ -1929,7 +1931,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.
@@ -1995,7 +1997,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);
@@ -2141,7 +2143,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
@@ -2592,7 +2594,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);
@@ -2754,7 +2756,7 @@ void QComboBox::showPopup()
const bool updatesEnabled = container->updatesEnabled();
#endif
-#if !defined(QT_NO_EFFECTS)
+#if QT_CONFIG(effects)
bool scrollDown = (listRect.topLeft() == below);
if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)
&& !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen))
@@ -2826,7 +2828,7 @@ void QComboBox::hidePopup()
{
Q_D(QComboBox);
if (d->container && d->container->isVisible()) {
-#if !defined(QT_NO_EFFECTS)
+#if QT_CONFIG(effects)
QSignalBlocker modelBlocker(d->model);
QSignalBlocker viewBlocker(d->container->itemView());
QSignalBlocker containerBlocker(d->container);
@@ -2870,7 +2872,7 @@ void QComboBox::hidePopup()
modelBlocker.unblock();
if (!didFade)
-#endif // QT_NO_EFFECTS
+#endif // QT_CONFIG(effects)
// Fade should implicitly hide as well ;-)
d->container->hide();
}
@@ -2934,7 +2936,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
@@ -3160,7 +3162,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()
@@ -3496,7 +3498,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);