Merge remote-tracking branch 'origin/5.9' into 5.10

Conflicts:
	examples/opengl/qopenglwidget/main.cpp
	src/3rdparty/pcre2/src/pcre2_printint.c
	src/plugins/platforms/cocoa/qnsview.mm
	src/widgets/widgets/qcombobox.cpp

Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
This commit is contained in:
Liang Qi 2017-09-06 13:26:31 +02:00
commit 19dd2ca93b
125 changed files with 936 additions and 1221 deletions

View File

@ -144,6 +144,7 @@ Build options:
-ltcg ................ Use Link Time Code Generation [no] -ltcg ................ Use Link Time Code Generation [no]
-use-gold-linker ..... Use the GNU gold linker [auto] -use-gold-linker ..... Use the GNU gold linker [auto]
-incredibuild-xge .... Use the IncrediBuild XGE [no] (Windows only) -incredibuild-xge .... Use the IncrediBuild XGE [no] (Windows only)
-ccache .............. Use the ccache compiler cache [no] (Unix only)
-make-tool <tool> .... Use <tool> to build qmake [nmake] (Windows only) -make-tool <tool> .... Use <tool> to build qmake [nmake] (Windows only)
-mp .................. Use multiple processors for compilation (MSVC only) -mp .................. Use multiple processors for compilation (MSVC only)

View File

@ -61,6 +61,7 @@
"avx2": "boolean", "avx2": "boolean",
"avx512": { "type": "boolean", "name": "avx512f" }, "avx512": { "type": "boolean", "name": "avx512f" },
"c++std": "cxxstd", "c++std": "cxxstd",
"ccache": { "type": "boolean", "name": "ccache" },
"commercial": "void", "commercial": "void",
"compile-examples": { "type": "boolean", "name": "compile_examples" }, "compile-examples": { "type": "boolean", "name": "compile_examples" },
"confirm-license": "void", "confirm-license": "void",
@ -635,6 +636,11 @@
"label": "IncrediBuild", "label": "IncrediBuild",
"type": "files", "type": "files",
"files": [ "BuildConsole.exe", "xgConsole.exe" ] "files": [ "BuildConsole.exe", "xgConsole.exe" ]
},
"ccache": {
"label": "ccache",
"type": "files",
"files": [ "ccache" ]
} }
}, },
@ -1246,6 +1252,12 @@
"condition": "tests.incredibuild_xge", "condition": "tests.incredibuild_xge",
"output": [ "publicConfig" ] "output": [ "publicConfig" ]
}, },
"ccache": {
"label": "Using ccache",
"autoDetect": false,
"condition": "config.unix && tests.ccache",
"output": [ "privateConfig" ]
},
"msvc_mp": { "msvc_mp": {
"label": "Use multiple processors when compiling with MSVC", "label": "Use multiple processors when compiling with MSVC",
"emitIf": "config.msvc", "emitIf": "config.msvc",
@ -1353,6 +1365,11 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5
"type": "firstAvailableFeature", "type": "firstAvailableFeature",
"args": "c++1z c++14 c++11" "args": "c++1z c++14 c++11"
}, },
{
"type": "feature",
"args": "ccache",
"condition": "config.unix"
},
"use_gold_linker", "use_gold_linker",
{ {
"type": "feature", "type": "feature",

288
dist/changes-5.6.3 vendored Normal file
View File

@ -0,0 +1,288 @@
Qt 5.6.3 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with previous Qt 5.6.x releases.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.6 series is binary compatible with the 5.5.x series.
Applications compiled for 5.5 will continue to run with 5.6.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
*****************************************************************************
* License Changes *
*****************************************************************************
- Static libraries that are linked into executables (winmain and
qopenglextensions) are now licensed under BSD _and_ commercial licenses.
******************************************************************************
* Important Behavior Changes *
******************************************************************************
- QPluginLoader:
* [QTBUG-49061] QPluginLoader no longer performs the actual unloading of
the plugin either on destruction or when unload() is called. This does
not affect QLibrary and QLibrary::unload().
******************************************************************************
* Library *
******************************************************************************
QtCore
------
- QDir:
* [QTBUG-58390] Fixed the implementation of mkpath() to not attempt to
mkdir directories that already exist, especially those in automount
filesystems (like /home).
- QHash / QMultiHash:
* [QTBUG-60395] Fixed a bug that caused operator== not to return true if
two containers had the elements with duplicate keys but in different
order.
- QLocale:
* [QTBUG-59159] Fixed the parsing of day-of-week names that start with the
name of another day.
- QObject:
* [QTBUG-59500] disconnectNotify() is now called when a connection is
disconnected using its QMetaObject::Connection handle.
* [QTBUG-52439] Fixed a bug that would cause applications compiled with the
Intel compiler to fail to connect signals and slots.
- QUrl:
* [QTBUG-60364] Fixed a bug that caused certain domain names that look
like Internationalized Domain Names to become corrupt in decoded forms
of QUrl, notably toString() and toDisplayString().
* Updated the table of valid top level domains
- QVarLengthArray:
* Fixed a bug involving appending an item already in the container to
the container again.
* [QTBUG-57277] Fixed a crash when initializing the array with an empty
std::initializer_list.
QtSql
-----
- MySql
* Fixed the build of MySql plugin with MySql 5.0
* [QTBUG-53397] Fixed the parsing of tinyint(1) when used via prepared
statements.
- PostgreSQL:
* [QTBUG-59524] Fixed datetime formats when the system locale doesn't use
arabic numerals
QtDBus
------
- QDBusServer
* [QTBUG-55087] Fixed a bug causing certain messages that arrive soon after
the client connects not to be processed.
QtNetwork
---------
- QNetworkInterface
* Fixed the reporting of virtual interfaces on Linux.
- QSslSocket
* [QTBUG-43388][QTBUG-55170] Fixed a bug that caused the read buffer's max
size not to be respected when using SecureTransport
* [QTBUG-49554] Made sure that the QSslConfiguration is up-to-date when the
QNetworkReply::encrypted() signal is emitted.
QtGui
-----
- Various fixes to our high DPI support.
- CSS parser:
* [QTBUG-53919] Fixed a crash while parsing malformed CSS.
- PDF writer:
* [QTBUG-56489] Monochrome images are now handled correctly.
- QImage:
* Fixed a crash when rendering to GrayScale8 images.
* [QTBUG-56252] Fixed an illegal memory access when rotating images.
* [QTBUG-59211] Improved rejection of corrupt images with invalid header
info.
- QMatrix4x4:
* operator*=() now calculates the correct result even if the RHS and LHS
are the same object.
- QPainter
* [QTBUG-14614] Fixed a read-after-free when using gradients.
* [QTBUG-56969] Fixed painting artifacts for certain dashed lines.
- Text:
* [QTBUG-55222] Always return a correct list of fallback fonts
* [QTBUG-55255][QTBUG-56714] Trailing whitespace are now properly taken
into account when shaping lines
* [QTBUG-53911] Fixed a crash that could happen if you were doing many
different text layouts with different fonts and superscript or
subscript alignment.
* [QTBUG-56659] Fixed a regression where raster fonts on Windows were
detected as smoothly scalable and thus rendering with said fonts in Qt
Quick would break.
* [QTBUG-51223] Fixed synthesized oblique for non-latin text on
platforms using the basic font database, such as Android.
* [QTBUG-56714] Fixed a bug where a no-break space would sometimes cause
the first character of the containing line to not be displayed.
* [QTBUG-48005] Fixed clipping errors and too small bounding rects for
some right-to-left text.
* [QTBUG-57241] Fixed a crash for very tall glyphs.
* [QTBUG-55569] Fixed Myanmar rendering with some fonts.
* [QTBUG-56659] Fixed the reporting of whether fonts are smoothly scalable
on Windows.
* [QTBUG-58364][QTBUG-42074][QTBUG-57003] Formatting characters are now
accepted as valid input.
QtWidgets
---------
- Input:
* [QTBUG-42074][QTBUG-57003] Characters in Private Use Area, as well as
zero-width joiners and zero-width non-joiners are now accepted as input
in QLineEdit and QTextEdit.
- QDockWidget:
* [QTBUG-7460][QTBUG-52354] Size of widgets no longer changed just because
they are in a floating dock.
* [QTBUG-58036] Dock widgets now have the correct parent after a drag.
* [QTBUG-58049] Fixed clearing the dock indicator when not over a floating
dock group window.
- QMainWindow:
* [QTBUG-56628] Fixed crash using takeCentralWidget when the central
widget was not set.
- QPixmapStyle:
* Now handles progress bars with minimum != 0 correctly.
- QPopup
* [QTBUG-57292] Popups blocked by modal dialogs are now properly closed.
- QTextEdit
* [QTBUG-55758] Placeholder text is no longer shown while composing text.
- QTooltip:
* [QTBUG-55523] QTooltip is now properly hidden when a close event is
received.
* [QTBUG-55523] Tooltips no longer prevent closing of the app on
lastWindowClosed()
- QWidget:
* [QTBUG-50589] Show and hide events are now properly sent to children on
minimize/restore.
* [QTBUG-53068] Fixed enter/leave events on popup menus.
- Style sheets:
* [QTBUG-55597] Now honors the font set on HeaderView section.
******************************************************************************
* Platform-specific Changes *
******************************************************************************
Android
-------
- [QTBUG-44697] Removed old work-around which was causing OpenGL shader
compilation to fail on updated Android emulators.
Darwin
------
- [QTBUG-61034] QT_NO_EXCEPTIONS is now correctly set for Objective C++
source files.
- [QTBUG-57165] Made QDir::tempPath() return the same directory as
NSTemporaryDirectory, instead of a hardcoded "/tmp".
- [QTBUG-55896] Fixed a bug that would cause QFileSystemWatcher to fail to
watch certain paths containing non-ASCII characters.
- [QTBUG-56124] Fixed a bug that would cause data corruption in QSettings
when storing QStrings containing NULs, when storing to native format.
- iOS specific:
* Starting from iOS 10, Apple requires all apps that need access to photos
to have the key 'NSPhotoLibraryUsageDescription' in the Info.plist.
Therefore, to get the same support in Qt (when, e.g., using a file
dialog), the Info.plist assigned to QMAKE_INFO_PLIST will need this key
as well.
* [QTBUG-49893] The shortcuts bar on iPad is now hidden when showing menus.
- macOS specific:
* Speech to text dictation now works for Qt text input.
* Various bug fixes to menu bar handling.
QNX
---
- Qt can now handle more than 256 file descriptors open in the same process,
up to a limit of 1000.
WinRT
-----
- Various fixes in our event and timer handling.
X11
---
- [QTBUG-55942] Qt::WindowNoState event is no longer sent when hiding
minimized windows.
- [QTBUG-49645] Fixed keyboard modifier state for drops from external apps.
- [QTBUG-48795] Fixed the keyboard state when processing key events.
******************************************************************************
* Compiler Specific Changes *
******************************************************************************
Visual Studio
-------------
- Visual Studio 2017 is now supported.
- [QTBUG-56594] PDB files are now properly generated even for static builds.
******************************************************************************
* Tools *
******************************************************************************
configure
---------
- Fixed builds that explicitly asked for -sdk iphoneos.
- [QTBUG-56388] Fixed the detection of the Microsoft compiler version when
the CL environment variable was set or when the compiler was configured to
another language (other than English).
qmake
-----
- [QTBUG-55505] Fixed an issue with iOS when the project path had a
whitespace.
- [QTBUG-56289] When cross-compiling on Windows to Unix targets, qmake no
longer generates chmod calls.
- [QTBUG-53905] Fixed qmake not to run moc twice on Objective C++ sources
listed in the OBJECTIVE_SOURCES variable.
- [QTBUG-56507] Fixed builds where a lex source refers to a file generated
by yacc.
- [QTBUG-57090][Darwin] Fixed the installation of asset catalog files.
qdbusxml2cpp
------------
- [QTBUG-21577] Fixed the generation of signals when the direction argument
was inverted from expected.

View File

@ -54,6 +54,8 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <math.h> #include <math.h>
bool GLWidget::m_transparent = false;
GLWidget::GLWidget(QWidget *parent) GLWidget::GLWidget(QWidget *parent)
: QOpenGLWidget(parent), : QOpenGLWidget(parent),
m_xRot(0), m_xRot(0),
@ -61,10 +63,9 @@ GLWidget::GLWidget(QWidget *parent)
m_zRot(0), m_zRot(0),
m_program(0) m_program(0)
{ {
m_core = QCoreApplication::arguments().contains(QStringLiteral("--coreprofile")); m_core = QSurfaceFormat::defaultFormat().profile() == QSurfaceFormat::CoreProfile;
// --transparent causes the clear color to be transparent. Therefore, on systems that // --transparent causes the clear color to be transparent. Therefore, on systems that
// support it, the widget will become transparent apart from the logo. // support it, the widget will become transparent apart from the logo.
m_transparent = QCoreApplication::arguments().contains(QStringLiteral("--transparent"));
if (m_transparent) { if (m_transparent) {
QSurfaceFormat fmt = format(); QSurfaceFormat fmt = format();
fmt.setAlphaBufferSize(8); fmt.setAlphaBufferSize(8);
@ -127,6 +128,8 @@ void GLWidget::setZRotation(int angle)
void GLWidget::cleanup() void GLWidget::cleanup()
{ {
if (m_program == nullptr)
return;
makeCurrent(); makeCurrent();
m_logoVbo.destroy(); m_logoVbo.destroy();
delete m_program; delete m_program;

View File

@ -68,6 +68,9 @@ public:
GLWidget(QWidget *parent = 0); GLWidget(QWidget *parent = 0);
~GLWidget(); ~GLWidget();
static bool isTransparent() { return m_transparent; }
static void setTransparent(bool t) { m_transparent = t; }
QSize minimumSizeHint() const override; QSize minimumSizeHint() const override;
QSize sizeHint() const override; QSize sizeHint() const override;
@ -108,7 +111,7 @@ private:
QMatrix4x4 m_proj; QMatrix4x4 m_proj;
QMatrix4x4 m_camera; QMatrix4x4 m_camera;
QMatrix4x4 m_world; QMatrix4x4 m_world;
bool m_transparent; static bool m_transparent;
}; };
#endif #endif

View File

@ -51,25 +51,46 @@
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QSurfaceFormat> #include <QSurfaceFormat>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "glwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
QCoreApplication::setApplicationName("Qt Hello GL 2 Example");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption multipleSampleOption("multisample", "Multisampling");
parser.addOption(multipleSampleOption);
QCommandLineOption coreProfileOption("coreprofile", "Use core profile");
parser.addOption(coreProfileOption);
QCommandLineOption transparentOption("transparent", "Transparent window");
parser.addOption(transparentOption);
parser.process(app);
QSurfaceFormat fmt; QSurfaceFormat fmt;
fmt.setDepthBufferSize(24); fmt.setDepthBufferSize(24);
if (QCoreApplication::arguments().contains(QStringLiteral("--multisample"))) if (parser.isSet(multipleSampleOption))
fmt.setSamples(4); fmt.setSamples(4);
if (QCoreApplication::arguments().contains(QStringLiteral("--coreprofile"))) { if (parser.isSet(coreProfileOption)) {
fmt.setVersion(3, 2); fmt.setVersion(3, 2);
fmt.setProfile(QSurfaceFormat::CoreProfile); fmt.setProfile(QSurfaceFormat::CoreProfile);
} }
QSurfaceFormat::setDefaultFormat(fmt); QSurfaceFormat::setDefaultFormat(fmt);
MainWindow mainWindow; MainWindow mainWindow;
if (QCoreApplication::arguments().contains(QStringLiteral("--transparent"))) {
GLWidget::setTransparent(parser.isSet(transparentOption));
if (GLWidget::isTransparent()) {
mainWindow.setAttribute(Qt::WA_TranslucentBackground); mainWindow.setAttribute(Qt::WA_TranslucentBackground);
mainWindow.setAttribute(Qt::WA_NoSystemBackground, false); mainWindow.setAttribute(Qt::WA_NoSystemBackground, false);
} }

View File

@ -52,6 +52,8 @@
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QGuiApplication> #include <QGuiApplication>
#include <QScreen> #include <QScreen>
#include <QThread> #include <QThread>
@ -60,9 +62,26 @@ int main(int argc, char *argv[])
{ {
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
QCoreApplication::setApplicationName("Qt HelloWindow GL Example");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption multipleOption("multiple", "Create multiple windows");
parser.addOption(multipleOption);
QCommandLineOption multipleSampleOption("multisample", "Multisampling");
parser.addOption(multipleSampleOption);
QCommandLineOption multipleScreenOption("multiscreen", "Run on multiple screens");
parser.addOption(multipleScreenOption);
QCommandLineOption timeoutOption("timeout", "Close after 10s");
parser.addOption(timeoutOption);
parser.process(app);
// Some platforms can only have one window per screen. Therefore we need to differentiate. // Some platforms can only have one window per screen. Therefore we need to differentiate.
const bool multipleWindows = QGuiApplication::arguments().contains(QStringLiteral("--multiple")); const bool multipleWindows = parser.isSet(multipleOption);
const bool multipleScreens = QGuiApplication::arguments().contains(QStringLiteral("--multiscreen")); const bool multipleScreens = parser.isSet(multipleScreenOption);
QScreen *screen = QGuiApplication::primaryScreen(); QScreen *screen = QGuiApplication::primaryScreen();
@ -70,7 +89,7 @@ int main(int argc, char *argv[])
QSurfaceFormat format; QSurfaceFormat format;
format.setDepthBufferSize(16); format.setDepthBufferSize(16);
if (QGuiApplication::arguments().contains(QStringLiteral("--multisample"))) if (parser.isSet(multipleSampleOption))
format.setSamples(4); format.setSamples(4);
QPoint center = QPoint(screenGeometry.center().x(), screenGeometry.top() + 80); QPoint center = QPoint(screenGeometry.center().x(), screenGeometry.top() + 80);
@ -136,7 +155,7 @@ int main(int argc, char *argv[])
} }
// Quit after 10 seconds. For platforms that do not have windows that are closeable. // Quit after 10 seconds. For platforms that do not have windows that are closeable.
if (QCoreApplication::arguments().contains(QStringLiteral("--timeout"))) if (parser.isSet(timeoutOption))
QTimer::singleShot(10000, qGuiApp, &QCoreApplication::quit); QTimer::singleShot(10000, qGuiApp, &QCoreApplication::quit);
const int exitValue = app.exec(); const int exitValue = app.exec();

View File

@ -51,6 +51,8 @@
#include <QApplication> #include <QApplication>
#include <QMainWindow> #include <QMainWindow>
#include <QSurfaceFormat> #include <QSurfaceFormat>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "mainwindow.h" #include "mainwindow.h"
int main( int argc, char ** argv ) int main( int argc, char ** argv )
@ -58,12 +60,25 @@ int main( int argc, char ** argv )
Q_INIT_RESOURCE(texture); Q_INIT_RESOURCE(texture);
QApplication a( argc, argv ); QApplication a( argc, argv );
QCoreApplication::setApplicationName("Qt QOpenGLWidget Example");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption multipleSampleOption("multisample", "Multisampling");
parser.addOption(multipleSampleOption);
QCommandLineOption srgbOption("srgb", "Use sRGB Color Space");
parser.addOption(srgbOption);
parser.process(a);
QSurfaceFormat format; QSurfaceFormat format;
format.setDepthBufferSize(24); format.setDepthBufferSize(24);
format.setStencilBufferSize(8); format.setStencilBufferSize(8);
if (QCoreApplication::arguments().contains(QStringLiteral("--srgb"))) if (parser.isSet(srgbOption))
format.setColorSpace(QSurfaceFormat::sRGBColorSpace); format.setColorSpace(QSurfaceFormat::sRGBColorSpace);
if (QCoreApplication::arguments().contains(QStringLiteral("--multisample"))) if (parser.isSet(multipleSampleOption))
format.setSamples(4); format.setSamples(4);
QSurfaceFormat::setDefaultFormat(format); QSurfaceFormat::setDefaultFormat(format);

View File

@ -53,6 +53,8 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QSurfaceFormat> #include <QSurfaceFormat>
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "mainwindow.h" #include "mainwindow.h"
#include "glwidget.h" #include "glwidget.h"
@ -67,6 +69,17 @@ int main( int argc, char ** argv )
{ {
QApplication a( argc, argv ); QApplication a( argc, argv );
QCoreApplication::setApplicationName("Qt Threaded QOpenGLWidget Example");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption singleOption("single", "Single thread");
parser.addOption(singleOption);
parser.process(a);
QSurfaceFormat format; QSurfaceFormat format;
format.setDepthBufferSize(16); format.setDepthBufferSize(16);
QSurfaceFormat::setDefaultFormat(format); QSurfaceFormat::setDefaultFormat(format);
@ -93,7 +106,7 @@ int main( int argc, char ** argv )
QScopedPointer<MainWindow> mw1; QScopedPointer<MainWindow> mw1;
QScopedPointer<MainWindow> mw2; QScopedPointer<MainWindow> mw2;
if (!QApplication::arguments().contains(QStringLiteral("--single"))) { if (!parser.isSet(singleOption)) {
if (supportsThreading) { if (supportsThreading) {
pos += QPoint(100, 100); pos += QPoint(100, 100);
mw1.reset(new MainWindow); mw1.reset(new MainWindow);

View File

@ -0,0 +1,19 @@
macx-xcode: return()
darwin: load(sdk)
ccache_prefix = ccache
precompile_header {
CCACHE_SLOPPINESS += pch_defines time_macros
ccache_prefix = \
CCACHE_SLOPPINESS=\"$$join(CCACHE_SLOPPINESS, ',')\$${CCACHE_SLOPPINESS+,\$$CCACHE_SLOPPINESS}\" \
# Make sure we build sources directly, not from their preprocessed version,
# otherwise precompiled headers will not be used during cache misses.
CCACHE_CPP2=true \
$$ccache_prefix
}
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_LINK_C)): \
$$tool = $$ccache_prefix $$eval($$tool)

View File

@ -100,7 +100,6 @@ FILES="
src/pcre2_newline.c src/pcre2_newline.c
src/pcre2_ord2utf.c src/pcre2_ord2utf.c
src/pcre2_pattern_info.c src/pcre2_pattern_info.c
src/pcre2_printint.c
src/pcre2_serialize.c src/pcre2_serialize.c
src/pcre2_string_utils.c src/pcre2_string_utils.c
src/pcre2_study.c src/pcre2_study.c

View File

@ -15,7 +15,7 @@ load(qt_helper_lib)
DEFINES += HAVE_CONFIG_H DEFINES += HAVE_CONFIG_H
# platform/compiler specific definitions # platform/compiler specific definitions
ios|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT uikit|qnx|winrt: DEFINES += PCRE2_DISABLE_JIT
SOURCES += \ SOURCES += \
$$PWD/src/pcre2_auto_possess.c \ $$PWD/src/pcre2_auto_possess.c \
@ -33,7 +33,6 @@ SOURCES += \
$$PWD/src/pcre2_newline.c \ $$PWD/src/pcre2_newline.c \
$$PWD/src/pcre2_ord2utf.c \ $$PWD/src/pcre2_ord2utf.c \
$$PWD/src/pcre2_pattern_info.c \ $$PWD/src/pcre2_pattern_info.c \
$$PWD/src/pcre2_printint.c \
$$PWD/src/pcre2_serialize.c \ $$PWD/src/pcre2_serialize.c \
$$PWD/src/pcre2_string_utils.c \ $$PWD/src/pcre2_string_utils.c \
$$PWD/src/pcre2_study.c \ $$PWD/src/pcre2_study.c \

View File

@ -1,831 +0,0 @@
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains a PCRE private debugging function for printing out the
internal form of a compiled regular expression, along with some supporting
local functions. This source file is #included in pcre2test.c at each supported
code unit width, with PCRE2_SUFFIX set appropriately, just like the functions
that comprise the library. It can also optionally be included in
pcre2_compile.c for detailed debugging in error situations. */
/* Tables of operator names. The same 8-bit table is used for all code unit
widths, so it must be defined only once. The list itself is defined in
pcre2_internal.h, which is #included by pcre2test before this file. */
#ifndef OP_LISTS_DEFINED
static const char *OP_names[] = { OP_NAME_LIST };
#define OP_LISTS_DEFINED
#endif
/* The functions and tables herein must all have mode-dependent names. */
#define OP_lengths PCRE2_SUFFIX(OP_lengths_)
#define get_ucpname PCRE2_SUFFIX(get_ucpname_)
#define pcre2_printint PCRE2_SUFFIX(pcre2_printint_)
#define print_char PCRE2_SUFFIX(print_char_)
#define print_custring PCRE2_SUFFIX(print_custring_)
#define print_custring_bylen PCRE2_SUFFIX(print_custring_bylen_)
#define print_prop PCRE2_SUFFIX(print_prop_)
/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
the definition is next to the definition of the opcodes in pcre2_internal.h.
The contents of the table are, however, mode-dependent. */
static const uint8_t OP_lengths[] = { OP_LENGTHS };
/*************************************************
* Print one character from a string *
*************************************************/
/* In UTF mode the character may occupy more than one code unit.
Arguments:
f file to write to
ptr pointer to first code unit of the character
utf TRUE if string is UTF (will be FALSE if UTF is not supported)
Returns: number of additional code units used
*/
static unsigned int
print_char(FILE *f, PCRE2_SPTR ptr, BOOL utf)
{
uint32_t c = *ptr;
BOOL one_code_unit = !utf;
/* If UTF is supported and requested, check for a valid single code unit. */
#ifdef SUPPORT_UNICODE
if (utf)
{
#if PCRE2_CODE_UNIT_WIDTH == 8
one_code_unit = c < 0x80;
#elif PCRE2_CODE_UNIT_WIDTH == 16
one_code_unit = (c & 0xfc00) != 0xd800;
#else
one_code_unit = (c & 0xfffff800u) != 0xd800u;
#endif /* CODE_UNIT_WIDTH */
}
#endif /* SUPPORT_UNICODE */
/* Handle a valid one-code-unit character at any width. */
if (one_code_unit)
{
if (PRINTABLE(c)) fprintf(f, "%c", (char)c);
else if (c < 0x80) fprintf(f, "\\x%02x", c);
else fprintf(f, "\\x{%02x}", c);
return 0;
}
/* Code for invalid UTF code units and multi-unit UTF characters is different
for each width. If UTF is not supported, control should never get here, but we
need a return statement to keep the compiler happy. */
#ifndef SUPPORT_UNICODE
return 0;
#else
/* Malformed UTF-8 should occur only if the sanity check has been turned off.
Rather than swallow random bytes, just stop if we hit a bad one. Print it with
\X instead of \x as an indication. */
#if PCRE2_CODE_UNIT_WIDTH == 8
if ((c & 0xc0) != 0xc0)
{
fprintf(f, "\\X{%x}", c); /* Invalid starting byte */
return 0;
}
else
{
int i;
int a = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes */
int s = 6*a;
c = (c & PRIV(utf8_table3)[a]) << s;
for (i = 1; i <= a; i++)
{
if ((ptr[i] & 0xc0) != 0x80)
{
fprintf(f, "\\X{%x}", c); /* Invalid secondary byte */
return i - 1;
}
s -= 6;
c |= (ptr[i] & 0x3f) << s;
}
fprintf(f, "\\x{%x}", c);
return a;
}
#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */
/* UTF-16: rather than swallow a low surrogate, just stop if we hit a bad one.
Print it with \X instead of \x as an indication. */
#if PCRE2_CODE_UNIT_WIDTH == 16
if ((ptr[1] & 0xfc00) != 0xdc00)
{
fprintf(f, "\\X{%x}", c);
return 0;
}
c = (((c & 0x3ff) << 10) | (ptr[1] & 0x3ff)) + 0x10000;
fprintf(f, "\\x{%x}", c);
return 1;
#endif /* PCRE2_CODE_UNIT_WIDTH == 16 */
/* For UTF-32 we get here only for a malformed code unit, which should only
occur if the sanity check has been turned off. Print it with \X instead of \x
as an indication. */
#if PCRE2_CODE_UNIT_WIDTH == 32
fprintf(f, "\\X{%x}", c);
return 0;
#endif /* PCRE2_CODE_UNIT_WIDTH == 32 */
#endif /* SUPPORT_UNICODE */
}
/*************************************************
* Print string as a list of code units *
*************************************************/
/* These take no account of UTF as they always print each individual code unit.
The string is zero-terminated for print_custring(); the length is given for
print_custring_bylen().
Arguments:
f file to write to
ptr point to the string
len length for print_custring_bylen()
Returns: nothing
*/
static void
print_custring(FILE *f, PCRE2_SPTR ptr)
{
while (*ptr != '\0')
{
uint32_t c = *ptr++;
if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c);
}
}
static void
print_custring_bylen(FILE *f, PCRE2_SPTR ptr, PCRE2_UCHAR len)
{
for (; len > 0; len--)
{
uint32_t c = *ptr++;
if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c);
}
}
/*************************************************
* Find Unicode property name *
*************************************************/
/* When there is no UTF/UCP support, the table of names does not exist. This
function should not be called in such configurations, because a pattern that
tries to use Unicode properties won't compile. Rather than put lots of #ifdefs
into the main code, however, we just put one into this function. */
static const char *
get_ucpname(unsigned int ptype, unsigned int pvalue)
{
#ifdef SUPPORT_UNICODE
int i;
for (i = PRIV(utt_size) - 1; i >= 0; i--)
{
if (ptype == PRIV(utt)[i].type && pvalue == PRIV(utt)[i].value) break;
}
return (i >= 0)? PRIV(utt_names) + PRIV(utt)[i].name_offset : "??";
#else /* No UTF support */
(void)ptype;
(void)pvalue;
return "??";
#endif /* SUPPORT_UNICODE */
}
/*************************************************
* Print Unicode property value *
*************************************************/
/* "Normal" properties can be printed from tables. The PT_CLIST property is a
pseudo-property that contains a pointer to a list of case-equivalent
characters.
Arguments:
f file to write to
code pointer in the compiled code
before text to print before
after text to print after
Returns: nothing
*/
static void
print_prop(FILE *f, PCRE2_SPTR code, const char *before, const char *after)
{
if (code[1] != PT_CLIST)
{
fprintf(f, "%s%s %s%s", before, OP_names[*code], get_ucpname(code[1],
code[2]), after);
}
else
{
const char *not = (*code == OP_PROP)? "" : "not ";
const uint32_t *p = PRIV(ucd_caseless_sets) + code[2];
fprintf (f, "%s%sclist", before, not);
while (*p < NOTACHAR) fprintf(f, " %04x", *p++);
fprintf(f, "%s", after);
}
}
/*************************************************
* Print compiled pattern *
*************************************************/
/* The print_lengths flag controls whether offsets and lengths of items are
printed. Lenths can be turned off from pcre2test so that automatic tests on
bytecode can be written that do not depend on the value of LINK_SIZE.
Arguments:
re a compiled pattern
f the file to write to
print_lengths show various lengths
Returns: nothing
*/
static void
pcre2_printint(pcre2_code *re, FILE *f, BOOL print_lengths)
{
PCRE2_SPTR codestart, nametable, code;
uint32_t nesize = re->name_entry_size;
BOOL utf = (re->overall_options & PCRE2_UTF) != 0;
nametable = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code));
code = codestart = nametable + re->name_count * re->name_entry_size;
for(;;)
{
PCRE2_SPTR ccode;
uint32_t c;
int i;
const char *flag = " ";
unsigned int extra = 0;
if (print_lengths)
fprintf(f, "%3d ", (int)(code - codestart));
else
fprintf(f, " ");
switch(*code)
{
/* ========================================================================== */
/* These cases are never obeyed. This is a fudge that causes a compile-
time error if the vectors OP_names or OP_lengths, which are indexed
by opcode, are not the correct length. It seems to be the only way to do
such a check at compile time, as the sizeof() operator does not work in
the C preprocessor. */
case OP_TABLE_LENGTH:
case OP_TABLE_LENGTH +
((sizeof(OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) &&
(sizeof(OP_lengths) == OP_TABLE_LENGTH)):
return;
/* ========================================================================== */
case OP_END:
fprintf(f, " %s\n", OP_names[*code]);
fprintf(f, "------------------------------------------------------------------\n");
return;
case OP_CHAR:
fprintf(f, " ");
do
{
code++;
code += 1 + print_char(f, code, utf);
}
while (*code == OP_CHAR);
fprintf(f, "\n");
continue;
case OP_CHARI:
fprintf(f, " /i ");
do
{
code++;
code += 1 + print_char(f, code, utf);
}
while (*code == OP_CHARI);
fprintf(f, "\n");
continue;
case OP_CBRA:
case OP_CBRAPOS:
case OP_SCBRA:
case OP_SCBRAPOS:
if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
else fprintf(f, " ");
fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));
break;
case OP_BRA:
case OP_BRAPOS:
case OP_SBRA:
case OP_SBRAPOS:
case OP_KETRMAX:
case OP_KETRMIN:
case OP_KETRPOS:
case OP_ALT:
case OP_KET:
case OP_ASSERT:
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ONCE:
case OP_COND:
case OP_SCOND:
case OP_REVERSE:
if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
else fprintf(f, " ");
fprintf(f, "%s", OP_names[*code]);
break;
case OP_CLOSE:
fprintf(f, " %s %d", OP_names[*code], GET2(code, 1));
break;
case OP_CREF:
fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
break;
case OP_DNCREF:
{
PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE;
fprintf(f, " %s Cond ref <", flag);
print_custring(f, entry);
fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
}
break;
case OP_RREF:
c = GET2(code, 1);
if (c == RREF_ANY)
fprintf(f, " Cond recurse any");
else
fprintf(f, " Cond recurse %d", c);
break;
case OP_DNRREF:
{
PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE;
fprintf(f, " %s Cond recurse <", flag);
print_custring(f, entry);
fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
}
break;
case OP_FALSE:
fprintf(f, " Cond false");
break;
case OP_TRUE:
fprintf(f, " Cond true");
break;
case OP_STARI:
case OP_MINSTARI:
case OP_POSSTARI:
case OP_PLUSI:
case OP_MINPLUSI:
case OP_POSPLUSI:
case OP_QUERYI:
case OP_MINQUERYI:
case OP_POSQUERYI:
flag = "/i";
/* Fall through */
case OP_STAR:
case OP_MINSTAR:
case OP_POSSTAR:
case OP_PLUS:
case OP_MINPLUS:
case OP_POSPLUS:
case OP_QUERY:
case OP_MINQUERY:
case OP_POSQUERY:
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
case OP_TYPEPOSSTAR:
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
case OP_TYPEPOSPLUS:
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
case OP_TYPEPOSQUERY:
fprintf(f, " %s ", flag);
if (*code >= OP_TYPESTAR)
{
if (code[1] == OP_PROP || code[1] == OP_NOTPROP)
{
print_prop(f, code + 1, "", " ");
extra = 2;
}
else fprintf(f, "%s", OP_names[code[1]]);
}
else extra = print_char(f, code+1, utf);
fprintf(f, "%s", OP_names[*code]);
break;
case OP_EXACTI:
case OP_UPTOI:
case OP_MINUPTOI:
case OP_POSUPTOI:
flag = "/i";
/* Fall through */
case OP_EXACT:
case OP_UPTO:
case OP_MINUPTO:
case OP_POSUPTO:
fprintf(f, " %s ", flag);
extra = print_char(f, code + 1 + IMM2_SIZE, utf);
fprintf(f, "{");
if (*code != OP_EXACT && *code != OP_EXACTI) fprintf(f, "0,");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_MINUPTO || *code == OP_MINUPTOI) fprintf(f, "?");
else if (*code == OP_POSUPTO || *code == OP_POSUPTOI) fprintf(f, "+");
break;
case OP_TYPEEXACT:
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
case OP_TYPEPOSUPTO:
if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
{
print_prop(f, code + IMM2_SIZE + 1, " ", " ");
extra = 2;
}
else fprintf(f, " %s", OP_names[code[1 + IMM2_SIZE]]);
fprintf(f, "{");
if (*code != OP_TYPEEXACT) fprintf(f, "0,");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_TYPEMINUPTO) fprintf(f, "?");
else if (*code == OP_TYPEPOSUPTO) fprintf(f, "+");
break;
case OP_NOTI:
flag = "/i";
/* Fall through */
case OP_NOT:
fprintf(f, " %s [^", flag);
extra = print_char(f, code + 1, utf);
fprintf(f, "]");
break;
case OP_NOTSTARI:
case OP_NOTMINSTARI:
case OP_NOTPOSSTARI:
case OP_NOTPLUSI:
case OP_NOTMINPLUSI:
case OP_NOTPOSPLUSI:
case OP_NOTQUERYI:
case OP_NOTMINQUERYI:
case OP_NOTPOSQUERYI:
flag = "/i";
/* Fall through */
case OP_NOTSTAR:
case OP_NOTMINSTAR:
case OP_NOTPOSSTAR:
case OP_NOTPLUS:
case OP_NOTMINPLUS:
case OP_NOTPOSPLUS:
case OP_NOTQUERY:
case OP_NOTMINQUERY:
case OP_NOTPOSQUERY:
fprintf(f, " %s [^", flag);
extra = print_char(f, code + 1, utf);
fprintf(f, "]%s", OP_names[*code]);
break;
case OP_NOTEXACTI:
case OP_NOTUPTOI:
case OP_NOTMINUPTOI:
case OP_NOTPOSUPTOI:
flag = "/i";
/* Fall through */
case OP_NOTEXACT:
case OP_NOTUPTO:
case OP_NOTMINUPTO:
case OP_NOTPOSUPTO:
fprintf(f, " %s [^", flag);
extra = print_char(f, code + 1 + IMM2_SIZE, utf);
fprintf(f, "]{");
if (*code != OP_NOTEXACT && *code != OP_NOTEXACTI) fprintf(f, "0,");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_NOTMINUPTO || *code == OP_NOTMINUPTOI) fprintf(f, "?");
else
if (*code == OP_NOTPOSUPTO || *code == OP_NOTPOSUPTOI) fprintf(f, "+");
break;
case OP_RECURSE:
if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
else fprintf(f, " ");
fprintf(f, "%s", OP_names[*code]);
break;
case OP_REFI:
flag = "/i";
/* Fall through */
case OP_REF:
fprintf(f, " %s \\%d", flag, GET2(code,1));
ccode = code + OP_lengths[*code];
goto CLASS_REF_REPEAT;
case OP_DNREFI:
flag = "/i";
/* Fall through */
case OP_DNREF:
{
PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE;
fprintf(f, " %s \\k<", flag);
print_custring(f, entry);
fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
}
ccode = code + OP_lengths[*code];
goto CLASS_REF_REPEAT;
case OP_CALLOUT:
fprintf(f, " %s %d %d %d", OP_names[*code], code[1 + 2*LINK_SIZE],
GET(code, 1), GET(code, 1 + LINK_SIZE));
break;
case OP_CALLOUT_STR:
c = code[1 + 4*LINK_SIZE];
fprintf(f, " %s %c", OP_names[*code], c);
extra = GET(code, 1 + 2*LINK_SIZE);
print_custring_bylen(f, code + 2 + 4*LINK_SIZE, extra - 3 - 4*LINK_SIZE);
for (i = 0; PRIV(callout_start_delims)[i] != 0; i++)
if (c == PRIV(callout_start_delims)[i])
{
c = PRIV(callout_end_delims)[i];
break;
}
fprintf(f, "%c %d %d %d", c, GET(code, 1 + 3*LINK_SIZE), GET(code, 1),
GET(code, 1 + LINK_SIZE));
break;
case OP_PROP:
case OP_NOTPROP:
print_prop(f, code, " ", "");
break;
/* OP_XCLASS cannot occur in 8-bit, non-UTF mode. However, there's no harm
in having this code always here, and it makes it less messy without all
those #ifdefs. */
case OP_CLASS:
case OP_NCLASS:
case OP_XCLASS:
{
unsigned int min, max;
BOOL printmap;
BOOL invertmap = FALSE;
uint8_t *map;
uint8_t inverted_map[32];
fprintf(f, " [");
if (*code == OP_XCLASS)
{
extra = GET(code, 1);
ccode = code + LINK_SIZE + 1;
printmap = (*ccode & XCL_MAP) != 0;
if ((*ccode & XCL_NOT) != 0)
{
invertmap = (*ccode & XCL_HASPROP) == 0;
fprintf(f, "^");
}
ccode++;
}
else
{
printmap = TRUE;
ccode = code + 1;
}
/* Print a bit map */
if (printmap)
{
map = (uint8_t *)ccode;
if (invertmap)
{
for (i = 0; i < 32; i++) inverted_map[i] = ~map[i];
map = inverted_map;
}
for (i = 0; i < 256; i++)
{
if ((map[i/8] & (1 << (i&7))) != 0)
{
int j;
for (j = i+1; j < 256; j++)
if ((map[j/8] & (1 << (j&7))) == 0) break;
if (i == '-' || i == ']') fprintf(f, "\\");
if (PRINTABLE(i)) fprintf(f, "%c", i);
else fprintf(f, "\\x%02x", i);
if (--j > i)
{
if (j != i + 1) fprintf(f, "-");
if (j == '-' || j == ']') fprintf(f, "\\");
if (PRINTABLE(j)) fprintf(f, "%c", j);
else fprintf(f, "\\x%02x", j);
}
i = j;
}
}
ccode += 32 / sizeof(PCRE2_UCHAR);
}
/* For an XCLASS there is always some additional data */
if (*code == OP_XCLASS)
{
PCRE2_UCHAR ch;
while ((ch = *ccode++) != XCL_END)
{
BOOL not = FALSE;
const char *notch = "";
switch(ch)
{
case XCL_NOTPROP:
not = TRUE;
notch = "^";
/* Fall through */
case XCL_PROP:
{
unsigned int ptype = *ccode++;
unsigned int pvalue = *ccode++;
switch(ptype)
{
case PT_PXGRAPH:
fprintf(f, "[:%sgraph:]", notch);
break;
case PT_PXPRINT:
fprintf(f, "[:%sprint:]", notch);
break;
case PT_PXPUNCT:
fprintf(f, "[:%spunct:]", notch);
break;
default:
fprintf(f, "\\%c{%s}", (not? 'P':'p'),
get_ucpname(ptype, pvalue));
break;
}
}
break;
default:
ccode += 1 + print_char(f, ccode, utf);
if (ch == XCL_RANGE)
{
fprintf(f, "-");
ccode += 1 + print_char(f, ccode, utf);
}
break;
}
}
}
/* Indicate a non-UTF class which was created by negation */
fprintf(f, "]%s", (*code == OP_NCLASS)? " (neg)" : "");
/* Handle repeats after a class or a back reference */
CLASS_REF_REPEAT:
switch(*ccode)
{
case OP_CRSTAR:
case OP_CRMINSTAR:
case OP_CRPLUS:
case OP_CRMINPLUS:
case OP_CRQUERY:
case OP_CRMINQUERY:
case OP_CRPOSSTAR:
case OP_CRPOSPLUS:
case OP_CRPOSQUERY:
fprintf(f, "%s", OP_names[*ccode]);
extra += OP_lengths[*ccode];
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
case OP_CRPOSRANGE:
min = GET2(ccode,1);
max = GET2(ccode,1 + IMM2_SIZE);
if (max == 0) fprintf(f, "{%u,}", min);
else fprintf(f, "{%u,%u}", min, max);
if (*ccode == OP_CRMINRANGE) fprintf(f, "?");
else if (*ccode == OP_CRPOSRANGE) fprintf(f, "+");
extra += OP_lengths[*ccode];
break;
/* Do nothing if it's not a repeat; this code stops picky compilers
warning about the lack of a default code path. */
default:
break;
}
}
break;
case OP_MARK:
case OP_PRUNE_ARG:
case OP_SKIP_ARG:
case OP_THEN_ARG:
fprintf(f, " %s ", OP_names[*code]);
print_custring_bylen(f, code + 2, code[1]);
extra += code[1];
break;
case OP_THEN:
fprintf(f, " %s", OP_names[*code]);
break;
case OP_CIRCM:
case OP_DOLLM:
flag = "/m";
/* Fall through */
/* Anything else is just an item with no data, but possibly a flag. */
default:
fprintf(f, " %s %s", flag, OP_names[*code]);
break;
}
code += OP_lengths[*code] + extra;
fprintf(f, "\n");
}
}
/* End of pcre2_printint.c */

View File

@ -440,12 +440,17 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
if (data.missingFlags(QFileSystemMetaData::LinkType)) if (data.missingFlags(QFileSystemMetaData::LinkType))
QFileSystemEngine::fillMetaData(link, data, QFileSystemMetaData::LinkType); QFileSystemEngine::fillMetaData(link, data, QFileSystemMetaData::LinkType);
QString ret; QString target;
if (data.isLnkFile()) if (data.isLnkFile())
ret = readLink(link); target = readLink(link);
else if (data.isLink()) else if (data.isLink())
ret = readSymLink(link); target = readSymLink(link);
return QFileSystemEntry(ret); QFileSystemEntry ret(target);
if (!target.isEmpty() && ret.isRelative()) {
target.prepend(absoluteName(link).path() + QLatin1Char('/'));
ret = QFileSystemEntry(QDir::cleanPath(target));
}
return ret;
} }
//static //static

View File

@ -79,7 +79,7 @@ public:
return r < other.r return r < other.r
|| (r == other.r && (c < other.c || (r == other.r && (c < other.c
|| (c == other.c && (i < other.i || (c == other.c && (i < other.i
|| (i == other.i && m < other.m ))))); || (i == other.i && std::less<const QAbstractItemModel *>()(m, other.m))))));
} }
private: private:
inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) Q_DECL_NOTHROW inline QModelIndex(int arow, int acolumn, void *ptr, const QAbstractItemModel *amodel) Q_DECL_NOTHROW

View File

@ -117,9 +117,9 @@ void QBasicDrag::disableEventFilter()
} }
static inline QPoint getNativeMousePos(QEvent *e, QObject *o) static inline QPoint getNativeMousePos(QEvent *e, QWindow *window)
{ {
return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), qobject_cast<QWindow*>(o)); return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), window);
} }
bool QBasicDrag::eventFilter(QObject *o, QEvent *e) bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
@ -156,14 +156,14 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
case QEvent::MouseMove: case QEvent::MouseMove:
{ {
QPoint nativePosition = getNativeMousePos(e, o); QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
move(nativePosition); move(nativePosition);
return true; // Eat all mouse move events return true; // Eat all mouse move events
} }
case QEvent::MouseButtonRelease: case QEvent::MouseButtonRelease:
disableEventFilter(); disableEventFilter();
if (canDrop()) { if (canDrop()) {
QPoint nativePosition = getNativeMousePos(e, o); QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
drop(nativePosition); drop(nativePosition);
} else { } else {
cancel(); cancel();

View File

@ -1,7 +1,6 @@
# Qt network access module # Qt network access module
HEADERS += \ HEADERS += \
access/qftp_p.h \
access/qhttpnetworkheader_p.h \ access/qhttpnetworkheader_p.h \
access/qhttpnetworkrequest_p.h \ access/qhttpnetworkrequest_p.h \
access/qhttpnetworkreply_p.h \ access/qhttpnetworkreply_p.h \
@ -18,7 +17,6 @@ HEADERS += \
access/qnetworkaccessdebugpipebackend_p.h \ access/qnetworkaccessdebugpipebackend_p.h \
access/qnetworkaccessfilebackend_p.h \ access/qnetworkaccessfilebackend_p.h \
access/qnetworkaccesscachebackend_p.h \ access/qnetworkaccesscachebackend_p.h \
access/qnetworkaccessftpbackend_p.h \
access/qnetworkcookie.h \ access/qnetworkcookie.h \
access/qnetworkcookie_p.h \ access/qnetworkcookie_p.h \
access/qnetworkcookiejar.h \ access/qnetworkcookiejar.h \
@ -33,8 +31,6 @@ HEADERS += \
access/qnetworkreplyfileimpl_p.h \ access/qnetworkreplyfileimpl_p.h \
access/qabstractnetworkcache_p.h \ access/qabstractnetworkcache_p.h \
access/qabstractnetworkcache.h \ access/qabstractnetworkcache.h \
access/qnetworkdiskcache_p.h \
access/qnetworkdiskcache.h \
access/qhttpthreaddelegate_p.h \ access/qhttpthreaddelegate_p.h \
access/qhttpmultipart.h \ access/qhttpmultipart.h \
access/qhttpmultipart_p.h \ access/qhttpmultipart_p.h \
@ -45,7 +41,6 @@ HEADERS += \
access/qhstsstore_p.h access/qhstsstore_p.h
SOURCES += \ SOURCES += \
access/qftp.cpp \
access/qhttpnetworkheader.cpp \ access/qhttpnetworkheader.cpp \
access/qhttpnetworkrequest.cpp \ access/qhttpnetworkrequest.cpp \
access/qhttpnetworkreply.cpp \ access/qhttpnetworkreply.cpp \
@ -61,7 +56,6 @@ SOURCES += \
access/qnetworkaccessdebugpipebackend.cpp \ access/qnetworkaccessdebugpipebackend.cpp \
access/qnetworkaccessfilebackend.cpp \ access/qnetworkaccessfilebackend.cpp \
access/qnetworkaccesscachebackend.cpp \ access/qnetworkaccesscachebackend.cpp \
access/qnetworkaccessftpbackend.cpp \
access/qnetworkcookie.cpp \ access/qnetworkcookie.cpp \
access/qnetworkcookiejar.cpp \ access/qnetworkcookiejar.cpp \
access/qnetworkrequest.cpp \ access/qnetworkrequest.cpp \
@ -71,7 +65,6 @@ SOURCES += \
access/qnetworkreplyhttpimpl.cpp \ access/qnetworkreplyhttpimpl.cpp \
access/qnetworkreplyfileimpl.cpp \ access/qnetworkreplyfileimpl.cpp \
access/qabstractnetworkcache.cpp \ access/qabstractnetworkcache.cpp \
access/qnetworkdiskcache.cpp \
access/qhttpthreaddelegate.cpp \ access/qhttpthreaddelegate.cpp \
access/qhttpmultipart.cpp \ access/qhttpmultipart.cpp \
access/qnetworkfile.cpp \ access/qnetworkfile.cpp \
@ -80,6 +73,24 @@ SOURCES += \
access/qhstspolicy.cpp \ access/qhstspolicy.cpp \
access/qhstsstore.cpp access/qhstsstore.cpp
qtConfig(ftp) {
HEADERS += \
access/qftp_p.h \
access/qnetworkaccessftpbackend_p.h
SOURCES += \
access/qftp.cpp \
access/qnetworkaccessftpbackend.cpp
}
qtConfig(networkdiskcache) {
HEADERS += \
access/qnetworkdiskcache_p.h \
access/qnetworkdiskcache.h
SOURCES += access/qnetworkdiskcache.cpp
}
mac: LIBS_PRIVATE += -framework Security mac: LIBS_PRIVATE += -framework Security
include($$PWD/../../3rdparty/zlib_dependency.pri) include($$PWD/../../3rdparty/zlib_dependency.pri)

View File

@ -43,8 +43,6 @@
#include "private/qftp_p.h" #include "private/qftp_p.h"
#include "qabstractsocket.h" #include "qabstractsocket.h"
#ifndef QT_NO_FTP
#include "qcoreapplication.h" #include "qcoreapplication.h"
#include "qtcpsocket.h" #include "qtcpsocket.h"
#include "qurlinfo_p.h" #include "qurlinfo_p.h"
@ -2453,5 +2451,3 @@ QT_END_NAMESPACE
#include "qftp.moc" #include "qftp.moc"
#include "moc_qftp_p.cpp" #include "moc_qftp_p.cpp"
#endif // QT_NO_FTP

View File

@ -56,11 +56,10 @@
#include <private/qurlinfo_p.h> #include <private/qurlinfo_p.h>
#include <QtCore/qobject.h> #include <QtCore/qobject.h>
QT_REQUIRE_CONFIG(ftp);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_FTP
class QFtpPrivate; class QFtpPrivate;
class Q_AUTOTEST_EXPORT QFtp : public QObject class Q_AUTOTEST_EXPORT QFtp : public QObject
@ -169,8 +168,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_piFtpReply(int, const QString&)) Q_PRIVATE_SLOT(d_func(), void _q_piFtpReply(int, const QString&))
}; };
#endif // QT_NO_FTP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QFTP_P_H #endif // QFTP_P_H

View File

@ -42,7 +42,9 @@
#include "qnetworkaccesscachebackend_p.h" #include "qnetworkaccesscachebackend_p.h"
#include "qabstractnetworkcache.h" #include "qabstractnetworkcache.h"
#include "qfileinfo.h" #include "qfileinfo.h"
#if QT_CONFIG(ftp)
#include "qurlinfo_p.h" #include "qurlinfo_p.h"
#endif
#include "qdir.h" #include "qdir.h"
#include "qcoreapplication.h" #include "qcoreapplication.h"

View File

@ -39,7 +39,9 @@
#include "qnetworkaccessfilebackend_p.h" #include "qnetworkaccessfilebackend_p.h"
#include "qfileinfo.h" #include "qfileinfo.h"
#if QT_CONFIG(ftp)
#include "qurlinfo_p.h" #include "qurlinfo_p.h"
#endif
#include "qdir.h" #include "qdir.h"
#include "private/qnoncontiguousbytedevice_p.h" #include "private/qnoncontiguousbytedevice_p.h"

View File

@ -43,8 +43,6 @@
#include "private/qnoncontiguousbytedevice_p.h" #include "private/qnoncontiguousbytedevice_p.h"
#include <QStringList> #include <QStringList>
#ifndef QT_NO_FTP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
enum { enum {
@ -382,5 +380,3 @@ void QNetworkAccessFtpBackend::ftpRawCommandReply(int code, const QString &text)
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FTP

View File

@ -60,7 +60,7 @@
#include "QtCore/qpointer.h" #include "QtCore/qpointer.h"
#ifndef QT_NO_FTP QT_REQUIRE_CONFIG(ftp);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -122,6 +122,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FTP
#endif #endif

View File

@ -51,7 +51,9 @@
#include "QtNetwork/qnetworksession.h" #include "QtNetwork/qnetworksession.h"
#include "QtNetwork/private/qsharednetworksession_p.h" #include "QtNetwork/private/qsharednetworksession_p.h"
#if QT_CONFIG(ftp)
#include "qnetworkaccessftpbackend_p.h" #include "qnetworkaccessftpbackend_p.h"
#endif
#include "qnetworkaccessfilebackend_p.h" #include "qnetworkaccessfilebackend_p.h"
#include "qnetworkaccessdebugpipebackend_p.h" #include "qnetworkaccessdebugpipebackend_p.h"
#include "qnetworkaccesscachebackend_p.h" #include "qnetworkaccesscachebackend_p.h"
@ -76,9 +78,9 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QNetworkAccessFileBackendFactory, fileBackend) Q_GLOBAL_STATIC(QNetworkAccessFileBackendFactory, fileBackend)
#ifndef QT_NO_FTP #if QT_CONFIG(ftp)
Q_GLOBAL_STATIC(QNetworkAccessFtpBackendFactory, ftpBackend) Q_GLOBAL_STATIC(QNetworkAccessFtpBackendFactory, ftpBackend)
#endif // QT_NO_FTP #endif // QT_CONFIG(ftp)
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
Q_GLOBAL_STATIC(QNetworkAccessDebugPipeBackendFactory, debugpipeBackend) Q_GLOBAL_STATIC(QNetworkAccessDebugPipeBackendFactory, debugpipeBackend)
@ -146,7 +148,7 @@ bool getProxyAuth(const QString& proxyHostname, const QString &scheme, QString&
static void ensureInitialized() static void ensureInitialized()
{ {
#ifndef QT_NO_FTP #if QT_CONFIG(ftp)
(void) ftpBackend(); (void) ftpBackend();
#endif #endif

View File

@ -60,8 +60,6 @@
#define MAX_COMPRESSION_SIZE (1024 * 1024 * 3) #define MAX_COMPRESSION_SIZE (1024 * 1024 * 3)
#ifndef QT_NO_NETWORKDISKCACHE
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/*! /*!
@ -737,5 +735,3 @@ bool QCacheItem::read(QFile *device, bool readData)
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_NETWORKDISKCACHE

View File

@ -43,11 +43,10 @@
#include <QtNetwork/qtnetworkglobal.h> #include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qabstractnetworkcache.h> #include <QtNetwork/qabstractnetworkcache.h>
QT_REQUIRE_CONFIG(networkdiskcache);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_NETWORKDISKCACHE
class QNetworkDiskCachePrivate; class QNetworkDiskCachePrivate;
class Q_NETWORK_EXPORT QNetworkDiskCache : public QAbstractNetworkCache class Q_NETWORK_EXPORT QNetworkDiskCache : public QAbstractNetworkCache
{ {
@ -84,8 +83,6 @@ private:
Q_DISABLE_COPY(QNetworkDiskCache) Q_DISABLE_COPY(QNetworkDiskCache)
}; };
#endif // QT_NO_NETWORKDISKCACHE
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QNETWORKDISKCACHE_H #endif // QNETWORKDISKCACHE_H

View File

@ -58,7 +58,7 @@
#include <qhash.h> #include <qhash.h>
#include <qtemporaryfile.h> #include <qtemporaryfile.h>
#ifndef QT_NO_NETWORKDISKCACHE QT_REQUIRE_CONFIG(networkdiskcache);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -123,6 +123,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_NETWORKDISKCACHE
#endif // QNETWORKDISKCACHE_P_H #endif // QNETWORKDISKCACHE_P_H

View File

@ -17,8 +17,7 @@ HEADERS += kernel/qtnetworkglobal.h \
kernel/qnetworkdatagram_p.h \ kernel/qnetworkdatagram_p.h \
kernel/qnetworkinterface.h \ kernel/qnetworkinterface.h \
kernel/qnetworkinterface_p.h \ kernel/qnetworkinterface_p.h \
kernel/qnetworkproxy.h \ kernel/qnetworkproxy.h
kernel/qurlinfo_p.h
SOURCES += kernel/qauthenticator.cpp \ SOURCES += kernel/qauthenticator.cpp \
kernel/qdnslookup.cpp \ kernel/qdnslookup.cpp \
@ -26,8 +25,12 @@ SOURCES += kernel/qauthenticator.cpp \
kernel/qhostinfo.cpp \ kernel/qhostinfo.cpp \
kernel/qnetworkdatagram.cpp \ kernel/qnetworkdatagram.cpp \
kernel/qnetworkinterface.cpp \ kernel/qnetworkinterface.cpp \
kernel/qnetworkproxy.cpp \ kernel/qnetworkproxy.cpp
kernel/qurlinfo.cpp
qtConfig(ftp) {
HEADERS += kernel/qurlinfo_p.h
SOURCES += kernel/qurlinfo.cpp
}
unix { unix {
!integrity: SOURCES += kernel/qdnslookup_unix.cpp !integrity: SOURCES += kernel/qdnslookup_unix.cpp

View File

@ -227,7 +227,9 @@
#ifndef QT_NO_NETWORKPROXY #ifndef QT_NO_NETWORKPROXY
#include "private/qnetworkrequest_p.h" #include "private/qnetworkrequest_p.h"
#if QT_CONFIG(socks5)
#include "private/qsocks5socketengine_p.h" #include "private/qsocks5socketengine_p.h"
#endif
#include "private/qhttpsocketengine_p.h" #include "private/qhttpsocketengine_p.h"
#include "qauthenticator.h" #include "qauthenticator.h"
#include "qdebug.h" #include "qdebug.h"
@ -251,7 +253,7 @@ public:
: mutex(QMutex::Recursive) : mutex(QMutex::Recursive)
, applicationLevelProxy(0) , applicationLevelProxy(0)
, applicationLevelProxyFactory(0) , applicationLevelProxyFactory(0)
#ifndef QT_NO_SOCKS5 #if QT_CONFIG(socks5)
, socks5SocketEngineHandler(0) , socks5SocketEngineHandler(0)
#endif #endif
#ifndef QT_NO_HTTP #ifndef QT_NO_HTTP
@ -263,7 +265,7 @@ public:
, useSystemProxies(false) , useSystemProxies(false)
#endif #endif
{ {
#ifndef QT_NO_SOCKS5 #if QT_CONFIG(socks5)
socks5SocketEngineHandler = new QSocks5SocketEngineHandler(); socks5SocketEngineHandler = new QSocks5SocketEngineHandler();
#endif #endif
#ifndef QT_NO_HTTP #ifndef QT_NO_HTTP
@ -275,7 +277,7 @@ public:
{ {
delete applicationLevelProxy; delete applicationLevelProxy;
delete applicationLevelProxyFactory; delete applicationLevelProxyFactory;
#ifndef QT_NO_SOCKS5 #if QT_CONFIG(socks5)
delete socks5SocketEngineHandler; delete socks5SocketEngineHandler;
#endif #endif
#ifndef QT_NO_HTTP #ifndef QT_NO_HTTP
@ -335,7 +337,7 @@ private:
QMutex mutex; QMutex mutex;
QNetworkProxy *applicationLevelProxy; QNetworkProxy *applicationLevelProxy;
QNetworkProxyFactory *applicationLevelProxyFactory; QNetworkProxyFactory *applicationLevelProxyFactory;
#ifndef QT_NO_SOCKS5 #if QT_CONFIG(socks5)
QSocks5SocketEngineHandler *socks5SocketEngineHandler; QSocks5SocketEngineHandler *socks5SocketEngineHandler;
#endif #endif
#ifndef QT_NO_HTTP #ifndef QT_NO_HTTP

View File

@ -39,8 +39,6 @@
#include "qurlinfo_p.h" #include "qurlinfo_p.h"
#ifndef QT_NO_FTP
#include "qurl.h" #include "qurl.h"
#include "qdir.h" #include "qdir.h"
#include <limits.h> #include <limits.h>
@ -727,5 +725,3 @@ bool QUrlInfo::isValid() const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FTP

View File

@ -56,11 +56,10 @@
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
#include <QtCore/qiodevice.h> #include <QtCore/qiodevice.h>
QT_REQUIRE_CONFIG(ftp);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_FTP
class QUrl; class QUrl;
class QUrlInfoPrivate; class QUrlInfoPrivate;
@ -129,8 +128,6 @@ private:
QUrlInfoPrivate *d; QUrlInfoPrivate *d;
}; };
#endif // QT_NO_FTP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QURLINFO_H #endif // QURLINFO_H

View File

@ -39,8 +39,6 @@
#include "qsocks5socketengine_p.h" #include "qsocks5socketengine_p.h"
#ifndef QT_NO_SOCKS5
#include "qtcpsocket.h" #include "qtcpsocket.h"
#include "qudpsocket.h" #include "qudpsocket.h"
#include "qtcpserver.h" #include "qtcpserver.h"
@ -1938,6 +1936,4 @@ QAbstractSocketEngine *QSocks5SocketEngineHandler::createSocketEngine(qintptr so
return 0; return 0;
} }
#endif // QT_NO_SOCKS5
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -55,9 +55,9 @@
#include "qabstractsocketengine_p.h" #include "qabstractsocketengine_p.h"
#include "qnetworkproxy.h" #include "qnetworkproxy.h"
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(socks5);
#ifndef QT_NO_SOCKS5 QT_BEGIN_NAMESPACE
class QSocks5SocketEnginePrivate; class QSocks5SocketEnginePrivate;
@ -291,7 +291,6 @@ public:
virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) Q_DECL_OVERRIDE; virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) Q_DECL_OVERRIDE;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_SOCKS5
#endif // QSOCKS5SOCKETENGINE_H #endif // QSOCKS5SOCKETENGINE_H

View File

@ -2293,6 +2293,9 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode)
q->connect(plainSocket, SIGNAL(channelBytesWritten(int, qint64)), q->connect(plainSocket, SIGNAL(channelBytesWritten(int, qint64)),
q, SLOT(_q_channelBytesWrittenSlot(int, qint64)), q, SLOT(_q_channelBytesWrittenSlot(int, qint64)),
Qt::DirectConnection); Qt::DirectConnection);
q->connect(plainSocket, SIGNAL(readChannelFinished()),
q, SLOT(_q_readChannelFinishedSlot()),
Qt::DirectConnection);
#ifndef QT_NO_NETWORKPROXY #ifndef QT_NO_NETWORKPROXY
q->connect(plainSocket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), q->connect(plainSocket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
q, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); q, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
@ -2511,6 +2514,15 @@ void QSslSocketPrivate::_q_channelBytesWrittenSlot(int channel, qint64 written)
emit q->channelBytesWritten(channel, written); emit q->channelBytesWritten(channel, written);
} }
/*!
\internal
*/
void QSslSocketPrivate::_q_readChannelFinishedSlot()
{
Q_Q(QSslSocket);
emit q->readChannelFinished();
}
/*! /*!
\internal \internal
*/ */

View File

@ -224,6 +224,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_channelReadyReadSlot(int)) Q_PRIVATE_SLOT(d_func(), void _q_channelReadyReadSlot(int))
Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64)) Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64))
Q_PRIVATE_SLOT(d_func(), void _q_channelBytesWrittenSlot(int, qint64)) Q_PRIVATE_SLOT(d_func(), void _q_channelBytesWrittenSlot(int, qint64))
Q_PRIVATE_SLOT(d_func(), void _q_readChannelFinishedSlot())
Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer())
Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer()) Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer())
Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation()) Q_PRIVATE_SLOT(d_func(), void _q_resumeImplementation())

View File

@ -180,6 +180,7 @@ public:
void _q_channelReadyReadSlot(int); void _q_channelReadyReadSlot(int);
void _q_bytesWrittenSlot(qint64); void _q_bytesWrittenSlot(qint64);
void _q_channelBytesWrittenSlot(int, qint64); void _q_channelBytesWrittenSlot(int, qint64);
void _q_readChannelFinishedSlot();
void _q_flushWriteBuffer(); void _q_flushWriteBuffer();
void _q_flushReadBuffer(); void _q_flushReadBuffer();
void _q_resumeImplementation(); void _q_resumeImplementation();

View File

@ -1621,6 +1621,7 @@ void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont)
m_uniqueFontData[uniqueFont].refCount.ref(); m_uniqueFontData[uniqueFont].refCount.ref();
} }
// ### fixme Qt 6 (QTBUG-58610): See comment at QWindowsFontDatabase::systemDefaultFont()
HFONT QWindowsFontDatabase::systemFont() HFONT QWindowsFontDatabase::systemFont()
{ {
static const HFONT stock_sysfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); static const HFONT stock_sysfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
@ -1961,12 +1962,31 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q
QFont QWindowsFontDatabase::systemDefaultFont() QFont QWindowsFontDatabase::systemDefaultFont()
{ {
#if QT_VERSION >= 0x060000
// Qt 6: Obtain default GUI font (typically "Segoe UI, 9pt", see QTBUG-58610)
NONCLIENTMETRICS ncm;
ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0);
const QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont);
#else
LOGFONT lf; LOGFONT lf;
GetObject(QWindowsFontDatabase::systemFont(), sizeof(lf), &lf); GetObject(QWindowsFontDatabase::systemFont(), sizeof(lf), &lf);
QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf); QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf);
// "MS Shell Dlg 2" is the correct system font >= Win2k // "MS Shell Dlg 2" is the correct system font >= Win2k
if (systemFont.family() == QLatin1String("MS Shell Dlg")) if (systemFont.family() == QLatin1String("MS Shell Dlg"))
systemFont.setFamily(QStringLiteral("MS Shell Dlg 2")); systemFont.setFamily(QStringLiteral("MS Shell Dlg 2"));
// Qt 5 by (Qt 4) legacy uses GetStockObject(DEFAULT_GUI_FONT) to
// obtain the default GUI font (typically "MS Shell Dlg 2, 8pt"). This has been
// long deprecated; the message font of the NONCLIENTMETRICS structure obtained by
// SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be used instead (see
// QWindowsTheme::refreshFonts(), typically "Segoe UI, 9pt"), which is larger.
// In single monitor setups, the point sizes revolve around 8 (depending on UI
// scale factor, but not proportional to it). However, in multi monitor setups,
// where the DPI of the primary monitor are smaller than those of the secondary,
// large bogus values are returned. Limit to 8.25 in that case.
if (GetSystemMetrics(SM_CMONITORS) > 1 && systemFont.pointSizeF() > 8.25)
systemFont.setPointSizeF(8.25);
#endif // Qt 5
qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont; qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
return systemFont; return systemFont;
} }

View File

@ -124,7 +124,22 @@ void QCocoaInputContext::connectSignals()
void QCocoaInputContext::focusObjectChanged(QObject *focusObject) void QCocoaInputContext::focusObjectChanged(QObject *focusObject)
{ {
Q_UNUSED(focusObject); Q_UNUSED(focusObject);
mWindow = QGuiApplication::focusWindow(); if (mWindow == QGuiApplication::focusWindow()) {
if (!mWindow)
return;
QCocoaWindow *window = static_cast<QCocoaWindow *>(mWindow->handle());
QNSView *view = qnsview_cast(window->view());
if (!view)
return;
if (NSTextInputContext *ctxt = [NSTextInputContext currentInputContext]) {
[ctxt discardMarkedText];
[view cancelComposingText];
}
} else {
mWindow = QGuiApplication::focusWindow();
}
} }
void QCocoaInputContext::updateLocale() void QCocoaInputContext::updateLocale()

View File

@ -63,6 +63,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
Qt::MouseButtons m_acceptedMouseDowns; Qt::MouseButtons m_acceptedMouseDowns;
Qt::MouseButtons m_frameStrutButtons; Qt::MouseButtons m_frameStrutButtons;
QString m_composingText; QString m_composingText;
QPointer<QObject> m_composingFocusObject;
bool m_sendKeyEvent; bool m_sendKeyEvent;
QStringList *currentCustomDragTypes; QStringList *currentCustomDragTypes;
bool m_dontOverrideCtrlLMB; bool m_dontOverrideCtrlLMB;
@ -93,6 +94,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)textInputContextKeyboardSelectionDidChangeNotification : (NSNotification *) textInputContextKeyboardSelectionDidChangeNotification; - (void)textInputContextKeyboardSelectionDidChangeNotification : (NSNotification *) textInputContextKeyboardSelectionDidChangeNotification;
- (void)viewDidHide; - (void)viewDidHide;
- (void)removeFromSuperview; - (void)removeFromSuperview;
- (void)cancelComposingText;
- (BOOL)isFlipped; - (BOOL)isFlipped;
- (BOOL)acceptsFirstResponder; - (BOOL)acceptsFirstResponder;

View File

@ -1544,6 +1544,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
} }
m_composingText.clear(); m_composingText.clear();
m_composingFocusObject = nullptr;
} }
- (void) setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange - (void) setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
@ -1598,6 +1599,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
m_composingText = preeditString; m_composingText = preeditString;
if (QObject *fo = m_platformWindow->window()->focusObject()) { if (QObject *fo = m_platformWindow->window()->focusObject()) {
m_composingFocusObject = fo;
QInputMethodQueryEvent queryEvent(Qt::ImEnabled); QInputMethodQueryEvent queryEvent(Qt::ImEnabled);
if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (QCoreApplication::sendEvent(fo, &queryEvent)) {
if (queryEvent.value(Qt::ImEnabled).toBool()) { if (queryEvent.value(Qt::ImEnabled).toBool()) {
@ -1610,6 +1612,25 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
} }
} }
- (void)cancelComposingText
{
if (m_composingText.isEmpty())
return;
if (m_composingFocusObject) {
QInputMethodQueryEvent queryEvent(Qt::ImEnabled);
if (QCoreApplication::sendEvent(m_composingFocusObject, &queryEvent)) {
if (queryEvent.value(Qt::ImEnabled).toBool()) {
QInputMethodEvent e;
QCoreApplication::sendEvent(m_composingFocusObject, &e);
}
}
}
m_composingText.clear();
m_composingFocusObject = nullptr;
}
- (void) unmarkText - (void) unmarkText
{ {
if (!m_composingText.isEmpty()) { if (!m_composingText.isEmpty()) {
@ -1625,6 +1646,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
} }
} }
m_composingText.clear(); m_composingText.clear();
m_composingFocusObject = nullptr;
} }
- (BOOL) hasMarkedText - (BOOL) hasMarkedText

View File

@ -65,6 +65,7 @@
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
#include <QtCore/QSet> #include <QtCore/QSet>
#include <QtCore/QHash> #include <QtCore/QHash>
@ -867,6 +868,18 @@ static inline bool resizeOnDpiChanged(const QWindow *w)
return result; return result;
} }
static bool shouldHaveNonClientDpiScaling(const QWindow *window)
{
return QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10
&& window->isTopLevel()
&& !window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()
#if QT_CONFIG(opengl) // /QTBUG-62901, EnableNonClientDpiScaling has problems with GL
&& (window->surfaceType() != QSurface::OpenGLSurface
|| QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL)
#endif
;
}
/*! /*!
\brief Main windows procedure registered for windows. \brief Main windows procedure registered for windows.
@ -988,10 +1001,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return true; return true;
case QtWindows::NonClientCreate: case QtWindows::NonClientCreate:
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel() if (shouldHaveNonClientDpiScaling(d->m_creationContext->window))
&& !d->m_creationContext->window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()) {
enableNonClientDpiScaling(msg.hwnd); enableNonClientDpiScaling(msg.hwnd);
}
return false; return false;
case QtWindows::CalculateSize: case QtWindows::CalculateSize:
return QWindowsGeometryHint::handleCalculateSize(d->m_creationContext->customMargins, msg, result); return QWindowsGeometryHint::handleCalculateSize(d->m_creationContext->customMargins, msg, result);

View File

@ -77,7 +77,9 @@
#include <qlineedit.h> #include <qlineedit.h>
#include <qmainwindow.h> #include <qmainwindow.h>
#include <qmdisubwindow.h> #include <qmdisubwindow.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h> #include <qmenubar.h>
#endif
#include <qpaintdevice.h> #include <qpaintdevice.h>
#include <qpainter.h> #include <qpainter.h>
#include <qpixmapcache.h> #include <qpixmapcache.h>
@ -805,7 +807,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
#endif #endif
else if (qobject_cast<const QHeaderView *>(widg)) else if (qobject_cast<const QHeaderView *>(widg))
ct = QStyle::CT_HeaderSection; ct = QStyle::CT_HeaderSection;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
else if (qobject_cast<const QMenuBar *>(widg)) else if (qobject_cast<const QMenuBar *>(widg))
ct = QStyle::CT_MenuBar; ct = QStyle::CT_MenuBar;
#endif #endif

View File

@ -80,7 +80,9 @@
#endif #endif
#include <qmainwindow.h> #include <qmainwindow.h>
#include <qmap.h> #include <qmap.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h> #include <qmenubar.h>
#endif
#include <qpaintdevice.h> #include <qpaintdevice.h>
#include <qpainter.h> #include <qpainter.h>
#include <qpixmapcache.h> #include <qpixmapcache.h>

View File

@ -1869,7 +1869,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
sz.setHeight(minimumHeight); sz.setHeight(minimumHeight);
} }
return sz; return sz;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
case CT_MenuBarItem: case CT_MenuBarItem:
if (!sz.isEmpty()) if (!sz.isEmpty())
sz += QSize(windowsItemHMargin * 5 + 1, 5); sz += QSize(windowsItemHMargin * 5 + 1, 5);

View File

@ -72,7 +72,9 @@
#if QT_CONFIG(listview) #if QT_CONFIG(listview)
#include <qlistview.h> #include <qlistview.h>
#endif #endif
#if QT_CONFIG(stackedwidget)
#include <qstackedwidget.h> #include <qstackedwidget.h>
#endif
#if QT_CONFIG(pushbutton) #if QT_CONFIG(pushbutton)
#include <qpushbutton.h> #include <qpushbutton.h>
#endif #endif
@ -3665,7 +3667,7 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
case CT_Menu: case CT_Menu:
sz += QSize(1, 0); sz += QSize(1, 0);
break; break;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
case CT_MenuBarItem: case CT_MenuBarItem:
if (!sz.isEmpty()) if (!sz.isEmpty())
sz += QSize(windowsItemHMargin * 5 + 1, 6); sz += QSize(windowsItemHMargin * 5 + 1, 6);

View File

@ -38,6 +38,7 @@
"label": "CUPS job control widget", "label": "CUPS job control widget",
"section": "Widgets", "section": "Widgets",
"condition": [ "condition": [
"features.buttongroup",
"features.calendarwidget", "features.calendarwidget",
"features.checkbox", "features.checkbox",
"features.combobox", "features.combobox",

View File

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

View File

@ -94,8 +94,10 @@ namespace QTest
extern int Q_TESTLIB_EXPORT defaultMouseDelay(); extern int Q_TESTLIB_EXPORT defaultMouseDelay();
// pos is in window local coordinates // pos is in window local coordinates
if (window->geometry().width() <= pos.x() || window->geometry().height() <= pos.y()) { const QSize windowSize = window->geometry().size();
QTest::qWarn("Mouse event occurs outside of target window."); if (windowSize.width() <= pos.x() || windowSize.height() <= pos.y()) {
QTest::qWarn(qPrintable(QString::fromLatin1("Mouse event at %1, %2 occurs outside of target window (%3x%4).")
.arg(pos.x()).arg(pos.y()).arg(windowSize.width()).arg(windowSize.height())));
} }
if (delay == -1 || delay < defaultMouseDelay()) if (delay == -1 || delay < defaultMouseDelay())

View File

@ -60,7 +60,9 @@
#include <qwhatsthis.h> #include <qwhatsthis.h>
#endif #endif
#include <QAbstractScrollArea> #include <QAbstractScrollArea>
#if QT_CONFIG(scrollarea)
#include <QScrollArea> #include <QScrollArea>
#endif
#if QT_CONFIG(scrollbar) #if QT_CONFIG(scrollbar)
#include <QScrollBar> #include <QScrollBar>
#endif #endif
@ -388,7 +390,7 @@ QStringList QAccessibleComboBox::keyBindingsForAction(const QString &/*actionNam
#endif // QT_CONFIG(combobox) #endif // QT_CONFIG(combobox)
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
// ======================= QAccessibleAbstractScrollArea ======================= // ======================= QAccessibleAbstractScrollArea =======================
QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget) QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::Client) : QAccessibleWidget(widget, QAccessible::Client)
@ -497,7 +499,7 @@ QAccessibleScrollArea::QAccessibleScrollArea(QWidget *widget)
{ {
Q_ASSERT(qobject_cast<QScrollArea *>(widget)); Q_ASSERT(qobject_cast<QScrollArea *>(widget));
} }
#endif // QT_NO_SCROLLAREA #endif // QT_CONFIG(scrollarea)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -70,7 +70,7 @@ class QTitleBar;
class QAbstractScrollArea; class QAbstractScrollArea;
class QScrollArea; class QScrollArea;
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
class QAccessibleAbstractScrollArea : public QAccessibleWidget class QAccessibleAbstractScrollArea : public QAccessibleWidget
{ {
public: public:
@ -105,7 +105,7 @@ class QAccessibleScrollArea : public QAccessibleAbstractScrollArea
public: public:
explicit QAccessibleScrollArea(QWidget *widget); explicit QAccessibleScrollArea(QWidget *widget);
}; };
#endif // QT_NO_SCROLLAREA #endif // QT_CONFIG(scrollarea)
#if QT_CONFIG(tabbar) #if QT_CONFIG(tabbar)
class QAccessibleTabBar : public QAccessibleWidget class QAccessibleTabBar : public QAccessibleWidget

View File

@ -40,7 +40,9 @@
#include "qaccessiblemenu_p.h" #include "qaccessiblemenu_p.h"
#include <qmenu.h> #include <qmenu.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h> #include <qmenubar.h>
#endif
#include <QtWidgets/QAction> #include <QtWidgets/QAction>
#include <qstyle.h> #include <qstyle.h>
@ -139,7 +141,7 @@ int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const
return -1; return -1;
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
QAccessibleMenuBar::QAccessibleMenuBar(QWidget *w) QAccessibleMenuBar::QAccessibleMenuBar(QWidget *w)
: QAccessibleWidget(w, QAccessible::MenuBar) : QAccessibleWidget(w, QAccessible::MenuBar)
{ {
@ -173,7 +175,7 @@ int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const
return -1; return -1;
} }
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action) QAccessibleMenuItem::QAccessibleMenuItem(QWidget *owner, QAction *action)
: m_action(action), m_owner(owner) : m_action(action), m_owner(owner)
@ -253,13 +255,13 @@ QRect QAccessibleMenuItem::rect() const
{ {
QRect rect; QRect rect;
QWidget *own = owner(); QWidget *own = owner();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) { if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
rect = menuBar->actionGeometry(m_action); rect = menuBar->actionGeometry(m_action);
QPoint globalPos = menuBar->mapToGlobal(QPoint(0,0)); QPoint globalPos = menuBar->mapToGlobal(QPoint(0,0));
rect = rect.translated(globalPos); rect = rect.translated(globalPos);
} else } else
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
if (QMenu *menu = qobject_cast<QMenu*>(own)) { if (QMenu *menu = qobject_cast<QMenu*>(own)) {
rect = menu->actionGeometry(m_action); rect = menu->actionGeometry(m_action);
QPoint globalPos = menu->mapToGlobal(QPoint(0,0)); QPoint globalPos = menu->mapToGlobal(QPoint(0,0));
@ -289,7 +291,7 @@ QAccessible::State QAccessibleMenuItem::state() const
if (QMenu *menu = qobject_cast<QMenu*>(own)) { if (QMenu *menu = qobject_cast<QMenu*>(own)) {
if (menu->activeAction() == m_action) if (menu->activeAction() == m_action)
s.focused = true; s.focused = true;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
} else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) { } else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
if (menuBar->activeAction() == m_action) if (menuBar->activeAction() == m_action)
s.focused = true; s.focused = true;

View File

@ -82,7 +82,7 @@ protected:
QMenu *menu() const; QMenu *menu() const;
}; };
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
class QAccessibleMenuBar : public QAccessibleWidget class QAccessibleMenuBar : public QAccessibleWidget
{ {
public: public:
@ -96,7 +96,7 @@ public:
protected: protected:
QMenuBar *menuBar() const; QMenuBar *menuBar() const;
}; };
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActionInterface class QAccessibleMenuItem : public QAccessibleInterface, public QAccessibleActionInterface

View File

@ -138,7 +138,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
#endif #endif
} else if (classname == QLatin1String("QToolBar")) { } else if (classname == QLatin1String("QToolBar")) {
iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle()); iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle());
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
} else if (classname == QLatin1String("QMenuBar")) { } else if (classname == QLatin1String("QMenuBar")) {
iface = new QAccessibleMenuBar(widget); iface = new QAccessibleMenuBar(widget);
#endif #endif
@ -177,7 +177,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
iface = new QAccessibleDisplay(widget, QAccessible::ToolTip); iface = new QAccessibleDisplay(widget, QAccessible::ToolTip);
} else if (classname == QLatin1String("QFrame")) { } else if (classname == QLatin1String("QFrame")) {
iface = new QAccessibleWidget(widget, QAccessible::Border); iface = new QAccessibleWidget(widget, QAccessible::Border);
#ifndef QT_NO_STACKEDWIDGET #if QT_CONFIG(stackedwidget)
} else if (classname == QLatin1String("QStackedWidget")) { } else if (classname == QLatin1String("QStackedWidget")) {
iface = new QAccessibleStackedWidget(widget); iface = new QAccessibleStackedWidget(widget);
#endif #endif
@ -207,7 +207,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QTextBrowser")) { } else if (classname == QLatin1String("QTextBrowser")) {
iface = new QAccessibleTextBrowser(widget); iface = new QAccessibleTextBrowser(widget);
#endif #endif
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
} else if (classname == QLatin1String("QAbstractScrollArea")) { } else if (classname == QLatin1String("QAbstractScrollArea")) {
iface = new QAccessibleAbstractScrollArea(widget); iface = new QAccessibleAbstractScrollArea(widget);
} else if (classname == QLatin1String("QScrollArea")) { } else if (classname == QLatin1String("QScrollArea")) {

View File

@ -52,7 +52,9 @@
#endif #endif
#include "qdebug.h" #include "qdebug.h"
#include <QApplication> #include <QApplication>
#if QT_CONFIG(stackedwidget)
#include <QStackedWidget> #include <QStackedWidget>
#endif
#if QT_CONFIG(toolbox) #if QT_CONFIG(toolbox)
#include <QToolBox> #include <QToolBox>
#endif #endif
@ -310,7 +312,7 @@ void QAccessibleTextEdit::scrollToSubstring(int startIndex, int endIndex)
#endif // QT_NO_TEXTEDIT && QT_NO_CURSOR #endif // QT_NO_TEXTEDIT && QT_NO_CURSOR
#ifndef QT_NO_STACKEDWIDGET #if QT_CONFIG(stackedwidget)
// ======================= QAccessibleStackedWidget ====================== // ======================= QAccessibleStackedWidget ======================
QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget) QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::LayeredPane) : QAccessibleWidget(widget, QAccessible::LayeredPane)
@ -356,7 +358,7 @@ QStackedWidget *QAccessibleStackedWidget::stackedWidget() const
{ {
return static_cast<QStackedWidget *>(object()); return static_cast<QStackedWidget *>(object());
} }
#endif // QT_NO_STACKEDWIDGET #endif // QT_CONFIG(stackedwidget)
#if QT_CONFIG(toolbox) #if QT_CONFIG(toolbox)
// ======================= QAccessibleToolBox ====================== // ======================= QAccessibleToolBox ======================

View File

@ -74,7 +74,8 @@
"effects": { "effects": {
"label": "Effects", "label": "Effects",
"purpose": "Provides special widget effects (e.g. fading and scrolling).", "purpose": "Provides special widget effects (e.g. fading and scrolling).",
"section": "Kernel" "section": "Kernel",
"output": [ "privateFeature" ]
}, },
"filesystemmodel": { "filesystemmodel": {
"label": "QFileSystemModel", "label": "QFileSystemModel",

View File

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

View File

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

View File

@ -41,7 +41,9 @@
#include "qapplication.h" #include "qapplication.h"
#include "qlayoutengine_p.h" #include "qlayoutengine_p.h"
#if QT_CONFIG(menubar)
#include "qmenubar.h" #include "qmenubar.h"
#endif
#include "qtoolbar.h" #include "qtoolbar.h"
#include "qsizegrip.h" #include "qsizegrip.h"
#include "qevent.h" #include "qevent.h"
@ -583,7 +585,7 @@ void QLayoutPrivate::doResize(const QSize &r)
const int mbTop = rect.top(); const int mbTop = rect.top();
rect.setTop(mbTop + mbh); rect.setTop(mbTop + mbh);
q->setGeometry(rect); q->setGeometry(rect);
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (menubar) if (menubar)
menubar->setGeometry(rect.left(), mbTop, r.width(), mbh); menubar->setGeometry(rect.left(), mbTop, r.width(), mbh);
#endif #endif
@ -615,7 +617,7 @@ void QLayout::widgetEvent(QEvent *e)
{ {
QChildEvent *c = (QChildEvent *)e; QChildEvent *c = (QChildEvent *)e;
if (c->child()->isWidgetType()) { if (c->child()->isWidgetType()) {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (c->child() == d->menubar) if (c->child() == d->menubar)
d->menubar = 0; d->menubar = 0;
#endif #endif
@ -664,7 +666,7 @@ int QLayout::totalHeightForWidth(int w) const
top += wd->topmargin + wd->bottommargin; top += wd->topmargin + wd->bottommargin;
} }
int h = heightForWidth(w - side) + top; int h = heightForWidth(w - side) + top;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
h += menuBarHeightForWidth(d->menubar, w); h += menuBarHeightForWidth(d->menubar, w);
#endif #endif
return h; return h;
@ -687,7 +689,7 @@ QSize QLayout::totalMinimumSize() const
} }
QSize s = minimumSize(); QSize s = minimumSize();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width() + side); top += menuBarHeightForWidth(d->menubar, s.width() + side);
#endif #endif
return s + QSize(side, top); return s + QSize(side, top);
@ -712,7 +714,7 @@ QSize QLayout::totalSizeHint() const
QSize s = sizeHint(); QSize s = sizeHint();
if (hasHeightForWidth()) if (hasHeightForWidth())
s.setHeight(heightForWidth(s.width() + side)); s.setHeight(heightForWidth(s.width() + side));
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width()); top += menuBarHeightForWidth(d->menubar, s.width());
#endif #endif
return s + QSize(side, top); return s + QSize(side, top);
@ -735,7 +737,7 @@ QSize QLayout::totalMaximumSize() const
} }
QSize s = maximumSize(); QSize s = maximumSize();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width()); top += menuBarHeightForWidth(d->menubar, s.width());
#endif #endif
@ -813,7 +815,7 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw)
Q_Q(QLayout); Q_Q(QLayout);
int n = q->count(); int n = q->count();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (menubar && menubar->parentWidget() != mw) { if (menubar && menubar->parentWidget() != mw) {
menubar->setParent(mw); menubar->setParent(mw);
} }

View File

@ -41,7 +41,9 @@
#include "qapplication.h" #include "qapplication.h"
#include "qlayoutengine_p.h" #include "qlayoutengine_p.h"
#if QT_CONFIG(menubar)
#include "qmenubar.h" #include "qmenubar.h"
#endif
#include "qtoolbar.h" #include "qtoolbar.h"
#include "qevent.h" #include "qevent.h"
#include "qstyle.h" #include "qstyle.h"

View File

@ -46,7 +46,9 @@
#include <qwhatsthis.h> #include <qwhatsthis.h>
#endif #endif
#include <qmenu.h> #include <qmenu.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h> #include <qmenubar.h>
#endif
#include <qapplication.h> #include <qapplication.h>
#include <private/qapplication_p.h> #include <private/qapplication_p.h>
#include <private/qshortcutmap_p.h> #include <private/qshortcutmap_p.h>
@ -143,7 +145,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window) static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window)
{ {
bool visible = w->isVisible(); bool visible = w->isVisible();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(w)) { if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(w)) {
if (menuBar->isNativeMenuBar()) if (menuBar->isNativeMenuBar())
visible = true; visible = true;
@ -208,7 +210,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window) static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)
{ {
bool visible = w->isVisible(); bool visible = w->isVisible();
#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR) #if defined(Q_OS_DARWIN) && QT_CONFIG(menubar)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true; visible = true;
#endif #endif

View File

@ -40,6 +40,8 @@
# include <private/qcore_mac_p.h> # include <private/qcore_mac_p.h>
#endif #endif
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <qapplication.h> #include <qapplication.h>
#include <qdesktopwidget.h> #include <qdesktopwidget.h>
#include <private/qdesktopwidget_p.h> #include <private/qdesktopwidget_p.h>
@ -49,7 +51,9 @@
#include <qstyleoption.h> #include <qstyleoption.h>
#include <qstylepainter.h> #include <qstylepainter.h>
#include <qtimer.h> #include <qtimer.h>
#if QT_CONFIG(effects)
#include <private/qeffects_p.h> #include <private/qeffects_p.h>
#endif
#include <qtextdocument.h> #include <qtextdocument.h>
#include <qdebug.h> #include <qdebug.h>
#include <private/qstylesheetstyle_p.h> #include <private/qstylesheetstyle_p.h>
@ -286,7 +290,7 @@ void QTipLabel::timerEvent(QTimerEvent *e)
|| e->timerId() == expireTimer.timerId()){ || e->timerId() == expireTimer.timerId()){
hideTimer.stop(); hideTimer.stop();
expireTimer.stop(); expireTimer.stop();
#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) #if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(effects)
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){ if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){
// Fade out tip on mac (makes it invisible). // Fade out tip on mac (makes it invisible).
// The tip will not be deleted until a new tip is shown. // The tip will not be deleted until a new tip is shown.
@ -506,7 +510,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons
QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label")); QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label"));
#if !defined(QT_NO_EFFECTS) && !0 /* Used to be included in Qt4 for Q_WS_MAC */ #if QT_CONFIG(effects) && !0 /* Used to be included in Qt4 for Q_WS_MAC */
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
qFadeEffect(QTipLabel::instance); qFadeEffect(QTipLabel::instance);
else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))

View File

@ -2439,7 +2439,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
{ {
Q_Q(const QWidget); Q_Q(const QWidget);
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
bool resetBrushOrigin = false; bool resetBrushOrigin = false;
QPointF oldBrushOrigin; QPointF oldBrushOrigin;
//If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture
@ -2452,7 +2452,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
painter->setBrushOrigin(-priv->contentsOffset()); painter->setBrushOrigin(-priv->contentsOffset());
} }
#endif // QT_NO_SCROLLAREA #endif // QT_CONFIG(scrollarea)
const QBrush autoFillBrush = q->palette().brush(q->backgroundRole()); const QBrush autoFillBrush = q->palette().brush(q->backgroundRole());
@ -2479,10 +2479,10 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q); q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q);
} }
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
if (resetBrushOrigin) if (resetBrushOrigin)
painter->setBrushOrigin(oldBrushOrigin); painter->setBrushOrigin(oldBrushOrigin);
#endif // QT_NO_SCROLLAREA #endif // QT_CONFIG(scrollarea)
} }
/* /*

View File

@ -101,7 +101,7 @@ public:
#ifndef QT_NO_MDIAREA #ifndef QT_NO_MDIAREA
|| qobject_cast<QMdiSubWindow *>(p) != 0 || qobject_cast<QMdiSubWindow *>(p) != 0
#endif #endif
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
|| qobject_cast<QAbstractScrollArea *>(p) != 0 || qobject_cast<QAbstractScrollArea *>(p) != 0
#endif #endif
) { ) {

View File

@ -1392,7 +1392,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2); opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2);
break; break;
#endif // QT_NO_MENU #endif // QT_NO_MENU
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
case CE_MenuBarItem: case CE_MenuBarItem:
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
@ -1412,7 +1412,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground)) if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground))
p->eraseRect(opt->rect); p->eraseRect(opt->rect);
break; break;
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
#if QT_CONFIG(progressbar) #if QT_CONFIG(progressbar)
case CE_ProgressBar: case CE_ProgressBar:
if (const QStyleOptionProgressBar *pb if (const QStyleOptionProgressBar *pb

View File

@ -46,7 +46,9 @@
#include <qdebug.h> #include <qdebug.h>
#include <qapplication.h> #include <qapplication.h>
#include <qmenu.h> #include <qmenu.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h> #include <qmenubar.h>
#endif
#include <qpainter.h> #include <qpainter.h>
#include <qstyleoption.h> #include <qstyleoption.h>
#include <qlineedit.h> #include <qlineedit.h>
@ -1662,7 +1664,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w); return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w);
#endif #endif
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (qobject_cast<const QMenuBar *>(w)) if (qobject_cast<const QMenuBar *>(w))
return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w); return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w);
#endif #endif
@ -2365,7 +2367,7 @@ static QWidget *embeddedWidget(QWidget *w)
return sb->findChild<QLineEdit *>(); return sb->findChild<QLineEdit *>();
#endif #endif
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w))
return sa->viewport(); return sa->viewport();
#endif #endif
@ -2396,7 +2398,7 @@ static QWidget *containerWidget(const QWidget *w)
} }
#endif // QT_NO_LINEEDIT #endif // QT_NO_LINEEDIT
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) { if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) {
if (sa->viewport() == w) if (sa->viewport() == w)
return w->parentWidget(); return w->parentWidget();
@ -2800,7 +2802,7 @@ void QStyleSheetStyle::polish(QWidget *w)
} }
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) { if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled); QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled);
if ((rule.hasBorder() && rule.border()->hasBorderImage()) if ((rule.hasBorder() && rule.border()->hasBorderImage())
@ -2831,7 +2833,7 @@ void QStyleSheetStyle::polish(QWidget *w)
#ifndef QT_NO_MDIAREA #ifndef QT_NO_MDIAREA
|| qobject_cast<QMdiSubWindow *>(w) || qobject_cast<QMdiSubWindow *>(w)
#endif #endif
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
|| qobject_cast<QMenuBar *>(w) || qobject_cast<QMenuBar *>(w)
#endif #endif
#if QT_CONFIG(dialog) #if QT_CONFIG(dialog)
@ -2902,7 +2904,7 @@ void QStyleSheetStyle::unpolish(QWidget *w)
w->setProperty("_q_stylesheet_maxh", QVariant()); w->setProperty("_q_stylesheet_maxh", QVariant());
w->setAttribute(Qt::WA_StyleSheet, false); w->setAttribute(Qt::WA_StyleSheet, false);
QObject::disconnect(w, 0, this, 0); QObject::disconnect(w, 0, this, 0);
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) { if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
sa, SLOT(update())); sa, SLOT(update()));
@ -4374,7 +4376,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
} }
break; break;
} }
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) { if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {
const QAbstractScrollAreaPrivate *sap = sa->d_func(); const QAbstractScrollAreaPrivate *sap = sa->d_func();
rule.drawBackground(p, opt->rect, sap->contentsOffset()); rule.drawBackground(p, opt->rect, sap->contentsOffset());

View File

@ -47,8 +47,10 @@
#include "qdrawutil.h" // for now #include "qdrawutil.h" // for now
#include "qevent.h" #include "qevent.h"
#include "qmenu.h" #include "qmenu.h"
#if QT_CONFIG(menubar)
#include "qmenubar.h" #include "qmenubar.h"
#include <private/qmenubar_p.h> #include <private/qmenubar_p.h>
#endif
#include "qpaintengine.h" #include "qpaintengine.h"
#include "qpainter.h" #include "qpainter.h"
#if QT_CONFIG(rubberband) #if QT_CONFIG(rubberband)
@ -166,7 +168,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
// Update state and repaint the menu bars. // Update state and repaint the menu bars.
d->alt_down = false; d->alt_down = false;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
QList<QMenuBar *> l = widget->findChildren<QMenuBar *>(); QList<QMenuBar *> l = widget->findChildren<QMenuBar *>();
for (int i = 0; i < l.size(); ++i) for (int i = 0; i < l.size(); ++i)
l.at(i)->update(); l.at(i)->update();
@ -574,7 +576,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
// Do nothing if we always paint underlines // Do nothing if we always paint underlines
Q_D(const QWindowsStyle); Q_D(const QWindowsStyle);
if (!ret && widget && d) { if (!ret && widget && d) {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget); const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
if (!menuBar && qobject_cast<const QMenu *>(widget)) { if (!menuBar && qobject_cast<const QMenu *>(widget)) {
QWidget *w = QApplication::activeWindow(); QWidget *w = QApplication::activeWindow();
@ -587,7 +589,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
ret = 1; ret = 1;
// Otherwise draw underlines if the toplevel widget has seen an alt-press // Otherwise draw underlines if the toplevel widget has seen an alt-press
} else } else
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
if (d->hasSeenAlt(widget)) { if (d->hasSeenAlt(widget)) {
ret = 1; ret = 1;
} }
@ -1260,7 +1262,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
} }
break; break;
#endif // QT_NO_MENU #endif // QT_NO_MENU
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
case CE_MenuBarItem: case CE_MenuBarItem:
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
bool active = mbi->state & State_Selected; bool active = mbi->state & State_Selected;
@ -1284,7 +1286,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
QCommonStyle::drawControl(ce, &newMbi, p, widget); QCommonStyle::drawControl(ce, &newMbi, p, widget);
} }
break; break;
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
#if QT_CONFIG(tabbar) #if QT_CONFIG(tabbar)
case CE_TabBarTabShape: case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
@ -2392,7 +2394,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
} }
break; break;
#endif // QT_NO_MENU #endif // QT_NO_MENU
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
case CT_MenuBarItem: case CT_MenuBarItem:
if (!sz.isEmpty()) if (!sz.isEmpty())
sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2); sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2);

View File

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

View File

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

View File

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

View File

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

View File

@ -39,11 +39,13 @@
#include "private/qabstractbutton_p.h" #include "private/qabstractbutton_p.h"
#include "private/qbuttongroup_p.h"
#if QT_CONFIG(itemviews) #if QT_CONFIG(itemviews)
#include "qabstractitemview.h" #include "qabstractitemview.h"
#endif #endif
#if QT_CONFIG(buttongroup)
#include "qbuttongroup.h" #include "qbuttongroup.h"
#include "private/qbuttongroup_p.h"
#endif
#include "qabstractbutton_p.h" #include "qabstractbutton_p.h"
#include "qevent.h" #include "qevent.h"
#include "qpainter.h" #include "qpainter.h"
@ -173,7 +175,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
#endif #endif
checkable(false), checked(false), autoRepeat(false), autoExclusive(false), checkable(false), checked(false), autoRepeat(false), autoExclusive(false),
down(false), blockRefresh(false), pressed(false), down(false), blockRefresh(false), pressed(false),
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
group(0), group(0),
#endif #endif
autoRepeatDelay(AUTO_REPEAT_DELAY), autoRepeatDelay(AUTO_REPEAT_DELAY),
@ -183,7 +185,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type)
QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
{ {
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (group) if (group)
return group->d_func()->buttonList; return group->d_func()->buttonList;
#endif #endif
@ -192,7 +194,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
if (autoExclusive) { if (autoExclusive) {
auto isNoMemberOfMyAutoExclusiveGroup = [](QAbstractButton *candidate) { auto isNoMemberOfMyAutoExclusiveGroup = [](QAbstractButton *candidate) {
return !candidate->autoExclusive() return !candidate->autoExclusive()
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
|| candidate->group() || candidate->group()
#endif #endif
; ;
@ -206,7 +208,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const
{ {
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (group) if (group)
return group->d_func()->checkedButton; return group->d_func()->checkedButton;
#endif #endif
@ -226,7 +228,7 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const
void QAbstractButtonPrivate::notifyChecked() void QAbstractButtonPrivate::notifyChecked()
{ {
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
Q_Q(QAbstractButton); Q_Q(QAbstractButton);
if (group) { if (group) {
QAbstractButton *previous = group->d_func()->checkedButton; QAbstractButton *previous = group->d_func()->checkedButton;
@ -244,7 +246,7 @@ void QAbstractButtonPrivate::notifyChecked()
void QAbstractButtonPrivate::moveFocus(int key) void QAbstractButtonPrivate::moveFocus(int key)
{ {
QList<QAbstractButton *> buttonList = queryButtonList();; QList<QAbstractButton *> buttonList = queryButtonList();;
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
bool exclusive = group ? group->d_func()->exclusive : autoExclusive; bool exclusive = group ? group->d_func()->exclusive : autoExclusive;
#else #else
bool exclusive = autoExclusive; bool exclusive = autoExclusive;
@ -335,7 +337,7 @@ void QAbstractButtonPrivate::moveFocus(int key)
void QAbstractButtonPrivate::fixFocusPolicy() void QAbstractButtonPrivate::fixFocusPolicy()
{ {
Q_Q(QAbstractButton); Q_Q(QAbstractButton);
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (!group && !autoExclusive) if (!group && !autoExclusive)
#else #else
if (!autoExclusive) if (!autoExclusive)
@ -382,7 +384,7 @@ void QAbstractButtonPrivate::click()
bool changeState = true; bool changeState = true;
if (checked && queryCheckedButton() == q) { if (checked && queryCheckedButton() == q) {
// the checked button of an exclusive or autoexclusive group cannot be unchecked // the checked button of an exclusive or autoexclusive group cannot be unchecked
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (group ? group->d_func()->exclusive : autoExclusive) if (group ? group->d_func()->exclusive : autoExclusive)
#else #else
if (autoExclusive) if (autoExclusive)
@ -410,7 +412,7 @@ void QAbstractButtonPrivate::emitClicked()
Q_Q(QAbstractButton); Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q); QPointer<QAbstractButton> guard(q);
emit q->clicked(checked); emit q->clicked(checked);
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
emit group->buttonClicked(group->id(q)); emit group->buttonClicked(group->id(q));
if (guard && group) if (guard && group)
@ -424,7 +426,7 @@ void QAbstractButtonPrivate::emitPressed()
Q_Q(QAbstractButton); Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q); QPointer<QAbstractButton> guard(q);
emit q->pressed(); emit q->pressed();
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
emit group->buttonPressed(group->id(q)); emit group->buttonPressed(group->id(q));
if (guard && group) if (guard && group)
@ -438,7 +440,7 @@ void QAbstractButtonPrivate::emitReleased()
Q_Q(QAbstractButton); Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q); QPointer<QAbstractButton> guard(q);
emit q->released(); emit q->released();
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
emit group->buttonReleased(group->id(q)); emit group->buttonReleased(group->id(q));
if (guard && group) if (guard && group)
@ -452,7 +454,7 @@ void QAbstractButtonPrivate::emitToggled(bool checked)
Q_Q(QAbstractButton); Q_Q(QAbstractButton);
QPointer<QAbstractButton> guard(q); QPointer<QAbstractButton> guard(q);
emit q->toggled(checked); emit q->toggled(checked);
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
emit group->buttonToggled(group->id(q), checked); emit group->buttonToggled(group->id(q), checked);
if (guard && group) if (guard && group)
@ -476,7 +478,7 @@ QAbstractButton::QAbstractButton(QWidget *parent)
*/ */
QAbstractButton::~QAbstractButton() QAbstractButton::~QAbstractButton()
{ {
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
Q_D(QAbstractButton); Q_D(QAbstractButton);
if (d->group) if (d->group)
d->group->removeButton(this); d->group->removeButton(this);
@ -623,7 +625,7 @@ void QAbstractButton::setChecked(bool checked)
if (!checked && d->queryCheckedButton() == this) { if (!checked && d->queryCheckedButton() == this) {
// the checked button of an exclusive or autoexclusive group cannot be unchecked // the checked button of an exclusive or autoexclusive group cannot be unchecked
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
if (d->group ? d->group->d_func()->exclusive : d->autoExclusive) if (d->group ? d->group->d_func()->exclusive : d->autoExclusive)
return; return;
if (d->group) if (d->group)
@ -798,7 +800,7 @@ bool QAbstractButton::autoExclusive() const
return d->autoExclusive; return d->autoExclusive;
} }
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
/*! /*!
Returns the group that this button belongs to. Returns the group that this button belongs to.
@ -812,7 +814,7 @@ QButtonGroup *QAbstractButton::group() const
Q_D(const QAbstractButton); Q_D(const QAbstractButton);
return d->group; return d->group;
} }
#endif // QT_NO_BUTTONGROUP #endif // QT_CONFIG(buttongroup)
/*! /*!
Performs an animated click: the button is pressed immediately, and Performs an animated click: the button is pressed immediately, and
@ -1070,7 +1072,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
#endif #endif
QWidget *pw = parentWidget(); QWidget *pw = parentWidget();
if (d->autoExclusive if (d->autoExclusive
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
|| d->group || d->group
#endif #endif
#if QT_CONFIG(itemviews) #if QT_CONFIG(itemviews)

View File

@ -108,7 +108,7 @@ public:
void setAutoExclusive(bool); void setAutoExclusive(bool);
bool autoExclusive() const; bool autoExclusive() const;
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
QButtonGroup *group() const; QButtonGroup *group() const;
#endif #endif

View File

@ -80,7 +80,7 @@ public:
uint blockRefresh :1; uint blockRefresh :1;
uint pressed : 1; uint pressed : 1;
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
QButtonGroup* group; QButtonGroup* group;
#endif #endif
QBasicTimer repeatTimer; QBasicTimer repeatTimer;

View File

@ -39,7 +39,7 @@
#include "qabstractscrollarea.h" #include "qabstractscrollarea.h"
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
#include "qscrollbar.h" #include "qscrollbar.h"
#include "qapplication.h" #include "qapplication.h"
@ -1662,4 +1662,4 @@ QT_END_NAMESPACE
#include "moc_qabstractscrollarea.cpp" #include "moc_qabstractscrollarea.cpp"
#include "moc_qabstractscrollarea_p.cpp" #include "moc_qabstractscrollarea_p.cpp"
#endif // QT_NO_SCROLLAREA #endif // QT_CONFIG(scrollarea)

View File

@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
class QMargins; class QMargins;
class QScrollBar; class QScrollBar;
@ -146,7 +146,7 @@ private:
friend class QWidgetPrivate; friend class QWidgetPrivate;
}; };
#endif // QT_NO_SCROLLAREA #endif // QT_CONFIG(scrollarea)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_SCROLLAREA #if QT_CONFIG(scrollarea)
class QScrollBar; class QScrollBar;
class QAbstractScrollAreaScrollBarContainer; class QAbstractScrollAreaScrollBarContainer;
@ -149,7 +149,7 @@ private:
Qt::Orientation orientation; Qt::Orientation orientation;
}; };
#endif // QT_NO_SCROLLAREA #endif // QT_CONFIG(scrollarea)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -39,8 +39,6 @@
#include "private/qbuttongroup_p.h" #include "private/qbuttongroup_p.h"
#ifndef QT_NO_BUTTONGROUP
#include "private/qabstractbutton_p.h" #include "private/qabstractbutton_p.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -362,5 +360,3 @@ int QButtonGroup::checkedId() const
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qbuttongroup.cpp" #include "moc_qbuttongroup.cpp"
#endif // QT_NO_BUTTONGROUP

View File

@ -43,11 +43,10 @@
#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h> #include <QtCore/qobject.h>
QT_REQUIRE_CONFIG(buttongroup);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BUTTONGROUP
class QAbstractButton; class QAbstractButton;
class QAbstractButtonPrivate; class QAbstractButtonPrivate;
class QButtonGroupPrivate; class QButtonGroupPrivate;
@ -94,8 +93,6 @@ private:
friend class QAbstractButtonPrivate; friend class QAbstractButtonPrivate;
}; };
#endif // QT_NO_BUTTONGROUP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBUTTONGROUP_H #endif // QBUTTONGROUP_H

View File

@ -54,14 +54,14 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qbuttongroup.h> #include <QtWidgets/qbuttongroup.h>
#ifndef QT_NO_BUTTONGROUP
#include <QtCore/private/qobject_p.h> #include <QtCore/private/qobject_p.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
#include <QtCore/qpointer.h> #include <QtCore/qpointer.h>
#include <QtCore/qhash.h> #include <QtCore/qhash.h>
QT_REQUIRE_CONFIG(buttongroup);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QButtonGroupPrivate: public QObjectPrivate class QButtonGroupPrivate: public QObjectPrivate
@ -81,6 +81,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_BUTTONGROUP
#endif // QBUTTONGROUP_P_H #endif // QBUTTONGROUP_P_H

View File

@ -71,7 +71,7 @@
#include <private/qabstractscrollarea_p.h> #include <private/qabstractscrollarea_p.h>
#include <private/qlineedit_p.h> #include <private/qlineedit_p.h>
#include <qdebug.h> #include <qdebug.h>
#ifndef QT_NO_EFFECTS #if QT_CONFIG(effects)
# include <private/qeffects_p.h> # include <private/qeffects_p.h>
#endif #endif
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
@ -103,7 +103,7 @@ QComboBoxPrivate::QComboBoxPrivate()
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
, m_platformMenu(0) , m_platformMenu(0)
#endif #endif
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
, completer(0) , completer(0)
#endif #endif
{ {
@ -189,7 +189,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
return menuOption; return menuOption;
} }
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index) void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)
{ {
Q_Q(QComboBox); Q_Q(QComboBox);
@ -224,7 +224,7 @@ void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)
} }
# endif // QT_KEYPAD_NAVIGATION # endif // QT_KEYPAD_NAVIGATION
} }
#endif // !QT_NO_COMPLETER #endif // QT_CONFIG(completer)
void QComboBoxPrivate::updateArrow(QStyle::StateFlag state) void QComboBoxPrivate::updateArrow(QStyle::StateFlag state)
{ {
@ -1214,7 +1214,7 @@ Qt::MatchFlags QComboBoxPrivate::matchFlags() const
{ {
// Base how duplicates are determined on the autocompletion case sensitivity // Base how duplicates are determined on the autocompletion case sensitivity
Qt::MatchFlags flags = Qt::MatchFixedString; Qt::MatchFlags flags = Qt::MatchFixedString;
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive) if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive)
#endif #endif
flags |= Qt::MatchCaseSensitive; flags |= Qt::MatchCaseSensitive;
@ -1443,7 +1443,7 @@ int QComboBox::maxCount() const
return d->maxCount; return d->maxCount;
} }
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
/*! /*!
\property QComboBox::autoCompletion \property QComboBox::autoCompletion
@ -1538,7 +1538,7 @@ void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity
d->lineEdit->completer()->setCaseSensitivity(sensitivity); d->lineEdit->completer()->setCaseSensitivity(sensitivity);
} }
#endif // QT_NO_COMPLETER #endif // QT_CONFIG(completer)
/*! /*!
\property QComboBox::duplicatesEnabled \property QComboBox::duplicatesEnabled
@ -1820,12 +1820,12 @@ void QComboBox::setLineEdit(QLineEdit *edit)
d->updateFocusPolicy(); d->updateFocusPolicy();
d->lineEdit->setFocusProxy(this); d->lineEdit->setFocusProxy(this);
d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
setAutoCompletion(d->autoCompletion); setAutoCompletion(d->autoCompletion);
#endif #endif
#ifdef QT_KEYPAD_NAVIGATION #ifdef QT_KEYPAD_NAVIGATION
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (QApplication::keypadNavigationEnabled()) { if (QApplication::keypadNavigationEnabled()) {
// Editable combo boxes will have a completer that is set to UnfilteredPopupCompletion. // 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 // This means that when the user enters edit mode they are immediately presented with a
@ -1889,7 +1889,7 @@ const QValidator *QComboBox::validator() const
} }
#endif // QT_NO_VALIDATOR #endif // QT_NO_VALIDATOR
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
/*! /*!
\fn void QComboBox::setCompleter(QCompleter *completer) \fn void QComboBox::setCompleter(QCompleter *completer)
@ -1929,7 +1929,7 @@ QCompleter *QComboBox::completer() const
return d->lineEdit ? d->lineEdit->completer() : 0; 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. Returns the item delegate used by the popup list view.
@ -1995,7 +1995,7 @@ void QComboBox::setModel(QAbstractItemModel *model)
if (model == d->model) if (model == d->model)
return; return;
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (d->lineEdit && d->lineEdit->completer() if (d->lineEdit && d->lineEdit->completer()
&& d->lineEdit->completer() == d->completer) && d->lineEdit->completer() == d->completer)
d->lineEdit->completer()->setModel(model); d->lineEdit->completer()->setModel(model);
@ -2141,7 +2141,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
const QString newText = itemText(normalized); const QString newText = itemText(normalized);
if (lineEdit->text() != newText) { if (lineEdit->text() != newText) {
lineEdit->setText(newText); // may cause lineEdit -> nullptr (QTBUG-54191) lineEdit->setText(newText); // may cause lineEdit -> nullptr (QTBUG-54191)
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (lineEdit && lineEdit->completer()) if (lineEdit && lineEdit->completer())
lineEdit->completer()->setCompletionPrefix(newText); lineEdit->completer()->setCompletionPrefix(newText);
#endif #endif
@ -2592,7 +2592,7 @@ void QComboBox::showPopup()
#endif // Q_OS_MAC #endif // Q_OS_MAC
#ifdef QT_KEYPAD_NAVIGATION #ifdef QT_KEYPAD_NAVIGATION
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (QApplication::keypadNavigationEnabled() && d->completer) { if (QApplication::keypadNavigationEnabled() && d->completer) {
// editable combo box is line edit plus completer // editable combo box is line edit plus completer
setEditFocus(true); setEditFocus(true);
@ -2754,7 +2754,7 @@ void QComboBox::showPopup()
const bool updatesEnabled = container->updatesEnabled(); const bool updatesEnabled = container->updatesEnabled();
#endif #endif
#if !defined(QT_NO_EFFECTS) #if QT_CONFIG(effects)
bool scrollDown = (listRect.topLeft() == below); bool scrollDown = (listRect.topLeft() == below);
if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)
&& !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen))
@ -2826,7 +2826,7 @@ void QComboBox::hidePopup()
{ {
Q_D(QComboBox); Q_D(QComboBox);
if (d->container && d->container->isVisible()) { if (d->container && d->container->isVisible()) {
#if !defined(QT_NO_EFFECTS) #if QT_CONFIG(effects)
QSignalBlocker modelBlocker(d->model); QSignalBlocker modelBlocker(d->model);
QSignalBlocker viewBlocker(d->container->itemView()); QSignalBlocker viewBlocker(d->container->itemView());
QSignalBlocker containerBlocker(d->container); QSignalBlocker containerBlocker(d->container);
@ -2870,7 +2870,7 @@ void QComboBox::hidePopup()
modelBlocker.unblock(); modelBlocker.unblock();
if (!didFade) if (!didFade)
#endif // QT_NO_EFFECTS #endif // QT_CONFIG(effects)
// Fade should implicitly hide as well ;-) // Fade should implicitly hide as well ;-)
d->container->hide(); d->container->hide();
} }
@ -2934,7 +2934,7 @@ void QComboBox::focusInEvent(QFocusEvent *e)
update(); update();
if (d->lineEdit) { if (d->lineEdit) {
d->lineEdit->event(e); d->lineEdit->event(e);
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (d->lineEdit->completer()) if (d->lineEdit->completer())
d->lineEdit->completer()->setWidget(this); d->lineEdit->completer()->setWidget(this);
#endif #endif
@ -3160,7 +3160,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
{ {
Q_D(QComboBox); Q_D(QComboBox);
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (d->lineEdit if (d->lineEdit
&& d->lineEdit->completer() && d->lineEdit->completer()
&& d->lineEdit->completer()->popup() && d->lineEdit->completer()->popup()
@ -3496,7 +3496,7 @@ void QComboBox::setModelColumn(int visibleColumn)
QListView *lv = qobject_cast<QListView *>(d->viewContainer()->itemView()); QListView *lv = qobject_cast<QListView *>(d->viewContainer()->itemView());
if (lv) if (lv)
lv->setModelColumn(visibleColumn); lv->setModelColumn(visibleColumn);
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
if (d->lineEdit && d->lineEdit->completer() if (d->lineEdit && d->lineEdit->completer()
&& d->lineEdit->completer() == d->completer) && d->lineEdit->completer() == d->completer)
d->lineEdit->completer()->setCompletionColumn(visibleColumn); 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(int minimumContentsLength READ minimumContentsLength WRITE setMinimumContentsLength)
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) 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(bool autoCompletion READ autoCompletion WRITE setAutoCompletion DESIGNABLE false)
Q_PROPERTY(Qt::CaseSensitivity autoCompletionCaseSensitivity READ autoCompletionCaseSensitivity WRITE setAutoCompletionCaseSensitivity 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 duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled)
Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
@ -91,7 +91,7 @@ public:
void setMaxCount(int max); void setMaxCount(int max);
int maxCount() const; int maxCount() const;
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
bool autoCompletion() const; bool autoCompletion() const;
void setAutoCompletion(bool enable); void setAutoCompletion(bool enable);
@ -149,7 +149,7 @@ public:
const QValidator *validator() const; const QValidator *validator() const;
#endif #endif
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
void setCompleter(QCompleter *c); void setCompleter(QCompleter *c);
QCompleter *completer() const; QCompleter *completer() const;
#endif #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_rowsRemoved(const QModelIndex & parent, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_modelReset()) 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)) Q_PRIVATE_SLOT(d_func(), void _q_completerActivated(const QModelIndex &index))
#endif #endif
}; };

View File

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

View File

@ -38,7 +38,6 @@
****************************************************************************/ ****************************************************************************/
#include "qapplication.h" #include "qapplication.h"
#ifndef QT_NO_EFFECTS
#include "qdesktopwidget.h" #include "qdesktopwidget.h"
#include "qeffects_p.h" #include "qeffects_p.h"
#include "qevent.h" #include "qevent.h"
@ -607,5 +606,3 @@ QT_END_NAMESPACE
*/ */
#include "qeffects.moc" #include "qeffects.moc"
#endif //QT_NO_EFFECTS

View File

@ -53,8 +53,9 @@
// //
#include "QtCore/qnamespace.h" #include "QtCore/qnamespace.h"
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_EFFECTS QT_REQUIRE_CONFIG(effects);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -77,6 +78,4 @@ extern void Q_WIDGETS_EXPORT qFadeEffect(QWidget*, int time = -1);
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_EFFECTS
#endif // QEFFECTS_P_H #endif // QEFFECTS_P_H

View File

@ -47,8 +47,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_KEYSEQUENCEEDIT
Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here
void QKeySequenceEditPrivate::init() void QKeySequenceEditPrivate::init()
@ -332,8 +330,6 @@ void QKeySequenceEdit::timerEvent(QTimerEvent *e)
QWidget::timerEvent(e); QWidget::timerEvent(e);
} }
#endif // QT_NO_KEYSEQUENCEEDIT
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qkeysequenceedit.cpp" #include "moc_qkeysequenceedit.cpp"

View File

@ -44,9 +44,9 @@
#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h> #include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(keysequenceedit);
#ifndef QT_NO_KEYSEQUENCEEDIT QT_BEGIN_NAMESPACE
class QKeySequenceEditPrivate; class QKeySequenceEditPrivate;
class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget
@ -82,8 +82,6 @@ private:
Q_DECLARE_PRIVATE(QKeySequenceEdit) Q_DECLARE_PRIVATE(QKeySequenceEdit)
}; };
#endif // QT_NO_KEYSEQUENCEEDIT
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QKEYSEQUENCEEDIT_H #endif // QKEYSEQUENCEEDIT_H

View File

@ -58,9 +58,9 @@
#include <private/qwidget_p.h> #include <private/qwidget_p.h>
#include <private/qkeysequence_p.h> #include <private/qkeysequence_p.h>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(keysequenceedit);
#ifndef QT_NO_KEYSEQUENCEEDIT QT_BEGIN_NAMESPACE
class QLineEdit; class QLineEdit;
@ -81,8 +81,6 @@ public:
int releaseTimer; int releaseTimer;
}; };
#endif // QT_NO_KEYSEQUENCEEDIT
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QKEYSEQUENCEEDIT_P_H #endif // QKEYSEQUENCEEDIT_P_H

View File

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

View File

@ -124,7 +124,7 @@ public:
const QValidator * validator() const; const QValidator * validator() const;
#endif #endif
#ifndef QT_NO_COMPLETER #if QT_CONFIG(completer)
void setCompleter(QCompleter *completer); void setCompleter(QCompleter *completer);
QCompleter *completer() const; QCompleter *completer() const;
#endif #endif
@ -252,7 +252,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) 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_textEdited(const QString &))
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged(int, int)) 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 &)) Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(const QString &))
#endif #endif
#ifdef QT_KEYPAD_NAVIGATION #ifdef QT_KEYPAD_NAVIGATION

View File

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

View File

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

View File

@ -50,7 +50,10 @@
#include "qtoolbar.h" #include "qtoolbar.h"
#include <qapplication.h> #include <qapplication.h>
#include <qmenu.h>
#if QT_CONFIG(menubar)
#include <qmenubar.h> #include <qmenubar.h>
#endif
#if QT_CONFIG(statusbar) #if QT_CONFIG(statusbar)
#include <qstatusbar.h> #include <qstatusbar.h>
#endif #endif
@ -491,7 +494,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
emit toolButtonStyleChanged(d->toolButtonStyle); emit toolButtonStyleChanged(d->toolButtonStyle);
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
/*! /*!
Returns the menu bar for the main window. This function creates Returns the menu bar for the main window. This function creates
and returns an empty menu bar if the menu bar does not exist. and returns an empty menu bar if the menu bar does not exist.
@ -578,7 +581,7 @@ void QMainWindow::setMenuWidget(QWidget *menuBar)
} }
d->layout->setMenuBar(menuBar); d->layout->setMenuBar(menuBar);
} }
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
#if QT_CONFIG(statusbar) #if QT_CONFIG(statusbar)
/*! /*!
@ -1412,7 +1415,7 @@ void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
// children and for the menu bar as well // children and for the menu bar as well
QWidget *child = childAt(event->pos()); QWidget *child = childAt(event->pos());
while (child && child != this) { while (child && child != this) {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) { if (QMenuBar *mb = qobject_cast<QMenuBar *>(child)) {
if (mb->parentWidget() != this) if (mb->parentWidget() != this)
return; return;

View File

@ -123,7 +123,7 @@ public:
bool isSeparator(const QPoint &pos) const; bool isSeparator(const QPoint &pos) const;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
QMenuBar *menuBar() const; QMenuBar *menuBar() const;
void setMenuBar(QMenuBar *menubar); void setMenuBar(QMenuBar *menubar);

View File

@ -171,6 +171,7 @@
#include <private/qdesktopwidget_p.h> #include <private/qdesktopwidget_p.h>
#include <QDebug> #include <QDebug>
#include <qmath.h> #include <qmath.h>
#include <qmenu.h>
#include <private/qlayoutengine_p.h> #include <private/qlayoutengine_p.h>
#include <algorithm> #include <algorithm>

View File

@ -162,6 +162,7 @@
#include <QDebug> #include <QDebug>
#include <QMdiArea> #include <QMdiArea>
#include <QScopedValueRollback> #include <QScopedValueRollback>
#include <QMenu>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -702,7 +703,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
: QObject(mdiChild), : QObject(mdiChild),
previousLeft(0), previousLeft(0),
previousRight(0), previousRight(0),
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
m_menuBar(0), m_menuBar(0),
#endif #endif
mdiChild(mdiChild) mdiChild(mdiChild)
@ -724,7 +725,7 @@ ControlContainer::ControlContainer(QMdiSubWindow *mdiChild)
ControlContainer::~ControlContainer() ControlContainer::~ControlContainer()
{ {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
removeButtonsFromMenuBar(); removeButtonsFromMenuBar();
#endif #endif
delete m_menuLabel; delete m_menuLabel;
@ -733,7 +734,7 @@ ControlContainer::~ControlContainer()
m_controllerWidget = 0; m_controllerWidget = 0;
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
/* /*
\internal \internal
*/ */
@ -845,7 +846,7 @@ void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar)
mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle()); mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle());
} }
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
void ControlContainer::updateWindowIcon(const QIcon &windowIcon) void ControlContainer::updateWindowIcon(const QIcon &windowIcon)
{ {
@ -1265,7 +1266,7 @@ void QMdiSubWindowPrivate::setNormalMode()
isMaximizeMode = false; isMaximizeMode = false;
ensureWindowState(Qt::WindowNoState); ensureWindowState(Qt::WindowNoState);
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
removeButtonsFromMenuBar(); removeButtonsFromMenuBar();
#endif #endif
@ -1372,7 +1373,7 @@ void QMdiSubWindowPrivate::setMaximizeMode()
updateGeometryConstraints(); updateGeometryConstraints();
if (wasVisible) { if (wasVisible) {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mBar = menuBar()) if (QMenuBar *mBar = menuBar())
showButtonsInMenuBar(mBar); showButtonsInMenuBar(mBar);
else else
@ -1435,7 +1436,7 @@ void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus)
Qt::WindowStates oldWindowState = q->windowState(); Qt::WindowStates oldWindowState = q->windowState();
ensureWindowState(Qt::WindowActive); ensureWindowState(Qt::WindowActive);
emit q->aboutToActivate(); emit q->aboutToActivate();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mBar = menuBar()) if (QMenuBar *mBar = menuBar())
showButtonsInMenuBar(mBar); showButtonsInMenuBar(mBar);
#endif #endif
@ -1772,7 +1773,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)) if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q))
return true; return true;
#if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW) #if !QT_CONFIG(menubar) || defined(QT_NO_MAINWINDOW)
Q_UNUSED(isChildOfQMdiSubWindow); Q_UNUSED(isChildOfQMdiSubWindow);
return true; return true;
#else #else
@ -1785,7 +1786,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
#endif #endif
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
/*! /*!
\internal \internal
@ -1856,7 +1857,7 @@ void QMdiSubWindowPrivate::removeButtonsFromMenuBar()
originalTitle.clear(); originalTitle.clear();
} }
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild) void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild)
{ {
@ -2281,7 +2282,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags)
QMdiSubWindow::~QMdiSubWindow() QMdiSubWindow::~QMdiSubWindow()
{ {
Q_D(QMdiSubWindow); Q_D(QMdiSubWindow);
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar(); d->removeButtonsFromMenuBar();
#endif #endif
d->setActive(false); d->setActive(false);
@ -2614,7 +2615,7 @@ void QMdiSubWindow::showShaded()
d->ensureWindowState(Qt::WindowMinimized); d->ensureWindowState(Qt::WindowMinimized);
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar(); d->removeButtonsFromMenuBar();
#endif #endif
@ -2754,7 +2755,7 @@ bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event)
if (object == d->baseWidget) { if (object == d->baseWidget) {
d->updateWindowTitle(true); d->updateWindowTitle(true);
d->lastChildWindowTitle = d->baseWidget->windowTitle(); d->lastChildWindowTitle = d->baseWidget->windowTitle();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
} else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() } else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
d->originalTitle.clear(); d->originalTitle.clear();
@ -2817,7 +2818,7 @@ bool QMdiSubWindow::event(QEvent *event)
break; break;
case QEvent::ParentChange: { case QEvent::ParentChange: {
bool wasResized = testAttribute(Qt::WA_Resized); bool wasResized = testAttribute(Qt::WA_Resized);
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar(); d->removeButtonsFromMenuBar();
#endif #endif
d->currentOperation = QMdiSubWindowPrivate::None; d->currentOperation = QMdiSubWindowPrivate::None;
@ -2874,12 +2875,12 @@ bool QMdiSubWindow::event(QEvent *event)
case QEvent::ModifiedChange: case QEvent::ModifiedChange:
if (!windowTitle().contains(QLatin1String("[*]"))) if (!windowTitle().contains(QLatin1String("[*]")))
break; break;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar()
->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) {
window()->setWindowModified(isWindowModified()); window()->setWindowModified(isWindowModified());
} }
#endif // QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
d->updateInternalWindowTitle(); d->updateInternalWindowTitle();
break; break;
case QEvent::LayoutDirectionChange: case QEvent::LayoutDirectionChange:
@ -2942,7 +2943,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
d->updateDirtyRegions(); d->updateDirtyRegions();
// Show buttons in the menu bar if they're already not there. // Show buttons in the menu bar if they're already not there.
// We want to do this when QMdiSubWindow becomes visible after being hidden. // We want to do this when QMdiSubWindow becomes visible after being hidden.
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (d->controlContainer) { if (d->controlContainer) {
if (QMenuBar *menuBar = d->menuBar()) { if (QMenuBar *menuBar = d->menuBar()) {
if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget()) if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget())
@ -2958,7 +2959,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
*/ */
void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/) void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/)
{ {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
d_func()->removeButtonsFromMenuBar(); d_func()->removeButtonsFromMenuBar();
#endif #endif
} }
@ -3032,7 +3033,7 @@ void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent)
closeEvent->ignore(); closeEvent->ignore();
return; return;
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
d->removeButtonsFromMenuBar(); d->removeButtonsFromMenuBar();
#endif #endif
d->setActive(false); d->setActive(false);

View File

@ -58,7 +58,9 @@
#include <QStyle> #include <QStyle>
#include <QStyleOptionTitleBar> #include <QStyleOptionTitleBar>
#if QT_CONFIG(menubar)
#include <QMenuBar> #include <QMenuBar>
#endif
#include <QSizeGrip> #include <QSizeGrip>
#include <QPointer> #include <QPointer>
#include <QDebug> #include <QDebug>
@ -96,7 +98,7 @@ public:
ControlContainer(QMdiSubWindow *mdiChild); ControlContainer(QMdiSubWindow *mdiChild);
~ControlContainer(); ~ControlContainer();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
void showButtonsInMenuBar(QMenuBar *menuBar); void showButtonsInMenuBar(QMenuBar *menuBar);
void removeButtonsFromMenuBar(QMenuBar *menuBar = 0); void removeButtonsFromMenuBar(QMenuBar *menuBar = 0);
QMenuBar *menuBar() const { return m_menuBar; } QMenuBar *menuBar() const { return m_menuBar; }
@ -108,7 +110,7 @@ public:
private: private:
QPointer<QWidget> previousLeft; QPointer<QWidget> previousLeft;
QPointer<QWidget> previousRight; QPointer<QWidget> previousRight;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
QPointer<QMenuBar> m_menuBar; QPointer<QMenuBar> m_menuBar;
#endif #endif
QPointer<QWidget> m_controllerWidget; QPointer<QWidget> m_controllerWidget;
@ -252,7 +254,7 @@ public:
int titleBarHeight(const QStyleOptionTitleBar &options) const; int titleBarHeight(const QStyleOptionTitleBar &options) const;
void sizeParameters(int *margin, int *minWidth) const; void sizeParameters(int *margin, int *minWidth) const;
bool drawTitleBarWhenMaximized() const; bool drawTitleBarWhenMaximized() const;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
QMenuBar *menuBar() const; QMenuBar *menuBar() const;
void showButtonsInMenuBar(QMenuBar *menuBar); void showButtonsInMenuBar(QMenuBar *menuBar);
void removeButtonsFromMenuBar(); void removeButtonsFromMenuBar();

View File

@ -41,6 +41,8 @@
#ifndef QT_NO_MENU #ifndef QT_NO_MENU
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qdebug.h" #include "qdebug.h"
#include "qstyle.h" #include "qstyle.h"
#include "qevent.h" #include "qevent.h"
@ -56,7 +58,7 @@
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
# include "qaccessible.h" # include "qaccessible.h"
#endif #endif
#ifndef QT_NO_EFFECTS #if QT_CONFIG(effects)
# include <private/qeffects_p.h> # include <private/qeffects_p.h>
#endif #endif
#if QT_CONFIG(whatsthis) #if QT_CONFIG(whatsthis)
@ -64,7 +66,9 @@
#endif #endif
#include "qmenu_p.h" #include "qmenu_p.h"
#if QT_CONFIG(menubar)
#include "qmenubar_p.h" #include "qmenubar_p.h"
#endif
#include "qwidgetaction.h" #include "qwidgetaction.h"
#if QT_CONFIG(toolbutton) #if QT_CONFIG(toolbutton)
#include "qtoolbutton.h" #include "qtoolbutton.h"
@ -498,7 +502,7 @@ void QMenuPrivate::hideUpToMenuBar()
QWidget *caused = causedPopup.widget; QWidget *caused = causedPopup.widget;
hideMenu(q); //hide after getting causedPopup hideMenu(q); //hide after getting causedPopup
while(caused) { while(caused) {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) { if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
mb->d_func()->setCurrentAction(0); mb->d_func()->setCurrentAction(0);
mb->d_func()->setKeyboardMode(false); mb->d_func()->setKeyboardMode(false);
@ -522,7 +526,7 @@ void QMenuPrivate::hideMenu(QMenu *menu)
{ {
if (!menu) if (!menu)
return; return;
#if !defined(QT_NO_EFFECTS) #if QT_CONFIG(effects)
QSignalBlocker blocker(menu); QSignalBlocker blocker(menu);
aboutToHide = true; aboutToHide = true;
// Flash item which is about to trigger (if any). // Flash item which is about to trigger (if any).
@ -544,7 +548,7 @@ void QMenuPrivate::hideMenu(QMenu *menu)
aboutToHide = false; aboutToHide = false;
blocker.unblock(); blocker.unblock();
#endif // QT_NO_EFFECTS #endif // QT_CONFIG(effects)
if (activeMenu == menu) if (activeMenu == menu)
activeMenu = 0; activeMenu = 0;
menu->d_func()->causedPopup.action = 0; menu->d_func()->causedPopup.action = 0;
@ -675,7 +679,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
} }
if (hideActiveMenu && previousAction != currentAction) { if (hideActiveMenu && previousAction != currentAction) {
if (popup == -1) { if (popup == -1) {
#ifndef QT_NO_EFFECTS #if QT_CONFIG(effects)
// kill any running effect // kill any running effect
qFadeEffect(0); qFadeEffect(0);
qScrollEffect(0); qScrollEffect(0);
@ -1280,7 +1284,7 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
bool passOnEvent = false; bool passOnEvent = false;
QWidget *next_widget = 0; QWidget *next_widget = 0;
QPoint cpos = caused->mapFromGlobal(e->globalPos()); QPoint cpos = caused->mapFromGlobal(e->globalPos());
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) { if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
passOnEvent = mb->rect().contains(cpos); passOnEvent = mb->rect().contains(cpos);
} else } else
@ -1322,7 +1326,7 @@ void QMenuPrivate::activateCausedStack(const QVector<QPointer<QWidget> > &caused
} else if (action_e == QAction::Hover) { } else if (action_e == QAction::Hover) {
emit qmenu->hovered(action); emit qmenu->hovered(action);
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
} else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) { } else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) {
if (action_e == QAction::Trigger) { if (action_e == QAction::Trigger) {
emit qmenubar->triggered(action); emit qmenubar->triggered(action);
@ -1417,7 +1421,7 @@ void QMenuPrivate::_q_actionTriggered()
QVector< QPointer<QWidget> > list; QVector< QPointer<QWidget> > list;
for(QWidget *widget = q->parentWidget(); widget; ) { for(QWidget *widget = q->parentWidget(); widget; ) {
if (qobject_cast<QMenu*>(widget) if (qobject_cast<QMenu*>(widget)
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
|| qobject_cast<QMenuBar*>(widget) || qobject_cast<QMenuBar*>(widget)
#endif #endif
) { ) {
@ -2318,7 +2322,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
d->doChildEffects = true; d->doChildEffects = true;
d->updateLayoutDirection(); d->updateLayoutDirection();
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
// if this menu is part of a chain attached to a QMenuBar, set the // if this menu is part of a chain attached to a QMenuBar, set the
// _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type // _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type
setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0); setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0);
@ -2414,11 +2418,11 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
if (snapToMouse) // position flowing left from the mouse if (snapToMouse) // position flowing left from the mouse
pos.setX(mouse.x() - size.width()); pos.setX(mouse.x() - size.width());
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
// if the menu is in a menubar or is a submenu, it should be right-aligned // if the menu is in a menubar or is a submenu, it should be right-aligned
if (qobject_cast<QMenuBar*>(d->causedPopup.widget) || qobject_cast<QMenu*>(d->causedPopup.widget)) if (qobject_cast<QMenuBar*>(d->causedPopup.widget) || qobject_cast<QMenu*>(d->causedPopup.widget))
pos.rx() -= size.width(); pos.rx() -= size.width();
#endif //QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
if (pos.x() < screen.left() + desktopFrame) if (pos.x() < screen.left() + desktopFrame)
pos.setX(qMax(p.x(), screen.left() + desktopFrame)); pos.setX(qMax(p.x(), screen.left() + desktopFrame));
@ -2479,7 +2483,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
} }
} }
setGeometry(QRect(pos, size)); setGeometry(QRect(pos, size));
#ifndef QT_NO_EFFECTS #if QT_CONFIG(effects)
int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll; int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll;
int vGuess = QEffects::DownScroll; int vGuess = QEffects::DownScroll;
if (isRightToLeft()) { if (isRightToLeft()) {
@ -2492,7 +2496,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
hGuess = QEffects::LeftScroll; hGuess = QEffects::LeftScroll;
} }
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) || if ((snapToMouse && (pos.y() + size.height() / 2 < mouse.y())) ||
(qobject_cast<QMenuBar*>(d->causedPopup.widget) && (qobject_cast<QMenuBar*>(d->causedPopup.widget) &&
pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y())) pos.y() + size.width() / 2 < d->causedPopup.widget->mapToGlobal(d->causedPopup.widget->pos()).y()))
@ -2500,7 +2504,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
#endif #endif
if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) { if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) {
bool doChildEffects = true; bool doChildEffects = true;
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) { if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) {
doChildEffects = mb->d_func()->doChildEffects; doChildEffects = mb->d_func()->doChildEffects;
mb->d_func()->doChildEffects = false; mb->d_func()->doChildEffects = false;
@ -2662,7 +2666,7 @@ void QMenu::hideEvent(QHideEvent *)
QAccessibleEvent event(this, QAccessible::PopupMenuEnd); QAccessibleEvent event(this, QAccessible::PopupMenuEnd);
QAccessible::updateAccessibility(&event); QAccessible::updateAccessibility(&event);
#endif #endif
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget)) if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
mb->d_func()->setCurrentAction(0); mb->d_func()->setCurrentAction(0);
#endif #endif
@ -3211,7 +3215,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this)) if (style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, this))
{ {
d->hideMenu(this); d->hideMenu(this);
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) { if (QMenuBar *mb = qobject_cast<QMenuBar*>(QApplication::focusWidget())) {
mb->d_func()->setKeyboardMode(false); mb->d_func()->setKeyboardMode(false);
} }
@ -3273,7 +3277,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
{ {
QPointer<QWidget> caused = d->causedPopup.widget; QPointer<QWidget> caused = d->causedPopup.widget;
d->hideMenu(this); // hide after getting causedPopup d->hideMenu(this); // hide after getting causedPopup
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) { if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
mb->d_func()->setCurrentAction(d->menuAction); mb->d_func()->setCurrentAction(d->menuAction);
mb->d_func()->setKeyboardMode(true); mb->d_func()->setKeyboardMode(true);
@ -3350,7 +3354,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
} }
} }
if (!key_consumed) { if (!key_consumed) {
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) { if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) {
QAction *oldAct = mb->d_func()->currentAction; QAction *oldAct = mb->d_func()->currentAction;
QApplication::sendEvent(mb, e); QApplication::sendEvent(mb, e);

View File

@ -41,8 +41,10 @@
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#include "qmenu.h" #include "qmenu.h"
#if QT_CONFIG(menubar)
#include "qmenubar.h" #include "qmenubar.h"
#include "qmenubar_p.h" #include "qmenubar_p.h"
#endif
#include "qmacnativewidget_mac.h" #include "qmacnativewidget_mac.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
@ -139,7 +141,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem*
#endif //QT_NO_MENU #endif //QT_NO_MENU
#ifndef QT_NO_MENUBAR #if QT_CONFIG(menubar)
/*! /*!
\since 5.2 \since 5.2
@ -159,7 +161,7 @@ NSMenu *QMenuBar::toNSMenu()
} }
return nil; return nil;
} }
#endif //QT_NO_MENUBAR #endif // QT_CONFIG(menubar)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -52,7 +52,9 @@
// //
#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/private/qtwidgetsglobal_p.h>
#if QT_CONFIG(menubar)
#include "QtWidgets/qmenubar.h" #include "QtWidgets/qmenubar.h"
#endif
#include "QtWidgets/qstyleoption.h" #include "QtWidgets/qstyleoption.h"
#include "QtCore/qdatetime.h" #include "QtCore/qdatetime.h"
#include "QtCore/qmap.h" #include "QtCore/qmap.h"

View File

@ -62,9 +62,6 @@
#include "qpa/qplatformintegration.h" #include "qpa/qplatformintegration.h"
#include <private/qdesktopwidget_p.h> #include <private/qdesktopwidget_p.h>
#ifndef QT_NO_MENUBAR
#include "qmenu_p.h" #include "qmenu_p.h"
#include "qmenubar_p.h" #include "qmenubar_p.h"
#include "qdebug.h" #include "qdebug.h"
@ -1875,9 +1872,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar()
// for private slots // for private slots
QT_END_NAMESPACE QT_END_NAMESPACE
#include <moc_qmenubar.cpp> #include <moc_qmenubar.cpp>
#endif // QT_NO_MENUBAR

Some files were not shown because too many files have changed in this diff Show More