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

Conflicts:
    src/widgets/widgets/qmainwindowlayout.cpp

Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
This commit is contained in:
Gabriel de Dietrich 2017-07-13 16:34:32 -07:00
commit d38fe875c7
149 changed files with 1379 additions and 1009 deletions

View File

@ -1,49 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <unistd.h>
#include <sys/mman.h>
int main(int, char **)
{
(void) ::mremap(static_cast<void *>(0), size_t(0), size_t(42), MREMAP_MAYMOVE);
return 0;
}

View File

@ -1,2 +0,0 @@
SOURCES = mremap.cpp
CONFIG -= qt dylib

View File

@ -411,11 +411,6 @@
"subarch": "neon" "subarch": "neon"
}, },
"mremap": {
"label": "mremap()",
"type": "compile",
"test": "unix/mremap"
},
"posix_fallocate": { "posix_fallocate": {
"label": "POSIX fallocate()", "label": "POSIX fallocate()",
"type": "compile", "type": "compile",
@ -942,11 +937,6 @@
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_NEON", "value": 1 } { "type": "define", "name": "QT_COMPILER_SUPPORTS_NEON", "value": 1 }
] ]
}, },
"mremap": {
"label": "mremap()",
"condition": "tests.mremap",
"output": [ "feature" ]
},
"posix_fallocate": { "posix_fallocate": {
"label": "POSIX fallocate()", "label": "POSIX fallocate()",
"condition": "tests.posix_fallocate", "condition": "tests.posix_fallocate",

View File

@ -1,131 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "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 Qt Company Ltd 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtWidgets>
#include "dialog.h"
//! [Dialog constructor part1]
Dialog::Dialog()
{
desktopGeometry = QApplication::desktop()->availableGeometry(0);
setWindowTitle(tr("SIP Dialog Example"));
QScrollArea *scrollArea = new QScrollArea(this);
QGroupBox *groupBox = new QGroupBox(scrollArea);
groupBox->setTitle(tr("SIP Dialog Example"));
QGridLayout *gridLayout = new QGridLayout(groupBox);
groupBox->setLayout(gridLayout);
//! [Dialog constructor part1]
//! [Dialog constructor part2]
QLineEdit* lineEdit = new QLineEdit(groupBox);
lineEdit->setText(tr("Open and close the SIP"));
lineEdit->setMinimumWidth(220);
QLabel* label = new QLabel(groupBox);
label->setText(tr("This dialog resizes if the SIP is opened"));
label->setMinimumWidth(220);
QPushButton* button = new QPushButton(groupBox);
button->setText(tr("Close Dialog"));
button->setMinimumWidth(220);
//! [Dialog constructor part2]
//! [Dialog constructor part3]
if (desktopGeometry.height() < 400)
gridLayout->setVerticalSpacing(80);
else
gridLayout->setVerticalSpacing(150);
gridLayout->addWidget(label);
gridLayout->addWidget(lineEdit);
gridLayout->addWidget(button);
//! [Dialog constructor part3]
//! [Dialog constructor part4]
scrollArea->setWidget(groupBox);
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(scrollArea);
setLayout(layout);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//! [Dialog constructor part4]
//! [Dialog constructor part5]
connect(button, &QAbstractButton::clicked, qApp, &QApplication::closeAllWindows);
connect(QApplication::desktop(), &QDesktopWidget::workAreaResized,
this, &Dialog::desktopResized);
}
//! [Dialog constructor part5]
//! [desktopResized() function]
void Dialog::desktopResized(int screen)
{
if (screen != 0)
return;
reactToSIP();
}
//! [desktopResized() function]
//! [reactToSIP() function]
void Dialog::reactToSIP()
{
QRect availableGeometry = QApplication::desktop()->availableGeometry(0);
if (desktopGeometry != availableGeometry) {
if (windowState() | Qt::WindowMaximized)
setWindowState(windowState() & ~Qt::WindowMaximized);
setGeometry(availableGeometry);
}
desktopGeometry = availableGeometry;
}
//! [reactToSIP() function]

View File

@ -1,73 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "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 Qt Company Ltd 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
//! [Dialog header]
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog();
void reactToSIP();
private:
QRect desktopGeometry;
public slots:
void desktopResized(int screen);
};
//! [Dialog header]
#endif

View File

@ -1,62 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "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 Qt Company Ltd 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtWidgets>
#include "dialog.h"
//! [main() function]
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Dialog dialog;
return dialog.exec();
}
//! [main() function]

View File

@ -1,11 +0,0 @@
QT += widgets
HEADERS = dialog.h
SOURCES = main.cpp \
dialog.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/sipdialog
INSTALLS += target
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib

View File

@ -1,127 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example dialogs/sipdialog
\title SIP Dialog Example
\ingroup qtce
\brief The SIP Dialog example shows how to create a dialog that is aware of
the Windows Mobile SIP (Software Input Panel) and reacts to it.
\table
\row \li \inlineimage sipdialog-closed.png
\li \inlineimage sipdialog-opened.png
\endtable
Sometimes it is necessary for a dialog to take the SIP into account,
as the SIP may hide important input widgets. The SIP Dialog Example
shows how a \c Dialog object, \c dialog, can be resized accordingly
if the SIP is opened, by embedding the contents of \c dialog in a
QScrollArea.
\section1 Dialog Class Definition
The \c Dialog class is a subclass of QDialog that implements a public
slot, \c desktopResized(), and a public function, \c reactToSIP(). Also,
it holds a private instance of QRect, \c desktopGeometry.
\snippet dialogs/sipdialog/dialog.h Dialog header
\section1 Dialog Class Implementation
In the constructor of \c Dialog, we start by obtaining the
available geometry of the screen with
\l{QDesktopWidget::availableGeometry()}{availableGeometry()}. The
parameter used is \c 0 to indicate that we require the primary screen.
\snippet dialogs/sipdialog/dialog.cpp Dialog constructor part1
We set the window's title to "SIP Dialog Example" and declare a QScrollArea
object, \c scrollArea. Next we instantiate a QGroupBox, \c groupBox, with
\c scrollArea as its parent. The title of \c groupBox is also set to
"SIP Dialog Example". A QGridLayout object, \c gridLayout, is then used
as \c{groupBox}'s layout.
We create a QLineEdit, a QLabel and a QPushButton and we set the
\l{QWidget::setMinimumWidth()}{minimumWidth} property to 220 pixels,
respectively.
\snippet dialogs/sipdialog/dialog.cpp Dialog constructor part2
Also, all three widgets' text are set accordingly. The
\l{QGridLayout::setVerticalSpacing()}{verticalSpacing} property of
\c gridLayout is set based on the height of \c desktopGeometry. This
is to adapt to the different form factors of Windows Mobile. Then, we
add our widgets to the layout.
\snippet dialogs/sipdialog/dialog.cpp Dialog constructor part3
The \c{scrollArea}'s widget is set to \c groupBox. We use a QHBoxLayout
object, \c layout, to contain \c scrollArea. The \c{Dialog}'s layout
is set to \c layout and the scroll area's horizontal scroll bar is turned
off.
\snippet dialogs/sipdialog/dialog.cpp Dialog constructor part4
The following signals are connected to their respective slots:
\list
\li \c{button}'s \l{QPushButton::pressed()}{pressed()} signal to
\l{QApplication}'s \l{QApplication::closeAllWindows()}
{closeAllWindows()} slot,
\li \l{QDesktopWidget}'s \l{QDesktopWidget::workAreaResized()}
{workAreaResized()} signal to \c{dialog}'s \c desktopResized() slot.
\endlist
\snippet dialogs/sipdialog/dialog.cpp Dialog constructor part5
The \c desktopResized() function accepts an integer, \a screen,
corresponding to the screen's index. We only invoke \c reactToSIP()
if \a screen is the primary screen (e.g. index = 0).
\snippet dialogs/sipdialog/dialog.cpp desktopResized() function
The \c reactToSIP() function resizes \c dialog accordingly if the
desktop's available geometry changed vertically, as this change signifies
that the SIP may have been opened or closed.
\snippet dialogs/sipdialog/dialog.cpp reactToSIP() function
If the height has decreased, we unset the maximized window state.
Otherwise, we set the maximized window state. Lastly, we update
\c desktopGeometry to the desktop's available geometry.
\section1 The \c main() function
The \c main() function for the SIP Dialog example instantiates \c Dialog
and invokes its \l{QDialog::exec()}{exec()} function.
\snippet dialogs/sipdialog/main.cpp main() function
\note Although this example uses a dialog, the techniques used here apply to
all top-level widgets respectively.
*/

View File

@ -600,6 +600,7 @@ bool PathStrokeRenderer::event(QEvent *e)
switch (e->type()) { switch (e->type()) {
case QEvent::TouchBegin: case QEvent::TouchBegin:
touchBegin = true; touchBegin = true;
Q_FALLTHROUGH();
case QEvent::TouchUpdate: case QEvent::TouchUpdate:
{ {
const QTouchEvent *const event = static_cast<const QTouchEvent*>(e); const QTouchEvent *const event = static_cast<const QTouchEvent*>(e);

View File

@ -36,7 +36,7 @@ QMAKE_CFLAGS_OPTIMIZE_FULL = -O3
QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Og QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Og
QMAKE_CFLAGS_OPTIMIZE_SIZE = -Os QMAKE_CFLAGS_OPTIMIZE_SIZE = -Os
QMAKE_CFLAGS += -pipe !equals(QMAKE_HOST.os, Windows): QMAKE_CFLAGS += -pipe
QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_DEPS += -M
QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_ON += -Wall -W
QMAKE_CFLAGS_WARN_OFF += -w QMAKE_CFLAGS_WARN_OFF += -w

View File

@ -50,11 +50,11 @@ isEmpty($${target_prefix}.INCDIRS) {
rim_qcc: \ rim_qcc: \
# Need the cc1plus and ld command lines to pick up the paths # Need the cc1plus and ld command lines to pick up the paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v
else: clang: \ else: darwin:clang: \
# Need to link to pick up library paths # Need to link to pick up library paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v
else: \ else: \
# gcc is fine with just preprocessing # Just preprocess, might not pick up library paths
cxx_flags += -E -v cxx_flags += -E -v
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec) output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
@ -111,6 +111,26 @@ isEmpty($${target_prefix}.INCDIRS) {
} }
} }
} }
!darwin:clang {
# Clang on a non-Apple system (that is, a system without ld64 -- say, with GNU ld
# or gold under Linux) will not print any library search path. Need to use another
# invocation with different options (which in turn doesn't print include search
# paths, so it can't just be used in place of the above code).
# What's more, -print-search-dirs can't be used on clang on Apple because it
# won't print all the library paths (only the clang-internal ones).
output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec)
!equals(ec, 0): \
error("Cannot run compiler '$$QMAKE_CXX'. Maybe you forgot to setup the environment?")
for (line, output) {
contains(line, "^libraries: .*") {
line ~= s,^libraries: ,,
paths = $$split(line, $$QMAKE_DIRLIST_SEP)
for (path, paths): \
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$replace(path, ^=, $$[SYSROOT]))
}
}
}
isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \ isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \
!integrity: \ !integrity: \
error("failed to parse default search paths from compiler output") error("failed to parse default search paths from compiler output")

View File

@ -292,6 +292,8 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
if (!var("BUILD_NAME").isEmpty()) { if (!var("BUILD_NAME").isEmpty()) {
ar_script_file += "." + var("BUILD_NAME"); ar_script_file += "." + var("BUILD_NAME");
} }
if (!var("MAKEFILE").isEmpty())
ar_script_file += "." + var("MAKEFILE");
// QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix. // QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix.
// Strip off any options since the ar commands will be read from file. // Strip off any options since the ar commands will be read from file.
QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0); QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);
@ -304,6 +306,8 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
if (!var("BUILD_NAME").isEmpty()) { if (!var("BUILD_NAME").isEmpty()) {
ld_script_file += "." + var("BUILD_NAME"); ld_script_file += "." + var("BUILD_NAME");
} }
if (!var("MAKEFILE").isEmpty())
ld_script_file += "." + var("MAKEFILE");
createLdObjectScriptFile(ld_script_file, project->values("OBJECTS")); createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
objectsLinkLine = escapeFilePath(ld_script_file); objectsLinkLine = escapeFilePath(ld_script_file);
} }

View File

@ -1,10 +1,6 @@
ARCH_SUBDIR=x86 ARCH_SUBDIR=x86
contains(QMAKE_TARGET.arch, x86_64): { contains(QT_ARCH, x86_64): ARCH_SUBDIR = amd64
ARCH_SUBDIR=amd64
} else {
!contains(QMAKE_TARGET.arch, x86): message("ERROR: Could not detect architecture from QMAKE_TARGET.arch")
}
MIDL_GENERATED = $$PWD/generated/$${ARCH_SUBDIR} MIDL_GENERATED = $$PWD/generated/$${ARCH_SUBDIR}

View File

@ -1,4 +1,6 @@
set(_qt5_root_dir ${_qt5_install_prefix}) set(_qt5_root_dir ${_qt5_install_prefix})
set(_qt5_module_paths ${_qt5_install_prefix}) set(_qt5_module_paths ${_qt5_install_prefix})
set(_qt5_module_location_template ${_qt5_install_prefix}/Qt5@module@/Qt5@module@Config.cmake) set(_qt5_at "@")
set(_qt5_module_location_template ${_qt5_install_prefix}/Qt5${_qt5_at}module${_qt5_at}/Qt5${_qt5_at}module${_qt5_at}Config.cmake)
unset(_qt5_at)

View File

@ -1336,14 +1336,14 @@
do {\ do {\
Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\ Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\
Q_UNREACHABLE_IMPL();\ Q_UNREACHABLE_IMPL();\
} while (0) } while (false)
#define Q_ASSUME(Expr) \ #define Q_ASSUME(Expr) \
do {\ do {\
const bool valueOfExpression = Expr;\ const bool valueOfExpression = Expr;\
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\ Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
Q_ASSUME_IMPL(valueOfExpression);\ Q_ASSUME_IMPL(valueOfExpression);\
} while (0) } while (false)
#if defined(__cplusplus) #if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(fallthrough) #if QT_HAS_CPP_ATTRIBUTE(fallthrough)

View File

@ -341,10 +341,10 @@ typedef double qreal;
#define Q_INIT_RESOURCE(name) \ #define Q_INIT_RESOURCE(name) \
do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \ do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0) QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (false)
#define Q_CLEANUP_RESOURCE(name) \ #define Q_CLEANUP_RESOURCE(name) \
do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \ do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \
QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (0) QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (false)
/* /*
* If we're compiling C++ code: * If we're compiling C++ code:
@ -664,7 +664,7 @@ inline void qt_noop(void) {}
# define QT_CATCH(A) else # define QT_CATCH(A) else
# define QT_THROW(A) qt_noop() # define QT_THROW(A) qt_noop()
# define QT_RETHROW qt_noop() # define QT_RETHROW qt_noop()
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0) # define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
#else #else
# define QT_TRY try # define QT_TRY try
# define QT_CATCH(A) catch (A) # define QT_CATCH(A) catch (A)
@ -672,9 +672,9 @@ inline void qt_noop(void) {}
# define QT_RETHROW throw # define QT_RETHROW throw
Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW; Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
# ifdef Q_COMPILER_NOEXCEPT # ifdef Q_COMPILER_NOEXCEPT
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0) # define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
# else # else
# define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (0) # define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (false)
# endif # endif
#endif #endif
@ -778,10 +778,10 @@ Q_CORE_EXPORT void qBadAlloc();
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
# define Q_CHECK_PTR(p) qt_noop() # define Q_CHECK_PTR(p) qt_noop()
# else # else
# define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0) # define Q_CHECK_PTR(p) do {if (!(p)) qt_check_pointer(__FILE__,__LINE__);} while (false)
# endif # endif
#else #else
# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0) # define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (false)
#endif #endif
template <typename T> template <typename T>

View File

@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
# endif # endif
# define QT_VERSION_TAG(sym) \ # define QT_VERSION_TAG(sym) \
asm ( \ asm ( \
".section .qtversion, \"aG\", @progbits, qt_version_tag, comdat\n" \ ".section .qtversion, \"aG\", @progbits, " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) ", comdat\n" \
".align 8\n" \ ".align 8\n" \
QT_VERSION_TAG_RELOC(sym) \ QT_VERSION_TAG_RELOC(sym) \
".long " QT_STRINGIFY(QT_VERSION) "\n" \ ".long " QT_STRINGIFY(QT_VERSION) "\n" \

View File

@ -113,7 +113,10 @@ win32 {
SOURCES += io/qfilesystemwatcher_win.cpp SOURCES += io/qfilesystemwatcher_win.cpp
HEADERS += io/qfilesystemwatcher_win_p.h HEADERS += io/qfilesystemwatcher_win_p.h
SOURCES += io/qfilesystemengine_win.cpp SOURCES += io/qfilesystemengine_win.cpp
qtConfig(filesystemiterator) {
SOURCES += io/qfilesystemiterator_win.cpp SOURCES += io/qfilesystemiterator_win.cpp
}
!winrt { !winrt {
HEADERS += \ HEADERS += \

View File

@ -568,9 +568,11 @@ QFile::rename(const QString &newName)
} }
// If the file exists and it is a case-changing rename ("foo" -> "Foo"), // If the file exists and it is a case-changing rename ("foo" -> "Foo"),
// compare Ids to make sure it really is a different file. // compare Ids to make sure it really is a different file.
if (QFile::exists(newName)) { // Note: this does not take file engines into account.
if (d->fileName.compare(newName, Qt::CaseInsensitive) QByteArray targetId = QFileSystemEngine::id(QFileSystemEntry(newName));
|| QFileSystemEngine::id(QFileSystemEntry(d->fileName)) != QFileSystemEngine::id(QFileSystemEntry(newName))) { if (!targetId.isNull()) {
QByteArray fileId = QFileSystemEngine::id(QFileSystemEntry(d->fileName));
if (fileId != targetId || d->fileName.compare(newName, Qt::CaseInsensitive)) {
// ### Race condition. If a file is moved in after this, it /will/ be // ### Race condition. If a file is moved in after this, it /will/ be
// overwritten. On Unix, the proper solution is to use hardlinks: // overwritten. On Unix, the proper solution is to use hardlinks:
// return ::link(old, new) && ::remove(old); // return ::link(old, new) && ::remove(old);

View File

@ -92,6 +92,8 @@ public:
QFileSystemMetaData::MetaDataFlags what); QFileSystemMetaData::MetaDataFlags what);
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
static bool fillMetaData(int fd, QFileSystemMetaData &data); // what = PosixStatFlags static bool fillMetaData(int fd, QFileSystemMetaData &data); // what = PosixStatFlags
static bool setPermissions(int fd, QFile::Permissions permissions, QSystemError &error,
QFileSystemMetaData *data = nullptr);
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View File

@ -315,8 +315,9 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
//static //static
QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
{ {
struct stat statResult; QT_STATBUF statResult;
if (stat(entry.nativeFilePath().constData(), &statResult)) { if (QT_STAT(entry.nativeFilePath().constData(), &statResult)) {
if (errno != ENOENT)
qErrnoWarning("stat() failed for '%s'", entry.nativeFilePath().constData()); qErrnoWarning("stat() failed for '%s'", entry.nativeFilePath().constData());
return QByteArray(); return QByteArray();
} }
@ -428,15 +429,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
data.entryFlags &= ~what; data.entryFlags &= ~what;
const char * nativeFilePath; const QByteArray nativeFilePath = entry.nativeFilePath();
int nativeFilePathLength;
{
const QByteArray &path = entry.nativeFilePath();
nativeFilePath = path.constData();
nativeFilePathLength = path.size();
Q_UNUSED(nativeFilePathLength);
}
bool entryExists = true; // innocent until proven otherwise bool entryExists = true; // innocent until proven otherwise
QT_STATBUF statBuffer; QT_STATBUF statBuffer;
@ -660,8 +653,7 @@ bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError &
} }
//static static mode_t toMode_t(QFile::Permissions permissions)
bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data)
{ {
mode_t mode = 0; mode_t mode = 0;
if (permissions & (QFile::ReadOwner | QFile::ReadUser)) if (permissions & (QFile::ReadOwner | QFile::ReadUser))
@ -682,6 +674,13 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per
mode |= S_IWOTH; mode |= S_IWOTH;
if (permissions & QFile::ExeOther) if (permissions & QFile::ExeOther)
mode |= S_IXOTH; mode |= S_IXOTH;
return mode;
}
//static
bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data)
{
mode_t mode = toMode_t(permissions);
bool success = ::chmod(entry.nativeFilePath().constData(), mode) == 0; bool success = ::chmod(entry.nativeFilePath().constData(), mode) == 0;
if (success && data) { if (success && data) {
@ -694,6 +693,22 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per
return success; return success;
} }
//static
bool QFileSystemEngine::setPermissions(int fd, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data)
{
mode_t mode = toMode_t(permissions);
bool success = ::fchmod(fd, mode) == 0;
if (success && data) {
data->entryFlags &= ~QFileSystemMetaData::Permissions;
data->entryFlags |= QFileSystemMetaData::MetaDataFlag(uint(permissions));
data->knownFlagsMask |= QFileSystemMetaData::Permissions;
}
if (!success)
error = QSystemError(errno, QSystemError::StandardLibraryError);
return success;
}
QString QFileSystemEngine::homePath() QString QFileSystemEngine::homePath()
{ {
QString home = QFile::decodeName(qgetenv("HOME")); QString home = QFile::decodeName(qgetenv("HOME"));

View File

@ -602,13 +602,13 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
QByteArray result; QByteArray result;
const HANDLE handle = const HANDLE handle =
#ifndef Q_OS_WINRT #ifndef Q_OS_WINRT
CreateFile((wchar_t*)entry.nativeFilePath().utf16(), GENERIC_READ, CreateFile((wchar_t*)entry.nativeFilePath().utf16(), 0,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
#else // !Q_OS_WINRT #else // !Q_OS_WINRT
CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), GENERIC_READ, CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), 0,
FILE_SHARE_READ, OPEN_EXISTING, NULL); FILE_SHARE_READ, OPEN_EXISTING, NULL);
#endif // Q_OS_WINRT #endif // Q_OS_WINRT
if (handle) { if (handle != INVALID_HANDLE_VALUE) {
result = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ? result = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ?
fileIdWin8(handle) : fileId(handle); fileIdWin8(handle) : fileId(handle);
CloseHandle(handle); CloseHandle(handle);

View File

@ -71,6 +71,19 @@ QT_BEGIN_NAMESPACE
# define DEBUG if (false) qDebug # define DEBUG if (false) qDebug
#endif #endif
static Qt::HANDLE createChangeNotification(const QString &path, uint flags)
{
// Volume and folder paths need a trailing slash for proper notification
// (e.g. "c:" -> "c:/").
QString nativePath = QDir::toNativeSeparators(path);
if ((flags & FILE_NOTIFY_CHANGE_ATTRIBUTES) == 0 && !nativePath.endsWith(QLatin1Char('\\')))
nativePath.append(QLatin1Char('\\'));
const HANDLE result = FindFirstChangeNotification(reinterpret_cast<const wchar_t *>(nativePath.utf16()),
FALSE, flags);
DEBUG() << __FUNCTION__ << nativePath << hex <<showbase << flags << "returns" << result;
return result;
}
#ifndef Q_OS_WINRT #ifndef Q_OS_WINRT
/////////// ///////////
// QWindowsRemovableDriveListener // QWindowsRemovableDriveListener
@ -404,8 +417,29 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
thread = *jt; thread = *jt;
QMutexLocker locker(&(thread->mutex)); QMutexLocker locker(&(thread->mutex));
handle = thread->handleForDir.value(QFileSystemWatcherPathKey(absolutePath)); const auto hit = thread->handleForDir.find(QFileSystemWatcherPathKey(absolutePath));
if (handle.handle != INVALID_HANDLE_VALUE && handle.flags == flags) { if (hit != thread->handleForDir.end() && hit.value().flags < flags) {
// Requesting to add a file whose directory has been added previously.
// Recreate the notification handle to add the missing notification attributes
// for files (FILE_NOTIFY_CHANGE_ATTRIBUTES...)
DEBUG() << "recreating" << absolutePath << hex << showbase << hit.value().flags
<< "->" << flags;
const Qt::HANDLE fileHandle = createChangeNotification(absolutePath, flags);
if (fileHandle != INVALID_HANDLE_VALUE) {
const int index = thread->handles.indexOf(hit.value().handle);
const auto pit = thread->pathInfoForHandle.find(hit.value().handle);
Q_ASSERT(index != -1);
Q_ASSERT(pit != thread->pathInfoForHandle.end());
FindCloseChangeNotification(hit.value().handle);
thread->handles[index] = hit.value().handle = fileHandle;
hit.value().flags = flags;
thread->pathInfoForHandle.insert(fileHandle, pit.value());
thread->pathInfoForHandle.erase(pit);
}
}
// In addition, check on flags for sufficient notification attributes
if (hit != thread->handleForDir.end() && hit.value().flags >= flags) {
handle = hit.value();
// found a thread now insert... // found a thread now insert...
DEBUG() << "Found a thread" << thread; DEBUG() << "Found a thread" << thread;
@ -426,14 +460,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
} }
// no thread found, first create a handle // no thread found, first create a handle
if (handle.handle == INVALID_HANDLE_VALUE || handle.flags != flags) { if (handle.handle == INVALID_HANDLE_VALUE) {
DEBUG() << "No thread found"; DEBUG() << "No thread found";
// Volume and folder paths need a trailing slash for proper notification handle.handle = createChangeNotification(absolutePath, flags);
// (e.g. "c:" -> "c:/").
const QString effectiveAbsolutePath =
isDir ? (absolutePath + QLatin1Char('/')) : absolutePath;
handle.handle = FindFirstChangeNotification((wchar_t*) QDir::toNativeSeparators(effectiveAbsolutePath).utf16(), false, flags);
handle.flags = flags; handle.flags = flags;
if (handle.handle == INVALID_HANDLE_VALUE) if (handle.handle == INVALID_HANDLE_VALUE)
continue; continue;

View File

@ -600,7 +600,12 @@ bool QFSFileEngine::setPermissions(uint perms)
{ {
Q_D(QFSFileEngine); Q_D(QFSFileEngine);
QSystemError error; QSystemError error;
if (!QFileSystemEngine::setPermissions(d->fileEntry, QFile::Permissions(perms), error, 0)) { bool ok;
if (d->fd != -1)
ok = QFileSystemEngine::setPermissions(d->fd, QFile::Permissions(perms), error, 0);
else
ok = QFileSystemEngine::setPermissions(d->fileEntry, QFile::Permissions(perms), error, 0);
if (!ok) {
setError(QFile::PermissionsError, error.toString()); setError(QFile::PermissionsError, error.toString());
return false; return false;
} }

View File

@ -43,36 +43,52 @@
#include <QtCore/qfileinfo.h> #include <QtCore/qfileinfo.h>
#include <QtCore/qvarlengtharray.h> #include <QtCore/qvarlengtharray.h>
#include "qfilesystementry_p.h"
#include <qt_windows.h> #include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static const int defaultBufferSize = MAX_PATH + 1; static const int defaultBufferSize = MAX_PATH + 1;
void QStorageInfoPrivate::initRootPath() static QString canonicalPath(const QString &rootPath)
{ {
rootPath = QFileInfo(rootPath).canonicalFilePath(); QString path = QDir::toNativeSeparators(QFileInfo(rootPath).canonicalFilePath());
if (path.isEmpty())
if (rootPath.isEmpty()) return path;
return;
QString path = QDir::toNativeSeparators(rootPath);
rootPath.clear();
if (path.startsWith(QLatin1String("\\\\?\\"))) if (path.startsWith(QLatin1String("\\\\?\\")))
path.remove(0, 4); path.remove(0, 4);
if (path.length() < 2 || path.at(1) != QLatin1Char(':')) if (path.length() < 2 || path.at(1) != QLatin1Char(':'))
return; return QString();
path[0] = path[0].toUpper(); path[0] = path[0].toUpper();
if (!(path.at(0).unicode() >= 'A' && path.at(0).unicode() <= 'Z')) if (!(path.at(0).unicode() >= 'A' && path.at(0).unicode() <= 'Z'))
return; return QString();
if (!path.endsWith(QLatin1Char('\\'))) if (!path.endsWith(QLatin1Char('\\')))
path.append(QLatin1Char('\\')); path.append(QLatin1Char('\\'));
return path;
}
void QStorageInfoPrivate::initRootPath()
{
// Do not unnecessarily call QFileInfo::canonicalFilePath() if the path is
// already a drive root since it may hang on network drives.
const QString path = QFileSystemEntry::isDriveRootPath(rootPath)
? QDir::toNativeSeparators(rootPath)
: canonicalPath(rootPath);
if (path.isEmpty()) {
valid = ready = false;
return;
}
// ### test if disk mounted to folder on other disk // ### test if disk mounted to folder on other disk
wchar_t buffer[defaultBufferSize]; wchar_t buffer[defaultBufferSize];
if (::GetVolumePathName(reinterpret_cast<const wchar_t *>(path.utf16()), buffer, defaultBufferSize)) if (::GetVolumePathName(reinterpret_cast<const wchar_t *>(path.utf16()), buffer, defaultBufferSize))
rootPath = QDir::fromNativeSeparators(QString::fromWCharArray(buffer)); rootPath = QDir::fromNativeSeparators(QString::fromWCharArray(buffer));
else
valid = ready = false;
} }
static inline QByteArray getDevice(const QString &rootPath) static inline QByteArray getDevice(const QString &rootPath)
@ -108,11 +124,14 @@ static inline QByteArray getDevice(const QString &rootPath)
void QStorageInfoPrivate::doStat() void QStorageInfoPrivate::doStat()
{ {
valid = ready = true;
initRootPath(); initRootPath();
if (rootPath.isEmpty()) if (!valid || !ready)
return; return;
retrieveVolumeInfo(); retrieveVolumeInfo();
if (!valid || !ready)
return;
device = getDevice(rootPath); device = getDevice(rootPath);
retrieveDiskFreeSpace(); retrieveDiskFreeSpace();
} }
@ -137,9 +156,6 @@ void QStorageInfoPrivate::retrieveVolumeInfo()
ready = false; ready = false;
valid = ::GetLastError() == ERROR_NOT_READY; valid = ::GetLastError() == ERROR_NOT_READY;
} else { } else {
ready = true;
valid = true;
fileSystemType = QString::fromWCharArray(fileSystemTypeBuffer).toLatin1(); fileSystemType = QString::fromWCharArray(fileSystemTypeBuffer).toLatin1();
name = QString::fromWCharArray(nameBuffer); name = QString::fromWCharArray(nameBuffer);
@ -154,7 +170,7 @@ void QStorageInfoPrivate::retrieveDiskFreeSpace()
const UINT oldmode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); const UINT oldmode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
const QString path = QDir::toNativeSeparators(rootPath); const QString path = QDir::toNativeSeparators(rootPath);
::GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()), ready = ::GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()),
PULARGE_INTEGER(&bytesAvailable), PULARGE_INTEGER(&bytesAvailable),
PULARGE_INTEGER(&bytesTotal), PULARGE_INTEGER(&bytesTotal),
PULARGE_INTEGER(&bytesFree)); PULARGE_INTEGER(&bytesFree));

View File

@ -1911,8 +1911,8 @@ void QCoreApplication::quit()
Installing or removing a QTranslator, or changing an installed QTranslator Installing or removing a QTranslator, or changing an installed QTranslator
generates a \l{QEvent::LanguageChange}{LanguageChange} event for the generates a \l{QEvent::LanguageChange}{LanguageChange} event for the
QCoreApplication instance. A QGuiApplication instance will propagate the event QCoreApplication instance. A QApplication instance will propagate the event
to all toplevel windows, where a reimplementation of changeEvent can to all toplevel widgets, where a reimplementation of changeEvent can
re-translate the user interface by passing user-visible strings via the re-translate the user interface by passing user-visible strings via the
tr() function to the respective property setters. User-interface classes tr() function to the respective property setters. User-interface classes
generated by Qt Designer provide a \c retranslateUi() function that can be generated by Qt Designer provide a \c retranslateUi() function that can be

View File

@ -420,7 +420,7 @@ void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
{ {
qint64 ns = remainingTimeNSecs(); qint64 ns = remainingTimeNSecs();
return ns <= 0 ? ns : ns / (1000 * 1000); return ns <= 0 ? ns : (ns + 999999) / (1000 * 1000);
} }
/*! /*!

View File

@ -205,6 +205,7 @@ private: \
QT_ANNOTATE_CLASS(qt_qgadget, "") \ QT_ANNOTATE_CLASS(qt_qgadget, "") \
/*end*/ /*end*/
/* qmake ignore Q_NAMESPACE */
#define Q_NAMESPACE \ #define Q_NAMESPACE \
extern const QMetaObject staticMetaObject; \ extern const QMetaObject staticMetaObject; \
QT_ANNOTATE_CLASS(qt_qnamespace, "") \ QT_ANNOTATE_CLASS(qt_qnamespace, "") \

View File

@ -855,6 +855,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
if (qstrcmp(QMetaType::typeName(d->type), "QMap<QString, QVariant>") == 0) { if (qstrcmp(QMetaType::typeName(d->type), "QMap<QString, QVariant>") == 0) {
*static_cast<QVariantMap *>(result) = *static_cast<QVariantMap *>(result) =
*static_cast<QMap<QString, QVariant> *>(d->data.shared->ptr); *static_cast<QMap<QString, QVariant> *>(d->data.shared->ptr);
} else if (d->type == QVariant::Hash) {
QVariantMap *map = static_cast<QVariantMap *>(result);
const QVariantHash *hash = v_cast<QVariantHash>(d);
const auto end = hash->end();
for (auto it = hash->begin(); it != end; ++it)
map->insertMulti(it.key(), it.value());
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
} else if (d->type == QMetaType::QJsonValue) { } else if (d->type == QMetaType::QJsonValue) {
if (!v_cast<QJsonValue>(d)->isObject()) if (!v_cast<QJsonValue>(d)->isObject())
@ -871,6 +877,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
if (qstrcmp(QMetaType::typeName(d->type), "QHash<QString, QVariant>") == 0) { if (qstrcmp(QMetaType::typeName(d->type), "QHash<QString, QVariant>") == 0) {
*static_cast<QVariantHash *>(result) = *static_cast<QVariantHash *>(result) =
*static_cast<QHash<QString, QVariant> *>(d->data.shared->ptr); *static_cast<QHash<QString, QVariant> *>(d->data.shared->ptr);
} else if (d->type == QVariant::Map) {
QVariantHash *hash = static_cast<QVariantHash *>(result);
const QVariantMap *map = v_cast<QVariantMap>(d);
const auto end = map->end();
for (auto it = map->begin(); it != end; ++it)
hash->insertMulti(it.key(), it.value());
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
} else if (d->type == QMetaType::QJsonValue) { } else if (d->type == QMetaType::QJsonValue) {
if (!v_cast<QJsonValue>(d)->isObject()) if (!v_cast<QJsonValue>(d)->isObject())
@ -2070,6 +2082,7 @@ void QVariant::load(QDataStream &s)
typeId = QMetaType::type(name.constData()); typeId = QMetaType::type(name.constData());
if (typeId == QMetaType::UnknownType) { if (typeId == QMetaType::UnknownType) {
s.setStatus(QDataStream::ReadCorruptData); s.setStatus(QDataStream::ReadCorruptData);
qWarning("QVariant::load: unknown user type with name %s.", name.constData());
return; return;
} }
} }

View File

@ -1583,13 +1583,13 @@ void QByteArray::chop(int n)
\snippet code/src_corelib_tools_qbytearray.cpp 12 \snippet code/src_corelib_tools_qbytearray.cpp 12
Note: QByteArray is an \l{implicitly shared} class. Consequently, Note: QByteArray is an \l{implicitly shared} class. Consequently,
if \e this is an empty QByteArray, then \e this will just share if you append to an empty byte array, then the byte array will just
the data held in \a ba. In this case, no copying of data is done, share the data held in \a ba. In this case, no copying of data is done,
taking \l{constant time}. If a shared instance is modified, it will taking \l{constant time}. If a shared instance is modified, it will
be copied (copy-on-write), taking \l{linear time}. be copied (copy-on-write), taking \l{linear time}.
If \e this is not an empty QByteArray, a deep copy of the data is If the byte array being appended to is not empty, a deep copy of the
performed, taking \l{linear time}. data is performed, taking \l{linear time}.
This operation typically does not suffer from allocation overhead, This operation typically does not suffer from allocation overhead,
because QByteArray preallocates extra space at the end of the data because QByteArray preallocates extra space at the end of the data
@ -1848,13 +1848,13 @@ QByteArray QByteArray::nulTerminated() const
This is the same as insert(0, \a ba). This is the same as insert(0, \a ba).
Note: QByteArray is an \l{implicitly shared} class. Consequently, Note: QByteArray is an \l{implicitly shared} class. Consequently,
if \e this is an empty QByteArray, then \e this will just share if you prepend to an empty byte array, then the byte array will just
the data held in \a ba. In this case, no copying of data is done, share the data held in \a ba. In this case, no copying of data is done,
taking \l{constant time}. If a shared instance is modified, it will taking \l{constant time}. If a shared instance is modified, it will
be copied (copy-on-write), taking \l{linear time}. be copied (copy-on-write), taking \l{linear time}.
If \e this is not an empty QByteArray, a deep copy of the data is If the byte array being prepended to is not empty, a deep copy of the
performed, taking \l{linear time}. data is performed, taking \l{linear time}.
\sa append(), insert() \sa append(), insert()
*/ */
@ -1936,13 +1936,13 @@ QByteArray &QByteArray::prepend(char ch)
This is the same as insert(size(), \a ba). This is the same as insert(size(), \a ba).
Note: QByteArray is an \l{implicitly shared} class. Consequently, Note: QByteArray is an \l{implicitly shared} class. Consequently,
if \e this is an empty QByteArray, then \e this will just share if you append to an empty byte array, then the byte array will just
the data held in \a ba. In this case, no copying of data is done, share the data held in \a ba. In this case, no copying of data is done,
taking \l{constant time}. If a shared instance is modified, it will taking \l{constant time}. If a shared instance is modified, it will
be copied (copy-on-write), taking \l{linear time}. be copied (copy-on-write), taking \l{linear time}.
If \e this is not an empty QByteArray, a deep copy of the data is If the byte array being appended to is not empty, a deep copy of the
performed, taking \l{linear time}. data is performed, taking \l{linear time}.
This operation typically does not suffer from allocation overhead, This operation typically does not suffer from allocation overhead,
because QByteArray preallocates extra space at the end of the data because QByteArray preallocates extra space at the end of the data

View File

@ -1647,10 +1647,14 @@ QString QTime::toString(Qt::DateFormat format) const
\li the hour with a leading zero (00 to 23, even with AM/PM display) \li the hour with a leading zero (00 to 23, even with AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59) \row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59) \row \li mm \li the minute with a leading zero (00 to 59)
\row \li s \li the second without a leading zero (0 to 59) \row \li s \li the whole second, without any leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59) \row \li ss \li the whole second, with a leading zero where applicable (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999) \row \li z \li the fractional part of the second, to go after a decimal
\row \li zzz \li the milliseconds with leading zeroes (000 to 999) point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
reports the seconds to full available (millisecond) precision
without trailing zeroes.
\row \li zzz \li the fractional part of the second, to millisecond
precision, including trailing zeroes where applicable (000 to 999).
\row \li AP or A \row \li AP or A
\li use AM/PM display. \e A/AP will be replaced by either \li use AM/PM display. \e A/AP will be replaced by either
QLocale::amText() or QLocale::pmText(). QLocale::amText() or QLocale::pmText().
@ -2005,10 +2009,14 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
\li the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) \li the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59) \row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59) \row \li mm \li the minute with a leading zero (00 to 59)
\row \li s \li the second without a leading zero (0 to 59) \row \li s \li the whole second, without any leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59) \row \li ss \li the whole second, with a leading zero where applicable (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999) \row \li z \li the fractional part of the second, to go after a decimal
\row \li zzz \li the milliseconds with leading zeroes (000 to 999) point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
reports the seconds to full available (millisecond) precision
without trailing zeroes.
\row \li zzz \li the fractional part of the second, to millisecond
precision, including trailing zeroes where applicable (000 to 999).
\row \li AP \row \li AP
\li interpret as an AM/PM time. \e AP must be either "AM" or "PM". \li interpret as an AM/PM time. \e AP must be either "AM" or "PM".
\row \li ap \row \li ap
@ -3932,10 +3940,14 @@ QString QDateTime::toString(Qt::DateFormat format) const
\li the hour with a leading zero (00 to 23, even with AM/PM display) \li the hour with a leading zero (00 to 23, even with AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59) \row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59) \row \li mm \li the minute with a leading zero (00 to 59)
\row \li s \li the second without a leading zero (0 to 59) \row \li s \li the whole second without a leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59) \row \li ss \li the whole second with a leading zero where applicable (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999) \row \li z \li the fractional part of the second, to go after a decimal
\row \li zzz \li the milliseconds with leading zeroes (000 to 999) point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
reports the seconds to full available (millisecond) precision
without trailing zeroes.
\row \li zzz \li the fractional part of the second, to millisecond
precision, including trailing zeroes where applicable (000 to 999).
\row \li AP or A \row \li AP or A
\li use AM/PM display. \e A/AP will be replaced by either "AM" or "PM". \li use AM/PM display. \e A/AP will be replaced by either "AM" or "PM".
\row \li ap or a \row \li ap or a
@ -3949,13 +3961,14 @@ QString QDateTime::toString(Qt::DateFormat format) const
in the output. Formats without separators (e.g. "HHmm") are currently not supported. in the output. Formats without separators (e.g. "HHmm") are currently not supported.
Example format strings (assumed that the QDateTime is 21 May 2001 Example format strings (assumed that the QDateTime is 21 May 2001
14:13:09): 14:13:09.120):
\table \table
\header \li Format \li Result \header \li Format \li Result
\row \li dd.MM.yyyy \li 21.05.2001 \row \li dd.MM.yyyy \li 21.05.2001
\row \li ddd MMMM d yy \li Tue May 21 01 \row \li ddd MMMM d yy \li Tue May 21 01
\row \li hh:mm:ss.zzz \li 14:13:09.042 \row \li hh:mm:ss.zzz \li 14:13:09.120
\row \li hh:mm:ss.z \li 14:13:09.12
\row \li h:m:s ap \li 2:13:9 pm \row \li h:m:s ap \li 2:13:9 pm
\endtable \endtable
@ -4963,10 +4976,14 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
\li the hour with a leading zero (00 to 23, even with AM/PM display) \li the hour with a leading zero (00 to 23, even with AM/PM display)
\row \li m \li the minute without a leading zero (0 to 59) \row \li m \li the minute without a leading zero (0 to 59)
\row \li mm \li the minute with a leading zero (00 to 59) \row \li mm \li the minute with a leading zero (00 to 59)
\row \li s \li the second without a leading zero (0 to 59) \row \li s \li the whole second without a leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59) \row \li ss \li the whole second with a leading zero where applicable (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999) \row \li z \li the fractional part of the second, to go after a decimal
\row \li zzz \li the milliseconds with leading zeroes (000 to 999) point, without trailing zeroes (0 to 999). Thus "\c{s.z}"
reports the seconds to full available (millisecond) precision
without trailing zeroes.
\row \li zzz \li the fractional part of the second, to millisecond
precision, including trailing zeroes where applicable (000 to 999).
\row \li AP or A \row \li AP or A
\li interpret as an AM/PM time. \e AP must be either "AM" or "PM". \li interpret as an AM/PM time. \e AP must be either "AM" or "PM".
\row \li ap or a \row \li ap or a

View File

@ -2964,14 +2964,17 @@ QString QLocalePrivate::dateTimeToString(QStringView format, const QDateTime &da
} else { } else {
repeat = 1; repeat = 1;
} }
switch (repeat) {
case 1: // note: the millisecond component is treated like the decimal part of the seconds
result.append(m_data->longLongToString(time.msec())); // so ms == 2 is always printed as "002", but ms == 200 can be either "2" or "200"
break;
case 3:
result.append(m_data->longLongToString(time.msec(), -1, 10, 3, QLocaleData::ZeroPadded)); result.append(m_data->longLongToString(time.msec(), -1, 10, 3, QLocaleData::ZeroPadded));
break; if (repeat == 1) {
if (result.endsWith(zero()))
result.chop(1);
if (result.endsWith(zero()))
result.chop(1);
} }
break; break;
case 't': case 't':

View File

@ -62,6 +62,7 @@ function(QT5_ADD_DBUS_INTERFACE _sources _interface _basename)
DEPENDS ${_infile} VERBATIM) DEPENDS ${_infile} VERBATIM)
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE)
qt5_generate_moc("${_header}" "${_moc}") qt5_generate_moc("${_header}" "${_moc}")
@ -147,6 +148,7 @@ function(QT5_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optio
qt5_generate_moc("${_header}" "${_moc}") qt5_generate_moc("${_header}" "${_moc}")
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE)
macro_add_file_dependencies("${_impl}" "${_moc}") macro_add_file_dependencies("${_impl}" "${_moc}")
list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}")

View File

@ -211,14 +211,14 @@ struct QDBusDispatchLocker: QDBusMutexLocker
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeAcquire, this); \ QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeAcquire, this); \
sem.acquire(); \ sem.acquire(); \
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterAcquire, this); \ QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterAcquire, this); \
} while (0) } while (false)
# define SEM_RELEASE(action, sem) \ # define SEM_RELEASE(action, sem) \
do { \ do { \
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeRelease, that); \ QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::BeforeRelease, that); \
sem.release(); \ sem.release(); \
QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterRelease, that); \ QDBusLockerBase::reportThreadAction(action, QDBusLockerBase::AfterRelease, that); \
} while (0) } while (false)
#else #else
# define SEM_ACQUIRE(action, sem) sem.acquire() # define SEM_ACQUIRE(action, sem) sem.acquire()

View File

@ -304,8 +304,8 @@ void QCosmeticStroker::setup()
ymin = deviceRect.top() - 1; ymin = deviceRect.top() - 1;
ymax = deviceRect.bottom() + 2; ymax = deviceRect.bottom() + 2;
lastPixel.x = -1; lastPixel.x = INT_MIN;
lastPixel.y = -1; lastPixel.y = INT_MIN;
} }
// returns true if the whole line gets clipped away // returns true if the whole line gets clipped away
@ -325,11 +325,11 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
x1 = xmax; x1 = xmax;
} }
if (x2 < xmin) { if (x2 < xmin) {
lastPixel.x = -1; lastPixel.x = INT_MIN;
y2 += (y2 - y1)/(x2 - x1) * (xmin - x2); y2 += (y2 - y1)/(x2 - x1) * (xmin - x2);
x2 = xmin; x2 = xmin;
} else if (x2 > xmax) { } else if (x2 > xmax) {
lastPixel.x = -1; lastPixel.x = INT_MIN;
y2 += (y2 - y1)/(x2 - x1) * (xmax - x2); y2 += (y2 - y1)/(x2 - x1) * (xmax - x2);
x2 = xmax; x2 = xmax;
} }
@ -346,11 +346,11 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
y1 = ymax; y1 = ymax;
} }
if (y2 < ymin) { if (y2 < ymin) {
lastPixel.x = -1; lastPixel.x = INT_MIN;
x2 += (x2 - x1)/(y2 - y1) * (ymin - y2); x2 += (x2 - x1)/(y2 - y1) * (ymin - y2);
y2 = ymin; y2 = ymin;
} else if (y2 > ymax) { } else if (y2 > ymax) {
lastPixel.x = -1; lastPixel.x = INT_MIN;
x2 += (x2 - x1)/(y2 - y1) * (ymax - y2); x2 += (x2 - x1)/(y2 - y1) * (ymax - y2);
y2 = ymax; y2 = ymax;
} }
@ -358,7 +358,7 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
return false; return false;
clipped: clipped:
lastPixel.x = -1; lastPixel.x = INT_MIN;
return true; return true;
} }
@ -374,7 +374,7 @@ void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2)
QPointF end = p2 * state->matrix; QPointF end = p2 * state->matrix;
patternOffset = state->lastPen.dashOffset()*64; patternOffset = state->lastPen.dashOffset()*64;
lastPixel.x = -1; lastPixel.x = INT_MIN;
stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0); stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0);
@ -417,8 +417,8 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
// by calculating the direction and last pixel of the last segment in the contour. // by calculating the direction and last pixel of the last segment in the contour.
// the info is then used to perform dropout control when drawing the first line segment // the info is then used to perform dropout control when drawing the first line segment
// of the contour // of the contour
lastPixel.x = -1; lastPixel.x = INT_MIN;
lastPixel.y = -1; lastPixel.y = INT_MIN;
if (clipLine(rx1, ry1, rx2, ry2)) if (clipLine(rx1, ry1, rx2, ry2))
return; return;
@ -599,7 +599,11 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]); bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
int caps = (!closed && drawCaps) ? CapBegin : NoCaps; int caps = (!closed && drawCaps) ? CapBegin : NoCaps;
if (closed) { if (closed) {
QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix; QPointF p2;
if (points[0] == end[-2] && points[1] == end[-1] && path.elementCount() > 2)
p2 = QPointF(end[-4], end[-3]) * state->matrix;
else
p2 = QPointF(end[-2], end[-1]) * state->matrix;
calculateLastPoint(p2.x(), p2.y(), p.x(), p.y()); calculateLastPoint(p2.x(), p2.y(), p.x(), p.y());
} }
@ -770,6 +774,11 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
int ys = (y2 + 32) >> 6; int ys = (y2 + 32) >> 6;
int round = (xinc > 0) ? 32 : 0; int round = (xinc > 0) ? 32 : 0;
// If capAdjust made us round away from what calculateLastPoint gave us,
// round back the other way so we start and end on the right point.
if ((caps & QCosmeticStroker::CapBegin) && stroker->lastPixel.y == y + 1)
y++;
if (y != ys) { if (y != ys) {
x += ((y * (1<<6)) + round - y1) * xinc >> 6; x += ((y * (1<<6)) + round - y1) * xinc >> 6;
@ -783,7 +792,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
qSwap(first, last); qSwap(first, last);
bool axisAligned = qAbs(xinc) < (1 << 14); bool axisAligned = qAbs(xinc) < (1 << 14);
if (stroker->lastPixel.x >= 0) { if (stroker->lastPixel.x > INT_MIN) {
if (first.x == stroker->lastPixel.x && if (first.x == stroker->lastPixel.x &&
first.y == stroker->lastPixel.y) { first.y == stroker->lastPixel.y) {
// remove duplicated pixel // remove duplicated pixel
@ -805,6 +814,14 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
--y; --y;
x -= xinc; x -= xinc;
} }
} else if (stroker->lastDir == dir &&
((qAbs(stroker->lastPixel.x - first.x) <= 1 &&
qAbs(stroker->lastPixel.y - first.y) > 1))) {
x += xinc >> 1;
if (swapped)
last.x = (x >> 16);
else
last.x = (x + (ys - y - 1)*xinc) >> 16;
} }
} }
stroker->lastDir = dir; stroker->lastDir = dir;
@ -847,6 +864,11 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
int xs = (x2 + 32) >> 6; int xs = (x2 + 32) >> 6;
int round = (yinc > 0) ? 32 : 0; int round = (yinc > 0) ? 32 : 0;
// If capAdjust made us round away from what calculateLastPoint gave us,
// round back the other way so we start and end on the right point.
if ((caps & QCosmeticStroker::CapBegin) && stroker->lastPixel.x == x + 1)
x++;
if (x != xs) { if (x != xs) {
y += ((x * (1<<6)) + round - x1) * yinc >> 6; y += ((x * (1<<6)) + round - x1) * yinc >> 6;
@ -860,7 +882,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
qSwap(first, last); qSwap(first, last);
bool axisAligned = qAbs(yinc) < (1 << 14); bool axisAligned = qAbs(yinc) < (1 << 14);
if (stroker->lastPixel.x >= 0) { if (stroker->lastPixel.x > INT_MIN) {
if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) { if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) {
// remove duplicated pixel // remove duplicated pixel
if (swapped) { if (swapped) {
@ -881,6 +903,14 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
--x; --x;
y -= yinc; y -= yinc;
} }
} else if (stroker->lastDir == dir &&
((qAbs(stroker->lastPixel.x - first.x) <= 1 &&
qAbs(stroker->lastPixel.y - first.y) > 1))) {
y += yinc >> 1;
if (swapped)
last.y = (y >> 16);
else
last.y = (y + (xs - x - 1)*yinc) >> 16;
} }
} }
stroker->lastDir = dir; stroker->lastDir = dir;

View File

@ -5561,13 +5561,13 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x); int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len); int end = qMin<int>(x + mapWidth, clip.x + clip.len);
Q_ASSERT(clip.len <= buffer_size); Q_ASSERT(clip.len <= buffer_size);
QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);
for (int xp=start; xp<end; ++xp) { for (int xp=start; xp<end; ++xp) {
const int coverage = map[xp - x]; const int coverage = map[xp - x];
alphamapblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile); alphamapblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile);
} }
destStore64(rasterBuffer, start, clip.y, dest, clip.len); destStore64(rasterBuffer, start, clip.y, dest, end - start);
} // for (i -> line.count) } // for (i -> line.count)
map += mapStride; map += mapStride;
} // for (yp -> bottom) } // for (yp -> bottom)
@ -5834,13 +5834,13 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x); int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len); int end = qMin<int>(x + mapWidth, clip.x + clip.len);
Q_ASSERT(clip.len <= buffer_size); Q_ASSERT(clip.len <= buffer_size);
QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, clip.len); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);
for (int xp=start; xp<end; ++xp) { for (int xp=start; xp<end; ++xp) {
const uint coverage = src[xp - x]; const uint coverage = src[xp - x];
alphargbblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile); alphargbblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile);
} }
destStore64(rasterBuffer, start, clip.y, dest, clip.len); destStore64(rasterBuffer, start, clip.y, dest, end - start);
} // for (i -> line.count) } // for (i -> line.count)
src += srcStride; src += srcStride;
} // for (yp -> bottom) } // for (yp -> bottom)

View File

@ -885,7 +885,7 @@ do { \
case 1: *--_d = *--_s; \ case 1: *--_d = *--_s; \
} while (--n > 0); \ } while (--n > 0); \
} \ } \
} while (0) } while (false)
#define QT_MEMCPY_USHORT(dest, src, length) \ #define QT_MEMCPY_USHORT(dest, src, length) \
do { \ do { \
@ -905,7 +905,7 @@ do { \
case 1: *_d++ = *_s++; \ case 1: *_d++ = *_s++; \
} while (--n > 0); \ } while (--n > 0); \
} \ } \
} while (0) } while (false)
inline ushort qConvertRgb32To16(uint c) inline ushort qConvertRgb32To16(uint c)
{ {

View File

@ -47,8 +47,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_LOCALSERVER
/*! /*!
\class QLocalServer \class QLocalServer
\since 4.4 \since 4.4
@ -536,8 +534,6 @@ bool QLocalServer::waitForNewConnection(int msec, bool *timedOut)
return !d->pendingConnections.isEmpty(); return !d->pendingConnections.isEmpty();
} }
#endif
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qlocalserver.cpp" #include "moc_qlocalserver.cpp"

View File

@ -43,11 +43,10 @@
#include <QtNetwork/qtnetworkglobal.h> #include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qabstractsocket.h> #include <QtNetwork/qabstractsocket.h>
QT_REQUIRE_CONFIG(localserver);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_LOCALSERVER
class QLocalSocket; class QLocalSocket;
class QLocalServerPrivate; class QLocalServerPrivate;
@ -105,8 +104,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QLocalServer::SocketOptions) Q_DECLARE_OPERATORS_FOR_FLAGS(QLocalServer::SocketOptions)
#endif // QT_NO_LOCALSERVER
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QLOCALSERVER_H #endif // QLOCALSERVER_H

View File

@ -53,12 +53,12 @@
#include <QtNetwork/private/qtnetworkglobal_p.h> #include <QtNetwork/private/qtnetworkglobal_p.h>
#ifndef QT_NO_LOCALSERVER
#include "qlocalserver.h" #include "qlocalserver.h"
#include "private/qobject_p.h" #include "private/qobject_p.h"
#include <qqueue.h> #include <qqueue.h>
QT_REQUIRE_CONFIG(localserver);
#if defined(QT_LOCALSOCKET_TCP) #if defined(QT_LOCALSOCKET_TCP)
# include <qtcpserver.h> # include <qtcpserver.h>
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
@ -128,7 +128,5 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_LOCALSERVER
#endif // QLOCALSERVER_P_H #endif // QLOCALSERVER_P_H

View File

@ -44,8 +44,6 @@
#include "qnet_unix_p.h" #include "qnet_unix_p.h"
#include "qtemporarydir.h" #include "qtemporarydir.h"
#ifndef QT_NO_LOCALSERVER
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
@ -341,5 +339,3 @@ void QLocalServerPrivate::setError(const QString &function)
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_LOCALSERVER

View File

@ -40,8 +40,6 @@
#include "qlocalsocket.h" #include "qlocalsocket.h"
#include "qlocalsocket_p.h" #include "qlocalsocket_p.h"
#ifndef QT_NO_LOCALSOCKET
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/*! /*!
@ -574,6 +572,4 @@ QDebug operator<<(QDebug debug, QLocalSocket::LocalSocketState state)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif
#include "moc_qlocalsocket.cpp" #include "moc_qlocalsocket.cpp"

View File

@ -44,11 +44,10 @@
#include <QtCore/qiodevice.h> #include <QtCore/qiodevice.h>
#include <QtNetwork/qabstractsocket.h> #include <QtNetwork/qabstractsocket.h>
QT_REQUIRE_CONFIG(localserver);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_LOCALSOCKET
class QLocalSocketPrivate; class QLocalSocketPrivate;
class Q_NETWORK_EXPORT QLocalSocket : public QIODevice class Q_NETWORK_EXPORT QLocalSocket : public QIODevice
@ -148,8 +147,6 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, QLocalSocket::LocalSocketError);
Q_NETWORK_EXPORT QDebug operator<<(QDebug, QLocalSocket::LocalSocketState); Q_NETWORK_EXPORT QDebug operator<<(QDebug, QLocalSocket::LocalSocketState);
#endif #endif
#endif // QT_NO_LOCALSOCKET
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QLOCALSOCKET_H #endif // QLOCALSOCKET_H

View File

@ -53,13 +53,13 @@
#include <QtNetwork/private/qtnetworkglobal_p.h> #include <QtNetwork/private/qtnetworkglobal_p.h>
#ifndef QT_NO_LOCALSOCKET
#include "qlocalsocket.h" #include "qlocalsocket.h"
#include "private/qiodevice_p.h" #include "private/qiodevice_p.h"
#include <qtimer.h> #include <qtimer.h>
QT_REQUIRE_CONFIG(localserver);
#if defined(QT_LOCALSOCKET_TCP) #if defined(QT_LOCALSOCKET_TCP)
# include "qtcpsocket.h" # include "qtcpsocket.h"
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
@ -161,7 +161,5 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_LOCALSOCKET
#endif // QLOCALSOCKET_P_H #endif // QLOCALSOCKET_P_H

View File

@ -41,8 +41,6 @@
#include "qlocalsocket_p.h" #include "qlocalsocket_p.h"
#include "qnet_unix_p.h" #include "qnet_unix_p.h"
#ifndef QT_NO_LOCALSOCKET
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
@ -555,5 +553,3 @@ bool QLocalSocket::waitForReadyRead(int msecs)
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif

View File

@ -8,10 +8,6 @@ HEADERS += socket/qabstractsocketengine_p.h \
socket/qudpsocket.h \ socket/qudpsocket.h \
socket/qtcpserver.h \ socket/qtcpserver.h \
socket/qtcpsocket_p.h \ socket/qtcpsocket_p.h \
socket/qlocalserver.h \
socket/qlocalserver_p.h \
socket/qlocalsocket.h \
socket/qlocalsocket_p.h \
socket/qtcpserver_p.h socket/qtcpserver_p.h
SOURCES += socket/qabstractsocketengine.cpp \ SOURCES += socket/qabstractsocketengine.cpp \
@ -19,9 +15,7 @@ SOURCES += socket/qabstractsocketengine.cpp \
socket/qabstractsocket.cpp \ socket/qabstractsocket.cpp \
socket/qtcpsocket.cpp \ socket/qtcpsocket.cpp \
socket/qudpsocket.cpp \ socket/qudpsocket.cpp \
socket/qtcpserver.cpp \ socket/qtcpserver.cpp
socket/qlocalsocket.cpp \
socket/qlocalserver.cpp
# SOCK5 support. # SOCK5 support.
@ -49,42 +43,42 @@ qtConfig(sctp) {
HEADERS += socket/qnativesocketengine_p.h HEADERS += socket/qnativesocketengine_p.h
} }
unix: { unix {
SOURCES += socket/qnativesocketengine_unix.cpp \ SOURCES += socket/qnativesocketengine_unix.cpp
socket/qlocalsocket_unix.cpp \ HEADERS += socket/qnet_unix_p.h
socket/qlocalserver_unix.cpp
} }
unix:HEADERS += \
socket/qnet_unix_p.h
# Suppress deprecation warnings with moc because MS headers have # Suppress deprecation warnings with moc because MS headers have
# invalid C/C++ code otherwise. # invalid C/C++ code otherwise.
msvc: QMAKE_MOC_OPTIONS += -D_WINSOCK_DEPRECATED_NO_WARNINGS msvc: QMAKE_MOC_OPTIONS += -D_WINSOCK_DEPRECATED_NO_WARNINGS
win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp \ win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp
socket/qlocalsocket_win.cpp \
socket/qlocalserver_win.cpp
win32:!winrt:LIBS_PRIVATE += -ladvapi32 win32:!winrt:LIBS_PRIVATE += -ladvapi32
winrt { winrt {
SOURCES += socket/qnativesocketengine_winrt.cpp \ SOURCES += socket/qnativesocketengine_winrt.cpp
socket/qlocalsocket_tcp.cpp \
socket/qlocalserver_tcp.cpp
HEADERS += socket/qnativesocketengine_winrt_p.h HEADERS += socket/qnativesocketengine_winrt_p.h
DEFINES += QT_LOCALSOCKET_TCP
} }
integrity: { qtConfig(localserver) {
SOURCES -= socket/qlocalsocket_unix.cpp \ HEADERS += socket/qlocalserver.h \
socket/qlocalserver_unix.cpp socket/qlocalserver_p.h \
SOURCES += socket/qlocalsocket_tcp.cpp \ socket/qlocalsocket.h \
socket/qlocalserver_tcp.cpp \ socket/qlocalsocket_p.h
socket/qnativesocketengine_unix.cpp SOURCES += socket/qlocalsocket.cpp \
socket/qlocalserver.cpp
intergrity|winrt {
SOURCES += socket/qlocalsocket_tcp.cpp \
socket/qlocalserver_tcp.cpp
DEFINES += QT_LOCALSOCKET_TCP DEFINES += QT_LOCALSOCKET_TCP
} else: unix {
SOURCES += socket/qlocalsocket_unix.cpp \
socket/qlocalserver_unix.cpp
} else: win32 {
SOURCES += socket/qlocalsocket_win.cpp \
socket/qlocalserver_win.cpp
}
} }
qtConfig(system-proxies) { qtConfig(system-proxies) {

View File

@ -33,7 +33,6 @@ SOURCES += qgl.cpp \
qglbuffer.cpp \ qglbuffer.cpp \
HEADERS += qglshaderprogram.h \ HEADERS += qglshaderprogram.h \
qgraphicsshadereffect_p.h \
gl2paintengineex/qglgradientcache_p.h \ gl2paintengineex/qglgradientcache_p.h \
gl2paintengineex/qglengineshadermanager_p.h \ gl2paintengineex/qglengineshadermanager_p.h \
gl2paintengineex/qgl2pexvertexarray_p.h \ gl2paintengineex/qgl2pexvertexarray_p.h \
@ -44,7 +43,6 @@ HEADERS += qglshaderprogram.h \
gl2paintengineex/qglshadercache_p.h gl2paintengineex/qglshadercache_p.h
SOURCES += qglshaderprogram.cpp \ SOURCES += qglshaderprogram.cpp \
qgraphicsshadereffect.cpp \
gl2paintengineex/qglgradientcache.cpp \ gl2paintengineex/qglgradientcache.cpp \
gl2paintengineex/qglengineshadermanager.cpp \ gl2paintengineex/qglengineshadermanager.cpp \
gl2paintengineex/qgl2pexvertexarray.cpp \ gl2paintengineex/qgl2pexvertexarray.cpp \
@ -52,4 +50,9 @@ SOURCES += qglshaderprogram.cpp \
gl2paintengineex/qglcustomshaderstage.cpp \ gl2paintengineex/qglcustomshaderstage.cpp \
gl2paintengineex/qtextureglyphcache_gl.cpp gl2paintengineex/qtextureglyphcache_gl.cpp
qtConfig(graphicseffect) {
HEADERS += qgraphicsshadereffect_p.h
SOURCES += qgraphicsshadereffect.cpp
}
load(qt_module) load(qt_module)

View File

@ -39,8 +39,6 @@
#include "qgraphicsshadereffect_p.h" #include "qgraphicsshadereffect_p.h"
#ifndef QT_NO_GRAPHICSEFFECT
#include "qglshaderprogram.h" #include "qglshaderprogram.h"
#include "gl2paintengineex/qglcustomshaderstage_p.h" #include "gl2paintengineex/qglcustomshaderstage_p.h"
#define QGL_HAVE_CUSTOM_SHADERS 1 #define QGL_HAVE_CUSTOM_SHADERS 1
@ -312,5 +310,3 @@ void QGraphicsShaderEffect::setUniforms(QGLShaderProgram *program)
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSEFFECT

View File

@ -53,12 +53,11 @@
#include <QtWidgets/qgraphicseffect.h> #include <QtWidgets/qgraphicseffect.h>
#ifndef QT_NO_GRAPHICSEFFECT
#include <QtOpenGL/qtopenglglobal.h> #include <QtOpenGL/qtopenglglobal.h>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(graphicseffect);
QT_BEGIN_NAMESPACE
class QGLShaderProgram; class QGLShaderProgram;
class QGLCustomShaderEffectStage; class QGLCustomShaderEffectStage;
@ -88,6 +87,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_GRAPHICSEFFECT
#endif // QGRAPHICSSHADEREFFECT_P_H #endif // QGRAPHICSSHADEREFFECT_P_H

View File

@ -40,9 +40,9 @@
#ifndef QINTEGRITYHIDMANAGER_P_H #ifndef QINTEGRITYHIDMANAGER_P_H
#define QINTEGRITYHIDMANAGER_P_H #define QINTEGRITYHIDMANAGER_P_H
#include <QObject> #include <QtCore/QObject>
#include <QList> #include <QtCore/QList>
#include <QThread> #include <QtCore/QThread>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -21,7 +21,6 @@ OBJECTIVE_SOURCES += main.mm \
qmultitouch_mac.mm \ qmultitouch_mac.mm \
qcocoaaccessibilityelement.mm \ qcocoaaccessibilityelement.mm \
qcocoaaccessibility.mm \ qcocoaaccessibility.mm \
qcocoafontdialoghelper.mm \
qcocoacursor.mm \ qcocoacursor.mm \
qcocoaclipboard.mm \ qcocoaclipboard.mm \
qcocoadrag.mm \ qcocoadrag.mm \
@ -55,7 +54,6 @@ HEADERS += qcocoaintegration.h \
qmultitouch_mac_p.h \ qmultitouch_mac_p.h \
qcocoaaccessibilityelement.h \ qcocoaaccessibilityelement.h \
qcocoaaccessibility.h \ qcocoaaccessibility.h \
qcocoafontdialoghelper.h \
qcocoacursor.h \ qcocoacursor.h \
qcocoaclipboard.h \ qcocoaclipboard.h \
qcocoadrag.h \ qcocoadrag.h \
@ -111,6 +109,11 @@ qtHaveModule(widgets) {
HEADERS += qcocoafiledialoghelper.h HEADERS += qcocoafiledialoghelper.h
} }
qtConfig(fontdialog) {
SOURCES += qcocoafontdialoghelper.mm
HEADERS += qcocoafontdialoghelper.h
}
QT += widgets-private printsupport-private QT += widgets-private printsupport-private
} }

View File

@ -41,8 +41,11 @@
#define QCOCOAFONTDIALOGHELPER_H #define QCOCOAFONTDIALOGHELPER_H
#include <QObject> #include <QObject>
#include <QtWidgets/qtwidgetsglobal.h>
#include <qpa/qplatformdialoghelper.h> #include <qpa/qplatformdialoghelper.h>
QT_REQUIRE_CONFIG(fontdialog);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCocoaFontDialogHelper : public QPlatformFontDialogHelper class QCocoaFontDialogHelper : public QPlatformFontDialogHelper

View File

@ -37,8 +37,6 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QT_NO_FONTDIALOG
#include <QtCore/qtimer.h> #include <QtCore/qtimer.h>
#include <QtGui/qfontdatabase.h> #include <QtGui/qfontdatabase.h>
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
@ -402,5 +400,3 @@ QFont QCocoaFontDialogHelper::currentFont() const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FONTDIALOG

View File

@ -44,8 +44,6 @@
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include "qcocoacolordialoghelper.h"
#include "qcocoafontdialoghelper.h"
#include "qcocoasystemsettings.h" #include "qcocoasystemsettings.h"
#include "qcocoasystemtrayicon.h" #include "qcocoasystemtrayicon.h"
#include "qcocoamenuitem.h" #include "qcocoamenuitem.h"
@ -64,9 +62,15 @@
#ifdef QT_WIDGETS_LIB #ifdef QT_WIDGETS_LIB
#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtwidgetsglobal.h>
#if QT_CONFIG(colordialog)
#include "qcocoacolordialoghelper.h"
#endif
#if QT_CONFIG(filedialog) #if QT_CONFIG(filedialog)
#include "qcocoafiledialoghelper.h" #include "qcocoafiledialoghelper.h"
#endif #endif
#if QT_CONFIG(fontdialog)
#include "qcocoafontdialoghelper.h"
#endif
#endif #endif
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
@ -130,11 +134,11 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const
{ {
if (dialogType == QPlatformTheme::FileDialog) if (dialogType == QPlatformTheme::FileDialog)
return true; return true;
#if QT_CONFIG(colordialog) #if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog)
if (dialogType == QPlatformTheme::ColorDialog) if (dialogType == QPlatformTheme::ColorDialog)
return true; return true;
#endif #endif
#ifndef QT_NO_FONTDIALOG #if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog)
if (dialogType == QPlatformTheme::FontDialog) if (dialogType == QPlatformTheme::FontDialog)
return true; return true;
#endif #endif
@ -148,11 +152,11 @@ QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialo
case QPlatformTheme::FileDialog: case QPlatformTheme::FileDialog:
return new QCocoaFileDialogHelper(); return new QCocoaFileDialogHelper();
#endif #endif
#if QT_CONFIG(colordialog) #if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog)
case QPlatformTheme::ColorDialog: case QPlatformTheme::ColorDialog:
return new QCocoaColorDialogHelper(); return new QCocoaColorDialogHelper();
#endif #endif
#ifndef QT_NO_FONTDIALOG #if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog)
case QPlatformTheme::FontDialog: case QPlatformTheme::FontDialog:
return new QCocoaFontDialogHelper(); return new QCocoaFontDialogHelper();
#endif #endif

View File

@ -78,6 +78,22 @@
return m_cocoaWindow->screen()->availableGeometry().toCGRect(); return m_cocoaWindow->screen()->availableGeometry().toCGRect();
} }
#if QT_MACOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_11)
/*
AppKit on OS X 10.10 wrongly calls windowWillUseStandardFrame:defaultFrame
from -[NSWindow _frameForFullScreenMode] when going into fullscreen, resulting
in black bars on top and bottom of the window. By implementing the following
method, AppKit will choose that instead, and resolve the right fullscreen
geometry.
*/
- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
{
Q_UNUSED(window);
Q_ASSERT(NSEqualSizes(m_cocoaWindow->screen()->geometry().size().toCGSize(), proposedSize));
return proposedSize;
}
#endif
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
{ {
Q_UNUSED(window); Q_UNUSED(window);

View File

@ -126,6 +126,18 @@
"features": [ "features": [
"disable_desktopgl" "disable_desktopgl"
] ]
},
{
"id": 11,
"description": "VMWare Workstation Player 12 has insufficient support for OpenGL",
"vendor_id": "0x15AD",
"device_id": [ "0x0405" ],
"os": {
"type": "win"
},
"features": [
"disable_desktopgl", "disable_d3d11"
]
} }
] ]
} }

View File

@ -844,6 +844,27 @@ static inline QWindowsInputContext *windowsInputContext()
return qobject_cast<QWindowsInputContext *>(QWindowsIntegration::instance()->inputContext()); return qobject_cast<QWindowsInputContext *>(QWindowsIntegration::instance()->inputContext());
} }
// Child windows, fixed-size windows or pop-ups and similar should not be resized
static inline bool resizeOnDpiChanged(const QWindow *w)
{
bool result = false;
if (w->isTopLevel()) {
switch (w->type()) {
case Qt::Window:
case Qt::Dialog:
case Qt::Sheet:
case Qt::Drawer:
case Qt::Tool:
result = !w->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint);
break;
default:
break;
}
}
return result;
}
/*! /*!
\brief Main windows procedure registered for windows. \brief Main windows procedure registered for windows.
@ -1118,9 +1139,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif #endif
} break; } break;
case QtWindows::DpiChangedEvent: { case QtWindows::DpiChangedEvent: {
if (platformWindow->window()->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint)) if (!resizeOnDpiChanged(platformWindow->window()))
return false; // Fixed-size window should not be resized return false;
platformWindow->setFlag(QWindowsWindow::WithinDpiChanged); platformWindow->setFlag(QWindowsWindow::WithinDpiChanged);
const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam); const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam);
SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top, SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top,

View File

@ -153,7 +153,8 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
<< d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y() << d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y()
<< " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height() << " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height()
<< " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth << " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth
<< " Format: " << d.format; << " Format: " << d.format
<< " hMonitor: " << d.hMonitor;
if (d.flags & QWindowsScreenData::PrimaryScreen) if (d.flags & QWindowsScreenData::PrimaryScreen)
dbg << " primary"; dbg << " primary";
if (d.flags & QWindowsScreenData::VirtualDesktop) if (d.flags & QWindowsScreenData::VirtualDesktop)
@ -290,6 +291,13 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
{ {
m_data.physicalSizeMM = newData.physicalSizeMM; m_data.physicalSizeMM = newData.physicalSizeMM;
if (m_data.hMonitor != newData.hMonitor) {
qCDebug(lcQpaWindows) << "Monitor" << m_data.name
<< "has had its hMonitor handle changed from"
<< m_data.hMonitor << "to" << newData.hMonitor;
m_data.hMonitor = newData.hMonitor;
}
if (m_data.geometry != newData.geometry || m_data.availableGeometry != newData.availableGeometry) { if (m_data.geometry != newData.geometry || m_data.availableGeometry != newData.availableGeometry) {
m_data.geometry = newData.geometry; m_data.geometry = newData.geometry;
m_data.availableGeometry = newData.availableGeometry; m_data.availableGeometry = newData.availableGeometry;

View File

@ -869,12 +869,18 @@ QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon
} }
SHFILEINFO info; SHFILEINFO info;
const unsigned int flags = unsigned int flags = SHGFI_ICON | iconSize | SHGFI_SYSICONINDEX | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX;
SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX; DWORD attributes = 0;
QString path = filePath;
const bool val = cacheableDirIcon && useDefaultFolderIcon if (cacheableDirIcon && useDefaultFolderIcon) {
? shGetFileInfoBackground(QString::fromWCharArray(L"dummy"), FILE_ATTRIBUTE_DIRECTORY, &info, flags | SHGFI_USEFILEATTRIBUTES) flags |= SHGFI_USEFILEATTRIBUTES;
: shGetFileInfoBackground(filePath, 0, &info, flags); attributes |= FILE_ATTRIBUTE_DIRECTORY;
path = QStringLiteral("dummy");
} else if (!fileInfo().exists()) {
flags |= SHGFI_USEFILEATTRIBUTES;
attributes |= FILE_ATTRIBUTE_NORMAL;
}
const bool val = shGetFileInfoBackground(path, attributes, &info, flags);
// Even if GetFileInfo returns a valid result, hIcon can be empty in some cases // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases
if (val && info.hIcon) { if (val && info.hIcon) {

View File

@ -39,7 +39,9 @@
#include "qwindowswindow.h" #include "qwindowswindow.h"
#include "qwindowscontext.h" #include "qwindowscontext.h"
#if QT_CONFIG(draganddrop)
# include "qwindowsdrag.h" # include "qwindowsdrag.h"
#endif
#include "qwindowsscreen.h" #include "qwindowsscreen.h"
#include "qwindowsintegration.h" #include "qwindowsintegration.h"
#include "qwindowsmenu.h" #include "qwindowsmenu.h"
@ -1834,6 +1836,8 @@ bool QWindowsWindow::isFullScreen_sys() const
if (!w->isTopLevel()) if (!w->isTopLevel())
return false; return false;
QRect geometry = geometry_sys(); QRect geometry = geometry_sys();
if (testFlag(HasBorderInFullScreen))
geometry += QMargins(1, 1, 1, 1);
QPlatformScreen *screen = screenForGeometry(geometry); QPlatformScreen *screen = screenForGeometry(geometry);
return screen && geometry == QHighDpi::toNativePixels(screen->geometry(), screen); return screen && geometry == QHighDpi::toNativePixels(screen->geometry(), screen);
} }

View File

@ -426,8 +426,7 @@ QDateTime QWinRTFileEngine::fileTime(FileTime type) const
ComPtr<FileProperties::IBasicProperties> properties; ComPtr<FileProperties::IBasicProperties> properties;
hr = QWinRTFunctions::await(op, properties.GetAddressOf()); hr = QWinRTFunctions::await(op, properties.GetAddressOf());
RETURN_IF_FAILED("Failed to get file properties", return QDateTime()); RETURN_IF_FAILED("Failed to get file properties", return QDateTime());
hr = type == ModificationTime ? properties->get_DateModified(&dateTime) hr = properties->get_DateModified(&dateTime);
: properties->get_ItemDate(&dateTime);
RETURN_IF_FAILED("Failed to get file date", return QDateTime()); RETURN_IF_FAILED("Failed to get file date", return QDateTime());
} }
break; break;

View File

@ -5,10 +5,3 @@ INCLUDEPATH += $$PWD/../
load(qt_build_paths) load(qt_build_paths)
!qtConfig(system-xcb) {
QMAKE_USE += xcb-static xcb
} else {
qtConfig(xkb): QMAKE_USE += xcb_xkb
qtConfig(xcb-render): QMAKE_USE += xcb_render
QMAKE_USE += xcb_syslibs
}

View File

@ -544,6 +544,7 @@ static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
case blr_varying: case blr_varying:
case blr_varying2: case blr_varying2:
strLen += 2; // for the two terminating null values strLen += 2; // for the two terminating null values
Q_FALLTHROUGH();
case blr_text: case blr_text:
case blr_text2: { case blr_text2: {
int o; int o;

View File

@ -81,21 +81,27 @@
#include <qpushbutton.h> #include <qpushbutton.h>
#endif #endif
#include <qradiobutton.h> #include <qradiobutton.h>
#if QT_CONFIG(rubberband)
#include <qrubberband.h> #include <qrubberband.h>
#endif
#include <qscrollbar.h> #include <qscrollbar.h>
#include <qsizegrip.h> #include <qsizegrip.h>
#include <qstyleoption.h> #include <qstyleoption.h>
#include <qtoolbar.h> #include <qtoolbar.h>
#include <qtoolbutton.h> #include <qtoolbutton.h>
#include <qtreeview.h> #include <qtreeview.h>
#if QT_CONFIG(tableview)
#include <qtableview.h> #include <qtableview.h>
#endif
#include <qoperatingsystemversion.h> #include <qoperatingsystemversion.h>
#if QT_CONFIG(wizard) #if QT_CONFIG(wizard)
#include <qwizard.h> #include <qwizard.h>
#endif #endif
#include <qdebug.h> #include <qdebug.h>
#include <qlibrary.h> #include <qlibrary.h>
#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h> #include <qdatetimeedit.h>
#endif
#include <qmath.h> #include <qmath.h>
#include <QtWidgets/qgraphicsproxywidget.h> #include <QtWidgets/qgraphicsproxywidget.h>
#include <QtWidgets/qgraphicsview.h> #include <QtWidgets/qgraphicsview.h>
@ -317,7 +323,7 @@ static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY)
} }
void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed) static void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed, bool documentMode)
{ {
p->setRenderHints(QPainter::Antialiasing); p->setRenderHints(QPainter::Antialiasing);
QRect rect(0, 0, closeButtonSize, closeButtonSize); QRect rect(0, 0, closeButtonSize, closeButtonSize);
@ -328,10 +334,16 @@ void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
// draw background circle // draw background circle
QColor background; QColor background;
if (selected) { if (selected) {
if (documentMode)
background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered; background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
else
background = QColor(255, 255, 255, pressed ? 150 : 100); // Translucent white
} else { } else {
background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered; background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered;
if (!documentMode)
background = background.lighter(pressed ? 135 : 140); // Lighter tab background, lighter color
} }
p->setPen(Qt::transparent); p->setPen(Qt::transparent);
p->setBrush(background); p->setBrush(background);
p->drawRoundedRect(rect, closeButtonCornerRadius, closeButtonCornerRadius); p->drawRoundedRect(rect, closeButtonCornerRadius, closeButtonCornerRadius);
@ -340,7 +352,7 @@ void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
// draw cross // draw cross
const int margin = 3; const int margin = 3;
QPen crossPen; QPen crossPen;
crossPen.setColor(selected ? tabBarCloseButtonCrossSelected : tabBarCloseButtonCross); crossPen.setColor(selected ? (documentMode ? tabBarCloseButtonCrossSelected : Qt::white) : tabBarCloseButtonCross);
crossPen.setWidthF(1.1); crossPen.setWidthF(1.1);
crossPen.setCapStyle(Qt::FlatCap); crossPen.setCapStyle(Qt::FlatCap);
p->setPen(crossPen); p->setPen(crossPen);
@ -1186,9 +1198,10 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h
} }
#ifndef QT_NO_TABBAR #ifndef QT_NO_TABBAR
void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect) const void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const
{ {
Q_ASSERT(textRect); Q_ASSERT(textRect);
Q_ASSERT(iconRect);
QRect tr = opt->rect; QRect tr = opt->rect;
const bool verticalTabs = opt->shape == QTabBar::RoundedEast const bool verticalTabs = opt->shape == QTabBar::RoundedEast
|| opt->shape == QTabBar::RoundedWest || opt->shape == QTabBar::RoundedWest
@ -1222,6 +1235,26 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
tr.setLeft(tr.left() + 4 + buttonSize); tr.setLeft(tr.left() + 4 + buttonSize);
} }
// icon
if (!opt->icon.isNull()) {
QSize iconSize = opt->iconSize;
if (!iconSize.isValid()) {
int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize);
iconSize = QSize(iconExtent, iconExtent);
}
QSize tabIconSize = opt->icon.actualSize(iconSize,
(opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled,
(opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off);
// High-dpi icons do not need adjustment; make sure tabIconSize is not larger than iconSize
tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.height()));
*iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
tabIconSize.width(), tabIconSize.height());
if (!verticalTabs)
*iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect);
tr.setLeft(tr.left() + tabIconSize.width() + 4);
}
if (!verticalTabs) if (!verticalTabs)
tr = proxyStyle->visualRect(opt->direction, opt->rect, tr); tr = proxyStyle->visualRect(opt->direction, opt->rect, tr);
@ -1487,7 +1520,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
// an extra check here before using the mini and small buttons. // an extra check here before using the mini and small buttons.
int h = combo->rect.size().height(); int h = combo->rect.size().height();
if (combo->editable){ if (combo->editable){
#ifndef QT_NO_DATETIMEEDIT #if QT_CONFIG(datetimeedit)
if (qobject_cast<const QDateTimeEdit *>(widget)) { if (qobject_cast<const QDateTimeEdit *>(widget)) {
// Except when, you know, we get a QDateTimeEdit with calendarPopup // Except when, you know, we get a QDateTimeEdit with calendarPopup
// enabled. And then things get weird, basically because it's a // enabled. And then things get weird, basically because it's a
@ -2354,6 +2387,8 @@ void QMacStyle::polish(QWidget* w)
QPalette p = w->palette(); QPalette p = w->palette();
p.setColor(QPalette::WindowText, QColor(17, 17, 17)); p.setColor(QPalette::WindowText, QColor(17, 17, 17));
w->setPalette(p); w->setPalette(p);
w->setAttribute(Qt::WA_SetPalette, false);
w->setAttribute(Qt::WA_SetFont, false);
} }
} }
#endif #endif
@ -2395,6 +2430,15 @@ void QMacStyle::unpolish(QWidget* w)
} }
#endif #endif
#ifndef QT_NO_TABBAR
if (qobject_cast<QTabBar*>(w)) {
if (!w->testAttribute(Qt::WA_SetFont))
w->setFont(qApp->font(w));
if (!w->testAttribute(Qt::WA_SetPalette))
w->setPalette(qApp->palette(w));
}
#endif
if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) { if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) {
rubber->setWindowOpacity(1.0); rubber->setWindowOpacity(1.0);
rubber->setAttribute(Qt::WA_PaintOnScreen, true); rubber->setAttribute(Qt::WA_PaintOnScreen, true);
@ -3579,14 +3623,16 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
case PE_IndicatorTabClose: { case PE_IndicatorTabClose: {
// Make close button visible only on the hovered tab. // Make close button visible only on the hovered tab.
if (QTabBar *tabBar = qobject_cast<QTabBar*>(w->parentWidget())) { if (QTabBar *tabBar = qobject_cast<QTabBar*>(w->parentWidget())) {
const bool documentMode = tabBar->documentMode();
const QTabBarPrivate *tabBarPrivate = static_cast<QTabBarPrivate *>(QObjectPrivate::get(tabBar)); const QTabBarPrivate *tabBarPrivate = static_cast<QTabBarPrivate *>(QObjectPrivate::get(tabBar));
const int hoveredTabIndex = tabBarPrivate->hoveredTabIndex(); const int hoveredTabIndex = tabBarPrivate->hoveredTabIndex();
if (hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) || if (!documentMode ||
(w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide)))) { (hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) ||
(w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide))))) {
const bool hover = (opt->state & State_MouseOver); const bool hover = (opt->state & State_MouseOver);
const bool selected = (opt->state & State_Selected); const bool selected = (opt->state & State_Selected);
const bool pressed = (opt->state & State_Sunken); const bool pressed = (opt->state & State_Sunken);
drawTabCloseButton(p, hover, selected, pressed); drawTabCloseButton(p, hover, selected, pressed, documentMode);
} }
} }
} break; } break;
@ -3729,7 +3775,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
CGRect bounds = ir.toCGRect(); CGRect bounds = ir.toCGRect();
bool noVerticalHeader = true; bool noVerticalHeader = true;
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
if (w) if (w)
if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget())) if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget()))
noVerticalHeader = !table->verticalHeader()->isVisible(); noVerticalHeader = !table->verticalHeader()->isVisible();
@ -4831,7 +4877,8 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break; break;
case SE_TabBarTabText: case SE_TabBarTabText:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
d->tabLayout(tab, widget, &rect); QRect dummyIconRect;
d->tabLayout(tab, widget, &rect, &dummyIconRect);
} }
break; break;
case SE_TabBarTabLeftButton: case SE_TabBarTabLeftButton:

View File

@ -82,7 +82,9 @@
#include <qpushbutton.h> #include <qpushbutton.h>
#endif #endif
#include <qradiobutton.h> #include <qradiobutton.h>
#if QT_CONFIG(rubberband)
#include <qrubberband.h> #include <qrubberband.h>
#endif
#include <qsizegrip.h> #include <qsizegrip.h>
#include <qspinbox.h> #include <qspinbox.h>
#include <qsplitter.h> #include <qsplitter.h>
@ -92,9 +94,13 @@
#include <qtoolbar.h> #include <qtoolbar.h>
#include <qtoolbutton.h> #include <qtoolbutton.h>
#include <qtreeview.h> #include <qtreeview.h>
#if QT_CONFIG(tableview)
#include <qtableview.h> #include <qtableview.h>
#endif
#include <qdebug.h> #include <qdebug.h>
#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h> #include <qdatetimeedit.h>
#endif
#include <qmath.h> #include <qmath.h>
#include <qpair.h> #include <qpair.h>
#include <qvector.h> #include <qvector.h>
@ -164,7 +170,7 @@ typedef void (^QCocoaDrawRectBlock)(CGContextRef, const CGRect &);
do { \ do { \
static const int sizes[] = { (large), (small), (mini) }; \ static const int sizes[] = { (large), (small), (mini) }; \
return sizes[controlSize]; \ return sizes[controlSize]; \
} while (0) } while (false)
#if QT_CONFIG(pushbutton) #if QT_CONFIG(pushbutton)
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
@ -242,7 +248,7 @@ public:
void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const; void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const;
#ifndef QT_NO_TABBAR #ifndef QT_NO_TABBAR
void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect) const; void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const;
#endif #endif
public: public:

View File

@ -82,7 +82,9 @@
#include <qdialogbuttonbox.h> #include <qdialogbuttonbox.h>
#endif #endif
#include <qinputdialog.h> #include <qinputdialog.h>
#if QT_CONFIG(tableview)
#include <qtableview.h> #include <qtableview.h>
#endif
#include <qdatetime.h> #include <qdatetime.h>
#include <qcommandlinkbutton.h> #include <qcommandlinkbutton.h>

View File

@ -1165,7 +1165,7 @@ void QWindowsXPStyle::polish(QWidget *widget)
widget->setAttribute(Qt::WA_Hover); widget->setAttribute(Qt::WA_Hover);
} }
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
if (qobject_cast<QRubberBand*>(widget)) { if (qobject_cast<QRubberBand*>(widget)) {
widget->setWindowOpacity(0.6); widget->setWindowOpacity(0.6);
} }
@ -1200,7 +1200,7 @@ void QWindowsXPStyle::polish(QPalette &pal)
/*! \reimp */ /*! \reimp */
void QWindowsXPStyle::unpolish(QWidget *widget) void QWindowsXPStyle::unpolish(QWidget *widget)
{ {
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
if (qobject_cast<QRubberBand*>(widget)) { if (qobject_cast<QRubberBand*>(widget)) {
widget->setWindowOpacity(1.0); widget->setWindowOpacity(1.0);
} }
@ -2418,7 +2418,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
} }
break; break;
#endif // QT_NO_DOCKWIDGET #endif // QT_NO_DOCKWIDGET
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
case CE_RubberBand: case CE_RubberBand:
if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) { if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight);
@ -2434,7 +2434,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
return; return;
} }
break; break;
#endif // QT_NO_RUBBERBAND #endif // QT_CONFIG(rubberband)
case CE_HeaderEmptyArea: case CE_HeaderEmptyArea:
if (option->state & State_Horizontal) if (option->state & State_Horizontal)
{ {
@ -3758,12 +3758,12 @@ int QWindowsXPStyle::styleHint(StyleHint hint, const QStyleOption *option, const
} }
} }
break; break;
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
case SH_RubberBand_Mask: case SH_RubberBand_Mask:
if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) if (qstyleoption_cast<const QStyleOptionRubberBand *>(option))
res = 0; res = 0;
break; break;
#endif // QT_NO_RUBBERBAND #endif // QT_CONFIG(rubberband)
case SH_ItemView_DrawDelegateFrame: case SH_ItemView_DrawDelegateFrame:
res = 1; res = 1;

View File

@ -45,9 +45,9 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0) #define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
#define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0) #define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -142,7 +142,9 @@ static QSet<QByteArray> keywords()
#ifdef Q_CC_MSVC #ifdef Q_CC_MSVC
<< "msvc" << "msvc"
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER == 1900 #if _MSC_VER == 1910
<< "msvc-2017"
#elif _MSC_VER == 1900
<< "msvc-2015" << "msvc-2015"
#elif _MSC_VER == 1800 #elif _MSC_VER == 1800
<< "msvc-2013" << "msvc-2013"

View File

@ -63,13 +63,13 @@ class QRegularExpression;
do {\ do {\
if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\ if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
return;\ return;\
} while (0) } while (false)
#define QFAIL(message) \ #define QFAIL(message) \
do {\ do {\
QTest::qFail(message, __FILE__, __LINE__);\ QTest::qFail(message, __FILE__, __LINE__);\
return;\ return;\
} while (0) } while (false)
#define QVERIFY2(statement, description) \ #define QVERIFY2(statement, description) \
do {\ do {\
@ -80,13 +80,13 @@ do {\
if (!QTest::qVerify(false, #statement, (description), __FILE__, __LINE__))\ if (!QTest::qVerify(false, #statement, (description), __FILE__, __LINE__))\
return;\ return;\
}\ }\
} while (0) } while (false)
#define QCOMPARE(actual, expected) \ #define QCOMPARE(actual, expected) \
do {\ do {\
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\
return;\ return;\
} while (0) } while (false)
#ifndef QT_NO_EXCEPTIONS #ifndef QT_NO_EXCEPTIONS
@ -111,7 +111,7 @@ do {\
" but unknown exception caught", __FILE__, __LINE__);\ " but unknown exception caught", __FILE__, __LINE__);\
return;\ return;\
}\ }\
} while (0) } while (false)
#else // QT_NO_EXCEPTIONS #else // QT_NO_EXCEPTIONS
@ -158,7 +158,7 @@ do {\
do { \ do { \
QTRY_IMPL((expr), timeout);\ QTRY_IMPL((expr), timeout);\
QVERIFY(expr); \ QVERIFY(expr); \
} while (0) } while (false)
#define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000) #define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000)
@ -167,7 +167,7 @@ do { \
do { \ do { \
QTRY_IMPL((expr), timeout);\ QTRY_IMPL((expr), timeout);\
QVERIFY2(expr, messageExpression); \ QVERIFY2(expr, messageExpression); \
} while (0) } while (false)
#define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000) #define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000)
@ -176,7 +176,7 @@ do { \
do { \ do { \
QTRY_IMPL(((expr) == (expected)), timeout);\ QTRY_IMPL(((expr) == (expected)), timeout);\
QCOMPARE((expr), expected); \ QCOMPARE((expr), expected); \
} while (0) } while (false)
#define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000) #define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
@ -184,7 +184,7 @@ do { \
do {\ do {\
QTest::qSkip(statement, __FILE__, __LINE__);\ QTest::qSkip(statement, __FILE__, __LINE__);\
return;\ return;\
} while (0) } while (false)
#ifdef Q_COMPILER_VARIADIC_MACROS #ifdef Q_COMPILER_VARIADIC_MACROS
@ -200,7 +200,7 @@ do {\
do {\ do {\
if (!QTest::qExpectFail(dataIndex, comment, QTest::mode, __FILE__, __LINE__))\ if (!QTest::qExpectFail(dataIndex, comment, QTest::mode, __FILE__, __LINE__))\
return;\ return;\
} while (0) } while (false)
#define QFETCH(Type, name)\ #define QFETCH(Type, name)\
Type name = *static_cast<Type *>(QTest::qData(#name, ::qMetaTypeId<typename std::remove_cv<Type >::type>())) Type name = *static_cast<Type *>(QTest::qData(#name, ::qMetaTypeId<typename std::remove_cv<Type >::type>()))
@ -212,7 +212,7 @@ do {\
do {\ do {\
if (!QTest::qTest(actual, testElement, #actual, #testElement, __FILE__, __LINE__))\ if (!QTest::qTest(actual, testElement, #actual, #testElement, __FILE__, __LINE__))\
return;\ return;\
} while (0) } while (false)
#define QWARN(msg)\ #define QWARN(msg)\
QTest::qWarn(msg, __FILE__, __LINE__) QTest::qWarn(msg, __FILE__, __LINE__)

View File

@ -46,7 +46,6 @@
#include <qtabbar.h> #include <qtabbar.h>
#include <qcombobox.h> #include <qcombobox.h>
#include <qlistview.h> #include <qlistview.h>
#include <qtableview.h>
#include <qlineedit.h> #include <qlineedit.h>
#include <qstyle.h> #include <qstyle.h>
#include <qstyleoption.h> #include <qstyleoption.h>

View File

@ -40,7 +40,9 @@
#include "itemviews_p.h" #include "itemviews_p.h"
#include <qheaderview.h> #include <qheaderview.h>
#if QT_CONFIG(tableview)
#include <qtableview.h> #include <qtableview.h>
#endif
#include <qlistview.h> #include <qlistview.h>
#include <qtreeview.h> #include <qtreeview.h>
#include <private/qtreeview_p.h> #include <private/qtreeview_p.h>
@ -81,7 +83,7 @@ QAccessibleTable::QAccessibleTable(QWidget *w)
{ {
Q_ASSERT(view()); Q_ASSERT(view());
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
if (qobject_cast<const QTableView*>(view())) { if (qobject_cast<const QTableView*>(view())) {
m_role = QAccessible::Table; m_role = QAccessible::Table;
} else } else
@ -117,7 +119,7 @@ QHeaderView *QAccessibleTable::horizontalHeader() const
{ {
QHeaderView *header = 0; QHeaderView *header = 0;
if (false) { if (false) {
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) { } else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
header = tv->horizontalHeader(); header = tv->horizontalHeader();
#endif #endif
@ -133,7 +135,7 @@ QHeaderView *QAccessibleTable::verticalHeader() const
{ {
QHeaderView *header = 0; QHeaderView *header = 0;
if (false) { if (false) {
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) { } else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
header = tv->verticalHeader(); header = tv->verticalHeader();
#endif #endif
@ -866,7 +868,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
QHeaderView *header = 0; QHeaderView *header = 0;
if (false) { if (false) {
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) { } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
header = tv->horizontalHeader(); header = tv->horizontalHeader();
#endif #endif
@ -882,7 +884,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
QHeaderView *QAccessibleTableCell::verticalHeader() const QHeaderView *QAccessibleTableCell::verticalHeader() const
{ {
QHeaderView *header = 0; QHeaderView *header = 0;
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
if (const QTableView *tv = qobject_cast<const QTableView*>(view)) if (const QTableView *tv = qobject_cast<const QTableView*>(view))
header = tv->verticalHeader(); header = tv->verticalHeader();
#endif #endif
@ -1125,7 +1127,7 @@ QRect QAccessibleTableHeaderCell::rect() const
{ {
QHeaderView *header = 0; QHeaderView *header = 0;
if (false) { if (false) {
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) { } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
if (orientation == Qt::Horizontal) { if (orientation == Qt::Horizontal) {
header = tv->horizontalHeader(); header = tv->horizontalHeader();
@ -1192,7 +1194,7 @@ QHeaderView *QAccessibleTableHeaderCell::headerView() const
{ {
QHeaderView *header = 0; QHeaderView *header = 0;
if (false) { if (false) {
#ifndef QT_NO_TABLEVIEW #if QT_CONFIG(tableview)
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) { } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
if (orientation == Qt::Horizontal) { if (orientation == Qt::Horizontal) {
header = tv->horizontalHeader(); header = tv->horizontalHeader();

View File

@ -54,7 +54,9 @@
#include "qwidget.h" #include "qwidget.h"
#include "qdebug.h" #include "qdebug.h"
#include <qmath.h> #include <qmath.h>
#if QT_CONFIG(rubberband)
#include <QRubberBand> #include <QRubberBand>
#endif
#include <QFocusFrame> #include <QFocusFrame>
#include <QMenu> #include <QMenu>
#include <QtWidgets/private/qwidget_p.h> #include <QtWidgets/private/qwidget_p.h>

View File

@ -193,7 +193,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QDial")) { } else if (classname == QLatin1String("QDial")) {
iface = new QAccessibleDial(widget); iface = new QAccessibleDial(widget);
#endif #endif
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
} else if (classname == QLatin1String("QRubberBand")) { } else if (classname == QLatin1String("QRubberBand")) {
iface = new QAccessibleWidget(widget, QAccessible::Border); iface = new QAccessibleWidget(widget, QAccessible::Border);
#endif #endif

View File

@ -58,7 +58,9 @@
#include <QDialogButtonBox> #include <QDialogButtonBox>
#endif #endif
#include <limits.h> #include <limits.h>
#if QT_CONFIG(rubberband)
#include <QRubberBand> #include <QRubberBand>
#endif
#include <QTextBrowser> #include <QTextBrowser>
#include <QCalendarWidget> #include <QCalendarWidget>
#include <QAbstractItemView> #include <QAbstractItemView>

View File

@ -1,12 +1,6 @@
# Qt dialogs module # Qt dialogs module
HEADERS += \
dialogs/qfontdialog.h \
dialogs/qfontdialog_p.h
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
SOURCES += \
dialogs/qfontdialog.cpp
qtConfig(colordialog) { qtConfig(colordialog) {
HEADERS += dialogs/qcolordialog.h HEADERS += dialogs/qcolordialog.h
@ -51,6 +45,14 @@ qtConfig(filesystemmodel) {
dialogs/qfileinfogatherer.cpp dialogs/qfileinfogatherer.cpp
} }
qtConfig(fontdialog) {
HEADERS += \
dialogs/qfontdialog.h \
dialogs/qfontdialog_p.h
SOURCES += dialogs/qfontdialog.cpp
}
qtConfig(fscompleter) { qtConfig(fscompleter) {
HEADERS += dialogs/qfscompleter_p.h HEADERS += dialogs/qfscompleter_p.h
} }

View File

@ -41,7 +41,9 @@
#if QT_CONFIG(colordialog) #if QT_CONFIG(colordialog)
#include "qcolordialog.h" #include "qcolordialog.h"
#endif #endif
#if QT_CONFIG(fontdialog)
#include "qfontdialog.h" #include "qfontdialog.h"
#endif
#if QT_CONFIG(filedialog) #if QT_CONFIG(filedialog)
#include "qfiledialog.h" #include "qfiledialog.h"
#endif #endif
@ -81,7 +83,7 @@ static inline int themeDialogType(const QDialog *dialog)
if (qobject_cast<const QColorDialog *>(dialog)) if (qobject_cast<const QColorDialog *>(dialog))
return QPlatformTheme::ColorDialog; return QPlatformTheme::ColorDialog;
#endif #endif
#ifndef QT_NO_FONTDIALOG #if QT_CONFIG(fontdialog)
if (qobject_cast<const QFontDialog *>(dialog)) if (qobject_cast<const QFontDialog *>(dialog))
return QPlatformTheme::FontDialog; return QPlatformTheme::FontDialog;
#endif #endif

View File

@ -40,8 +40,6 @@
#include "qwindowdefs.h" #include "qwindowdefs.h"
#include "qfontdialog.h" #include "qfontdialog.h"
#if QT_CONFIG(fontdialog)
#include "qfontdialog_p.h" #include "qfontdialog_p.h"
#include <qapplication.h> #include <qapplication.h>
@ -1049,5 +1047,3 @@ QT_END_NAMESPACE
#include "qfontdialog.moc" #include "qfontdialog.moc"
#include "moc_qfontdialog.cpp" #include "moc_qfontdialog.cpp"
#endif // QT_CONFIG(fontdialog)

View File

@ -44,12 +44,11 @@
#include <QtGui/qwindowdefs.h> #include <QtGui/qwindowdefs.h>
#include <QtGui/qfont.h> #include <QtGui/qfont.h>
#ifndef QT_NO_FONTDIALOG
#include <QtWidgets/qdialog.h> #include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(fontdialog);
QT_BEGIN_NAMESPACE
class QFontDialogPrivate; class QFontDialogPrivate;
@ -120,6 +119,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_FONTDIALOG
#endif // QFONTDIALOG_H #endif // QFONTDIALOG_H

View File

@ -59,7 +59,7 @@
#include <qpa/qplatformdialoghelper.h> #include <qpa/qplatformdialoghelper.h>
#include "qsharedpointer.h" #include "qsharedpointer.h"
#ifndef QT_NO_FONTDIALOG QT_REQUIRE_CONFIG(fontdialog);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -149,8 +149,6 @@ private:
virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE; virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
}; };
#endif // QT_NO_FONTDIALOG
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QFONTDIALOG_P_H #endif // QFONTDIALOG_P_H

View File

@ -450,7 +450,7 @@ public:
} }
QSize minimumSizeHint() const Q_DECL_OVERRIDE { QSize minimumSizeHint() const Q_DECL_OVERRIDE {
if (!pixmap() && !pixmap()->isNull()) if (pixmap() && !pixmap()->isNull())
return pixmap()->size(); return pixmap()->size();
return QFrame::minimumSizeHint(); return QFrame::minimumSizeHint();
} }

View File

@ -114,7 +114,6 @@
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <private/qdrawhelper_p.h> #include <private/qdrawhelper_p.h>
#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QGraphicsEffectPrivate::~QGraphicsEffectPrivate() QGraphicsEffectPrivate::~QGraphicsEffectPrivate()
@ -1237,5 +1236,3 @@ QT_END_NAMESPACE
#include "moc_qgraphicseffect.cpp" #include "moc_qgraphicseffect.cpp"
#include "moc_qgraphicseffect_p.cpp" #include "moc_qgraphicseffect_p.cpp"
#endif //QT_NO_GRAPHICSEFFECT

View File

@ -47,9 +47,9 @@
#include <QtGui/qcolor.h> #include <QtGui/qcolor.h>
#include <QtGui/qbrush.h> #include <QtGui/qbrush.h>
#ifndef QT_NO_GRAPHICSEFFECT QT_REQUIRE_CONFIG(graphicseffect);
QT_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
class QGraphicsItem; class QGraphicsItem;
class QStyleOption; class QStyleOption;
@ -279,7 +279,5 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_GRAPHICSEFFECT
#endif // QGRAPHICSEFFECT_H #endif // QGRAPHICSEFFECT_H

View File

@ -59,7 +59,8 @@
#include <private/qobject_p.h> #include <private/qobject_p.h>
#include <private/qpixmapfilter_p.h> #include <private/qpixmapfilter_p.h>
#ifndef QT_NO_GRAPHICSEFFECT QT_REQUIRE_CONFIG(graphicseffect);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QGraphicsEffectSourcePrivate; class QGraphicsEffectSourcePrivate;
@ -226,6 +227,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_GRAPHICSEFFECT
#endif // QGRAPHICSEFFECT_P_H #endif // QGRAPHICSEFFECT_P_H

View File

@ -54,7 +54,6 @@
#include "private/qmemrotate_p.h" #include "private/qmemrotate_p.h"
#include "private/qdrawhelper_p.h" #include "private/qdrawhelper_p.h"
#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QPixmapFilterPrivate : public QObjectPrivate class QPixmapFilterPrivate : public QObjectPrivate
@ -1353,5 +1352,3 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qpixmapfilter_p.cpp" #include "moc_qpixmapfilter_p.cpp"
#endif //QT_NO_GRAPHICSEFFECT

View File

@ -56,9 +56,9 @@
#include <QtGui/qpixmap.h> #include <QtGui/qpixmap.h>
#include <QtWidgets/qgraphicseffect.h> #include <QtWidgets/qgraphicseffect.h>
#ifndef QT_NO_GRAPHICSEFFECT QT_REQUIRE_CONFIG(graphicseffect);
QT_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
class QPainter; class QPainter;
class QPlatformPixmap; class QPlatformPixmap;
@ -187,5 +187,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_GRAPHICSEFFECT
#endif // QPIXMAPFILTER_H #endif // QPIXMAPFILTER_H

View File

@ -756,7 +756,9 @@
#include <QtWidgets/qstyleoption.h> #include <QtWidgets/qstyleoption.h>
#include <QtGui/qevent.h> #include <QtGui/qevent.h>
#include <QtGui/qinputmethod.h> #include <QtGui/qinputmethod.h>
#if QT_CONFIG(graphicseffect)
#include <QtWidgets/qgraphicseffect.h> #include <QtWidgets/qgraphicseffect.h>
#endif
#include <private/qgraphicsitem_p.h> #include <private/qgraphicsitem_p.h>
#include <private/qgraphicswidget_p.h> #include <private/qgraphicswidget_p.h>
@ -1558,9 +1560,9 @@ QGraphicsItem::~QGraphicsItem()
setParentItem(0); setParentItem(0);
} }
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
delete d_ptr->graphicsEffect; delete d_ptr->graphicsEffect;
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
if (d_ptr->transformData) { if (d_ptr->transformData) {
for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) { for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i); QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
@ -2383,9 +2385,9 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly,
if (c) if (c)
c->purge(); c->purge();
if (scene) { if (scene) {
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
invalidateParentGraphicsEffectsRecursively(); invalidateParentGraphicsEffectsRecursively();
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true); scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true);
} }
} }
@ -2832,11 +2834,11 @@ void QGraphicsItem::setOpacity(qreal opacity)
// Update. // Update.
if (d_ptr->scene) { if (d_ptr->scene) {
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
d_ptr->invalidateParentGraphicsEffectsRecursively(); d_ptr->invalidateParentGraphicsEffectsRecursively();
if (!(d_ptr->flags & ItemDoesntPropagateOpacityToChildren)) if (!(d_ptr->flags & ItemDoesntPropagateOpacityToChildren))
d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged); d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged);
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
d_ptr->scene->d_func()->markDirty(this, QRectF(), d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true, /*invalidateChildren=*/true,
/*force=*/false, /*force=*/false,
@ -2854,7 +2856,7 @@ void QGraphicsItem::setOpacity(qreal opacity)
\since 4.6 \since 4.6
*/ */
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
QGraphicsEffect *QGraphicsItem::graphicsEffect() const QGraphicsEffect *QGraphicsItem::graphicsEffect() const
{ {
return d_ptr->graphicsEffect; return d_ptr->graphicsEffect;
@ -2896,11 +2898,11 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
prepareGeometryChange(); prepareGeometryChange();
} }
} }
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively() void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
{ {
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
QGraphicsItemPrivate *itemPrivate = this; QGraphicsItemPrivate *itemPrivate = this;
do { do {
// parent chain already notified? // parent chain already notified?
@ -2923,7 +2925,7 @@ void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
*/ */
QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
{ {
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
Q_Q(const QGraphicsItem); Q_Q(const QGraphicsItem);
QGraphicsEffect *effect = graphicsEffect; QGraphicsEffect *effect = graphicsEffect;
if (scene && effect && effect->isEnabled()) { if (scene && effect && effect->isEnabled()) {
@ -2939,7 +2941,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
} }
return q->mapRectFromScene(sceneEffectRect); return q->mapRectFromScene(sceneEffectRect);
} }
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
return rect; return rect;
} }
@ -2955,7 +2957,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
*/ */
QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectItem) const QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectItem) const
{ {
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
Q_Q(const QGraphicsItem); Q_Q(const QGraphicsItem);
QRectF brect = effectiveBoundingRect(q_ptr->boundingRect()); QRectF brect = effectiveBoundingRect(q_ptr->boundingRect());
if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren
@ -2980,10 +2982,10 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectI
} }
return brect; return brect;
#else //QT_NO_GRAPHICSEFFECT #else //QT_CONFIG(graphicseffect)
Q_UNUSED(topMostEffectItem); Q_UNUSED(topMostEffectItem);
return q_ptr->boundingRect(); return q_ptr->boundingRect();
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
} }
@ -5485,7 +5487,7 @@ int QGraphicsItemPrivate::depth() const
/*! /*!
\internal \internal
*/ */
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively() void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively()
{ {
QGraphicsItemPrivate *itemPrivate = this; QGraphicsItemPrivate *itemPrivate = this;
@ -5516,7 +5518,7 @@ void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsIt
childPrivate->invalidateChildGraphicsEffectsRecursively(reason); childPrivate->invalidateChildGraphicsEffectsRecursively(reason);
} }
} }
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
/*! /*!
\internal \internal
@ -5798,9 +5800,9 @@ void QGraphicsItem::update(const QRectF &rect)
return; return;
// Make sure we notify effects about invalidated source. // Make sure we notify effects about invalidated source.
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
d_ptr->invalidateParentGraphicsEffectsRecursively(); d_ptr->invalidateParentGraphicsEffectsRecursively();
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
if (CacheMode(d_ptr->cacheMode) != NoCache) { if (CacheMode(d_ptr->cacheMode) != NoCache) {
// Invalidate cache. // Invalidate cache.
@ -11225,7 +11227,7 @@ int QGraphicsItemGroup::type() const
return Type; return Type;
} }
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const
{ {
const bool deviceCoordinates = (system == Qt::DeviceCoordinates); const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
@ -11366,7 +11368,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
return pixmap; return pixmap;
} }
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM
static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item) static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item)

View File

@ -228,11 +228,11 @@ public:
qreal effectiveOpacity() const; qreal effectiveOpacity() const;
void setOpacity(qreal opacity); void setOpacity(qreal opacity);
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
// Effect // Effect
QGraphicsEffect *graphicsEffect() const; QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect); void setGraphicsEffect(QGraphicsEffect *effect);
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
Qt::MouseButtons acceptedMouseButtons() const; Qt::MouseButtons acceptedMouseButtons() const;
void setAcceptedMouseButtons(Qt::MouseButtons buttons); void setAcceptedMouseButtons(Qt::MouseButtons buttons);
@ -550,7 +550,7 @@ class Q_WIDGETS_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect) Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect)
#endif #endif
Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged) Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged)

View File

@ -59,9 +59,6 @@
#include "qgraphicstransform.h" #include "qgraphicstransform.h"
#include <private/qgraphicstransform_p.h> #include <private/qgraphicstransform_p.h>
#include <private/qgraphicseffect_p.h>
#include <qgraphicseffect.h>
#include <QtCore/qpoint.h> #include <QtCore/qpoint.h>
#if !defined(QT_NO_GRAPHICSVIEW) #if !defined(QT_NO_GRAPHICSVIEW)
@ -217,13 +214,13 @@ public:
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
virtual void transformChanged() {} virtual void transformChanged() {}
int depth() const; int depth() const;
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
enum InvalidateReason { enum InvalidateReason {
OpacityChanged OpacityChanged
}; };
void invalidateParentGraphicsEffectsRecursively(); void invalidateParentGraphicsEffectsRecursively();
void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason); void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason);
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
void invalidateDepthRecursively(); void invalidateDepthRecursively();
void resolveDepth(); void resolveDepth();
void addChild(QGraphicsItem *child); void addChild(QGraphicsItem *child);
@ -590,7 +587,7 @@ struct QGraphicsItemPaintInfo
quint32 drawItem : 1; quint32 drawItem : 1;
}; };
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{ {
public: public:
@ -650,7 +647,7 @@ public:
QGraphicsItemPaintInfo *info; QGraphicsItemPaintInfo *info;
QTransform lastEffectTransform; QTransform lastEffectTransform;
}; };
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
/*! /*!
Returns \c true if \a item1 is on top of \a item2. Returns \c true if \a item1 is on top of \a item2.
@ -784,7 +781,7 @@ inline bool QGraphicsItemPrivate::insertionOrder(QGraphicsItem *a, QGraphicsItem
inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect) inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
{ {
QGraphicsItemPrivate *parentp = this; QGraphicsItemPrivate *parentp = this;
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) { if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) {
parentp->notifyInvalidated = 1; parentp->notifyInvalidated = 1;
static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func() static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
@ -800,7 +797,7 @@ inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
// ### Only do this if the parent's effect applies to the entire subtree. // ### Only do this if the parent's effect applies to the entire subtree.
parentp->notifyBoundingRectChanged = 1; parentp->notifyBoundingRectChanged = 1;
} }
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
if (parentp->graphicsEffect) { if (parentp->graphicsEffect) {
if (updateBoundingRect) { if (updateBoundingRect) {
static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func() static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()

View File

@ -243,10 +243,11 @@
#include <QtWidgets/qtooltip.h> #include <QtWidgets/qtooltip.h>
#include <QtGui/qtransform.h> #include <QtGui/qtransform.h>
#include <QtGui/qinputmethod.h> #include <QtGui/qinputmethod.h>
#include <QtWidgets/qgraphicseffect.h>
#include <private/qapplication_p.h> #include <private/qapplication_p.h>
#include <private/qobject_p.h> #include <private/qobject_p.h>
#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h> #include <private/qgraphicseffect_p.h>
#endif
#include <private/qgesturemanager_p.h> #include <private/qgesturemanager_p.h>
#include <private/qpathclipper_p.h> #include <private/qpathclipper_p.h>
@ -4810,7 +4811,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (itemHasChildren && itemClipsChildrenToShape) if (itemHasChildren && itemClipsChildrenToShape)
ENSURE_TRANSFORM_PTR; ENSURE_TRANSFORM_PTR;
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) { if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) {
ENSURE_TRANSFORM_PTR; ENSURE_TRANSFORM_PTR;
QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp,
@ -4847,7 +4848,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
painter->setWorldTransform(restoreTransform); painter->setWorldTransform(restoreTransform);
sourced->info = 0; sourced->info = 0;
} else } else
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
{ {
draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity, draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity,
effectTransform, wasDirtyParentSceneTransform, drawItem); effectTransform, wasDirtyParentSceneTransform, drawItem);

View File

@ -249,7 +249,7 @@ public:
item->d_ptr->fullUpdatePending = 0; item->d_ptr->fullUpdatePending = 0;
item->d_ptr->ignoreVisible = 0; item->d_ptr->ignoreVisible = 0;
item->d_ptr->ignoreOpacity = 0; item->d_ptr->ignoreOpacity = 0;
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
QGraphicsEffect::ChangeFlags flags; QGraphicsEffect::ChangeFlags flags;
if (item->d_ptr->notifyBoundingRectChanged) { if (item->d_ptr->notifyBoundingRectChanged) {
flags |= QGraphicsEffect::SourceBoundingRectChanged; flags |= QGraphicsEffect::SourceBoundingRectChanged;
@ -259,15 +259,15 @@ public:
flags |= QGraphicsEffect::SourceInvalidated; flags |= QGraphicsEffect::SourceInvalidated;
item->d_ptr->notifyInvalidated = 0; item->d_ptr->notifyInvalidated = 0;
} }
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
if (recursive) { if (recursive) {
for (int i = 0; i < item->d_ptr->children.size(); ++i) for (int i = 0; i < item->d_ptr->children.size(); ++i)
resetDirtyItem(item->d_ptr->children.at(i), recursive); resetDirtyItem(item->d_ptr->children.at(i), recursive);
} }
#ifndef QT_NO_GRAPHICSEFFECT #if QT_CONFIG(graphicseffect)
if (flags && item->d_ptr->graphicsEffect) if (flags && item->d_ptr->graphicsEffect)
item->d_ptr->graphicsEffect->sourceChanged(flags); item->d_ptr->graphicsEffect->sourceChanged(flags);
#endif //QT_NO_GRAPHICSEFFECT #endif // QT_CONFIG(graphicseffect)
} }
inline void ensureSortedTopLevelItems() inline void ensureSortedTopLevelItems()

View File

@ -353,7 +353,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate()
viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), viewportUpdateMode(QGraphicsView::MinimalViewportUpdate),
optimizationFlags(0), optimizationFlags(0),
scene(0), scene(0),
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
rubberBanding(false), rubberBanding(false),
rubberBandSelectionMode(Qt::IntersectsItemShape), rubberBandSelectionMode(Qt::IntersectsItemShape),
rubberBandSelectionOperation(Qt::ReplaceSelection), rubberBandSelectionOperation(Qt::ReplaceSelection),
@ -633,7 +633,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
{ {
Q_Q(QGraphicsView); Q_Q(QGraphicsView);
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
updateRubberBand(event); updateRubberBand(event);
#endif #endif
@ -708,7 +708,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
/*! /*!
\internal \internal
*/ */
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const
{ {
QStyleHintReturnMask mask; QStyleHintReturnMask mask;
@ -1508,7 +1508,7 @@ void QGraphicsView::setDragMode(DragMode mode)
#endif #endif
} }
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
/*! /*!
\property QGraphicsView::rubberBandSelectionMode \property QGraphicsView::rubberBandSelectionMode
\brief the behavior for selecting items with a rubber band selection rectangle. \brief the behavior for selecting items with a rubber band selection rectangle.
@ -3274,7 +3274,7 @@ void QGraphicsView::mousePressEvent(QMouseEvent *event)
} }
} }
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
if (d->dragMode == QGraphicsView::RubberBandDrag && !d->rubberBanding) { if (d->dragMode == QGraphicsView::RubberBandDrag && !d->rubberBanding) {
if (d->sceneInteractionAllowed) { if (d->sceneInteractionAllowed) {
// Rubberbanding is only allowed in interactive mode. // Rubberbanding is only allowed in interactive mode.
@ -3336,7 +3336,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{ {
Q_D(QGraphicsView); Q_D(QGraphicsView);
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
if (d->dragMode == QGraphicsView::RubberBandDrag && d->sceneInteractionAllowed && !event->buttons()) { if (d->dragMode == QGraphicsView::RubberBandDrag && d->sceneInteractionAllowed && !event->buttons()) {
if (d->rubberBanding) { if (d->rubberBanding) {
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){ if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){
@ -3459,7 +3459,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Set up the painter // Set up the painter
QPainter painter(viewport()); QPainter painter(viewport());
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
if (d->rubberBanding && !d->rubberBandRect.isEmpty()) if (d->rubberBanding && !d->rubberBandRect.isEmpty())
painter.save(); painter.save();
#endif #endif
@ -3583,7 +3583,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Foreground // Foreground
drawForeground(&painter, exposedSceneRect); drawForeground(&painter, exposedSceneRect);
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
// Rubberband // Rubberband
if (d->rubberBanding && !d->rubberBandRect.isEmpty()) { if (d->rubberBanding && !d->rubberBandRect.isEmpty()) {
painter.restore(); painter.restore();
@ -3651,7 +3651,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) { if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) {
if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) { if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) {
if (d->accelerateScrolling) { if (d->accelerateScrolling) {
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
// Update new and old rubberband regions // Update new and old rubberband regions
if (!d->rubberBandRect.isEmpty()) { if (!d->rubberBandRect.isEmpty()) {
QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect)); QRegion rubberBandRegion(d->rubberBandRegion(viewport(), d->rubberBandRect));

View File

@ -72,7 +72,7 @@ class Q_WIDGETS_EXPORT QGraphicsView : public QAbstractScrollArea
Q_PROPERTY(ViewportAnchor transformationAnchor READ transformationAnchor WRITE setTransformationAnchor) Q_PROPERTY(ViewportAnchor transformationAnchor READ transformationAnchor WRITE setTransformationAnchor)
Q_PROPERTY(ViewportAnchor resizeAnchor READ resizeAnchor WRITE setResizeAnchor) Q_PROPERTY(ViewportAnchor resizeAnchor READ resizeAnchor WRITE setResizeAnchor)
Q_PROPERTY(ViewportUpdateMode viewportUpdateMode READ viewportUpdateMode WRITE setViewportUpdateMode) Q_PROPERTY(ViewportUpdateMode viewportUpdateMode READ viewportUpdateMode WRITE setViewportUpdateMode)
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
Q_PROPERTY(Qt::ItemSelectionMode rubberBandSelectionMode READ rubberBandSelectionMode WRITE setRubberBandSelectionMode) Q_PROPERTY(Qt::ItemSelectionMode rubberBandSelectionMode READ rubberBandSelectionMode WRITE setRubberBandSelectionMode)
#endif #endif
Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags) Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags)
@ -144,7 +144,7 @@ public:
DragMode dragMode() const; DragMode dragMode() const;
void setDragMode(DragMode mode); void setDragMode(DragMode mode);
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
Qt::ItemSelectionMode rubberBandSelectionMode() const; Qt::ItemSelectionMode rubberBandSelectionMode() const;
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode); void setRubberBandSelectionMode(Qt::ItemSelectionMode mode);
QRect rubberBandRect() const; QRect rubberBandRect() const;
@ -228,7 +228,7 @@ public Q_SLOTS:
void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers); void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers);
void updateSceneRect(const QRectF &rect); void updateSceneRect(const QRectF &rect);
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
Q_SIGNALS: Q_SIGNALS:
void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint); void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint);
#endif #endif

View File

@ -136,7 +136,7 @@ public:
QGraphicsView::OptimizationFlags optimizationFlags; QGraphicsView::OptimizationFlags optimizationFlags;
QPointer<QGraphicsScene> scene; QPointer<QGraphicsScene> scene;
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
QRect rubberBandRect; QRect rubberBandRect;
QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const; QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const;
void updateRubberBand(const QMouseEvent *event); void updateRubberBand(const QMouseEvent *event);

View File

@ -9,8 +9,6 @@ HEADERS += \
itemviews/qlistview.h \ itemviews/qlistview.h \
itemviews/qlistview_p.h \ itemviews/qlistview_p.h \
itemviews/qbsptree_p.h \ itemviews/qbsptree_p.h \
itemviews/qtableview.h \
itemviews/qtableview_p.h \
itemviews/qtreeview.h \ itemviews/qtreeview.h \
itemviews/qtreeview_p.h \ itemviews/qtreeview_p.h \
itemviews/qabstractitemdelegate.h \ itemviews/qabstractitemdelegate.h \
@ -28,7 +26,6 @@ SOURCES += \
itemviews/qheaderview.cpp \ itemviews/qheaderview.cpp \
itemviews/qlistview.cpp \ itemviews/qlistview.cpp \
itemviews/qbsptree.cpp \ itemviews/qbsptree.cpp \
itemviews/qtableview.cpp \
itemviews/qtreeview.cpp \ itemviews/qtreeview.cpp \
itemviews/qabstractitemdelegate.cpp \ itemviews/qabstractitemdelegate.cpp \
itemviews/qitemdelegate.cpp \ itemviews/qitemdelegate.cpp \
@ -57,6 +54,14 @@ qtConfig(listwidget) {
SOURCES += itemviews/qlistwidget.cpp SOURCES += itemviews/qlistwidget.cpp
} }
qtConfig(tableview) {
HEADERS += \
itemviews/qtableview.h \
itemviews/qtableview_p.h
SOURCES += itemviews/qtableview.cpp
}
qtConfig(tablewidget) { qtConfig(tablewidget) {
HEADERS += \ HEADERS += \
itemviews/qtablewidget.h \ itemviews/qtablewidget.h \

View File

@ -53,7 +53,6 @@
#include <qlineedit.h> #include <qlineedit.h>
#include <qspinbox.h> #include <qspinbox.h>
#include <qtreeview.h> #include <qtreeview.h>
#include <qtableview.h>
#include <qheaderview.h> #include <qheaderview.h>
#include <qstyleditemdelegate.h> #include <qstyleditemdelegate.h>
#include <private/qabstractitemview_p.h> #include <private/qabstractitemview_p.h>

View File

@ -44,7 +44,9 @@
#ifndef QT_NO_ITEMVIEWS #ifndef QT_NO_ITEMVIEWS
#include <qcombobox.h> #include <qcombobox.h>
#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h> #include <qdatetimeedit.h>
#endif
#if QT_CONFIG(label) #if QT_CONFIG(label)
#include <qlabel.h> #include <qlabel.h>
#endif #endif
@ -252,7 +254,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
sb->setMaximum(INT_MAX); sb->setMaximum(INT_MAX);
return sb; } return sb; }
#endif #endif
#ifndef QT_NO_DATETIMEEDIT #if QT_CONFIG(datetimeedit)
case QVariant::Date: { case QVariant::Date: {
QDateTimeEdit *ed = new QDateEdit(parent); QDateTimeEdit *ed = new QDateEdit(parent);
ed->setFrame(false); ed->setFrame(false);
@ -308,7 +310,7 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
case QVariant::Double: case QVariant::Double:
return "value"; return "value";
#endif #endif
#ifndef QT_NO_DATETIMEEDIT #if QT_CONFIG(datetimeedit)
case QVariant::Date: case QVariant::Date:
return "date"; return "date";
case QVariant::Time: case QVariant::Time:

View File

@ -50,7 +50,9 @@
#include <qstyle.h> #include <qstyle.h>
#include <qevent.h> #include <qevent.h>
#include <qscrollbar.h> #include <qscrollbar.h>
#if QT_CONFIG(rubberband)
#include <qrubberband.h> #include <qrubberband.h>
#endif
#include <private/qlistview_p.h> #include <private/qlistview_p.h>
#include <private/qscrollbar_p.h> #include <private/qscrollbar_p.h>
#include <qdebug.h> #include <qdebug.h>
@ -1042,7 +1044,7 @@ void QListView::paintEvent(QPaintEvent *e)
d->commonListView->paintDragDrop(&painter); d->commonListView->paintDragDrop(&painter);
#endif #endif
#ifndef QT_NO_RUBBERBAND #if QT_CONFIG(rubberband)
// #### move this implementation into a dynamic class // #### move this implementation into a dynamic class
if (d->showElasticBand && d->elasticBand.isValid()) { if (d->showElasticBand && d->elasticBand.isValid()) {
QStyleOptionRubberBand opt; QStyleOptionRubberBand opt;
@ -1870,6 +1872,11 @@ void QCommonListViewBase::paintDragDrop(QPainter *painter)
} }
#endif #endif
QSize QListModeViewBase::viewportSize(const QAbstractItemView *v)
{
return v->contentsRect().marginsRemoved(v->viewportMargins()).size();
}
void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
{ {
horizontalScrollBar()->d_func()->itemviewChangeSingleStep(step.width() + spacing()); horizontalScrollBar()->d_func()->itemviewChangeSingleStep(step.width() + spacing());
@ -1882,7 +1889,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded && const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded; qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
const QSize viewportSize = qq->contentsRect().size(); const QSize viewportSize = QListModeViewBase::viewportSize(qq);
bool verticalWantsToShow = contentsSize.height() > viewportSize.height(); bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow; bool horizontalWantsToShow;
@ -1912,7 +1919,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded && const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded; qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
const QSize viewportSize = qq->contentsRect().size(); const QSize viewportSize = QListModeViewBase::viewportSize(qq);
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width(); bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow; bool verticalWantsToShow;

View File

@ -53,7 +53,6 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractitemview_p.h" #include "private/qabstractitemview_p.h"
#include "qrubberband.h"
#include "qbitarray.h" #include "qbitarray.h"
#include "qbsptree_p.h" #include "qbsptree_p.h"
#include <limits.h> #include <limits.h>
@ -225,6 +224,7 @@ public:
QRect mapToViewport(const QRect &rect) const override; QRect mapToViewport(const QRect &rect) const override;
int horizontalOffset() const override; int horizontalOffset() const override;
int verticalOffset() const override; int verticalOffset() const override;
inline static QSize viewportSize(const QAbstractItemView *v);
void updateHorizontalScrollBar(const QSize &step) override; void updateHorizontalScrollBar(const QSize &step) override;
void updateVerticalScrollBar(const QSize &step) override; void updateVerticalScrollBar(const QSize &step) override;

View File

@ -67,7 +67,9 @@
#include <private/qlayoutengine_p.h> #include <private/qlayoutengine_p.h>
#include <qdebug.h> #include <qdebug.h>
#include <qlocale.h> #include <qlocale.h>
#if QT_CONFIG(tableview)
#include <qtableview.h> #include <qtableview.h>
#endif
#include <limits.h> #include <limits.h>
@ -500,7 +502,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
// let the editor take up all available space // let the editor take up all available space
//if the editor is not a QLineEdit //if the editor is not a QLineEdit
//or it is in a QTableView //or it is in a QTableView
#if !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT) #if QT_CONFIG(tableview) && !defined(QT_NO_LINEEDIT)
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget)) if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor); opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
else else

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