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"
},
"mremap": {
"label": "mremap()",
"type": "compile",
"test": "unix/mremap"
},
"posix_fallocate": {
"label": "POSIX fallocate()",
"type": "compile",
@ -942,11 +937,6 @@
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_NEON", "value": 1 }
]
},
"mremap": {
"label": "mremap()",
"condition": "tests.mremap",
"output": [ "feature" ]
},
"posix_fallocate": {
"label": "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()) {
case QEvent::TouchBegin:
touchBegin = true;
Q_FALLTHROUGH();
case QEvent::TouchUpdate:
{
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_SIZE = -Os
QMAKE_CFLAGS += -pipe
!equals(QMAKE_HOST.os, Windows): QMAKE_CFLAGS += -pipe
QMAKE_CFLAGS_DEPS += -M
QMAKE_CFLAGS_WARN_ON += -Wall -W
QMAKE_CFLAGS_WARN_OFF += -w

View File

@ -50,11 +50,11 @@ isEmpty($${target_prefix}.INCDIRS) {
rim_qcc: \
# Need the cc1plus and ld command lines to pick up the paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v
else: clang: \
else: darwin:clang: \
# Need to link to pick up library paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v
else: \
# gcc is fine with just preprocessing
# Just preprocess, might not pick up library paths
cxx_flags += -E -v
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): \
!integrity: \
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()) {
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.
// Strip off any options since the ar commands will be read from file.
QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);
@ -304,6 +306,8 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
if (!var("BUILD_NAME").isEmpty()) {
ld_script_file += "." + var("BUILD_NAME");
}
if (!var("MAKEFILE").isEmpty())
ld_script_file += "." + var("MAKEFILE");
createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
objectsLinkLine = escapeFilePath(ld_script_file);
}

View File

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

View File

@ -1,4 +1,6 @@
set(_qt5_root_dir ${_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 {\
Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\
Q_UNREACHABLE_IMPL();\
} while (0)
} while (false)
#define Q_ASSUME(Expr) \
do {\
const bool valueOfExpression = Expr;\
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
Q_ASSUME_IMPL(valueOfExpression);\
} while (0)
} while (false)
#if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)

View File

@ -341,10 +341,10 @@ typedef double qreal;
#define Q_INIT_RESOURCE(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) \
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:
@ -664,7 +664,7 @@ inline void qt_noop(void) {}
# define QT_CATCH(A) else
# define QT_THROW(A) 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
# define QT_TRY try
# define QT_CATCH(A) catch (A)
@ -672,9 +672,9 @@ inline void qt_noop(void) {}
# define QT_RETHROW throw
Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
# 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
# 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
@ -778,10 +778,10 @@ Q_CORE_EXPORT void qBadAlloc();
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
# define Q_CHECK_PTR(p) qt_noop()
# 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
#else
# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0)
# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (false)
#endif
template <typename T>

View File

@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
# endif
# define QT_VERSION_TAG(sym) \
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" \
QT_VERSION_TAG_RELOC(sym) \
".long " QT_STRINGIFY(QT_VERSION) "\n" \

View File

@ -113,7 +113,10 @@ win32 {
SOURCES += io/qfilesystemwatcher_win.cpp
HEADERS += io/qfilesystemwatcher_win_p.h
SOURCES += io/qfilesystemengine_win.cpp
SOURCES += io/qfilesystemiterator_win.cpp
qtConfig(filesystemiterator) {
SOURCES += io/qfilesystemiterator_win.cpp
}
!winrt {
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"),
// compare Ids to make sure it really is a different file.
if (QFile::exists(newName)) {
if (d->fileName.compare(newName, Qt::CaseInsensitive)
|| QFileSystemEngine::id(QFileSystemEntry(d->fileName)) != QFileSystemEngine::id(QFileSystemEntry(newName))) {
// Note: this does not take file engines into account.
QByteArray targetId = 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
// overwritten. On Unix, the proper solution is to use hardlinks:
// return ::link(old, new) && ::remove(old);

View File

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

View File

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

View File

@ -602,13 +602,13 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
QByteArray result;
const HANDLE handle =
#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);
#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);
#endif // Q_OS_WINRT
if (handle) {
if (handle != INVALID_HANDLE_VALUE) {
result = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ?
fileIdWin8(handle) : fileId(handle);
CloseHandle(handle);

View File

@ -71,6 +71,19 @@ QT_BEGIN_NAMESPACE
# define DEBUG if (false) qDebug
#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
///////////
// QWindowsRemovableDriveListener
@ -404,8 +417,29 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
thread = *jt;
QMutexLocker locker(&(thread->mutex));
handle = thread->handleForDir.value(QFileSystemWatcherPathKey(absolutePath));
if (handle.handle != INVALID_HANDLE_VALUE && handle.flags == flags) {
const auto hit = thread->handleForDir.find(QFileSystemWatcherPathKey(absolutePath));
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...
DEBUG() << "Found a thread" << thread;
@ -426,14 +460,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
// 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";
// Volume and folder paths need a trailing slash for proper notification
// (e.g. "c:" -> "c:/").
const QString effectiveAbsolutePath =
isDir ? (absolutePath + QLatin1Char('/')) : absolutePath;
handle.handle = FindFirstChangeNotification((wchar_t*) QDir::toNativeSeparators(effectiveAbsolutePath).utf16(), false, flags);
handle.handle = createChangeNotification(absolutePath, flags);
handle.flags = flags;
if (handle.handle == INVALID_HANDLE_VALUE)
continue;

View File

@ -600,7 +600,12 @@ bool QFSFileEngine::setPermissions(uint perms)
{
Q_D(QFSFileEngine);
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());
return false;
}

View File

@ -43,36 +43,52 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qvarlengtharray.h>
#include "qfilesystementry_p.h"
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
static const int defaultBufferSize = MAX_PATH + 1;
void QStorageInfoPrivate::initRootPath()
static QString canonicalPath(const QString &rootPath)
{
rootPath = QFileInfo(rootPath).canonicalFilePath();
if (rootPath.isEmpty())
return;
QString path = QDir::toNativeSeparators(rootPath);
rootPath.clear();
QString path = QDir::toNativeSeparators(QFileInfo(rootPath).canonicalFilePath());
if (path.isEmpty())
return path;
if (path.startsWith(QLatin1String("\\\\?\\")))
path.remove(0, 4);
if (path.length() < 2 || path.at(1) != QLatin1Char(':'))
return;
return QString();
path[0] = path[0].toUpper();
if (!(path.at(0).unicode() >= 'A' && path.at(0).unicode() <= 'Z'))
return;
return QString();
if (!path.endsWith(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
wchar_t buffer[defaultBufferSize];
if (::GetVolumePathName(reinterpret_cast<const wchar_t *>(path.utf16()), buffer, defaultBufferSize))
rootPath = QDir::fromNativeSeparators(QString::fromWCharArray(buffer));
else
valid = ready = false;
}
static inline QByteArray getDevice(const QString &rootPath)
@ -108,11 +124,14 @@ static inline QByteArray getDevice(const QString &rootPath)
void QStorageInfoPrivate::doStat()
{
valid = ready = true;
initRootPath();
if (rootPath.isEmpty())
if (!valid || !ready)
return;
retrieveVolumeInfo();
if (!valid || !ready)
return;
device = getDevice(rootPath);
retrieveDiskFreeSpace();
}
@ -137,9 +156,6 @@ void QStorageInfoPrivate::retrieveVolumeInfo()
ready = false;
valid = ::GetLastError() == ERROR_NOT_READY;
} else {
ready = true;
valid = true;
fileSystemType = QString::fromWCharArray(fileSystemTypeBuffer).toLatin1();
name = QString::fromWCharArray(nameBuffer);
@ -154,10 +170,10 @@ void QStorageInfoPrivate::retrieveDiskFreeSpace()
const UINT oldmode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
const QString path = QDir::toNativeSeparators(rootPath);
::GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()),
PULARGE_INTEGER(&bytesAvailable),
PULARGE_INTEGER(&bytesTotal),
PULARGE_INTEGER(&bytesFree));
ready = ::GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()),
PULARGE_INTEGER(&bytesAvailable),
PULARGE_INTEGER(&bytesTotal),
PULARGE_INTEGER(&bytesFree));
::SetErrorMode(oldmode);
}

View File

@ -1911,8 +1911,8 @@ void QCoreApplication::quit()
Installing or removing a QTranslator, or changing an installed QTranslator
generates a \l{QEvent::LanguageChange}{LanguageChange} event for the
QCoreApplication instance. A QGuiApplication instance will propagate the event
to all toplevel windows, where a reimplementation of changeEvent can
QCoreApplication instance. A QApplication instance will propagate the event
to all toplevel widgets, where a reimplementation of changeEvent can
re-translate the user interface by passing user-visible strings via the
tr() function to the respective property setters. User-interface classes
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 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, "") \
/*end*/
/* qmake ignore Q_NAMESPACE */
#define Q_NAMESPACE \
extern const QMetaObject staticMetaObject; \
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) {
*static_cast<QVariantMap *>(result) =
*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
} else if (d->type == QMetaType::QJsonValue) {
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) {
*static_cast<QVariantHash *>(result) =
*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
} else if (d->type == QMetaType::QJsonValue) {
if (!v_cast<QJsonValue>(d)->isObject())
@ -2070,6 +2082,7 @@ void QVariant::load(QDataStream &s)
typeId = QMetaType::type(name.constData());
if (typeId == QMetaType::UnknownType) {
s.setStatus(QDataStream::ReadCorruptData);
qWarning("QVariant::load: unknown user type with name %s.", name.constData());
return;
}
}

View File

@ -1583,13 +1583,13 @@ void QByteArray::chop(int n)
\snippet code/src_corelib_tools_qbytearray.cpp 12
Note: QByteArray is an \l{implicitly shared} class. Consequently,
if \e this is an empty QByteArray, then \e this will just share
the data held in \a ba. In this case, no copying of data is done,
if you append to an empty byte array, then the byte array will just
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
be copied (copy-on-write), taking \l{linear time}.
If \e this is not an empty QByteArray, a deep copy of the data is
performed, taking \l{linear time}.
If the byte array being appended to is not empty, a deep copy of the
data is performed, taking \l{linear time}.
This operation typically does not suffer from allocation overhead,
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).
Note: QByteArray is an \l{implicitly shared} class. Consequently,
if \e this is an empty QByteArray, then \e this will just share
the data held in \a ba. In this case, no copying of data is done,
if you prepend to an empty byte array, then the byte array will just
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
be copied (copy-on-write), taking \l{linear time}.
If \e this is not an empty QByteArray, a deep copy of the data is
performed, taking \l{linear time}.
If the byte array being prepended to is not empty, a deep copy of the
data is performed, taking \l{linear time}.
\sa append(), insert()
*/
@ -1936,13 +1936,13 @@ QByteArray &QByteArray::prepend(char ch)
This is the same as insert(size(), \a ba).
Note: QByteArray is an \l{implicitly shared} class. Consequently,
if \e this is an empty QByteArray, then \e this will just share
the data held in \a ba. In this case, no copying of data is done,
if you append to an empty byte array, then the byte array will just
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
be copied (copy-on-write), taking \l{linear time}.
If \e this is not an empty QByteArray, a deep copy of the data is
performed, taking \l{linear time}.
If the byte array being appended to is not empty, a deep copy of the
data is performed, taking \l{linear time}.
This operation typically does not suffer from allocation overhead,
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)
\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 s \li the second without a leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999)
\row \li zzz \li the milliseconds with leading zeroes (000 to 999)
\row \li s \li the whole second, without any leading zero (0 to 59)
\row \li ss \li the whole second, with a leading zero where applicable (00 to 59)
\row \li z \li the fractional part of the second, to go after a decimal
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
\li use AM/PM display. \e A/AP will be replaced by either
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)
\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 s \li the second without a leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999)
\row \li zzz \li the milliseconds with leading zeroes (000 to 999)
\row \li s \li the whole second, without any leading zero (0 to 59)
\row \li ss \li the whole second, with a leading zero where applicable (00 to 59)
\row \li z \li the fractional part of the second, to go after a decimal
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
\li interpret as an AM/PM time. \e AP must be either "AM" or "PM".
\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)
\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 s \li the second without a leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999)
\row \li zzz \li the milliseconds with leading zeroes (000 to 999)
\row \li s \li the whole second without a leading zero (0 to 59)
\row \li ss \li the whole second with a leading zero where applicable (00 to 59)
\row \li z \li the fractional part of the second, to go after a decimal
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
\li use AM/PM display. \e A/AP will be replaced by either "AM" or "PM".
\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.
Example format strings (assumed that the QDateTime is 21 May 2001
14:13:09):
14:13:09.120):
\table
\header \li Format \li Result
\row \li dd.MM.yyyy \li 21.05.2001
\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
\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)
\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 s \li the second without a leading zero (0 to 59)
\row \li ss \li the second with a leading zero (00 to 59)
\row \li z \li the milliseconds without leading zeroes (0 to 999)
\row \li zzz \li the milliseconds with leading zeroes (000 to 999)
\row \li s \li the whole second without a leading zero (0 to 59)
\row \li ss \li the whole second with a leading zero where applicable (00 to 59)
\row \li z \li the fractional part of the second, to go after a decimal
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
\li interpret as an AM/PM time. \e AP must be either "AM" or "PM".
\row \li ap or a

View File

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

View File

@ -62,6 +62,7 @@ function(QT5_ADD_DBUS_INTERFACE _sources _interface _basename)
DEPENDS ${_infile} VERBATIM)
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE)
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}")
set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE)
set_source_files_properties("${_header}" PROPERTIES SKIP_AUTOMOC TRUE)
macro_add_file_dependencies("${_impl}" "${_moc}")
list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}")

View File

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

View File

@ -304,8 +304,8 @@ void QCosmeticStroker::setup()
ymin = deviceRect.top() - 1;
ymax = deviceRect.bottom() + 2;
lastPixel.x = -1;
lastPixel.y = -1;
lastPixel.x = INT_MIN;
lastPixel.y = INT_MIN;
}
// 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;
}
if (x2 < xmin) {
lastPixel.x = -1;
lastPixel.x = INT_MIN;
y2 += (y2 - y1)/(x2 - x1) * (xmin - x2);
x2 = xmin;
} else if (x2 > xmax) {
lastPixel.x = -1;
lastPixel.x = INT_MIN;
y2 += (y2 - y1)/(x2 - x1) * (xmax - x2);
x2 = xmax;
}
@ -346,11 +346,11 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
y1 = ymax;
}
if (y2 < ymin) {
lastPixel.x = -1;
lastPixel.x = INT_MIN;
x2 += (x2 - x1)/(y2 - y1) * (ymin - y2);
y2 = ymin;
} else if (y2 > ymax) {
lastPixel.x = -1;
lastPixel.x = INT_MIN;
x2 += (x2 - x1)/(y2 - y1) * (ymax - y2);
y2 = ymax;
}
@ -358,7 +358,7 @@ bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2)
return false;
clipped:
lastPixel.x = -1;
lastPixel.x = INT_MIN;
return true;
}
@ -374,7 +374,7 @@ void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2)
QPointF end = p2 * state->matrix;
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);
@ -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.
// the info is then used to perform dropout control when drawing the first line segment
// of the contour
lastPixel.x = -1;
lastPixel.y = -1;
lastPixel.x = INT_MIN;
lastPixel.y = INT_MIN;
if (clipLine(rx1, ry1, rx2, ry2))
return;
@ -599,7 +599,11 @@ void QCosmeticStroker::drawPath(const QVectorPath &path)
bool closed = path.hasImplicitClose() || (points[0] == end[-2] && points[1] == end[-1]);
int caps = (!closed && drawCaps) ? CapBegin : NoCaps;
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());
}
@ -770,6 +774,11 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
int ys = (y2 + 32) >> 6;
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) {
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);
bool axisAligned = qAbs(xinc) < (1 << 14);
if (stroker->lastPixel.x >= 0) {
if (stroker->lastPixel.x > INT_MIN) {
if (first.x == stroker->lastPixel.x &&
first.y == stroker->lastPixel.y) {
// remove duplicated pixel
@ -805,6 +814,14 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
--y;
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;
@ -847,6 +864,11 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
int xs = (x2 + 32) >> 6;
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) {
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);
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) {
// remove duplicated pixel
if (swapped) {
@ -881,6 +903,14 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
--x;
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;

View File

@ -5561,13 +5561,13 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
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) {
const int coverage = map[xp - x];
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)
map += mapStride;
} // for (yp -> bottom)
@ -5834,13 +5834,13 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len);
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) {
const uint coverage = src[xp - x];
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)
src += srcStride;
} // for (yp -> bottom)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,11 +44,10 @@
#include <QtCore/qiodevice.h>
#include <QtNetwork/qabstractsocket.h>
QT_REQUIRE_CONFIG(localserver);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_LOCALSOCKET
class QLocalSocketPrivate;
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);
#endif
#endif // QT_NO_LOCALSOCKET
QT_END_NAMESPACE
#endif // QLOCALSOCKET_H

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -78,6 +78,22 @@
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
{
Q_UNUSED(window);

View File

@ -126,6 +126,18 @@
"features": [
"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());
}
// 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.
@ -1118,9 +1139,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
} break;
case QtWindows::DpiChangedEvent: {
if (platformWindow->window()->flags().testFlag(Qt::MSWindowsFixedSizeDialogHint))
return false; // Fixed-size window should not be resized
if (!resizeOnDpiChanged(platformWindow->window()))
return false;
platformWindow->setFlag(QWindowsWindow::WithinDpiChanged);
const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam);
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()
<< " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height()
<< " 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)
dbg << " primary";
if (d.flags & QWindowsScreenData::VirtualDesktop)
@ -290,6 +291,13 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
{
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) {
m_data.geometry = newData.geometry;
m_data.availableGeometry = newData.availableGeometry;

View File

@ -869,12 +869,18 @@ QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon
}
SHFILEINFO info;
const unsigned int flags =
SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX;
const bool val = cacheableDirIcon && useDefaultFolderIcon
? shGetFileInfoBackground(QString::fromWCharArray(L"dummy"), FILE_ATTRIBUTE_DIRECTORY, &info, flags | SHGFI_USEFILEATTRIBUTES)
: shGetFileInfoBackground(filePath, 0, &info, flags);
unsigned int flags = SHGFI_ICON | iconSize | SHGFI_SYSICONINDEX | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX;
DWORD attributes = 0;
QString path = filePath;
if (cacheableDirIcon && useDefaultFolderIcon) {
flags |= SHGFI_USEFILEATTRIBUTES;
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
if (val && info.hIcon) {

View File

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

View File

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

View File

@ -5,10 +5,3 @@ INCLUDEPATH += $$PWD/../
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_varying2:
strLen += 2; // for the two terminating null values
Q_FALLTHROUGH();
case blr_text:
case blr_text2: {
int o;

View File

@ -81,21 +81,27 @@
#include <qpushbutton.h>
#endif
#include <qradiobutton.h>
#if QT_CONFIG(rubberband)
#include <qrubberband.h>
#endif
#include <qscrollbar.h>
#include <qsizegrip.h>
#include <qstyleoption.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qtreeview.h>
#if QT_CONFIG(tableview)
#include <qtableview.h>
#endif
#include <qoperatingsystemversion.h>
#if QT_CONFIG(wizard)
#include <qwizard.h>
#endif
#include <qdebug.h>
#include <qlibrary.h>
#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
#endif
#include <qmath.h>
#include <QtWidgets/qgraphicsproxywidget.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);
QRect rect(0, 0, closeButtonSize, closeButtonSize);
@ -328,10 +334,16 @@ void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
// draw background circle
QColor background;
if (selected) {
background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
if (documentMode)
background = pressed ? tabBarCloseButtonBackgroundSelectedPressed : tabBarCloseButtonBackgroundSelectedHovered;
else
background = QColor(255, 255, 255, pressed ? 150 : 100); // Translucent white
} else {
background = pressed ? tabBarCloseButtonBackgroundPressed : tabBarCloseButtonBackgroundHovered;
if (!documentMode)
background = background.lighter(pressed ? 135 : 140); // Lighter tab background, lighter color
}
p->setPen(Qt::transparent);
p->setBrush(background);
p->drawRoundedRect(rect, closeButtonCornerRadius, closeButtonCornerRadius);
@ -340,7 +352,7 @@ void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pressed)
// draw cross
const int margin = 3;
QPen crossPen;
crossPen.setColor(selected ? tabBarCloseButtonCrossSelected : tabBarCloseButtonCross);
crossPen.setColor(selected ? (documentMode ? tabBarCloseButtonCrossSelected : Qt::white) : tabBarCloseButtonCross);
crossPen.setWidthF(1.1);
crossPen.setCapStyle(Qt::FlatCap);
p->setPen(crossPen);
@ -1186,9 +1198,10 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h
}
#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(iconRect);
QRect tr = opt->rect;
const bool verticalTabs = opt->shape == QTabBar::RoundedEast
|| opt->shape == QTabBar::RoundedWest
@ -1222,6 +1235,26 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
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)
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.
int h = combo->rect.size().height();
if (combo->editable){
#ifndef QT_NO_DATETIMEEDIT
#if QT_CONFIG(datetimeedit)
if (qobject_cast<const QDateTimeEdit *>(widget)) {
// Except when, you know, we get a QDateTimeEdit with calendarPopup
// enabled. And then things get weird, basically because it's a
@ -2354,6 +2387,8 @@ void QMacStyle::polish(QWidget* w)
QPalette p = w->palette();
p.setColor(QPalette::WindowText, QColor(17, 17, 17));
w->setPalette(p);
w->setAttribute(Qt::WA_SetPalette, false);
w->setAttribute(Qt::WA_SetFont, false);
}
}
#endif
@ -2395,6 +2430,15 @@ void QMacStyle::unpolish(QWidget* w)
}
#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)) {
rubber->setWindowOpacity(1.0);
rubber->setAttribute(Qt::WA_PaintOnScreen, true);
@ -3579,14 +3623,16 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
case PE_IndicatorTabClose: {
// Make close button visible only on the hovered tab.
if (QTabBar *tabBar = qobject_cast<QTabBar*>(w->parentWidget())) {
const bool documentMode = tabBar->documentMode();
const QTabBarPrivate *tabBarPrivate = static_cast<QTabBarPrivate *>(QObjectPrivate::get(tabBar));
const int hoveredTabIndex = tabBarPrivate->hoveredTabIndex();
if (hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) ||
(w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide)))) {
if (!documentMode ||
(hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) ||
(w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide))))) {
const bool hover = (opt->state & State_MouseOver);
const bool selected = (opt->state & State_Selected);
const bool pressed = (opt->state & State_Sunken);
drawTabCloseButton(p, hover, selected, pressed);
drawTabCloseButton(p, hover, selected, pressed, documentMode);
}
}
} break;
@ -3729,7 +3775,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
CGRect bounds = ir.toCGRect();
bool noVerticalHeader = true;
#ifndef QT_NO_TABLEVIEW
#if QT_CONFIG(tableview)
if (w)
if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget()))
noVerticalHeader = !table->verticalHeader()->isVisible();
@ -4831,7 +4877,8 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
case SE_TabBarTabText:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
d->tabLayout(tab, widget, &rect);
QRect dummyIconRect;
d->tabLayout(tab, widget, &rect, &dummyIconRect);
}
break;
case SE_TabBarTabLeftButton:

View File

@ -82,7 +82,9 @@
#include <qpushbutton.h>
#endif
#include <qradiobutton.h>
#if QT_CONFIG(rubberband)
#include <qrubberband.h>
#endif
#include <qsizegrip.h>
#include <qspinbox.h>
#include <qsplitter.h>
@ -92,9 +94,13 @@
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qtreeview.h>
#if QT_CONFIG(tableview)
#include <qtableview.h>
#endif
#include <qdebug.h>
#if QT_CONFIG(datetimeedit)
#include <qdatetimeedit.h>
#endif
#include <qmath.h>
#include <qpair.h>
#include <qvector.h>
@ -164,7 +170,7 @@ typedef void (^QCocoaDrawRectBlock)(CGContextRef, const CGRect &);
do { \
static const int sizes[] = { (large), (small), (mini) }; \
return sizes[controlSize]; \
} while (0)
} while (false)
#if QT_CONFIG(pushbutton)
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;
#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
public:

View File

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

View File

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

View File

@ -45,9 +45,9 @@
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -228,11 +228,11 @@ public:
qreal effectiveOpacity() const;
void setOpacity(qreal opacity);
#ifndef QT_NO_GRAPHICSEFFECT
#if QT_CONFIG(graphicseffect)
// Effect
QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect);
#endif //QT_NO_GRAPHICSEFFECT
#endif // QT_CONFIG(graphicseffect)
Qt::MouseButtons acceptedMouseButtons() const;
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 scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
#ifndef QT_NO_GRAPHICSEFFECT
#if QT_CONFIG(graphicseffect)
Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect)
#endif
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 <private/qgraphicstransform_p.h>
#include <private/qgraphicseffect_p.h>
#include <qgraphicseffect.h>
#include <QtCore/qpoint.h>
#if !defined(QT_NO_GRAPHICSVIEW)
@ -217,13 +214,13 @@ public:
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
virtual void transformChanged() {}
int depth() const;
#ifndef QT_NO_GRAPHICSEFFECT
#if QT_CONFIG(graphicseffect)
enum InvalidateReason {
OpacityChanged
};
void invalidateParentGraphicsEffectsRecursively();
void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason);
#endif //QT_NO_GRAPHICSEFFECT
#endif // QT_CONFIG(graphicseffect)
void invalidateDepthRecursively();
void resolveDepth();
void addChild(QGraphicsItem *child);
@ -590,7 +587,7 @@ struct QGraphicsItemPaintInfo
quint32 drawItem : 1;
};
#ifndef QT_NO_GRAPHICSEFFECT
#if QT_CONFIG(graphicseffect)
class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate
{
public:
@ -650,7 +647,7 @@ public:
QGraphicsItemPaintInfo *info;
QTransform lastEffectTransform;
};
#endif //QT_NO_GRAPHICSEFFECT
#endif // QT_CONFIG(graphicseffect)
/*!
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)
{
QGraphicsItemPrivate *parentp = this;
#ifndef QT_NO_GRAPHICSEFFECT
#if QT_CONFIG(graphicseffect)
if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) {
parentp->notifyInvalidated = 1;
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.
parentp->notifyBoundingRectChanged = 1;
}
#ifndef QT_NO_GRAPHICSEFFECT
#if QT_CONFIG(graphicseffect)
if (parentp->graphicsEffect) {
if (updateBoundingRect) {
static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()

View File

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

View File

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

View File

@ -353,7 +353,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate()
viewportUpdateMode(QGraphicsView::MinimalViewportUpdate),
optimizationFlags(0),
scene(0),
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
rubberBanding(false),
rubberBandSelectionMode(Qt::IntersectsItemShape),
rubberBandSelectionOperation(Qt::ReplaceSelection),
@ -633,7 +633,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
{
Q_Q(QGraphicsView);
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
updateRubberBand(event);
#endif
@ -708,7 +708,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
/*!
\internal
*/
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRect &rect) const
{
QStyleHintReturnMask mask;
@ -1508,7 +1508,7 @@ void QGraphicsView::setDragMode(DragMode mode)
#endif
}
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
/*!
\property QGraphicsView::rubberBandSelectionMode
\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->sceneInteractionAllowed) {
// Rubberbanding is only allowed in interactive mode.
@ -3336,7 +3336,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QGraphicsView);
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
if (d->dragMode == QGraphicsView::RubberBandDrag && d->sceneInteractionAllowed && !event->buttons()) {
if (d->rubberBanding) {
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate){
@ -3459,7 +3459,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Set up the painter
QPainter painter(viewport());
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
if (d->rubberBanding && !d->rubberBandRect.isEmpty())
painter.save();
#endif
@ -3583,7 +3583,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Foreground
drawForeground(&painter, exposedSceneRect);
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
// Rubberband
if (d->rubberBanding && !d->rubberBandRect.isEmpty()) {
painter.restore();
@ -3651,7 +3651,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
if (d->viewportUpdateMode != QGraphicsView::NoViewportUpdate) {
if (d->viewportUpdateMode != QGraphicsView::FullViewportUpdate) {
if (d->accelerateScrolling) {
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
// Update new and old rubberband regions
if (!d->rubberBandRect.isEmpty()) {
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 resizeAnchor READ resizeAnchor WRITE setResizeAnchor)
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)
#endif
Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags)
@ -144,7 +144,7 @@ public:
DragMode dragMode() const;
void setDragMode(DragMode mode);
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
Qt::ItemSelectionMode rubberBandSelectionMode() const;
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode);
QRect rubberBandRect() const;
@ -228,7 +228,7 @@ public Q_SLOTS:
void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers);
void updateSceneRect(const QRectF &rect);
#ifndef QT_NO_RUBBERBAND
#if QT_CONFIG(rubberband)
Q_SIGNALS:
void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint);
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,7 +67,9 @@
#include <private/qlayoutengine_p.h>
#include <qdebug.h>
#include <qlocale.h>
#if QT_CONFIG(tableview)
#include <qtableview.h>
#endif
#include <limits.h>
@ -500,7 +502,7 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
// let the editor take up all available space
//if the editor is not a QLineEdit
//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))
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
else

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