Convert features.textedit to QT_[REQUIRE_]CONFIG

Change-Id: I0fb0e658796484f374586d8d1f0f1b9167ab30d2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-09-03 18:44:21 +02:00
parent 14e20bb474
commit 9833e68217
19 changed files with 66 additions and 64 deletions

View File

@ -167,7 +167,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QSplitterHandle")) {
iface = new QAccessibleWidget(widget, QAccessible::Grip);
#endif
#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
#if QT_CONFIG(textedit) && !defined(QT_NO_CURSOR)
} else if (classname == QLatin1String("QTextEdit")) {
iface = new QAccessibleTextEdit(widget);
} else if (classname == QLatin1String("QPlainTextEdit")) {

View File

@ -41,11 +41,13 @@
#include "qabstracttextdocumentlayout.h"
#include "qapplication.h"
#include "qclipboard.h"
#include "qtextedit.h"
#include "private/qtextedit_p.h"
#include "qtextdocument.h"
#include "qtextobject.h"
#if QT_CONFIG(textedit)
#include "qplaintextedit.h"
#include "qtextedit.h"
#include "private/qtextedit_p.h"
#endif
#include "qtextboundaryfinder.h"
#if QT_CONFIG(scrollbar)
#include "qscrollbar.h"
@ -86,6 +88,7 @@
#include <QMainWindow>
#endif
#include <QFocusFrame>
#include <QMenu>
#ifndef QT_NO_ACCESSIBILITY
@ -117,7 +120,7 @@ QList<QWidget*> childWidgets(const QWidget *widget)
return widgets;
}
#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)
#if QT_CONFIG(textedit) && !defined(QT_NO_CURSOR)
QAccessiblePlainTextEdit::QAccessiblePlainTextEdit(QWidget* o)
:QAccessibleTextWidget(o)
@ -314,7 +317,7 @@ void QAccessibleTextEdit::scrollToSubstring(int startIndex, int endIndex)
qWarning("AccessibleTextEdit::scrollToSubstring failed!");
}
#endif // QT_NO_TEXTEDIT && QT_NO_CURSOR
#endif // QT_CONFIG(textedit) && QT_NO_CURSOR
#if QT_CONFIG(stackedwidget)
// ======================= QAccessibleStackedWidget ======================

View File

@ -132,7 +132,7 @@ protected:
virtual QWidget *viewport() const = 0;
};
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
class QAccessiblePlainTextEdit : public QAccessibleTextWidget
{
public:
@ -184,7 +184,7 @@ protected:
QTextDocument *textDocument() const Q_DECL_OVERRIDE;
QWidget *viewport() const Q_DECL_OVERRIDE;
};
#endif // QT_NO_TEXTEDIT
#endif // QT_CONFIG(textedit)
#endif //QT_NO_CURSOR
class QAccessibleStackedWidget : public QAccessibleWidget

View File

@ -54,7 +54,9 @@
#include <QtGui/qicon.h>
#include <QtGui/qtextdocument.h>
#include <QtWidgets/qapplication.h>
#if QT_CONFIG(textedit)
#include <QtWidgets/qtextedit.h>
#endif
#include <QtWidgets/qmenu.h>
#include "qdialog_p.h"
#include <QtGui/qfont.h>
@ -83,7 +85,7 @@ enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5
NewButtonMask = 0xFFFFFC00 };
enum DetailButtonLabel { ShowLabel = 0, HideLabel = 1 };
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
class QMessageBoxDetailsText : public QWidget
{
Q_OBJECT
@ -152,7 +154,7 @@ private:
bool copyAvailable;
TextEdit *textEdit;
};
#endif // QT_NO_TEXTEDIT
#endif // QT_CONFIG(textedit)
class DetailButton : public QPushButton
{
@ -192,7 +194,7 @@ class QMessageBoxPrivate : public QDialogPrivate
public:
QMessageBoxPrivate() : escapeButton(0), defaultButton(0), checkbox(0), clickedButton(0), detailsButton(0),
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
detailsText(0),
#endif
compatMode(false), autoAddOkButton(true),
@ -242,7 +244,7 @@ public:
QCheckBox *checkbox;
QAbstractButton *clickedButton;
DetailButton *detailsButton;
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
QMessageBoxDetailsText *detailsText;
#endif
bool compatMode;
@ -463,7 +465,7 @@ int QMessageBoxPrivate::execReturnCode(QAbstractButton *button)
void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
{
Q_Q(QMessageBox);
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
if (detailsButton && detailsText && button == detailsButton) {
detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel);
detailsText->setHidden(!detailsText->isHidden());
@ -1417,7 +1419,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT)
#if !defined(QT_NO_TEXTEDIT)
#if QT_CONFIG(textedit)
if (e == QKeySequence::Copy) {
if (d->detailsText && d->detailsText->isVisible() && d->detailsText->copy()) {
e->setAccepted(true);
@ -1428,7 +1430,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
e->setAccepted(true);
return;
}
#endif // !QT_NO_TEXTEDIT
#endif // QT_CONFIG(textedit)
#if defined(Q_OS_WIN)
if (e == QKeySequence::Copy) {
@ -1444,7 +1446,7 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
for (const auto *button : buttons)
textToCopy += button->text() + QLatin1String(" ");
textToCopy += QLatin1Char('\n') + separator;
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
if (d->detailsText)
textToCopy += d->detailsText->text() + QLatin1Char('\n') + separator;
#endif
@ -1982,7 +1984,7 @@ int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon ico
void QMessageBoxPrivate::retranslateStrings()
{
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
if (detailsButton)
detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel);
#endif
@ -2437,7 +2439,7 @@ void QMessageBox::setButtonText(int button, const QString &text)
}
}
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
/*!
\property QMessageBox::detailedText
\brief the text to be displayed in the details area.
@ -2485,7 +2487,7 @@ void QMessageBox::setDetailedText(const QString &text)
}
d->setupLayout();
}
#endif // QT_NO_TEXTEDIT
#endif // QT_CONFIG(textedit)
/*!
\property QMessageBox::informativeText

View File

@ -61,7 +61,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText)
#endif
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText)
@ -270,7 +270,7 @@ public:
QString informativeText() const;
void setInformativeText(const QString &text);
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
QString detailedText() const;
void setDetailedText(const QString &text);
#endif

View File

@ -56,7 +56,9 @@
#if QT_CONFIG(lineedit)
#include <QtWidgets/qlineedit.h>
#endif
#if QT_CONFIG(textedit)
#include <QtWidgets/qtextedit.h>
#endif
QT_BEGIN_NAMESPACE

View File

@ -52,8 +52,10 @@
#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>
@ -435,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()) {
@ -449,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);

View File

@ -45,8 +45,10 @@
#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>

View File

@ -43,7 +43,9 @@
#include "qpixmapstyle_p_p.h"
#include <QDebug>
#if QT_CONFIG(textedit)
#include <QTextEdit>
#endif
#include <QStringBuilder>
#include <QPainter>
#include <QPixmapCache>

View File

@ -60,8 +60,10 @@
#include "qvariant.h"
#include "qvector.h"
#include "qdebug.h"
#if QT_CONFIG(textedit)
#include "qtextedit.h"
#include <private/qtextedit_p.h>
#endif
#include <private/qwidgettextcontrol_p.h>
#ifndef QT_NO_ACCESSIBILITY

View File

@ -63,8 +63,6 @@
#include <qtexttable.h>
#include <qvariant.h>
#ifndef QT_NO_TEXTEDIT
QT_BEGIN_NAMESPACE
static inline bool shouldEnableInputMethod(QPlainTextEdit *plaintextedit)
@ -3194,5 +3192,3 @@ QT_END_NAMESPACE
#include "moc_qplaintextedit.cpp"
#include "moc_qplaintextedit_p.cpp"
#endif // QT_NO_TEXTEDIT

View File

@ -50,11 +50,10 @@
#include <QtGui/qtextformat.h>
#include <QtGui/qabstracttextdocumentlayout.h>
#ifndef QT_NO_TEXTEDIT
QT_REQUIRE_CONFIG(textedit);
QT_BEGIN_NAMESPACE
class QStyleSheet;
class QTextDocument;
class QMenu;
@ -329,7 +328,4 @@ private:
QT_END_NAMESPACE
#endif // QT_NO_TEXTEDIT
#endif // QPLAINTEXTEDIT_H

View File

@ -64,10 +64,10 @@
#include "QtCore/qbasictimer.h"
#include "qplaintextedit.h"
#ifndef QT_NO_TEXTEDIT
#include "private/qwidgettextcontrol_p.h"
QT_REQUIRE_CONFIG(textedit);
QT_BEGIN_NAMESPACE
class QMimeData;
@ -187,6 +187,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_TEXTEDIT
#endif // QPLAINTEXTEDIT_P_H

View File

@ -45,7 +45,6 @@
#include "qtextbrowser.h"
#endif
#ifndef QT_NO_TEXTEDIT
#include <qfont.h>
#include <qpainter.h>
#include <qevent.h>
@ -71,12 +70,8 @@
#include <qtexttable.h>
#include <qvariant.h>
#endif
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTEDIT
static inline bool shouldEnableInputMethod(QTextEdit *textedit)
{
return !textedit->isReadOnly();
@ -2639,8 +2634,6 @@ void QTextEdit::ensureCursorVisible()
(\a available is true) or unavailable (\a available is false).
*/
#endif // QT_NO_TEXTEDIT
QT_END_NAMESPACE
#include "moc_qtextedit.cpp"

View File

@ -47,12 +47,10 @@
#include <QtGui/qtextcursor.h>
#include <QtGui/qtextformat.h>
#ifndef QT_NO_TEXTEDIT
QT_REQUIRE_CONFIG(textedit);
QT_BEGIN_NAMESPACE
class QStyleSheet;
class QTextDocument;
class QMenu;
@ -321,6 +319,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEdit::AutoFormatting)
QT_END_NAMESPACE
#endif // QT_NO_TEXTEDIT
#endif // QTEXTEDIT_H

View File

@ -65,10 +65,10 @@
#include "QtCore/qurl.h"
#include "qtextedit.h"
#ifndef QT_NO_TEXTEDIT
#include "private/qwidgettextcontrol_p.h"
QT_REQUIRE_CONFIG(textedit);
QT_BEGIN_NAMESPACE
class QMimeData;
@ -141,6 +141,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_TEXTEDIT
#endif // QTEXTEDIT_P_H

View File

@ -53,7 +53,9 @@
#include <qtimer.h>
#include "private/qtextdocumentlayout_p.h"
#include "private/qabstracttextdocumentlayout_p.h"
#if QT_CONFIG(textedit)
#include "private/qtextedit_p.h"
#endif
#include "qtextdocument.h"
#include "private/qtextdocument_p.h"
#include "qtextlist.h"
@ -1349,7 +1351,7 @@ process:
QVariant QWidgetTextControl::loadResource(int type, const QUrl &name)
{
#ifdef QT_NO_TEXTEDIT
#if !QT_CONFIG(textedit)
Q_UNUSED(type);
Q_UNUSED(name);
#else
@ -2410,7 +2412,7 @@ void QWidgetTextControl::setAcceptRichText(bool accept)
d->acceptRichText = accept;
}
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
void QWidgetTextControl::setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections)
{
@ -2474,7 +2476,7 @@ QList<QTextEdit::ExtraSelection> QWidgetTextControl::extraSelections() const
return selections;
}
#endif // QT_NO_TEXTEDIT
#endif // QT_CONFIG(textedit)
void QWidgetTextControl::setTextWidth(qreal width)
{
@ -3295,7 +3297,7 @@ void QUnicodeControlCharacterMenu::menuActionTriggered()
QChar c(qt_controlCharacters[idx].character);
QString str(c);
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
if (QTextEdit *edit = qobject_cast<QTextEdit *>(editWidget)) {
edit->insertPlainText(str);
return;

View File

@ -56,7 +56,9 @@
#include <QtGui/qtextoption.h>
#include <QtGui/qtextcursor.h>
#include <QtGui/qtextformat.h>
#if QT_CONFIG(textedit)
#include <QtWidgets/qtextedit.h>
#endif
#include <QtWidgets/qmenu.h>
#include <QtCore/qrect.h>
#include <QtGui/qabstracttextdocumentlayout.h>
@ -148,7 +150,7 @@ public:
bool acceptRichText() const;
void setAcceptRichText(bool accept);
#ifndef QT_NO_TEXTEDIT
#if QT_CONFIG(textedit)
void setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections);
QList<QTextEdit::ExtraSelection> extraSelections() const;
#endif

View File

@ -5,8 +5,6 @@ HEADERS += \
widgets/qframe_p.h \
widgets/qmenu.h \
widgets/qmenu_p.h \
widgets/qtextedit.h \
widgets/qtextedit_p.h \
widgets/qtoolbar.h \
widgets/qtoolbar_p.h \
widgets/qtoolbarlayout_p.h \
@ -15,22 +13,18 @@ HEADERS += \
widgets/qabstractscrollarea_p.h \
widgets/qfocusframe.h \
widgets/qwidgetanimator_p.h \
widgets/qtoolbararealayout_p.h \
widgets/qplaintextedit.h \
widgets/qplaintextedit_p.h
widgets/qtoolbararealayout_p.h
SOURCES += \
widgets/qframe.cpp \
widgets/qmenu.cpp \
widgets/qtextedit.cpp \
widgets/qtoolbar.cpp \
widgets/qtoolbarlayout.cpp \
widgets/qtoolbarseparator.cpp \
widgets/qabstractscrollarea.cpp \
widgets/qfocusframe.cpp \
widgets/qwidgetanimator.cpp \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp
widgets/qtoolbararealayout.cpp
qtConfig(abstractbutton) {
HEADERS += \
@ -305,6 +299,18 @@ qtConfig(tabbar) {
SOURCES += widgets/qtabbar.cpp
}
qtConfig(textedit) {
HEADERS += \
widgets/qplaintextedit.h \
widgets/qplaintextedit_p.h \
widgets/qtextedit.h \
widgets/qtextedit_p.h
SOURCES += \
widgets/qplaintextedit.cpp \
widgets/qtextedit.cpp
}
qtConfig(textbrowser) {
HEADERS += widgets/qtextbrowser.h
SOURCES += widgets/qtextbrowser.cpp