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

Change-Id: Idec54e19963e8d88c711cb179cffc81596323899
This commit is contained in:
Sergio Ahumada 2014-03-13 15:57:03 +01:00
commit 27016b89ae
331 changed files with 9327 additions and 22321 deletions

65
configure vendored
View File

@ -649,6 +649,7 @@ CFG_XINPUT2=auto
CFG_XINPUT=runtime
CFG_XKB=auto
CFG_XKBCOMMON=auto
CFG_XKB_CONFIG_ROOT=auto
CFG_XCB=auto
CFG_XCB_XLIB=auto
CFG_XCB_GLX=no
@ -898,6 +899,7 @@ while [ "$#" -gt 0 ]; do
-qpa| \
-qconfig| \
-qreal| \
-xkb-config-root| \
-android-sdk| \
-android-ndk| \
-android-ndk-platform| \
@ -2109,6 +2111,9 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
xkb-config-root)
CFG_XKB_CONFIG_ROOT="$VAL"
;;
android-sdk)
CFG_DEFAULT_ANDROID_SDK_ROOT="$VAL"
;;
@ -2358,6 +2363,7 @@ Third Party Libraries:
(libxcb.so will still be used from operating system).
+ -system-xcb ........ Use xcb- libraries from the operating system.
-xkb-config-root ... Set default XKB config root. This option is used only together with -qt-xkbcommon.
-qt-xkbcommon ...... Use the xkbcommon library bundled with Qt.
+ -system-xkbcommon .. Use the xkbcommon library from the operating system.
@ -2770,7 +2776,6 @@ if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ];
# Commercial preview release
Licensee="Preview"
Edition="Preview"
QT_EDITION="QT_EDITION_DESKTOP"
LicenseType="Technology Preview"
elif [ $COMMERCIAL_USER = "yes" ]; then
# one of commercial editions
@ -2826,17 +2831,14 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
case $ProductCode in
F)
Edition="Universal"
QT_EDITION="QT_EDITION_UNIVERSAL"
;;
B)
Edition="FullFramework"
EditionString="Full Framework"
QT_EDITION="QT_EDITION_DESKTOP"
;;
L)
Edition="GUIFramework"
EditionString="GUI Framework"
QT_EDITION="QT_EDITION_DESKTOPLIGHT"
;;
esac
;;
@ -2846,12 +2848,11 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
case $ProductCode in
B)
Edition="Evaluation"
QT_EDITION="QT_EDITION_EVALUATION"
;;
esac
;;
esac
if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
if [ -z "$LicenseType" -o -z "$Edition" ]; then
echo
echo "Invalid license key. Please check the license key."
exit 1
@ -2921,7 +2922,6 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
esac
Licensee="$Edition"
EditionString="$Edition"
QT_EDITION="QT_EDITION_DESKTOP"
fi
case "$LicenseFeatureCode" in
@ -2962,7 +2962,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
;;
esac
if [ '!' -f "$outpath/LICENSE" ]; then
echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
echo "The LICENSE, LICENSE.GPL LICENSE.LGPL file shipped with"
echo "this software has disappeared."
echo
echo "Sorry, you are not licensed to use this software."
@ -2975,7 +2975,6 @@ elif [ $COMMERCIAL_USER = "no" ]; then
Licensee="Open Source"
Edition="OpenSource"
EditionString="Open Source"
QT_EDITION="QT_EDITION_OPENSOURCE"
fi
echo
echo "This is the Qt ${EditionString} Edition."
@ -2999,7 +2998,7 @@ if [ "$Edition" = "OpenSource" ]; then
while true; do
echo "You are licensed to use this software under the terms of"
echo "the Lesser GNU General Public License (LGPL) versions 2.1."
if [ -f "$relpath/LICENSE.GPL3" ]; then
if [ -f "$relpath/LICENSE.GPL" ]; then
echo "You are also licensed to use this software under the terms of"
echo "the GNU General Public License (GPL) versions 3."
affix="either"
@ -3011,7 +3010,7 @@ if [ "$Edition" = "OpenSource" ]; then
echo "You have already accepted the terms of the $LicenseType license."
acceptance=yes
else
if [ -f "$relpath/LICENSE.GPL3" ]; then
if [ -f "$relpath/LICENSE.GPL" ]; then
echo "Type '3' to view the GNU General Public License version 3."
fi
echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
@ -3029,7 +3028,7 @@ if [ "$Edition" = "OpenSource" ]; then
echo
exit 1
elif [ "$acceptance" = "3" ]; then
more "$relpath/LICENSE.GPL3"
more "$relpath/LICENSE.GPL"
elif [ "$acceptance" = "L" ]; then
more "$relpath/LICENSE.LGPL"
fi
@ -4028,9 +4027,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
echo "EXEEXT = $EXEEXT" >> "$mkfile"
echo "RM_F = rm -f" >> "$mkfile"
echo "RM_RF = rm -rf" >> "$mkfile"
if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
echo "EXTRA_CPPFLAGS = -DQMAKE_OPENSOURCE_EDITION" >> "$mkfile"
fi
if [ "$BUILD_ON_MAC" = "yes" ]; then
echo "EXTRA_CXXFLAGS += -MMD" >> "$mkfile"
@ -5225,7 +5221,7 @@ if [ "$CFG_XCB" != "no" ]; then
CFG_XCB="system"
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm"
XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape"
QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags $XCB_PACKAGES 2>/dev/null`"
QMAKE_LIBS_XCB="`$PKG_CONFIG --libs $XCB_PACKAGES 2>/dev/null`"
# for xcb-xkb tests
@ -5281,9 +5277,6 @@ if [ "$CFG_XCB" != "no" ]; then
CFG_XCB=no
fi
fi
if [ "$CFG_XCB" = "no" ]; then
QMakeVar add DEFINES QT_NO_XCB
fi
if [ "$CFG_DIRECTFB" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists directfb 2>/dev/null; then
@ -5360,6 +5353,25 @@ fi
if [ "$CFG_XKBCOMMON" = "qt" ]; then
QT_CONFIG="$QT_CONFIG xkbcommon-qt"
# detect XKB config root
if [ "$CFG_XKB_CONFIG_ROOT" = "auto" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkeyboard-config" 2> /dev/null; then
CFG_XKB_CONFIG_ROOT="`$PKG_CONFIG --variable=xkb_base xkeyboard-config`"
else
# search for xkb configs in most probable locations
if [ -d "/usr/share/X11/xkb" ]; then
# Linux
CFG_XKB_CONFIG_ROOT="/usr/share/X11/xkb"
elif [ -d "/usr/local/share/X11/xkb" ]; then
# BSD UNIX
CFG_XKB_CONFIG_ROOT="/usr/local/share/X11/xkb"
fi
fi
fi
QMakeVar set QMAKE_XKB_CONFIG_ROOT "$CFG_XKB_CONFIG_ROOT"
if [ "$CFG_XKB_CONFIG_ROOT" = "auto" ]; then
CFG_XKB_CONFIG_ROOT="not found"
fi
elif [ "$CFG_XKBCOMMON" = "no" ]; then
QMakeVar add DEFINES QT_NO_XKBCOMMON
fi
@ -6225,10 +6237,6 @@ esac
cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
/* Qt Edition */
#ifndef QT_EDITION
# define QT_EDITION $QT_EDITION
#endif
EOF
echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
@ -6483,7 +6491,6 @@ host_build {
QMAKE_DEFAULT_LIBDIRS = `shellQuoteLines "$DEFAULT_LIBDIRS"`
QMAKE_DEFAULT_INCDIRS = `shellQuoteLines "$DEFAULT_INCDIRS"`
}
QT_EDITION = $Edition
QT_CONFIG += $QT_CONFIG
#versioning
@ -6610,10 +6617,6 @@ if [ -n "$QT_LFLAGS_TDS" ]; then
echo "QT_LFLAGS_TDS = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp"
fi
if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then
echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp"
fi
#dump in the OPENSSL_LIBS info
if [ '!' -z "$OPENSSL_LIBS" ]; then
echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp"
@ -6827,7 +6830,7 @@ report_support " SQLite 2 ............." "$CFG_SQL_sqlite2" plugin "plugin" y
report_support_plugin " SQLite ..............." "$CFG_SQL_sqlite" "$CFG_SQLITE" QtSql
report_support " TDS .................." "$CFG_SQL_tds" plugin "plugin" yes "built into QtSql"
report_support " udev ..................." "$CFG_LIBUDEV"
report_support " xkbcommon .............." "$CFG_XKBCOMMON" system "system library" qt "bundled copy"
report_support " xkbcommon .............." "$CFG_XKBCOMMON" system "system library" qt "bundled copy, XKB config root: $CFG_XKB_CONFIG_ROOT"
report_support " zlib ..................." "$CFG_ZLIB" system "system library" yes "bundled copy"
echo
@ -6852,6 +6855,10 @@ if [ "$ORIG_CFG_XKBCOMMON" != qt ] && [ "$CFG_XKBCOMMON" = qt ]; then
echo "NOTE: libxkbcommon 0.2.0 (or higher) not found on the system, will use "
echo "the bundled version from 3rd party directory."
fi
if [ "$CFG_XKBCOMMON" = "qt" ] && [ "$CFG_XKB_CONFIG_ROOT" = "not found" ]; then
echo "WARNING: Could not find XKB config root, use -xkb-config-root to set a path to "
echo "XKB configuration data. This is required for keyboard input support."
fi
if [ "$CFG_QREAL" = double ] && [ "$CFG_ARCH" = arm ]; then
echo "NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1."
echo "Configure with '-qreal float' to create a build that is binary compatible with 5.1."

View File

@ -475,3 +475,11 @@
\externalpage http://qt-project.org/doc/qtcreator/creator-diff-editor.html
\title Qt Creator: Comparing Files
*/
/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-beautifier.html
\title Qt Creator: Beautifying Source Code
*/
/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-developing-winrt.html
\title Qt Creator: Connecting Windows Runtime Devices
*/

View File

@ -0,0 +1,9 @@
TEMPLATE = app
QT += widgets
SOURCES += main.cpp \
widget.cpp \
renderwindow.cpp
HEADERS += widget.h \
renderwindow.h

View File

@ -0,0 +1,53 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 Digia Plc and its Subsidiary(-ies) 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 <QApplication>
#include "widget.h"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Widget w;
w.resize(700, 800);
w.show();
return app.exec();
}

View File

@ -0,0 +1,220 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 Digia Plc and its Subsidiary(-ies) 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 "renderwindow.h"
#include <QTimer>
#include <QMatrix4x4>
#include <QOpenGLContext>
#include <QOpenGLShaderProgram>
#include <QOpenGLFunctions>
RenderWindow::RenderWindow(const QSurfaceFormat &format)
: m_context(0),
m_initialized(false),
m_forceGLSL110(false),
m_angle(0.0f)
{
setSurfaceType(QWindow::OpenGLSurface);
setFormat(format);
m_context = new QOpenGLContext(this);
m_context->setFormat(requestedFormat());
if (!m_context->create()) {
delete m_context;
m_context = 0;
}
}
void RenderWindow::exposeEvent(QExposeEvent *)
{
if (isExposed())
render();
}
// ES needs the precision qualifiers.
// On desktop GL QOpenGLShaderProgram inserts dummy defines for highp/mediump/lowp.
static const char *vertexShaderSource110 =
"attribute highp vec4 posAttr;\n"
"attribute lowp vec4 colAttr;\n"
"varying lowp vec4 col;\n"
"uniform highp mat4 matrix;\n"
"void main() {\n"
" col = colAttr;\n"
" gl_Position = matrix * posAttr;\n"
"}\n";
static const char *fragmentShaderSource110 =
"varying lowp vec4 col;\n"
"void main() {\n"
" gl_FragColor = col;\n"
"}\n";
static const char *vertexShaderSource =
"#version 150\n"
"in vec4 posAttr;\n"
"in vec4 colAttr;\n"
"out vec4 col;\n"
"uniform mat4 matrix;\n"
"void main() {\n"
" col = colAttr;\n"
" gl_Position = matrix * posAttr;\n"
"}\n";
static const char *fragmentShaderSource =
"#version 150\n"
"in vec4 col;\n"
"out vec4 fragColor;\n"
"void main() {\n"
" fragColor = col;\n"
"}\n";
static GLfloat vertices[] = {
0.0f, 0.707f,
-0.5f, -0.5f,
0.5f, -0.5f
};
static GLfloat colors[] = {
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f
};
void RenderWindow::init()
{
m_program = new QOpenGLShaderProgram(this);
QSurfaceFormat format = m_context->format();
bool useNewStyleShader = format.profile() == QSurfaceFormat::CoreProfile;
// Try to handle 3.0 & 3.1 that do not have the core/compatibility profile concept 3.2+ has.
// This may still fail since version 150 (3.2) is specified in the sources but it's worth a try.
if (format.renderableType() == QSurfaceFormat::OpenGL && format.majorVersion() == 3 && format.minorVersion() <= 1)
useNewStyleShader = !format.testOption(QSurfaceFormat::DeprecatedFunctions);
if (m_forceGLSL110)
useNewStyleShader = false;
const char *vsrc = useNewStyleShader ? vertexShaderSource : vertexShaderSource110;
const char *fsrc = useNewStyleShader ? fragmentShaderSource : fragmentShaderSource110;
qDebug("Using version %s shader", useNewStyleShader ? "150" : "110");
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vsrc)) {
emit error(m_program->log());
return;
}
if (!m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fsrc)) {
emit error(m_program->log());
return;
}
if (!m_program->link()) {
emit error(m_program->log());
return;
}
m_posAttr = m_program->attributeLocation("posAttr");
m_colAttr = m_program->attributeLocation("colAttr");
m_matrixUniform = m_program->uniformLocation("matrix");
m_vbo.create();
m_vbo.bind();
m_vbo.allocate(vertices, sizeof(vertices) + sizeof(colors));
m_vbo.write(sizeof(vertices), colors, sizeof(colors));
m_vbo.release();
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao);
if (m_vao.isCreated()) // have VAO support, use it
setupVertexAttribs();
}
void RenderWindow::setupVertexAttribs()
{
m_vbo.bind();
m_program->setAttributeBuffer(m_posAttr, GL_FLOAT, 0, 2);
m_program->setAttributeBuffer(m_colAttr, GL_FLOAT, sizeof(vertices), 3);
m_program->enableAttributeArray(m_posAttr);
m_program->enableAttributeArray(m_colAttr);
m_vbo.release();
}
void RenderWindow::render()
{
if (!m_context->makeCurrent(this)) {
qWarning("makeCurrent() failed");
return;
}
QOpenGLFunctions *f = m_context->functions();
if (!m_initialized) {
m_initialized = true;
f->glEnable(GL_DEPTH_TEST);
f->glClearColor(0, 0, 0, 1);
init();
emit ready();
}
if (!m_vbo.isCreated()) // init() failed, don't bother with trying to render
return;
const qreal retinaScale = devicePixelRatio();
f->glViewport(0, 0, width() * retinaScale, height() * retinaScale);
f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_program->bind();
QMatrix4x4 matrix;
matrix.perspective(60.0f, 4.0f / 3.0f, 0.1f, 100.0f);
matrix.translate(0.0f, 0.0f, -2.0f);
matrix.rotate(m_angle, 0.0f, 1.0f, 0.0f);
m_program->setUniformValue(m_matrixUniform, matrix);
if (m_vao.isCreated())
m_vao.bind();
else // no VAO support, set the vertex attribute arrays now
setupVertexAttribs();
f->glDrawArrays(GL_TRIANGLES, 0, 3);
m_vao.release();
m_program->release();
// swapInterval is 1 by default which means that swapBuffers() will (hopefully) block
// and wait for vsync.
m_context->swapBuffers(this);
m_angle += 1.0f;
QTimer::singleShot(0, this, SLOT(render()));
}

View File

@ -0,0 +1,82 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 Digia Plc and its Subsidiary(-ies) 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 RENDERWINDOW_H
#define RENDERWINDOW_H
#include <QWindow>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
QT_FORWARD_DECLARE_CLASS(QOpenGLContext)
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
class RenderWindow : public QWindow
{
Q_OBJECT
public:
RenderWindow(const QSurfaceFormat &format);
QOpenGLContext *context() { return m_context; }
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; }
signals:
void ready();
void error(const QString &msg);
private slots:
void render();
private:
void init();
void setupVertexAttribs();
QOpenGLContext *m_context;
bool m_initialized;
bool m_forceGLSL110;
QOpenGLShaderProgram *m_program;
int m_posAttr, m_colAttr, m_matrixUniform;
QOpenGLVertexArrayObject m_vao;
QOpenGLBuffer m_vbo;
float m_angle;
};
#endif // RENDERWINDOW_H

View File

@ -0,0 +1,358 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 Digia Plc and its Subsidiary(-ies) 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 "widget.h"
#include "renderwindow.h"
#include <QVBoxLayout>
#include <QComboBox>
#include <QGroupBox>
#include <QRadioButton>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QTextEdit>
#include <QSplitter>
#include <QSurfaceFormat>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QDebug>
struct Version {
const char *str;
int major;
int minor;
};
static struct Version versions[] = {
{ "1.0", 1, 0 },
{ "1.1", 1, 1 },
{ "1.2", 1, 2 },
{ "1.3", 1, 3 },
{ "1.4", 1, 4 },
{ "1.5", 1, 5 },
{ "2.0", 2, 0 },
{ "2.1", 2, 1 },
{ "3.0", 3, 0 },
{ "3.1", 3, 1 },
{ "3.2", 3, 2 },
{ "3.3", 3, 3 },
{ "4.0", 4, 0 },
{ "4.1", 4, 1 },
{ "4.2", 4, 2 },
{ "4.3", 4, 3 },
{ "4.4", 4, 4 }
};
struct Profile {
const char *str;
QSurfaceFormat::OpenGLContextProfile profile;
};
static struct Profile profiles[] = {
{ "none", QSurfaceFormat::NoProfile },
{ "core", QSurfaceFormat::CoreProfile },
{ "compatibility", QSurfaceFormat::CompatibilityProfile }
};
struct Option {
const char *str;
QSurfaceFormat::FormatOption option;
};
static struct Option options[] = {
{ "deprecated functions (not forward compatible)", QSurfaceFormat::DeprecatedFunctions },
{ "debug context", QSurfaceFormat::DebugContext },
{ "stereo buffers", QSurfaceFormat::StereoBuffers },
// This is not a QSurfaceFormat option but is helpful to determine if the driver
// allows compiling old-style shaders with core profile.
{ "force version 110 shaders", QSurfaceFormat::FormatOption(0) }
};
struct Renderable {
const char *str;
QSurfaceFormat::RenderableType renderable;
};
static struct Renderable renderables[] = {
{ "default", QSurfaceFormat::DefaultRenderableType },
{ "OpenGL", QSurfaceFormat::OpenGL },
{ "OpenGL ES", QSurfaceFormat::OpenGLES }
};
void Widget::addVersions(QLayout *layout)
{
QHBoxLayout *hbox = new QHBoxLayout;
hbox->setSpacing(20);
QLabel *label = new QLabel(tr("Context &version: "));
hbox->addWidget(label);
m_version = new QComboBox;
m_version->setMinimumWidth(60);
label->setBuddy(m_version);
hbox->addWidget(m_version);
for (size_t i = 0; i < sizeof(versions) / sizeof(Version); ++i) {
m_version->addItem(QString::fromLatin1(versions[i].str));
if (versions[i].major == 2 && versions[i].minor == 0)
m_version->setCurrentIndex(m_version->count() - 1);
}
QPushButton *btn = new QPushButton(tr("Create context"));
connect(btn, &QPushButton::clicked, this, &Widget::start);
btn->setMinimumSize(120, 40);
hbox->addWidget(btn);
layout->addItem(hbox);
}
void Widget::addProfiles(QLayout *layout)
{
QGroupBox *groupBox = new QGroupBox(tr("Profile"));
QVBoxLayout *vbox = new QVBoxLayout;
for (size_t i = 0; i < sizeof(profiles) / sizeof(Profile); ++i)
vbox->addWidget(new QRadioButton(QString::fromLatin1(profiles[i].str)));
static_cast<QRadioButton *>(vbox->itemAt(0)->widget())->setChecked(true);
groupBox->setLayout(vbox);
layout->addWidget(groupBox);
m_profiles = vbox;
}
void Widget::addOptions(QLayout *layout)
{
QGroupBox *groupBox = new QGroupBox(tr("Options"));
QVBoxLayout *vbox = new QVBoxLayout;
for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i)
vbox->addWidget(new QCheckBox(QString::fromLatin1(options[i].str)));
groupBox->setLayout(vbox);
layout->addWidget(groupBox);
m_options = vbox;
}
void Widget::addRenderableTypes(QLayout *layout)
{
QGroupBox *groupBox = new QGroupBox(tr("Renderable type"));
QVBoxLayout *vbox = new QVBoxLayout;
for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i)
vbox->addWidget(new QRadioButton(QString::fromLatin1(renderables[i].str)));
static_cast<QRadioButton *>(vbox->itemAt(0)->widget())->setChecked(true);
groupBox->setLayout(vbox);
layout->addWidget(groupBox);
m_renderables = vbox;
}
void Widget::addRenderWindow()
{
m_renderWindowLayout->addWidget(m_renderWindowContainer);
}
static QWidget *widgetWithLayout(QLayout *layout)
{
QWidget *w = new QWidget;
w->setLayout(layout);
return w;
}
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *layout = new QVBoxLayout;
QSplitter *vsplit = new QSplitter(Qt::Vertical);
layout->addWidget(vsplit);
QSplitter *hsplit = new QSplitter;
QVBoxLayout *settingsLayout = new QVBoxLayout;
addVersions(settingsLayout);
addProfiles(settingsLayout);
addOptions(settingsLayout);
addRenderableTypes(settingsLayout);
hsplit->addWidget(widgetWithLayout(settingsLayout));
QVBoxLayout *outputLayout = new QVBoxLayout;
m_output = new QTextEdit;
m_output->setReadOnly(true);
outputLayout->addWidget(m_output);
m_extensions = new QTextEdit;
m_extensions->setReadOnly(true);
outputLayout->addWidget(m_extensions);
hsplit->addWidget(widgetWithLayout(outputLayout));
hsplit->setStretchFactor(0, 4);
hsplit->setStretchFactor(1, 6);
vsplit->addWidget(hsplit);
m_renderWindowLayout = new QVBoxLayout;
vsplit->addWidget(widgetWithLayout(m_renderWindowLayout));
vsplit->setStretchFactor(1, 5);
m_renderWindowContainer = new QWidget;
addRenderWindow();
setLayout(layout);
}
void Widget::start()
{
QSurfaceFormat fmt;
int idx = m_version->currentIndex();
if (idx < 0)
return;
fmt.setVersion(versions[idx].major, versions[idx].minor);
for (size_t i = 0; i < sizeof(profiles) / sizeof(Profile); ++i)
if (static_cast<QRadioButton *>(m_profiles->itemAt(int(i))->widget())->isChecked()) {
fmt.setProfile(profiles[i].profile);
break;
}
bool forceGLSL110 = false;
for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i)
if (static_cast<QCheckBox *>(m_options->itemAt(int(i))->widget())->isChecked()) {
if (options[i].option)
fmt.setOption(options[i].option);
else if (i == 3)
forceGLSL110 = true;
}
for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i)
if (static_cast<QRadioButton *>(m_renderables->itemAt(int(i))->widget())->isChecked()) {
fmt.setRenderableType(renderables[i].renderable);
break;
}
// The example rendering will need a depth buffer.
fmt.setDepthBufferSize(16);
m_output->clear();
m_extensions->clear();
qDebug() << "Requesting surface format" << fmt;
m_renderWindowLayout->removeWidget(m_renderWindowContainer);
delete m_renderWindowContainer;
RenderWindow *renderWindow = new RenderWindow(fmt);
if (!renderWindow->context()) {
m_output->append(tr("Failed to create context"));
delete renderWindow;
m_renderWindowContainer = new QWidget;
addRenderWindow();
return;
}
renderWindow->setForceGLSL110(forceGLSL110);
connect(renderWindow, &RenderWindow::ready, this, &Widget::renderWindowReady);
connect(renderWindow, &RenderWindow::error, this, &Widget::renderWindowError);
m_renderWindowContainer = QWidget::createWindowContainer(renderWindow);
addRenderWindow();
}
void Widget::renderWindowReady()
{
QOpenGLContext *context = QOpenGLContext::currentContext();
Q_ASSERT(context);
const QSurfaceFormat format = context->format();
m_output->append(tr("OpenGL version: %1.%2").arg(format.majorVersion()).arg(format.minorVersion()));
for (size_t i = 0; i < sizeof(profiles) / sizeof(Profile); ++i)
if (profiles[i].profile == format.profile()) {
m_output->append(tr("Profile: %1").arg(QString::fromLatin1(profiles[i].str)));
break;
}
QString opts;
for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i)
if (format.testOption(options[i].option))
opts += QString::fromLatin1(options[i].str) + QStringLiteral(" ");
m_output->append(tr("Options: %1").arg(opts));
for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i)
if (renderables[i].renderable == format.renderableType()) {
m_output->append(tr("Renderable type: %1").arg(QString::fromLatin1(renderables[i].str)));
break;
}
QString vendor, renderer, version, glslVersion;
const GLubyte *p;
QOpenGLFunctions *f = context->functions();
if ((p = f->glGetString(GL_VENDOR)))
vendor = QString::fromLatin1(reinterpret_cast<const char *>(p));
if ((p = f->glGetString(GL_RENDERER)))
renderer = QString::fromLatin1(reinterpret_cast<const char *>(p));
if ((p = f->glGetString(GL_VERSION)))
version = QString::fromLatin1(reinterpret_cast<const char *>(p));
if ((p = f->glGetString(GL_SHADING_LANGUAGE_VERSION)))
glslVersion = QString::fromLatin1(reinterpret_cast<const char *>(p));
m_output->append(tr("\nVendor: %1").arg(vendor));
m_output->append(tr("Renderer: %1").arg(renderer));
m_output->append(tr("OpenGL version: %1").arg(version));
m_output->append(tr("GLSL version: %1").arg(glslVersion));
m_output->append(tr("\nDepth buffer size: %1").arg(QString::number(format.depthBufferSize())));
m_output->append(tr("Stencil buffer size: %1").arg(QString::number(format.stencilBufferSize())));
m_output->append(tr("Samples: %1").arg(QString::number(format.samples())));
m_output->append(tr("Red buffer size: %1").arg(QString::number(format.redBufferSize())));
m_output->append(tr("Green buffer size: %1").arg(QString::number(format.greenBufferSize())));
m_output->append(tr("Blue buffer size: %1").arg(QString::number(format.blueBufferSize())));
m_output->append(tr("Alpha buffer size: %1").arg(QString::number(format.alphaBufferSize())));
m_output->append(tr("Swap interval: %1").arg(QString::number(format.swapInterval())));
const char *gltype[] = { "Desktop", "GLES 2", "GLES 1" };
m_output->append(tr("\nQt OpenGL configuration: %1")
.arg(QString::fromLatin1(gltype[QOpenGLContext::openGLModuleType()])));
m_output->append(tr("Qt OpenGL library handle: %1")
.arg(QString::number(qintptr(QOpenGLContext::openGLModuleHandle()), 16)));
QList<QByteArray> extensionList = context->extensions().toList();
std::sort(extensionList.begin(), extensionList.end());
m_extensions->append(tr("Found %1 extensions:").arg(extensionList.count()));
Q_FOREACH (const QByteArray &ext, extensionList)
m_extensions->append(QString::fromLatin1(ext));
m_output->moveCursor(QTextCursor::Start);
m_extensions->moveCursor(QTextCursor::Start);
}
void Widget::renderWindowError(const QString &msg)
{
m_output->append(tr("An error has occurred:\n%1").arg(msg));
}

View File

@ -0,0 +1,79 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 Digia Plc and its Subsidiary(-ies) 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 WIDGET_H
#define WIDGET_H
#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QComboBox)
QT_FORWARD_DECLARE_CLASS(QTextEdit)
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
private slots:
void start();
void renderWindowReady();
void renderWindowError(const QString &msg);
private:
void addVersions(QLayout *layout);
void addProfiles(QLayout *layout);
void addOptions(QLayout *layout);
void addRenderableTypes(QLayout *layout);
void addRenderWindow();
QComboBox *m_version;
QLayout *m_profiles;
QLayout *m_options;
QLayout *m_renderables;
QTextEdit *m_output;
QTextEdit *m_extensions;
QVBoxLayout *m_renderWindowLayout;
QWidget *m_renderWindowContainer;
};
#endif // WIDGET_H

View File

@ -41,6 +41,7 @@
#include "hellowindow.h"
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <qmath.h>
Renderer::Renderer(const QSurfaceFormat &format, Renderer *share, QScreen *screen)
@ -142,15 +143,16 @@ void Renderer::render()
m_initialized = true;
}
glViewport(0, 0, viewSize.width() * surface->devicePixelRatio(), viewSize.height() * surface->devicePixelRatio());
QOpenGLFunctions *f = m_context->functions();
f->glViewport(0, 0, viewSize.width() * surface->devicePixelRatio(), viewSize.height() * surface->devicePixelRatio());
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
f->glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glFrontFace(GL_CW);
glCullFace(GL_FRONT);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
f->glFrontFace(GL_CW);
f->glCullFace(GL_FRONT);
f->glEnable(GL_CULL_FACE);
f->glEnable(GL_DEPTH_TEST);
QMatrix4x4 modelview;
modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
@ -164,8 +166,8 @@ void Renderer::render()
paintQtLogo();
m_program->release();
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
f->glDisable(GL_DEPTH_TEST);
f->glDisable(GL_CULL_FACE);
m_context->swapBuffers(surface);
@ -187,8 +189,6 @@ void Renderer::paintQtLogo()
void Renderer::initialize()
{
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this);
vshader->compileSourceCode(
"attribute highp vec4 vertex;"

View File

@ -51,8 +51,9 @@ int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
const bool multipleWindows =
QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)
QPlatformIntegration *integ = QGuiApplicationPrivate::platformIntegration();
const bool multipleWindows = integ->hasCapability(QPlatformIntegration::ThreadedOpenGL)
&& integ->hasCapability(QPlatformIntegration::WindowManagement)
&& !QGuiApplication::arguments().contains(QStringLiteral("--single"));
QScreen *screen = QGuiApplication::primaryScreen();

View File

@ -14,7 +14,6 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){
}
} else {
SUBDIRS = 2dpainting \
cube \
grabber \
hellogl \
overpainting \
@ -25,6 +24,8 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){
}
SUBDIRS += hellowindow \
paintedwindow
paintedwindow \
contextinfo \
cube
EXAMPLE_FILES = shared

View File

@ -83,6 +83,8 @@ void GLWidget::setClearColor(const QColor &color)
void GLWidget::initializeGL()
{
initializeOpenGLFunctions();
makeObject();
glEnable(GL_DEPTH_TEST);

View File

@ -43,10 +43,11 @@
#include <QtWidgets>
#include <QGLWidget>
#include <QOpenGLFunctions>
QT_FORWARD_DECLARE_CLASS(QGLShaderProgram);
class GLWidget : public QGLWidget
class GLWidget : public QGLWidget, protected QOpenGLFunctions
{
Q_OBJECT

View File

@ -118,7 +118,7 @@ private:
{
public:
KeyLaunchTransition(Boat *boat, QEvent::Type type, int key)
: QKeyEventTransition(boat, type, key), boat(boat), key(key)
: QKeyEventTransition(boat, type, key), boat(boat)
{
}
protected:
@ -131,7 +131,6 @@ protected:
}
private:
Boat * boat;
int key;
};
//This state is describing when the boat is moving right

View File

@ -205,7 +205,7 @@
supported formats using the \l{The foreach Keyword}{foreach keyword}.
This keyword has the following format:
\snippet code/doc_src_examples_dropsite.qdoc 0
\include code/doc_src_examples_dropsite.qdoc 0
In our example, \c format is the \a variable and the \a container is a
QStringList, obtained from \c mimeData->formats().

View File

@ -81,7 +81,9 @@ FilterWidget::FilterWidget(QWidget *parent)
const QIcon icon = QIcon(QPixmap(":/images/find.png"));
QToolButton *optionsButton = new QToolButton;
#ifndef QT_NO_CURSOR
optionsButton->setCursor(Qt::ArrowCursor);
#endif
optionsButton->setFocusPolicy(Qt::NoFocus);
optionsButton->setStyleSheet("* { border: none; }");
optionsButton->setIcon(icon);

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -15,7 +15,7 @@ QMAKE_CC = gcc
QMAKE_LINK_C = $$QMAKE_CC
QMAKE_LINK_C_SHLIB = $$QMAKE_CC
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -g
QMAKE_CXX = g++

View File

@ -31,11 +31,14 @@
# you can use the manual test in tests/manual/mkspecs.
#
QMAKE_CFLAGS_OPTIMIZE = -O2
QMAKE_CFLAGS_OPTIMIZE_FULL = -O3
QMAKE_CFLAGS += -pipe
QMAKE_CFLAGS_DEPS += -M
QMAKE_CFLAGS_WARN_ON += -Wall -W
QMAKE_CFLAGS_WARN_OFF += -w
QMAKE_CFLAGS_RELEASE += -O2
QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE
QMAKE_CFLAGS_DEBUG += -g
QMAKE_CFLAGS_SHLIB += -fPIC
QMAKE_CFLAGS_STATIC_LIB += -fPIC

View File

@ -51,11 +51,8 @@ load(cmake_functions)
CMAKE_BUILD_TYPE = Debug
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
win32: CMAKE_GENERATOR = -G \"NMake Makefiles\"
mingw:isEmpty(CROSS_COMPILE):CMAKE_GENERATOR = -G \"MinGW Makefiles\"
win32:equals(QT_ARCH, x86_64) {
win32-msvc2010:CMAKE_GENERATOR = -G \"Visual Studio 10 Win64\"
win32-msvc2012:CMAKE_GENERATOR = -G \"Visual Studio 11 Win64\"
}
BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP)

View File

@ -38,6 +38,15 @@ force_debug_info {
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
}
optimize_full {
!isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_FULL) {
QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE
QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE
QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL
}
}
debug {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG

View File

@ -117,7 +117,7 @@ QT_CPU_FEATURES = $$eval(QT_CPU_FEATURES.$$QT_ARCH)
silent:avx2_compiler.commands = @echo compiling[avx2] ${QMAKE_FILE_IN} && $$avx2_compiler.commands
QMAKE_EXTRA_COMPILERS += avx2_compiler
}
neon {
contains(QT_CPU_FEATURES.$$QT_ARCH, neon) {
HEADERS += $$NEON_HEADERS
neon_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS)

View File

@ -24,7 +24,9 @@ wince* {
contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC
QT_CONFIG -= opengl
} else {
!contains(QT_CONFIG, dynamicgl) {
QMAKE_LIBS += $$QMAKE_LIBS_OPENGL
QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL
}
}
}

View File

@ -8,7 +8,6 @@
#
load(device_config)
load(qt_config)
MAKEFILE_GENERATOR = MINGW
QMAKE_PLATFORM = win32 mingw
@ -85,7 +84,7 @@ QMAKE_LIBS =
QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32
QMAKE_LIBS_NETWORK = -lws2_32
!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32
QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32
QMAKE_LIBS_OPENGL_ES2 = -llibEGL -llibGLESv2 -lgdi32 -luser32
QMAKE_LIBS_OPENGL_ES2_DEBUG = -llibEGLd -llibGLESv2d -lgdi32 -luser32
QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
@ -111,3 +110,4 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
QMAKE_NM = $${CROSS_COMPILE}nm -P
load(qt_config)

View File

@ -4,8 +4,6 @@
# Written for Intel C++
#
load(qt_config)
MAKEFILE_GENERATOR = MSVC.NET
QMAKE_PLATFORM = win32
CONFIG += incremental flat debug_and_release debug_and_release_target
@ -58,12 +56,13 @@ QMAKE_LFLAGS_DEBUG = /DEBUG
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:console
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:windows
QMAKE_LFLAGS_DLL = /DLL
QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS =
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib
!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
QMAKE_LIBS_QT_ENTRY = -lqtmain
@ -74,3 +73,4 @@ QMAKE_RC = rc
include(../common/shell-win32.conf)
DSP_EXTENSION = .dsp
load(qt_config)

View File

@ -4,8 +4,6 @@
# Written for Microsoft Visual C++ 2005
#
load(qt_config)
MAKEFILE_GENERATOR = MSVC.NET
QMAKE_PLATFORM = win32
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
@ -77,7 +75,7 @@ QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib
!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
@ -93,3 +91,4 @@ include(../common/shell-win32.conf)
VCPROJ_EXTENSION = .vcproj
VCSOLUTION_EXTENSION = .sln
VCPROJ_KEYWORD = Qt4VSv1.0
load(qt_config)

View File

@ -4,8 +4,6 @@
# Written for Microsoft Visual C++ 2008
#
load(qt_config)
MAKEFILE_GENERATOR = MSVC.NET
QMAKE_PLATFORM = win32
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
@ -79,7 +77,7 @@ QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib
!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
@ -95,3 +93,4 @@ include(../common/shell-win32.conf)
VCPROJ_EXTENSION = .vcproj
VCSOLUTION_EXTENSION = .sln
VCPROJ_KEYWORD = Qt4VSv1.0
load(qt_config)

View File

@ -4,8 +4,6 @@
# Written for Microsoft Visual C++ 2010
#
load(qt_config)
MAKEFILE_GENERATOR = MSBUILD
QMAKE_PLATFORM = win32
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
@ -55,7 +53,7 @@ QMAKE_CXXFLAGS_STL_OFF =
QMAKE_CXXFLAGS_RTTI_ON = -GR
QMAKE_CXXFLAGS_RTTI_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0
QMAKE_INCDIR =
@ -81,7 +79,7 @@ QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib
!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
@ -97,3 +95,4 @@ include(../common/shell-win32.conf)
VCPROJ_EXTENSION = .vcxproj
VCSOLUTION_EXTENSION = .sln
VCPROJ_KEYWORD = Qt4VSv1.0
load(qt_config)

View File

@ -4,8 +4,6 @@
# Written for Microsoft Visual C++ 2012
#
load(qt_config)
MAKEFILE_GENERATOR = MSBUILD
QMAKE_PLATFORM = win32
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
@ -55,7 +53,7 @@ QMAKE_CXXFLAGS_STL_OFF =
QMAKE_CXXFLAGS_RTTI_ON = -GR
QMAKE_CXXFLAGS_RTTI_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0
QMAKE_INCDIR =
@ -81,7 +79,7 @@ QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib
!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
@ -97,3 +95,4 @@ include(../common/shell-win32.conf)
VCPROJ_EXTENSION = .vcxproj
VCSOLUTION_EXTENSION = .sln
VCPROJ_KEYWORD = Qt4VSv1.0
load(qt_config)

View File

@ -4,8 +4,6 @@
# Written for Microsoft Visual C++ 2013
#
load(qt_config)
MAKEFILE_GENERATOR = MSBUILD
QMAKE_PLATFORM = win32
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
@ -55,7 +53,7 @@ QMAKE_CXXFLAGS_STL_OFF =
QMAKE_CXXFLAGS_RTTI_ON = -GR
QMAKE_CXXFLAGS_RTTI_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0
QMAKE_INCDIR =
@ -81,7 +79,7 @@ QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib
!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
@ -97,3 +95,4 @@ include(../common/shell-win32.conf)
VCPROJ_EXTENSION = .vcxproj
VCSOLUTION_EXTENSION = .sln
VCPROJ_KEYWORD = Qt4VSv1.0
load(qt_config)

View File

@ -2195,6 +2195,16 @@ QString VCXProjectWriter::generateCondition(const VCConfiguration &config)
QString VCXProjectWriter::platformToolSetVersion(const DotNET version, bool winphoneBuild)
{
// The PlatformToolset string corresponds to the name of a directory in
// $(VCTargetsPath)\Platforms\{Win32,x64,...}\PlatformToolsets
// e.g. v90, v100, v110, v110_xp, v120_CTP_Nov, v120, or WindowsSDK7.1
// This environment variable may be set by a commandline build
// environment such as the Windows SDK command prompt
QByteArray envVar = qgetenv("PlatformToolset");
if (!envVar.isEmpty())
return envVar;
switch (version)
{
case NET2012:

View File

@ -29,10 +29,6 @@ HEADERS += project.h property.h \
generators/integrity/gbuild.h \
generators/win32/cesdkhandler.h
contains(QT_EDITION, OpenSource) {
DEFINES += QMAKE_OPENSOURCE_EDITION
}
bootstrap { #Qt code
SOURCES+= \
qbitarray.cpp \

View File

@ -1,7 +1,8 @@
Contains the header and sources files from selected xcb libraries:
libxcb-1.5 together with xcb-proto-1.6 (sync, xfixes, randr sources)
libxcb-1.8.1 together with xcb-proto-1.8 (xkb sources)
# libxkbcommon-x11 requires libxcb-xkb >= 1.10
libxcb-1.10 together with xcb-proto-1.10 (xkb sources)
libxcb-util-image-0.3.9
libxcb-util-keysyms-0.3.9
libxcb-util-renderutil-0.3.8

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,273 @@
diff --git a/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch b/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch
index f63719d..e69de29 100644
--- a/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch
+++ b/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch
@@ -1,134 +0,0 @@
-diff --git a/src/3rdparty/xcb/libxcb/xkb.c b/src/3rdparty/xcb/libxcb/xkb.c
-index d55bd76..2e3a24a 100644
---- a/src/3rdparty/xcb/libxcb/xkb.c
-+++ b/src/3rdparty/xcb/libxcb/xkb.c
-@@ -18,6 +18,15 @@
-
- xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 };
-
-+int qt_xcb_sumof(uint8_t *list, int len)
-+{
-+ int i, s = 0;
-+ for(i=0; i<len; i++) {
-+ s += *list;
-+ list++;
-+ }
-+ return s;
-+}
-
- /*****************************************************************************
- **
-@@ -9025,7 +9034,7 @@ int
- xcb_xkb_get_names_value_list_kt_level_names_length (const xcb_xkb_get_names_reply_t *R /**< */,
- const xcb_xkb_get_names_value_list_t *S /**< */)
- {
-- return xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
-+ return (/* valueList */ S->nLevelsPerType, R->nTypes);
- }
-
-
-@@ -9043,7 +9052,7 @@ xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t
- const xcb_xkb_get_names_value_list_t *S /**< */)
- {
- xcb_generic_iterator_t i;
-- i.data = /* valueList */ S->ktLevelNames + xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
-+ i.data = /* valueList */ S->ktLevelNames + qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
- i.rem = 0;
- i.index = (char *) i.data - (char *) S;
- return i;
-@@ -9508,8 +9517,8 @@ xcb_xkb_get_names_value_list_serialize (void **_
- xcb_block_len = 0;
- /* ktLevelNames */
- xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
-- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
-+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
- xcb_parts_idx++;
- xcb_align_to = ALIGNOF(xcb_atom_t);
- }
-@@ -9762,7 +9771,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer /
- xcb_block_len = 0;
- /* ktLevelNames */
- _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
- xcb_tmp += xcb_block_len;
- xcb_align_to = ALIGNOF(xcb_atom_t);
- }
-@@ -10139,7 +10148,7 @@ int
- xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R /**< */,
- const xcb_xkb_set_names_values_t *S /**< */)
- {
-- return xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
-+ return qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
- }
-
-
-@@ -10157,7 +10166,7 @@ xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t *
- const xcb_xkb_set_names_values_t *S /**< */)
- {
- xcb_generic_iterator_t i;
-- i.data = /* values */ S->ktLevelNames + xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
-+ i.data = /* values */ S->ktLevelNames + qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
- i.rem = 0;
- i.index = (char *) i.data - (char *) S;
- return i;
-@@ -10607,8 +10616,8 @@ xcb_xkb_set_names_values_serialize (void **_buffer
- xcb_block_len = 0;
- /* ktLevelNames */
- xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_parts_idx++;
- xcb_align_to = ALIGNOF(xcb_atom_t);
- }
-@@ -10849,7 +10858,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */,
- xcb_block_len = 0;
- /* ktLevelNames */
- _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_tmp += xcb_block_len;
- xcb_align_to = ALIGNOF(xcb_atom_t);
- }
-@@ -12872,7 +12881,7 @@ int
- xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */,
- const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
- {
-- return xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
-+ return qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
- }
-
-
-@@ -12890,7 +12899,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const x
- const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
- {
- xcb_generic_iterator_t i;
-- i.data = /* replies */ S->key_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
-+ i.data = /* replies */ S->key_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
- i.rem = 0;
- i.index = (char *) i.data - (char *) S;
- return i;
-@@ -13340,8 +13349,8 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void
- xcb_block_len = 0;
- /* ktLevelNames */
- xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_parts_idx++;
- xcb_align_to = ALIGNOF(xcb_atom_t);
- }
-@@ -13582,7 +13591,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void
- xcb_block_len = 0;
- /* ktLevelNames */
- _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_tmp += xcb_block_len;
- xcb_align_to = ALIGNOF(xcb_atom_t);
- }
diff --git a/src/3rdparty/xcb/libxcb/xkb.c b/src/3rdparty/xcb/libxcb/xkb.c
index d55bd76..ff025f6 100644
--- a/src/3rdparty/xcb/libxcb/xkb.c
+++ b/src/3rdparty/xcb/libxcb/xkb.c
@@ -18,6 +18,15 @@
xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 };
+int qt_xcb_sumof(uint8_t *list, int len)
+{
+ int i, s = 0;
+ for(i=0; i<len; i++) {
+ s += *list;
+ list++;
+ }
+ return s;
+}
/*****************************************************************************
**
@@ -9025,7 +9034,7 @@ int
xcb_xkb_get_names_value_list_kt_level_names_length (const xcb_xkb_get_names_reply_t *R /**< */,
const xcb_xkb_get_names_value_list_t *S /**< */)
{
- return xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
+ return qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
}
@@ -9043,7 +9052,7 @@ xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t
const xcb_xkb_get_names_value_list_t *S /**< */)
{
xcb_generic_iterator_t i;
- i.data = /* valueList */ S->ktLevelNames + xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
+ i.data = /* valueList */ S->ktLevelNames + qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
i.rem = 0;
i.index = (char *) i.data - (char *) S;
return i;
@@ -9508,8 +9517,8 @@ xcb_xkb_get_names_value_list_serialize (void **_
xcb_block_len = 0;
/* ktLevelNames */
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
xcb_parts_idx++;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -9762,7 +9771,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer /
xcb_block_len = 0;
/* ktLevelNames */
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -10139,7 +10148,7 @@ int
xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R /**< */,
const xcb_xkb_set_names_values_t *S /**< */)
{
- return xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
+ return qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
}
@@ -10157,7 +10166,7 @@ xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t *
const xcb_xkb_set_names_values_t *S /**< */)
{
xcb_generic_iterator_t i;
- i.data = /* values */ S->ktLevelNames + xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
+ i.data = /* values */ S->ktLevelNames + qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
i.rem = 0;
i.index = (char *) i.data - (char *) S;
return i;
@@ -10607,8 +10616,8 @@ xcb_xkb_set_names_values_serialize (void **_buffer
xcb_block_len = 0;
/* ktLevelNames */
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_parts_idx++;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -10849,7 +10858,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */,
xcb_block_len = 0;
/* ktLevelNames */
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -12872,7 +12881,7 @@ int
xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */,
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
{
- return xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
+ return qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
}
@@ -12890,7 +12899,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const x
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
{
xcb_generic_iterator_t i;
- i.data = /* replies */ S->key_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
+ i.data = /* replies */ S->key_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
i.rem = 0;
i.index = (char *) i.data - (char *) S;
return i;
@@ -13340,8 +13349,8 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void
xcb_block_len = 0;
/* ktLevelNames */
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_parts_idx++;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -13582,7 +13591,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void
xcb_block_len = 0;
/* ktLevelNames */
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(xcb_atom_t);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,172 +0,0 @@
diff --git src/3rdparty/xcb/libxcb/xkb.c src/3rdparty/xcb/libxcb/xkb.c
index cd09226..3e07d6d 100644
--- src/3rdparty/xcb/libxcb/xkb.c
+++ src/3rdparty/xcb/libxcb/xkb.c
@@ -15,6 +15,15 @@
xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 };
+int qt_xcb_sumof(uint8_t *list, int len)
+{
+ int i, s = 0;
+ for(i=0; i<len; i++) {
+ s += *list;
+ list++;
+ }
+ return s;
+}
/*****************************************************************************
**
@@ -9622,7 +9631,7 @@ int
xcb_xkb_get_names_value_list_kt_level_names_length (const xcb_xkb_get_names_reply_t *R /**< */,
const xcb_xkb_get_names_value_list_t *S /**< */)
{
- return xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
+ return qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
}
@@ -9640,7 +9649,7 @@ xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t
const xcb_xkb_get_names_value_list_t *S /**< */)
{
xcb_generic_iterator_t i;
- i.data = /* valueList */ S->ktLevelNames + xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
+ i.data = /* valueList */ S->ktLevelNames + qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes);
i.rem = 0;
i.index = (char *) i.data - (char *) S;
return i;
@@ -10089,8 +10098,8 @@ xcb_xkb_get_names_value_list_serialize (void **_
xcb_block_len = 0;
/* ktLevelNames */
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
xcb_parts_idx++;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -10330,7 +10339,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer /
xcb_block_len = 0;
/* ktLevelNames */
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -10707,7 +10716,7 @@ int
xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R /**< */,
const xcb_xkb_set_names_values_t *S /**< */)
{
- return xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
+ return qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
}
@@ -10725,7 +10734,7 @@ xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t *
const xcb_xkb_set_names_values_t *S /**< */)
{
xcb_generic_iterator_t i;
- i.data = /* values */ S->ktLevelNames + xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
+ i.data = /* values */ S->ktLevelNames + qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels);
i.rem = 0;
i.index = (char *) i.data - (char *) S;
return i;
@@ -11175,8 +11184,8 @@ xcb_xkb_set_names_values_serialize (void **_buffer
xcb_block_len = 0;
/* ktLevelNames */
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_parts_idx++;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -11417,7 +11426,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */,
xcb_block_len = 0;
/* ktLevelNames */
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -16654,7 +16663,7 @@ int
xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */,
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
{
- return xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
+ return qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
}
@@ -16672,7 +16681,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const x
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
{
xcb_generic_iterator_t i;
- i.data = /* replies */ S->key_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
+ i.data = /* replies */ S->key_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels);
i.rem = 0;
i.index = (char *) i.data - (char *) S;
return i;
@@ -17122,8 +17131,8 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void
xcb_block_len = 0;
/* ktLevelNames */
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_parts_idx++;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -17364,7 +17373,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void
xcb_block_len = 0;
/* ktLevelNames */
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -17624,7 +17633,7 @@ int
xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */,
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
{
- return xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
+ return qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
}
@@ -17642,7 +17651,7 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_end (const
const xcb_xkb_get_kbd_by_name_replies_t *S /**< */)
{
xcb_generic_iterator_t i;
- i.data = /* replies */ S->other_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
+ i.data = /* replies */ S->other_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels);
i.rem = 0;
i.index = (char *) i.data - (char *) S;
return i;
@@ -18092,8 +18101,8 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_serialize (void
xcb_block_len = 0;
/* ktLevelNames */
xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_parts_idx++;
xcb_align_to = ALIGNOF(xcb_atom_t);
}
@@ -18334,7 +18343,7 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_unpack (const void
xcb_block_len = 0;
/* ktLevelNames */
_aux->ktLevelNames = (xcb_atom_t *)xcb_tmp;
- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t);
xcb_tmp += xcb_block_len;
xcb_align_to = ALIGNOF(xcb_atom_t);
}

View File

@ -1,7 +1,7 @@
QMAKE_CFLAGS += -std=gnu99 -w
INCLUDEPATH += $$PWD/xkbcommon $$PWD/xkbcommon/src $$PWD/xkbcommon/src/xkbcomp
DEFINES += DFLT_XKB_CONFIG_ROOT='\\"$$QMAKE_X11_PREFIX/share/X11/xkb\\"'
DEFINES += DFLT_XKB_CONFIG_ROOT='\\"$$QMAKE_XKB_CONFIG_ROOT\\"'
### RMLVO names can be overwritten with environmental variables (See libxkbcommon documentation)
DEFINES += DEFAULT_XKB_RULES='\\"evdev\\"'

View File

@ -51,6 +51,8 @@ import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.ClipboardManager;
import android.text.Html;
import android.text.Spanned;
import android.util.TypedValue;
import android.view.View;
import android.widget.Button;
@ -74,11 +76,11 @@ class ButtonStruct implements View.OnClickListener
{
m_dialog = dialog;
m_id = id;
m_text = text;
m_text = Html.fromHtml(text);
}
QtMessageDialogHelper m_dialog;
private int m_id;
String m_text;
Spanned m_text;
@Override
public void onClick(View view) {
@ -153,22 +155,22 @@ public class QtMessageDialogHelper
public void setTile(String title)
{
m_title = title;
m_title = Html.fromHtml(title);
}
public void setText(String text)
{
m_text = text;
m_text = Html.fromHtml(text);
}
public void setInformativeText(String informativeText)
{
m_informativeText = informativeText;
m_informativeText = Html.fromHtml(informativeText);
}
public void setDetailedText(String text)
{
m_detailedText = text;
m_detailedText = Html.fromHtml(text);
}
public void addButton(int id, String text)
@ -417,7 +419,7 @@ public class QtMessageDialogHelper
private Activity m_activity;
private int m_icon = 0;
private String m_title, m_text, m_informativeText, m_detailedText;
private Spanned m_title, m_text, m_informativeText, m_detailedText;
private ArrayList<ButtonStruct> m_buttonsList;
private AlertDialog m_dialog;
private long m_handler = 0;

View File

@ -2,6 +2,16 @@
Copyright (c) 2011-2013, BogDan Vatra <bogdan@kde.org>
Contact: http://www.qt-project.org/legal
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 Digia. For licensing terms and
conditions see http://qt.digia.com/licensing. For further information
use the contact form at http://qt.digia.com/contact-us.
BSD License Usage
Alternatively, this file may be used under 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:

View File

@ -2,6 +2,16 @@
Copyright (c) 2011-2013, BogDan Vatra <bogdan@kde.org>
Contact: http://www.qt-project.org/legal
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 Digia. For licensing terms and
conditions see http://qt.digia.com/licensing. For further information
use the contact form at http://qt.digia.com/contact-us.
BSD License Usage
Alternatively, this file may be used under 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:

View File

@ -2,6 +2,16 @@
Copyright (c) 2012-2013, BogDan Vatra <bogdan@kde.org>
Contact: http://www.qt-project.org/legal
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 Digia. For licensing terms and
conditions see http://qt.digia.com/licensing. For further information
use the contact form at http://qt.digia.com/contact-us.
BSD License Usage
Alternatively, this file may be used under 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:
@ -624,12 +634,16 @@ public class QtActivity extends Activity
+ "\tQML_IMPORT_PATH=" + pluginsPrefix + "/imports"
+ "\tQT_PLUGIN_PATH=" + pluginsPrefix + "/plugins");
if (APPLICATION_PARAMETERS != null) {
loaderParams.putString(APPLICATION_PARAMETERS_KEY, APPLICATION_PARAMETERS);
} else {
Intent intent = getIntent();
if (intent != null) {
String parameters = intent.getStringExtra("applicationArguments");
if (parameters != null)
loaderParams.putString(APPLICATION_PARAMETERS_KEY, parameters.replace(' ', '\t'));
}
}
loadApplication(loaderParams);
return;

View File

@ -2,6 +2,16 @@
Copyright (c) 2012-2013, BogDan Vatra <bogdan@kde.org>
Contact: http://www.qt-project.org/legal
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 Digia. For licensing terms and
conditions see http://qt.digia.com/licensing. For further information
use the contact form at http://qt.digia.com/contact-us.
BSD License Usage
Alternatively, this file may be used under 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:

View File

@ -11,6 +11,8 @@ DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
CONFIG += optimize_full
# otherwise mingw headers do not declare common functions like putenv
mingw:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x

View File

@ -195,7 +195,7 @@ int divide(int a, int b)
//! [18]
ASSERT: "b == 0" in file div.cpp, line 7
ASSERT: "b != 0" in file div.cpp, line 7
//! [18]

View File

@ -1,2 +0,0 @@
QT = core
SOURCES = main.cpp

View File

@ -208,7 +208,7 @@
\l{QCoreApplication::}{postEvent()} is also used during object
initialization, since the posted event will typically be dispatched
very soon after the initialization of the object is complete.
When implementing a widget, it is important to realise that events
When implementing a widget, it is important to realize that events
can be delivered very early in its lifetime so, in its constructor,
be sure to initialize member variables early on, before there's any
chance that it might receive an event.

View File

@ -860,7 +860,7 @@
#ifdef Q_COMPILER_NULLPTR
# define Q_NULLPTR nullptr
#else
# define Q_NULLPTR 0
# define Q_NULLPTR NULL
#endif
#ifdef Q_COMPILER_DEFAULT_MEMBERS

View File

@ -394,7 +394,7 @@ Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits");
\fn bool QFlags::testFlag(Enum flag) const
\since 4.2
Returns \c true if the \a flag is set, otherwise false.
Returns \c true if the \a flag is set, otherwise \c false.
*/
/*!
@ -1937,7 +1937,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
\relates <QtGlobal>
Prints a warning message containing the source code file name and
line number if \a test is false.
line number if \a test is \c false.
Q_ASSERT() is useful for testing pre- and post-conditions
during development. It does nothing if \c QT_NO_DEBUG was defined
@ -1960,7 +1960,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
\relates <QtGlobal>
Prints the message \a what together with the location \a where,
the source file name and line number if \a test is false.
the source file name and line number if \a test is \c false.
Q_ASSERT_X is useful for testing pre- and post-conditions during
development. It does nothing if \c QT_NO_DEBUG was defined during
@ -1983,18 +1983,18 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
\relates <QtGlobal>
\since 5.0
Causes the compiler to assume that \a expr is true. This macro is useful
Causes the compiler to assume that \a expr is \c true. This macro is useful
for improving code generation, by providing the compiler with hints about
conditions that it would not otherwise know about. However, there is no
guarantee that the compiler will actually use those hints.
This macro could be considered a "lighter" version of \l{Q_ASSERT()}. While
Q_ASSERT will abort the program's execution if the condition is false,
Q_ASSERT will abort the program's execution if the condition is \c false,
Q_ASSUME will tell the compiler not to generate code for those conditions.
Therefore, it is important that the assumptions always hold, otherwise
undefined behaviour may occur.
If \a expr is a constantly false condition, Q_ASSUME will tell the compiler
If \a expr is a constantly \c false condition, Q_ASSUME will tell the compiler
that the current code execution cannot be reached. That is, Q_ASSUME(false)
is equivalent to Q_UNREACHABLE().
@ -3346,6 +3346,8 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
It expands to "std::move" if your compiler supports that C++11 function, or to nothing
otherwise.
qMove takes an rvalue reference to its parameter \a x, and converts it to an xvalue.
*/
/*!
@ -3426,7 +3428,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
\relates <QtGlobal>
\since 5.0
This macro marks a function as non-throwing if \a x is true. If
This macro marks a function as non-throwing if \a x is \c true. If
the function does nevertheless throw, the behaviour is defined:
std::terminate() is called.

View File

@ -110,10 +110,8 @@ public:
inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(unsigned long t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(qint64 t)
{ stream->ts << QString::number(t); return maybeSpace(); }
inline QDebug &operator<<(quint64 t)
{ stream->ts << QString::number(t); return maybeSpace(); }
inline QDebug &operator<<(qint64 t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(quint64 t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); }

View File

@ -195,7 +195,7 @@ QString QFileSystemEntry::path() const
if (m_lastSeparator == -1) {
#if defined(Q_OS_WIN)
if (m_filePath.length() >= 2 && m_filePath.at(1) == QLatin1Char(':'))
return QFSFileEngine::currentPath(m_filePath.left(2));
return m_filePath.left(2);
#endif
return QString(QLatin1Char('.'));
}

View File

@ -108,8 +108,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
Rules are evaluated in text order, from first to last. That is, if two rules
apply to a category/type, the rule that comes later is applied.
Rules can be set via \l setFilterRules(). Since Qt 5.3 logging rules
are also automatically loaded from the \c [Rules] section of a logging
Rules can be set via \l setFilterRules(). Since Qt 5.3 logging rules can also
be set in the \c QT_LOGGING_RULES environment variable, and
are automatically loaded from the \c [Rules] section of a logging
configuration file. Such configuration files are looked up in the QtProject
configuration directory, or explicitly set in a \c QT_LOGGING_CONF
environment variable.
@ -117,13 +118,15 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
Rules set by \l setFilterRules() take precedence over rules specified
in the QtProject configuration directory, and can, in turn, be
overwritten by rules from the configuration file specified by
\c QT_LOGGING_CONF.
\c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES.
Order of evaluation:
\list
\li Rules from QtProject/qlogging.ini
\li Rules set by \l setFilterRules()
\li Rules from file in \c QT_LOGGING_CONF
\li Rules from environment variable QT_LOGGING_RULES
\endlist
The \c QtProject/qlogging.ini file is looked up in all directories returned
@ -137,6 +140,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
QCoreApplication::applicationDirPath() + \c "/data"
\endlist
Set the \c QT_LOGGING_DEBUG environment variable to see from where
logging rules are loaded.
\section2 Installing a Custom Filter
As a lower-level alternative to the text rules you can also implement a
@ -341,9 +347,8 @@ QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter)
\snippet qloggingcategory/main.cpp 2
\note The rules might be ignored if a custom category filter is installed
with \l installFilter(), or if the user defined a custom logging
configuration file in the \c QT_LOGGING_CONF environment variable.
with \l installFilter(), or if the user defined \c QT_LOGGING_CONF or \c QT_LOGGING_RULES
environment variable.
*/
void QLoggingCategory::setFilterRules(const QString &rules)
{

View File

@ -45,6 +45,13 @@
#include <QtCore/qfile.h>
#include <QtCore/qstandardpaths.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qdir.h>
// We can't use the default macros because this would lead to recursion.
// Instead let's define our own one that unconditionally logs...
#define debugMsg QMessageLogger(__FILE__, __LINE__, __FUNCTION__, "qt.core.logging").debug
#define warnMsg QMessageLogger(__FILE__, __LINE__, __FUNCTION__, "qt.core.logging").warning
QT_BEGIN_NAMESPACE
@ -64,12 +71,12 @@ QLoggingRule::QLoggingRule() :
\internal
Constructs a logging rule.
*/
QLoggingRule::QLoggingRule(const QString &pattern, bool enabled) :
pattern(pattern),
QLoggingRule::QLoggingRule(const QStringRef &pattern, bool enabled) :
messageType(-1),
flags(Invalid),
enabled(enabled)
{
parse();
parse(pattern);
}
/*!
@ -77,48 +84,33 @@ QLoggingRule::QLoggingRule(const QString &pattern, bool enabled) :
Return value 1 means filter passed, 0 means filter doesn't influence this
category, -1 means category doesn't pass this filter.
*/
int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const
int QLoggingRule::pass(const QString &cat, QtMsgType msgType) const
{
QString fullCategory = categoryName;
switch (msgType) {
case QtDebugMsg:
fullCategory += QLatin1String(".debug");
break;
case QtWarningMsg:
fullCategory += QLatin1String(".warning");
break;
case QtCriticalMsg:
fullCategory += QLatin1String(".critical");
break;
default:
break;
}
// check message type
if (messageType > -1 && messageType != msgType)
return 0;
if (flags == FullText) {
// can be
// qtproject.org.debug = true
// or
// qtproject.org = true
if (pattern == categoryName
|| pattern == fullCategory)
// full match
if (category == cat)
return (enabled ? 1 : -1);
else
return 0;
}
int idx = 0;
const int idx = cat.indexOf(category);
if (idx >= 0) {
if (flags == MidFilter) {
// e.g. *.qtproject*
idx = fullCategory.indexOf(pattern);
// matches somewhere
if (idx >= 0)
return (enabled ? 1 : -1);
} else {
idx = fullCategory.indexOf(pattern);
if (flags == LeftFilter) {
// e.g. org.qtproject.*
} else if (flags == LeftFilter) {
// matches left
if (idx == 0)
return (enabled ? 1 : -1);
} else if (flags == RightFilter) {
// e.g. *.qtproject
if (idx == (fullCategory.count() - pattern.count()))
// matches right
if (idx == (cat.count() - category.count()))
return (enabled ? 1 : -1);
}
}
@ -127,30 +119,51 @@ int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const
/*!
\internal
Parses the category and checks which kind of wildcard the filter can contain.
Parses \a pattern.
Allowed is f.ex.:
org.qtproject.logging FullText
org.qtproject.* LeftFilter
*.qtproject RightFilter
*.qtproject* MidFilter
qt.core.io.debug FullText, QtDebugMsg
qt.core.* LeftFilter, all types
*.io.warning RightFilter, QtWarningMsg
*.core.* MidFilter
*/
void QLoggingRule::parse()
void QLoggingRule::parse(const QStringRef &pattern)
{
int index = pattern.indexOf(QLatin1Char('*'));
if (index < 0) {
QStringRef p;
// strip trailing ".messagetype"
if (pattern.endsWith(QLatin1String(".debug"))) {
p = QStringRef(pattern.string(), pattern.position(),
pattern.length() - strlen(".debug"));
messageType = QtDebugMsg;
} else if (pattern.endsWith(QLatin1String(".warning"))) {
p = QStringRef(pattern.string(), pattern.position(),
pattern.length() - strlen(".warning"));
messageType = QtWarningMsg;
} else if (pattern.endsWith(QLatin1String(".critical"))) {
p = QStringRef(pattern.string(), pattern.position(),
pattern.length() - strlen(".critical"));
messageType = QtCriticalMsg;
} else {
p = pattern;
}
flags = Invalid;
if (!p.contains(QLatin1Char('*'))) {
flags = FullText;
} else {
flags = Invalid;
if (index == 0) {
flags |= RightFilter;
pattern = pattern.remove(0, 1);
index = pattern.indexOf(QLatin1Char('*'));
}
if (index == (pattern.length() - 1)) {
if (p.endsWith(QLatin1Char('*'))) {
flags |= LeftFilter;
pattern = pattern.remove(pattern.length() - 1, 1);
p = QStringRef(p.string(), p.position(), p.length() - 1);
}
if (p.startsWith(QLatin1Char('*'))) {
flags |= RightFilter;
p = QStringRef(p.string(), p.position() + 1, p.length() - 1);
}
if (p.contains(QLatin1Char('*'))) // '*' only supported at start/end
flags = Invalid;
}
category = p.toString();
}
/*!
@ -207,7 +220,7 @@ void QLoggingSettingsParser::setContent(QTextStream &stream)
int equalPos = line.indexOf(QLatin1Char('='));
if ((equalPos != -1)
&& (line.lastIndexOf(QLatin1Char('=')) == equalPos)) {
const QString pattern = line.left(equalPos);
const QStringRef pattern = line.leftRef(equalPos);
const QStringRef value = line.midRef(equalPos + 1);
bool enabled = (value.compare(QLatin1String("true"),
Qt::CaseInsensitive) == 0);
@ -226,10 +239,16 @@ QLoggingRegistry::QLoggingRegistry()
{
}
static bool qtLoggingDebug()
{
static const bool debugEnv = qEnvironmentVariableIsSet("QT_LOGGING_DEBUG");
return debugEnv;
}
/*!
\internal
Initializes the rules database by loading
.config/QtProject/qtlogging.ini and $QT_LOGGING_CONF.
$QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini.
*/
void QLoggingRegistry::init()
{
@ -241,9 +260,20 @@ void QLoggingRegistry::init()
QTextStream stream(&file);
QLoggingSettingsParser parser;
parser.setContent(stream);
if (qtLoggingDebug())
debugMsg("Loading \"%s\" ...",
QDir::toNativeSeparators(file.fileName()).toUtf8().constData());
envRules = parser.rules();
}
}
const QByteArray rulesSrc = qgetenv("QT_LOGGING_RULES");
if (!rulesSrc.isEmpty()) {
QTextStream stream(rulesSrc);
QLoggingSettingsParser parser;
parser.setSection(QStringLiteral("Rules"));
parser.setContent(stream);
envRules += parser.rules();
}
// get rules from qt configuration
QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation,
@ -254,6 +284,9 @@ void QLoggingRegistry::init()
QTextStream stream(&file);
QLoggingSettingsParser parser;
parser.setContent(stream);
if (qtLoggingDebug())
debugMsg("Loading \"%s\" ...",
QDir::toNativeSeparators(envPath).toUtf8().constData());
configRules = parser.rules();
}
}
@ -302,6 +335,10 @@ void QLoggingRegistry::setApiRules(const QString &content)
parser.setContent(content);
QMutexLocker locker(&registryMutex);
if (qtLoggingDebug())
debugMsg("Loading logging rules set by Qt API ...");
apiRules = parser.rules();
updateRules();

View File

@ -64,11 +64,11 @@ class tst_QLoggingRegistry;
QT_BEGIN_NAMESPACE
class QLoggingRule
class Q_AUTOTEST_EXPORT QLoggingRule
{
public:
QLoggingRule();
QLoggingRule(const QString &pattern, bool enabled);
QLoggingRule(const QStringRef &pattern, bool enabled);
int pass(const QString &categoryName, QtMsgType type) const;
enum PatternFlag {
@ -80,12 +80,13 @@ public:
};
Q_DECLARE_FLAGS(PatternFlags, PatternFlag)
QString pattern;
QString category;
int messageType;
PatternFlags flags;
bool enabled;
private:
void parse();
void parse(const QStringRef &pattern);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QLoggingRule::PatternFlags)

View File

@ -880,18 +880,18 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv
// copy the stdin socket if asked to (without closing on exec)
if (inputChannelMode != QProcess::ForwardedInputChannel)
qt_safe_dup2(stdinChannel.pipe[0], fileno(stdin), 0);
qt_safe_dup2(stdinChannel.pipe[0], STDIN_FILENO, 0);
// copy the stdout and stderr if asked to
if (processChannelMode != QProcess::ForwardedChannels) {
if (processChannelMode != QProcess::ForwardedOutputChannel)
qt_safe_dup2(stdoutChannel.pipe[1], fileno(stdout), 0);
qt_safe_dup2(stdoutChannel.pipe[1], STDOUT_FILENO, 0);
// merge stdout and stderr if asked to
if (processChannelMode == QProcess::MergedChannels) {
qt_safe_dup2(fileno(stdout), fileno(stderr), 0);
qt_safe_dup2(STDOUT_FILENO, STDERR_FILENO, 0);
} else if (processChannelMode != QProcess::ForwardedErrorChannel) {
qt_safe_dup2(stderrChannel.pipe[1], fileno(stderr), 0);
qt_safe_dup2(stderrChannel.pipe[1], STDERR_FILENO, 0);
}
}

View File

@ -2610,6 +2610,7 @@ void QSortFilterProxyModel::invalidateFilter()
\li QMetaType::UInt
\li QMetaType::LongLong
\li QMetaType::ULongLong
\li QMetaType::Float
\li QMetaType::Double
\li QMetaType::QChar
\li QMetaType::QDate

View File

@ -343,18 +343,47 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other)
The conversion will convert QVariant types as follows:
\table
\header
\li Source type
\li Destination type
\row
\li
\list
\li QMetaType::Bool
\endlist
\li QJsonValue::Bool
\row
\li
\list
\li QMetaType::Bool to Bool
\li QMetaType::Int
\li QMetaType::Double
\li QMetaType::UInt
\li QMetaType::LongLong
\li QMetaType::ULongLong
\li QMetaType::UInt to Double
\li QMetaType::QString to String
\li QMetaType::QStringList
\li QMetaType::QVariantList to Array
\li QMetaType::QVariantMap to Object
\li QMetaType::Float
\li QMetaType::Double
\endlist
\li QJsonValue::Double
\row
\li
\list
\li QMetaType::QString
\endlist
\li QJsonValue::String
\row
\li
\list
\li QMetaType::QStringList
\li QMetaType::QVariantList
\endlist
\li QJsonValue::Array
\row
\li
\list
\li QMetaType::QVariantMap
\endlist
\li QJsonValue::Object
\endtable
For all other QVariant types a conversion to a QString will be attempted. If the returned string
is empty, a Null QJsonValue will be stored, otherwise a String value using the returned QString.
@ -363,10 +392,11 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other)
*/
QJsonValue QJsonValue::fromVariant(const QVariant &variant)
{
switch (variant.type()) {
switch (variant.userType()) {
case QVariant::Bool:
return QJsonValue(variant.toBool());
case QVariant::Int:
case QMetaType::Float:
case QVariant::Double:
case QVariant::LongLong:
case QVariant::ULongLong:

View File

@ -274,6 +274,7 @@ QT_BEGIN_NAMESPACE
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue NativeGesture
\omitvalue WindowChangeInternal
*/
/*!

View File

@ -278,6 +278,8 @@ public:
StyleAnimationUpdate = 213, // style animation target should be updated
ApplicationStateChange = 214,
WindowChangeInternal = 215, // internal for QQuickWidget
// 512 reserved for Qt Jambi's MetaCall event
// 513 reserved for Qt Jambi's DeleteOnMainThread event

View File

@ -264,12 +264,8 @@ template <typename BaseClass> struct QGenericAtomicOps
template <typename T> static inline always_inline
T fetchAndSubRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
{
// implement fetchAndSub on top of testAndSet
Q_FOREVER {
T tmp = BaseClass::load(_q_value);
if (BaseClass::testAndSetRelaxed(_q_value, tmp, T(tmp - operand)))
return tmp;
}
// implement fetchAndSub on top of fetchAndAdd
return fetchAndAddRelaxed(_q_value, -operand);
}
template <typename T> static inline always_inline

View File

@ -504,22 +504,22 @@ void QThread::usleep(unsigned long usecs)
void QThread::yieldCurrentThread()
{
std::this_thread::yield();
msleep(1);
}
void QThread::sleep(unsigned long secs)
{
std::this_thread::sleep_for(std::chrono::seconds(secs));
msleep(secs * 1000);
}
void QThread::msleep(unsigned long msecs)
{
std::this_thread::sleep_for(std::chrono::milliseconds(msecs));
WaitForSingleObjectEx(GetCurrentThread(), msecs, FALSE);
}
void QThread::usleep(unsigned long usecs)
{
std::this_thread::sleep_for(std::chrono::microseconds(usecs));
msleep((usecs / 1000) + 1);
}
#endif // Q_OS_WINRT

View File

@ -4186,6 +4186,91 @@ QByteArray QByteArray::fromPercentEncoding(const QByteArray &input, char percent
return tmp;
}
/*! \fn QByteArray QByteArray::fromCFData(CFDataRef data)
\since 5.3
Constructs a new QByteArray containing a copy of the CFData \a data.
\sa fromRawCFData(), fromRawData(), toRawCFData(), toCFData()
*/
/*! \fn QByteArray QByteArray::fromRawCFData(CFDataRef data)
\since 5.3
Constructs a QByteArray that uses the bytes of the CFData \a data.
The \a data's bytes are not copied.
The caller guarantees that the CFData will not be deleted
or modified as long as this QByteArray object exists.
\sa fromCFData(), fromRawData(), toRawCFData(), toCFData()
*/
/*! \fn CFDataRef QByteArray::toCFData() const
\since 5.3
Creates a CFData from a QByteArray. The caller owns the CFData object
and is responsible for releasing it.
\sa toRawCFData(), fromCFData(), fromRawCFData(), fromRawData()
*/
/*! \fn CFDataRef QByteArray::toRawCFData() const
\since 5.3
Constructs a CFData that uses the bytes of the QByteArray.
The QByteArray's bytes are not copied.
The caller guarantees that the QByteArray will not be deleted
or modified as long as this CFData object exists.
\sa toCFData(), fromRawCFData(), fromCFData(), fromRawData()
*/
/*! \fn QByteArray QByteArray::fromNSData(const NSData *data)
\since 5.3
Constructs a new QByteArray containing a copy of the NSData \a data.
\sa fromRawNSData(), fromRawData(), toNSData(), toRawNSData()
*/
/*! \fn QByteArray QByteArray::fromRawNSData(const NSData *data)
\since 5.3
Constructs a QByteArray that uses the bytes of the NSData \a data.
The \a data's bytes are not copied.
The caller guarantees that the NSData will not be deleted
or modified as long as this QByteArray object exists.
\sa fromNSData(), fromRawData(), toRawNSData(), toNSData()
*/
/*! \fn NSData QByteArray::toNSData() const
\since 5.3
Creates a NSData from a QByteArray. The NSData object is autoreleased.
\sa fromNSData(), fromRawNSData(), fromRawData(), toRawNSData()
*/
/*! \fn NSData QByteArray::toRawNSData() const
\since 5.3
Constructs a NSData that uses the bytes of the QByteArray.
The QByteArray's bytes are not copied.
The caller guarantees that the QByteArray will not be deleted
or modified as long as this NSData object exists.
\sa fromRawNSData(), fromNSData(), fromRawData(), toNSData()
*/
static inline bool q_strchr(const char str[], char chr)
{
if (!str) return false;

View File

@ -65,6 +65,12 @@
#endif
#ifdef Q_OS_MAC
Q_FORWARD_DECLARE_CF_TYPE(CFData);
# ifdef __OBJC__
Q_FORWARD_DECLARE_OBJC_CLASS(NSData);
# endif
#endif
QT_BEGIN_NAMESPACE
@ -354,6 +360,18 @@ public:
static QByteArray fromHex(const QByteArray &hexEncoded);
static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%');
#if defined(Q_OS_MAC) || defined(Q_QDOC)
static QByteArray fromCFData(CFDataRef data);
static QByteArray fromRawCFData(CFDataRef data);
CFDataRef toCFData() const Q_DECL_CF_RETURNS_RETAINED;
CFDataRef toRawCFData() const Q_DECL_CF_RETURNS_RETAINED;
# if defined(__OBJC__) || defined(Q_QDOC)
static QByteArray fromNSData(const NSData *data);
static QByteArray fromRawNSData(const NSData *data);
NSData *toNSData() const Q_DECL_NS_RETURNS_AUTORELEASED;
NSData *toRawNSData() const Q_DECL_NS_RETURNS_AUTORELEASED;
# endif
#endif
typedef char *iterator;
typedef const char *const_iterator;

View File

@ -0,0 +1,101 @@
/****************************************************************************
**
** Copyright (C) 2014 Samuel Gaist <samuel.gaist@edeltech.ch>
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module 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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qbytearray.h"
#import <Foundation/Foundation.h>
QT_BEGIN_NAMESPACE
QByteArray QByteArray::fromCFData(CFDataRef data)
{
if (!data)
return QByteArray();
return QByteArray(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
}
QByteArray QByteArray::fromRawCFData(CFDataRef data)
{
if (!data)
return QByteArray();
return QByteArray::fromRawData(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
}
CFDataRef QByteArray::toCFData() const
{
return CFDataCreate(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()), length());
}
CFDataRef QByteArray::toRawCFData() const
{
return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()),
length(), kCFAllocatorNull);
}
QByteArray QByteArray::fromNSData(const NSData *data)
{
if (!data)
return QByteArray();
return QByteArray(reinterpret_cast<const char *>([data bytes]), [data length]);
}
QByteArray QByteArray::fromRawNSData(const NSData *data)
{
if (!data)
return QByteArray();
return QByteArray::fromRawData(reinterpret_cast<const char *>([data bytes]), [data length]);
}
NSData *QByteArray::toNSData() const
{
return [NSData dataWithBytes:constData() length:size()];
}
NSData *QByteArray::toRawNSData() const
{
// const_cast is fine here because NSData is immutable thus will never modify bytes we're giving it
return [NSData dataWithBytesNoCopy:const_cast<char *>(constData()) length:size() freeWhenDone:NO];
}
QT_END_NAMESPACE

View File

@ -1,258 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 by Southwest Research Institute (R)
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module 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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <qbytearraylist.h>
QT_BEGIN_NAMESPACE
/*! \typedef QByteArrayListIterator
\relates QByteArrayList
The QByteArrayListIterator type definition provides a Java-style const
iterator for QByteArrayList.
QByteArrayList provides both \l{Java-style iterators} and
\l{STL-style iterators}. The Java-style const iterator is simply
a type definition for QListIterator<QByteArray>.
\sa QMutableByteArrayListIterator, QByteArrayList::const_iterator
*/
/*! \typedef QMutableByteArrayListIterator
\relates QByteArrayList
The QByteArrayListIterator type definition provides a Java-style
non-const iterator for QByteArrayList.
QByteArrayList provides both \l{Java-style iterators} and
\l{STL-style iterators}. The Java-style non-const iterator is
simply a type definition for QMutableListIterator<QByteArray>.
\sa QByteArrayListIterator, QByteArrayList::iterator
*/
/*!
\class QByteArrayList
\inmodule QtCore
\since 5.3
\brief The QByteArrayList class provides a list of byte arrays.
\ingroup tools
\ingroup shared
\ingroup string-processing
\reentrant
QByteArrayList inherits from QList<QByteArray>. Like QList, QByteArrayList is
\l{implicitly shared}. It provides fast index-based access as well as fast
insertions and removals. Passing string lists as value parameters is both
fast and safe.
All of QList's functionality also applies to QByteArrayList. For example, you
can use isEmpty() to test whether the list is empty, and you can call
functions like append(), prepend(), insert(), replace(), removeAll(),
removeAt(), removeFirst(), removeLast(), and removeOne() to modify a
QByteArrayList. In addition, QByteArrayList provides several join()
methods for concatenating the list into a single QByteArray.
The purpose of QByteArrayList is quite different from that of QStringList.
Whereas QStringList has many methods for manipulation of elements within
the list, QByteArrayList does not.
Normally, QStringList should be used whenever working with a list of printable
strings. QByteArrayList should be used to handle and efficiently join large blobs
of binary data, as when sequentially receiving serialized data through a
QIODevice.
\sa QByteArray, QStringList
*/
/*!
\fn QByteArrayList::QByteArrayList()
Constructs an empty byte array list.
*/
/*!
\fn QByteArrayList::QByteArrayList(const QByteArray &ba)
Constructs a byte array list that contains the given byte array,
\a ba. Longer lists are easily created like this:
\snippet qbytearraylist/main.cpp 0
\sa append()
*/
/*!
\fn QByteArrayList::QByteArrayList(const QByteArrayList &other)
Constructs a copy of the \a other byte array list.
This operation takes \l{constant time} because QByteArrayList is
\l{implicitly shared}, making the process of returning a
QByteArrayList from a function very fast. If a shared instance is
modified, it will be copied (copy-on-write), and that takes
\l{linear time}.
\sa operator=()
*/
/*!
\fn QByteArrayList::QByteArrayList(const QList<QByteArray> &other)
Constructs a copy of \a other.
This operation takes \l{constant time}, because QByteArrayList is
\l{implicitly shared}. This makes returning a QByteArrayList from a
function very fast. If a shared instance is modified, it will be
copied (copy-on-write), and that takes \l{linear time}.
\sa operator=()
*/
/*! \fn QByteArrayList::QByteArrayList(std::initializer_list<QByteArray> args)
Construct a list from a std::initializer_list given by \a args.
This constructor is only enabled if the compiler supports C++11 initializer
lists.
*/
/*!
\fn QByteArray QByteArrayList::join() const
Joins all the byte arrays into a single byte array.
*/
/*!
\fn QByteArray QByteArrayList::join(const QByteArray &separator) const
Joins all the byte arrays into a single byte array with each
element separated by the given \a separator.
*/
int QByteArrayList_joinedSize(const QByteArrayList *that, int seplen)
{
int totalLength = 0;
const int size = that->size();
for (int i = 0; i < size; ++i)
totalLength += that->at(i).size();
if (size > 0)
totalLength += seplen * (size - 1);
return totalLength;
}
/*!
\fn QByteArray QByteArrayList::join(char separator) const
Joins all the byte arrays into a single byte array with each
element separated by the given \a separator.
*/
QByteArray QtPrivate::QByteArrayList_join(const QByteArrayList *that, const char *sep, int seplen)
{
int totalLength = QByteArrayList_joinedSize(that, seplen);
QByteArray res;
if (totalLength == 0)
return res;
res.reserve(totalLength);
for (int i = 0; i < that->size(); ++i) {
if (i)
res.append(sep, seplen);
res += that->at(i);
}
return res;
}
/*!
\fn QByteArrayList operator+(const QByteArrayList &list1, const QByteArrayList &list2)
\relates QByteArrayList
Returns a byte array list that is the concatenation of \a list1 and \a list2.
*/
/*!
\fn QByteArrayList& operator+=(QByteArrayList &list1, const QByteArrayList &list2)
\relates QByteArrayList
Appends \a list2 to \a list1 and returns a reference to \a list1.
*/
/*!
\fn QByteArrayList &QByteArrayList::operator<<(const QByteArray &ba)
Appends the given byte array, \a ba, to this byte array list and returns
a reference to the byte array list.
\sa append()
*/
/*!
\fn QByteArrayList &QByteArrayList::operator<<(const QByteArrayList &other)
\overload
Appends the \a other byte array list to the byte array list and returns a reference to
the latter byte array list.
*/
/*!
\fn QDataStream &operator>>(QDataStream &in, QByteArrayList &list)
\relates QByteArrayList
Reads a byte array list from the given \a in stream into the specified
\a list.
\sa {Serializing Qt Data Types}
*/
/*!
\fn QDataStream &operator<<(QDataStream &out, const QByteArrayList &list)
\relates QByteArrayList
Writes the given byte array \a list to the specified \a out stream.
\sa {Serializing Qt Data Types}
*/
QT_END_NAMESPACE

View File

@ -1,124 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 by Southwest Research Institute (R)
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module 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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QBYTEARRAYLIST_H
#define QBYTEARRAYLIST_H
#include <QtCore/qdatastream.h>
#include <QtCore/qlist.h>
#include <QtCore/qbytearray.h>
QT_BEGIN_NAMESPACE
typedef QListIterator<QByteArray> QByteArrayListIterator;
typedef QMutableListIterator<QByteArray> QMutableByteArrayListIterator;
class QByteArrayList : public QList<QByteArray>
{
public:
inline QByteArrayList() { }
inline explicit QByteArrayList(const QByteArray &i) { append(i); }
inline QByteArrayList(const QByteArrayList &l) : QList<QByteArray>(l) { }
inline QByteArrayList(const QList<QByteArray> &l) : QList<QByteArray>(l) { }
#ifdef Q_COMPILER_INITIALIZER_LISTS
inline QByteArrayList(std::initializer_list<QByteArray> args) : QList<QByteArray>(args) { }
#endif
inline QByteArray join() const;
inline QByteArray join(const QByteArray &sep) const;
inline QByteArray join(char sep) const;
inline QByteArrayList &operator<<(const QByteArray &str)
{ append(str); return *this; }
inline QByteArrayList &operator<<(const QByteArrayList &l)
{ *this += l; return *this; }
};
Q_DECLARE_TYPEINFO(QByteArrayList, Q_MOVABLE_TYPE);
namespace QtPrivate {
QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *s, int l);
}
inline QByteArray QByteArrayList::join() const
{
return QtPrivate::QByteArrayList_join(this, 0, 0);
}
inline QByteArray QByteArrayList::join(const QByteArray &sep) const
{
return QtPrivate::QByteArrayList_join(this, sep.constData(), sep.size());
}
inline QByteArray QByteArrayList::join(char sep) const
{
return QtPrivate::QByteArrayList_join(this, &sep, 1);
}
inline QByteArrayList operator+(const QByteArrayList &lhs, const QByteArrayList &rhs)
{
QByteArrayList res = lhs;
res += rhs;
return res;
}
inline QByteArrayList& operator+=(QByteArrayList &lhs, const QByteArrayList &rhs)
{
lhs.append( rhs );
return lhs;
}
#ifndef QT_NO_DATASTREAM
inline QDataStream &operator>>(QDataStream &in, QByteArrayList &list)
{
return operator>>(in, static_cast<QList<QByteArray> &>(list));
}
inline QDataStream &operator<<(QDataStream &out, const QByteArrayList &list)
{
return operator<<(out, static_cast<const QList<QByteArray> &>(list));
}
#endif // QT_NO_DATASTREAM
QT_END_NAMESPACE
#endif // QBYTEARRAYLIST_H

View File

@ -241,7 +241,7 @@ public:
3. User increments month: 31/03/2000
At step 1, cachedDay stores 31. At step 2, the 31 is invalid for February, so the cachedDay is not updated.
At step 3, the the month is changed to March, for which 31 is a valid day. Since 29 < 31, the day is set to cachedDay.
At step 3, the month is changed to March, for which 31 is a valid day. Since 29 < 31, the day is set to cachedDay.
This is good for when users have selected their desired day and are scrolling up or down in the month or year section
and do not want smaller months (or non-leap years) to alter the day that they chose.
*/

View File

@ -1232,6 +1232,8 @@ void QEasingCurve::setOvershoot(qreal overshoot)
It is only applicable if type() is QEasingCurve::BezierSpline.
Note that the spline implicitly starts at (0.0, 0.0) and has to end at (1.0, 1.0) to
be a valid easing curve.
\a c1 and \a c2 are the control points used for drawing the curve.
\a endPoint is the endpoint of the curve.
*/
void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint)
{
@ -1290,8 +1292,12 @@ QVector<QPointF> static inline tcbToBezier(const TCBPoints &tcbPoints)
It is only applicable if type() is QEasingCurve::TCBSpline.
The spline has to start explitly at (0.0, 0.0) and has to end at (1.0, 1.0) to
be a valid easing curve.
The three parameters are called tension, continuity and bias. All three parameters are
valid between -1 and 1 and define the tangent of the control point.
The tension \a t changes the length of the tangent vector.
The continuity \a c changes the sharpness in change between the tangents.
The bias \a b changes the direction of the tangent vector.
\a nextPoint is the sample position.
All three parameters are valid between -1 and 1 and define the
tangent of the control point.
If all three parameters are 0 the resulting spline is a Catmull-Rom spline.
The begin and endpoint always have a bias of -1 and 1, since the outer tangent is not defined.
*/
@ -1390,7 +1396,7 @@ void QEasingCurve::setType(Type type)
/*!
Sets a custom easing curve that is defined by the user in the function \a func.
The signature of the function is qreal myEasingFunction(qreal progress),
where \e progress and the return value is considered to be normalized between 0 and 1.
where \e progress and the return value are considered to be normalized between 0 and 1.
(In some cases the return value can be outside that range)
After calling this function type() will return QEasingCurve::Custom.
\a func cannot be zero.
@ -1420,8 +1426,8 @@ QEasingCurve::EasingFunction QEasingCurve::customType() const
/*!
Return the effective progress for the easing curve at \a progress.
While \a progress must be between 0 and 1, the returned effective progress
can be outside those bounds. For instance, QEasingCurve::InBack will
Whereas \a progress must be between 0 and 1, the returned effective progress
can be outside those bounds. For example, QEasingCurve::InBack will
return negative values in the beginning of the function.
*/
qreal QEasingCurve::valueForProgress(qreal progress) const

View File

@ -1617,7 +1617,7 @@ void QString::resize(int size)
This function is useful for code that needs to build up a long
string and wants to avoid repeated reallocation. In this example,
we want to add to the string until some condition is true, and
we want to add to the string until some condition is \c true, and
we're fairly sure that size is large enough to make a call to
reserve() worthwhile:
@ -2534,6 +2534,9 @@ bool QString::operator==(QLatin1String other) const
QT_NO_CAST_FROM_ASCII when you compile your applications. This
can be useful if you want to ensure that all user-visible strings
go through QObject::tr(), for example.
Returns \c true if this string is lexically equal to the parameter
string \a other. Otherwise returns \c false.
*/
/*! \fn bool QString::operator==(const char *other) const
@ -2563,9 +2566,11 @@ bool operator<(const QString &s1, const QString &s2)
{
return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0;
}
/*!
\overload operator<()
\relates QString
Returns \c true if this string is lexically less than the parameter
string called \a other; otherwise returns \c false.
*/
bool QString::operator<(QLatin1String other) const
{
@ -2592,6 +2597,9 @@ bool QString::operator<(QLatin1String other) const
/*! \fn bool QString::operator<(const char *other) const
Returns \c true if this string is lexically less than string \a other.
Otherwise returns \c false.
\overload operator<()
The \a other const char pointer is converted to a QString using
@ -2616,6 +2624,9 @@ bool QString::operator<(QLatin1String other) const
/*! \fn bool QString::operator<=(QLatin1String other) const
Returns \c true if this string is lexically less than or equal to
parameter string \a other. Otherwise returns \c false.
\overload operator<=()
*/
@ -2659,6 +2670,9 @@ bool QString::operator<(QLatin1String other) const
/*!
\overload operator>()
\relates QString
Returns \c true if this string is lexically greater than the parameter
string \a other; otherwise returns \c false.
*/
bool QString::operator>(QLatin1String other) const
{
@ -2710,6 +2724,9 @@ bool QString::operator>(QLatin1String other) const
/*! \fn bool QString::operator>=(QLatin1String other) const
Returns \c true if this string is lexically greater than or equal to parameter
string \a other. Otherwise returns \c false.
\overload operator>=()
*/
@ -2754,6 +2771,9 @@ bool QString::operator>(QLatin1String other) const
/*! \fn bool QString::operator!=(QLatin1String other) const
Returns \c true if this string is not equal to parameter string \a other.
Otherwise returns \c false.
\overload operator!=()
*/
@ -4082,7 +4102,7 @@ QString QString::mid(int position, int n) const
/*!
Returns \c true if the string starts with \a s; otherwise returns
false.
\c false.
If \a cs is Qt::CaseSensitive (default), the search is
case sensitive; otherwise the search is case insensitive.
@ -4109,7 +4129,7 @@ bool QString::startsWith(QLatin1String s, Qt::CaseSensitivity cs) const
\overload startsWith()
Returns \c true if the string starts with \a c; otherwise returns
false.
\c false.
*/
bool QString::startsWith(QChar c, Qt::CaseSensitivity cs) const
{
@ -4138,7 +4158,7 @@ bool QString::startsWith(const QStringRef &s, Qt::CaseSensitivity cs) const
/*!
Returns \c true if the string ends with \a s; otherwise returns
false.
\c false.
If \a cs is Qt::CaseSensitive (default), the search is case
sensitive; otherwise the search is case insensitive.
@ -4181,7 +4201,7 @@ bool QString::endsWith(QLatin1String s, Qt::CaseSensitivity cs) const
/*!
Returns \c true if the string ends with \a c; otherwise returns
false.
\c false.
\overload endsWith()
*/
@ -4581,7 +4601,7 @@ QString& QString::setUnicode(const QChar *unicode, int size)
replaced with a single space.
Whitespace means any character for which QChar::isSpace() returns
true. This includes the ASCII characters '\\t', '\\n', '\\v',
\c true. This includes the ASCII characters '\\t', '\\n', '\\v',
'\\f', '\\r', and ' '.
Example:
@ -4671,7 +4691,7 @@ QString QString::simplified() const
the end.
Whitespace means any character for which QChar::isSpace() returns
true. This includes the ASCII characters '\\t', '\\n', '\\v',
\c true. This includes the ASCII characters '\\t', '\\n', '\\v',
'\\f', '\\r', and ' '.
Example:
@ -4866,7 +4886,7 @@ QString& QString::fill(QChar ch, int size)
/*! \fn bool QString::isEmpty() const
Returns \c true if the string has no characters; otherwise returns
false.
\c false.
Example:
@ -4981,7 +5001,7 @@ QString& QString::fill(QChar ch, int size)
\relates QString
Returns \c true if \a s1 is not equal to \a s2; otherwise returns
false.
\c false.
For \a s1 != 0, this is equivalent to \c {compare(} \a s1, \a s2
\c {) != 0}. Note that no string is equal to \a s1 being 0.
@ -5389,12 +5409,12 @@ const ushort *QString::utf16() const
Returns a string of size \a width that contains this string
padded by the \a fill character.
If \a truncate is false and the size() of the string is more than
If \a truncate is \c false and the size() of the string is more than
\a width, then the returned string is a copy of the string.
\snippet qstring/main.cpp 32
If \a truncate is true and the size() of the string is more than
If \a truncate is \c true and the size() of the string is more than
\a width, then any characters in a copy of the string after
position \a width are removed, and the copy is returned.
@ -5430,7 +5450,7 @@ QString QString::leftJustified(int width, QChar fill, bool truncate) const
\snippet qstring/main.cpp 49
If \a truncate is false and the size() of the string is more than
If \a truncate is \c false and the size() of the string is more than
\a width, then the returned string is a copy of the string.
If \a truncate is true and the size() of the string is more than
@ -6053,8 +6073,8 @@ QString &QString::vsprintf(const char* cformat, va_list ap)
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6093,8 +6113,8 @@ qlonglong QString::toIntegral_helper(const QChar *data, int len, bool *ok, int b
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6134,8 +6154,8 @@ qulonglong QString::toIntegral_helper(const QChar *data, uint len, bool *ok, int
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6163,8 +6183,8 @@ long QString::toLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6191,8 +6211,8 @@ ulong QString::toULong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6218,8 +6238,8 @@ int QString::toInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6245,8 +6265,8 @@ uint QString::toUInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6272,8 +6292,8 @@ short QString::toShort(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -6300,8 +6320,8 @@ ushort QString::toUShort(bool *ok, int base) const
Returns 0.0 if the conversion fails.
If a conversion error occurs, \c{*}\a{ok} is set to false;
otherwise \c{*}\a{ok} is set to true.
If a conversion error occurs, \c{*}\a{ok} is set to \c false;
otherwise \c{*}\a{ok} is set to \c true.
\snippet qstring/main.cpp 66
@ -6332,8 +6352,8 @@ double QString::toDouble(bool *ok) const
/*!
Returns the string converted to a \c float value.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true. Returns 0.0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true. Returns 0.0 if the conversion fails.
The string conversion will always happen in the 'C' locale. For locale
dependent conversion use QLocale::toFloat()
@ -8276,7 +8296,7 @@ ownership of it, no memory is freed when instances are destroyed.
\fn bool QStringRef::isEmpty() const
Returns \c true if the string reference has no characters; otherwise returns
false.
\c false.
A string reference is empty if its size is zero.
@ -9523,7 +9543,7 @@ QVector<uint> QStringRef::toUcs4() const
the end.
Whitespace means any character for which QChar::isSpace() returns
true. This includes the ASCII characters '\\t', '\\n', '\\v',
\c true. This includes the ASCII characters '\\t', '\\n', '\\v',
'\\f', '\\r', and ' '.
Unlike QString::simplified(), trimmed() leaves internal whitespace alone.
@ -9555,8 +9575,8 @@ QStringRef QStringRef::trimmed() const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9580,8 +9600,8 @@ qint64 QStringRef::toLongLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9607,8 +9627,8 @@ quint64 QStringRef::toULongLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9634,8 +9654,8 @@ long QStringRef::toLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9660,8 +9680,8 @@ ulong QStringRef::toULong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9685,8 +9705,8 @@ int QStringRef::toInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9710,8 +9730,8 @@ uint QStringRef::toUInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9735,8 +9755,8 @@ short QStringRef::toShort(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true.
If \a base is 0, the C language convention is used: If the string
begins with "0x", base 16 is used; if the string begins with "0",
@ -9761,8 +9781,8 @@ ushort QStringRef::toUShort(bool *ok, int base) const
Returns 0.0 if the conversion fails.
If a conversion error occurs, \c{*}\a{ok} is set to false;
otherwise \c{*}\a{ok} is set to true.
If a conversion error occurs, \c{*}\a{ok} is set to \c false;
otherwise \c{*}\a{ok} is set to \c true.
The string conversion will always happen in the 'C' locale. For locale
dependent conversion use QLocale::toDouble()
@ -9784,8 +9804,8 @@ double QStringRef::toDouble(bool *ok) const
/*!
Returns the string converted to a \c float value.
If a conversion error occurs, *\a{ok} is set to false; otherwise
*\a{ok} is set to true. Returns 0.0 if the conversion fails.
If a conversion error occurs, *\a{ok} is set to \c false; otherwise
*\a{ok} is set to \c true. Returns 0.0 if the conversion fails.
The string conversion will always happen in the 'C' locale. For locale
dependent conversion use QLocale::toFloat()

View File

@ -189,6 +189,8 @@
/*! \fn bool QVarLengthArray::empty() const
\since 5.0
Returns \c true if the array has size 0; otherwise returns \c false.
Same as isEmpty(). Provided for STL-compatibility.
*/
@ -285,7 +287,8 @@
\fn void QVarLengthArray::push_back(const T &t)
\since 5.0
Same as append(). Provided for STL-compatibility.
Appends item \a t to the array, extending the array if necessary.
Provided for STL-compatibility.
*/
/*!
@ -665,8 +668,7 @@
/*! \fn QVarLengthArray &QVarLengthArray::operator+=(const T &value)
\since 4.8
Appends \a value to the array and returns a reference to this
vector.
Appends \a value to the array and returns a reference to this vector.
\sa append(), operator<<()
*/

View File

@ -565,6 +565,7 @@
/*! \fn void QVector::removeAt(int i)
\since 5.2
Removes the element at index position \a i.
Equivalent to
\code
remove(i);
@ -588,6 +589,8 @@
/*! \fn T QVector::takeAt(int i)
\since 5.2
Removes the element at index position \a i and returns it.
Equivalent to
\code
T t = at(i);
@ -907,7 +910,7 @@
/*! \fn bool QVector::empty() const
This function is provided for STL compatibility. It is equivalent
to isEmpty(), returning true if the vector is empty; otherwise
to isEmpty(), returning \c true if the vector is empty; otherwise
returns \c false.
*/

View File

@ -9,7 +9,6 @@ HEADERS += \
tools/qarraydatapointer.h \
tools/qbitarray.h \
tools/qbytearray.h \
tools/qbytearraylist.h \
tools/qbytearraymatcher.h \
tools/qbytedata_p.h \
tools/qcache.h \
@ -78,7 +77,6 @@ SOURCES += \
tools/qarraydata.cpp \
tools/qbitarray.cpp \
tools/qbytearray.cpp \
tools/qbytearraylist.cpp \
tools/qbytearraymatcher.cpp \
tools/qcollator.cpp \
tools/qcommandlineoption.cpp \
@ -127,7 +125,8 @@ false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
SOURCES += tools/qelapsedtimer_mac.cpp
OBJECTIVE_SOURCES += tools/qlocale_mac.mm \
tools/qtimezoneprivate_mac.mm \
tools/qstring_mac.mm
tools/qstring_mac.mm \
tools/qbytearray_mac.mm
}
else:blackberry {
SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_blackberry.cpp tools/qtimezoneprivate_tz.cpp

View File

@ -605,6 +605,8 @@ const QDBusArgument &QDBusArgument::operator>>(uchar &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toByte();
else
arg = 0;
return *this;
}
@ -617,6 +619,8 @@ const QDBusArgument &QDBusArgument::operator>>(bool &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toBool();
else
arg = false;
return *this;
}
@ -629,6 +633,8 @@ const QDBusArgument &QDBusArgument::operator>>(ushort &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toUShort();
else
arg = 0;
return *this;
}
@ -641,6 +647,8 @@ const QDBusArgument &QDBusArgument::operator>>(short &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toShort();
else
arg = 0;
return *this;
}
@ -653,6 +661,8 @@ const QDBusArgument &QDBusArgument::operator>>(int &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toInt();
else
arg = 0;
return *this;
}
@ -665,6 +675,8 @@ const QDBusArgument &QDBusArgument::operator>>(uint &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toUInt();
else
arg = 0;
return *this;
}
@ -677,6 +689,8 @@ const QDBusArgument &QDBusArgument::operator>>(qlonglong &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toLongLong();
else
arg = 0;
return *this;
}
@ -689,6 +703,8 @@ const QDBusArgument &QDBusArgument::operator>>(qulonglong &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toULongLong();
else
arg = 0;
return *this;
}
@ -701,6 +717,8 @@ const QDBusArgument &QDBusArgument::operator>>(double &arg) const
{
if (QDBusArgumentPrivate::checkReadAndDetach(d))
arg = d->demarshaller()->toDouble();
else
arg = 0;
return *this;
}

View File

@ -71,7 +71,8 @@ QT_END_NAMESPACE
This function needs to handle all messages to the path of the
virtual object, when the SubPath option is specified.
The service, path, interface and methos are all part of the \a message.
Must return true when the message is handled, otherwise false (will generate dbus error message).
Parameter \a connection is the connection handle.
Must return \c true when the message is handled, otherwise \c false (will generate dbus error message).
*/

View File

@ -18,8 +18,6 @@ win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
\$\$QT_MODULE_INCLUDE_BASE/QtANGLE
}
contains(QT_CONFIG, dynamicgl): DEFINES += QT_OPENGL_DYNAMIC_IN_GUI
load(qt_module)
# Code coverage with TestCocoon
@ -32,7 +30,7 @@ testcocoon {
mac:!ios: LIBS_PRIVATE += -framework Cocoa
CONFIG += simd
CONFIG += simd optimize_full
include(accessible/accessible.pri)
include(kernel/kernel.pri)
@ -86,7 +84,7 @@ contains(QT_CONFIG, angle) {
} else:contains(QT_CONFIG, opengl) {
!isEmpty(QMAKE_INCDIR_OPENGL): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL)
CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
!contains(QT_CONFIG, dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
!isEmpty(QMAKE_LIBDIR_OPENGL): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL)
CMAKE_GL_HEADER_NAME = GL/gl.h
mac: CMAKE_GL_HEADER_NAME = gl.h

View File

@ -3295,11 +3295,14 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
n = "MouseButtonDblClick";
break;
}
dbg.nospace() << "QMouseEvent(" << n
QDebug nsp = dbg.nospace();
nsp << "QMouseEvent(" << n
<< ", " << me->button()
<< ", " << hex << (int)me->buttons()
<< ", " << hex << (int)me->modifiers()
<< ')';
<< ", " << hex << (int)me->modifiers() << dec;
if (const Qt::MouseEventSource source = me->source())
nsp << ", source = " << source;
nsp << ')';
}
return dbg.space();

View File

@ -145,7 +145,7 @@ ulong QGuiApplicationPrivate::mousePressTime = 0;
Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
int QGuiApplicationPrivate::mousePressX = 0;
int QGuiApplicationPrivate::mousePressY = 0;
int QGuiApplicationPrivate::mouse_double_click_distance = 5;
int QGuiApplicationPrivate::mouse_double_click_distance = -1;
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
@ -910,7 +910,7 @@ qreal QGuiApplication::devicePixelRatio() const
}
/*!
Returns the top level window at the given position, if any.
Returns the top level window at the given position \a pos, if any.
*/
QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
{
@ -1007,16 +1007,17 @@ static void init_platform(const QString &pluginArgument, const QString &platform
if (!platformThemeName.isEmpty())
themeNames.append(platformThemeName);
// 2) Ask the platform integration for a list of names and try loading them.
// 2) Ask the platform integration for a list of theme names
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
// 3) Look for a theme plugin.
foreach (const QString &themeName, themeNames) {
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
if (QGuiApplicationPrivate::platform_theme)
break;
}
// 3) If none found, look for a theme plugin. Theme plugins are located in the
// same directory as platform plugins.
// 4) If no theme plugin was found ask the platform integration to
// create a theme
if (!QGuiApplicationPrivate::platform_theme) {
foreach (const QString &themeName, themeNames) {
QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName);
@ -1026,7 +1027,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform
// No error message; not having a theme plugin is allowed.
}
// 4) Fall back on the built-in "null" platform theme.
// 5) Fall back on the built-in "null" platform theme.
if (!QGuiApplicationPrivate::platform_theme)
QGuiApplicationPrivate::platform_theme = new QPlatformTheme;
@ -1254,6 +1255,8 @@ void QGuiApplicationPrivate::init()
initPalette();
QFont::initialize();
mouse_double_click_distance = platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt();
#ifndef QT_NO_CURSOR
QCursorData::initialize();
#endif
@ -2708,7 +2711,7 @@ void QGuiApplicationPrivate::notifyWindowIconChanged()
\brief whether the application implicitly quits when the last window is
closed.
The default is true.
The default is \c true.
If this property is \c true, the applications quits when the last visible
primary window (i.e. window with no parent) is closed.
@ -2736,7 +2739,7 @@ bool QGuiApplication::quitOnLastWindowClosed()
primary window (i.e. window with no parent) is closed.
By default, QGuiApplication quits after this signal is emitted. This feature
can be turned off by setting \l quitOnLastWindowClosed to false.
can be turned off by setting \l quitOnLastWindowClosed to \c false.
\sa QWindow::close(), QWindow::isTopLevel()
*/
@ -2912,7 +2915,7 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state)
Returns \c true if the application is currently saving the
\l{Session Management}{session}; otherwise returns \c false.
This is true when commitDataRequest() and saveStateRequest() are emitted,
This is \c true when commitDataRequest() and saveStateRequest() are emitted,
but also when the windows are closed afterwards by session management.
\sa sessionId(), commitDataRequest(), saveStateRequest()
@ -3183,7 +3186,7 @@ QStyleHints *QGuiApplication::styleHints()
/*!
Sets whether Qt should use the system's standard colors, fonts, etc., to
\a on. By default, this is true.
\a on. By default, this is \c true.
This function must be called before creating the QGuiApplication object, like
this:
@ -3199,7 +3202,7 @@ void QGuiApplication::setDesktopSettingsAware(bool on)
/*!
Returns \c true if Qt is set to use the system's standard colors, fonts, etc.;
otherwise returns \c false. The default is true.
otherwise returns \c false. The default is \c true.
\sa setDesktopSettingsAware()
*/

View File

@ -52,6 +52,7 @@
#include <QtGui/private/qopengl_p.h>
#include <QtGui/private/qwindow_p.h>
#include <QtGui/QScreen>
#include <qpa/qplatformnativeinterface.h>
#include <private/qopenglextensions_p.h>
#include <private/qopenglversionfunctionsfactory_p.h>
@ -162,7 +163,7 @@ void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion)
}
/*!
Returns the OpenGL profile. Only make sense if profiles are supported by this version.
Returns the OpenGL profile. Only makes sense if profiles are supported by this version.
\sa setProfile(), supportsProfiles()
*/
@ -172,7 +173,8 @@ QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const
}
/*!
Sets the profile. Only make sense if profiles are supported by this version.
Sets the OpenGL profile \a profile. Only makes sense if profiles are supported by
this version.
\sa profile(), supportsProfiles()
*/
@ -204,7 +206,7 @@ bool QOpenGLVersionProfile::isLegacyVersion() const
/*!
Returns \c true if the version number is valid. Note that for a default constructed
QOpenGLVersionProfile object this function will return false.
QOpenGLVersionProfile object this function will return \c false.
\sa setVersion(), version()
*/
@ -256,12 +258,10 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
rendering a new frame, after calling swapBuffers().
If the context is temporarily not needed, such as when the application is
not rendering, it can be useful to call destroy() to free resources.
However, if you do so you will need to call create() again before the
context can be used, and you might need to recreate any OpenGL resources
and reinitialize the OpenGL state. You can connect to the
aboutToBeDestroyed() signal to clean up any resources that have been
allocated with different ownership from the QOpenGLContext itself.
not rendering, it can be useful to delete it in order to free resources.
You can connect to the aboutToBeDestroyed() signal to clean up any
resources that have been allocated with different ownership from the
QOpenGLContext itself.
Once a QOpenGLContext has been made current, you can render to it in a
platform independent way by using Qt's OpenGL enablers such as
@ -335,16 +335,18 @@ int QOpenGLContextPrivate::maxTextureSize()
if (max_texture_size != -1)
return max_texture_size;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
Q_Q(QOpenGLContext);
QOpenGLFunctions *funcs = q->functions();
funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
#ifndef QT_OPENGL_ES
if (!QOpenGLFunctions::isES()) {
if (!q->isES()) {
GLenum proxy = GL_PROXY_TEXTURE_2D;
GLint size;
GLint next = 64;
glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
if (size == 0) {
return max_texture_size;
}
@ -354,8 +356,8 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size);
max_texture_size = size;
@ -633,9 +635,9 @@ QOpenGLFunctions *QOpenGLContext::functions() const
*/
/*!
Returns a pointer to an object that provides access to all functions for
the version of the current context. Before using any of the functions
they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions().
Returns a pointer to an object that provides access to all functions for the
\a versionProfile of the current context. Before using any of the functions they must
be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions().
Usually one would use the template version of this function to automatically
have the result cast to the correct type.
@ -643,8 +645,8 @@ QOpenGLFunctions *QOpenGLContext::functions() const
QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
{
#ifndef QT_OPENGL_ES_2
if (QOpenGLFunctions::isES()) {
qWarning("versionFunctions: Not supported on dynamic GL ES");
if (isES()) {
qWarning("versionFunctions: Not supported on OpenGL ES");
return 0;
}
#endif // QT_OPENGL_ES_2
@ -703,7 +705,7 @@ QSet<QByteArray> QOpenGLContext::extensions() const
/*!
Returns \c true if this OpenGL context supports the specified OpenGL
\a extension, false otherwise.
\a extension, \c false otherwise.
The context or a sharing context must be current.
@ -864,7 +866,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
qWarning() << "QOpenGLContext::swapBuffers() called without corresponding makeCurrent()";
#endif
if (surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer)
glFlush();
functions()->glFlush();
d->platformGLContext->swapBuffers(surfaceHandle);
}
@ -885,6 +887,20 @@ QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) cons
Returns the format of the underlying platform context, if create() has been called.
Otherwise, returns the requested format.
The requested and the actual format may differ. Requesting a given OpenGL version does
not mean the resulting context will target exactly the requested version. It is only
guaranteed that the version/profile/options combination for the created context is
compatible with the request, as long as the driver is able to provide such a context.
For example, requesting an OpenGL version 3.x core profile context may result in an
OpenGL 4.x core profile context. Similarly, a request for OpenGL 2.1 may result in an
OpenGL 3.0 context with deprecated functions enabled. Finally, depending on the
driver, unsupported versions may result in either a context creation failure or in a
context for the highest supported version.
Similar differences are possible in the buffer sizes, for example, the resulting
context may have a larger depth buffer than requested. This is perfectly normal.
*/
QSurfaceFormat QOpenGLContext::format() const
{
@ -959,6 +975,88 @@ void QOpenGLContext::deleteQGLContext()
}
}
/*!
Returns the platform-specific handle for the OpenGL implementation that
is currently in use. (for example, a HMODULE on Windows)
On platforms that do not use dynamic GL switch the return value is null.
The library might be GL-only, meaning that windowing system interface
functions (for example EGL) may live in another, separate library.
\note This function requires that the QGuiApplication instance is already created.
\sa openGLModuleType()
\since 5.3
*/
void *QOpenGLContext::openGLModuleHandle()
{
#ifdef QT_OPENGL_DYNAMIC
QGuiApplication *app = qGuiApp;
Q_ASSERT(app);
return app->platformNativeInterface()->nativeResourceForIntegration(QByteArrayLiteral("glhandle"));
#else
return 0;
#endif
}
/*!
\enum QOpenGLContext::OpenGLModuleType
This enum defines the type of the underlying OpenGL implementation.
\value DesktopGL Desktop OpenGL
\value GLES2 OpenGL ES 2.0 or higher
\value GLES1 OpenGL ES 1.x
\since 5.3
*/
/*!
Returns the underlying OpenGL implementation type.
On platforms where the OpenGL implementation is not dynamically
loaded, the return value is determined during compile time and never
changes.
\note A desktop OpenGL implementation may be capable of creating
ES-compatible contexts too. Therefore in most cases it is more
appropriate to check QSurfaceFormat::renderableType() or using the
the convenience function isES().
\note This function requires that the QGuiApplication instance is already created.
\since 5.3
*/
QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
{
#if defined(QT_OPENGL_DYNAMIC)
Q_ASSERT(qGuiApp);
return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
#elif defined(QT_OPENGL_ES_2)
return GLES2;
#elif defined(QT_OPENGL_ES)
return GLES1;
#else
return DesktopGL;
#endif
}
/*!
Returns true if the context is an OpenGL ES context.
If the context has not yet been created, the result is based on the
requested format set via setFormat().
\sa create(), format(), setFormat()
\since 5.3
*/
bool QOpenGLContext::isES() const
{
return format().renderableType() == QSurfaceFormat::OpenGLES;
}
/*!
\internal
*/

View File

@ -192,6 +192,18 @@ public:
QSet<QByteArray> extensions() const;
bool hasExtension(const QByteArray &extension) const;
static void *openGLModuleHandle();
enum OpenGLModuleType {
DesktopGL,
GLES2,
GLES1
};
static OpenGLModuleType openGLModuleType();
bool isES() const;
Q_SIGNALS:
void aboutToBeDestroyed();

View File

@ -72,8 +72,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
inline QPalette &operator=(QPalette &&other)
{
data.resolve_mask = other.data.resolve_mask;
data.current_group = other.data.current_group;
for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
qSwap(d, other.d); return *this;
}
#endif

View File

@ -229,6 +229,16 @@ QPlatformServices *QPlatformIntegration::services() const
management. This includes the typical desktop platforms. Can be set to false on
platforms where no window management is available, meaning for example that windows
are never repositioned by the window manager. The default implementation returns \c true.
\value AllGLFunctionsQueryable The QOpenGLContext backend provided by the platform is
able to return function pointers from getProcAddress() even for standard OpenGL
functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is
important because the OpenGL specifications do not require this ability from the
getProcAddress implementations of the windowing system interfaces (EGL, WGL, GLX). The
platform plugins may however choose to enhance the behavior in the backend
implementation for QOpenGLContext::getProcAddress() and support returning a function
pointer also for the standard, non-extension functions. This capability is a
prerequisite for dynamic OpenGL loading.
*/
/*!
@ -465,7 +475,31 @@ QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(cons
*/
void QPlatformIntegration::sync()
{
}
#ifndef QT_NO_OPENGL
/*!
Platform integration function for querying the OpenGL implementation type.
Used only when dynamic OpenGL implementation loading is enabled.
Subclasses should reimplement this function and return a value based on
the OpenGL implementation they have chosen to load.
\note The return value does not indicate or limit the types of
contexts that can be created by a given implementation. For example
a desktop OpenGL implementation may be capable of creating OpenGL
ES-compatible contexts too.
\sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isES()
\since 5.3
*/
QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
{
qWarning("This plugin does not support dynamic OpenGL loading!");
return QOpenGLContext::DesktopGL;
}
#endif
QT_END_NAMESPACE

View File

@ -54,6 +54,7 @@
#include <QtGui/qwindowdefs.h>
#include <qpa/qplatformscreen.h>
#include <QtGui/qsurfaceformat.h>
#include <QtGui/qopenglcontext.h>
QT_BEGIN_NAMESPACE
@ -96,7 +97,8 @@ public:
NativeWidgets,
WindowManagement,
SyncState,
RasterGLSurface
RasterGLSurface,
AllGLFunctionsQueryable
};
virtual ~QPlatformIntegration() { }
@ -169,6 +171,11 @@ public:
#endif
virtual void sync();
#ifndef QT_NO_OPENGL
virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
#endif
protected:
void screenAdded(QPlatformScreen *screen);
};

View File

@ -499,6 +499,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(false);
case MousePressAndHoldInterval:
return QVariant(800);
case MouseDoubleClickDistance:
return QVariant(5);
}
return QVariant();
}

View File

@ -108,7 +108,8 @@ public:
PasswordMaskCharacter,
DialogSnapToDefaultButton,
ContextMenuOnMouseRelease,
MousePressAndHoldInterval
MousePressAndHoldInterval,
MouseDoubleClickDistance
};
enum DialogType {

View File

@ -116,6 +116,8 @@ void QBasicDrag::disableEventFilter()
bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
{
Q_UNUSED(o);
if (!m_drag) {
if (e->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
disableEventFilter();
@ -125,9 +127,6 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
return false;
}
if (!qobject_cast<QWindow *>(o))
return false;
switch (e->type()) {
case QEvent::ShortcutOverride:
// prevent accelerators from firing while dragging
@ -324,9 +323,10 @@ void QSimpleDrag::startDrag()
void QSimpleDrag::cancel()
{
QBasicDrag::cancel();
if (drag())
if (drag() && m_current_window) {
QWindowSystemInterface::handleDrag(m_current_window, 0, QPoint(), Qt::IgnoreAction);
m_current_window = 0;
}
}
void QSimpleDrag::move(const QMouseEvent *me)

View File

@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QTouchDevice
\brief The QTouchDevice class describes the device from with touch events originate.
\brief The QTouchDevice class describes the device from which touch events originate.
\since 5.0
\ingroup touch
\inmodule QtGui

View File

@ -642,7 +642,7 @@ void QWindow::setFormat(const QSurfaceFormat &format)
}
/*!
Returns the requested surfaceformat of this window.
Returns the requested surface format of this window.
If the requested format was not supported by the platform implementation,
the requestedFormat will differ from the actual window format.
@ -662,9 +662,17 @@ QSurfaceFormat QWindow::requestedFormat() const
After the window has been created, this function will return the actual surface format
of the window. It might differ from the requested format if the requested format could
not be fulfilled by the platform.
not be fulfilled by the platform. It might also be a superset, for example certain
buffer sizes may be larger than requested.
\sa create(), requestedFormat()
\note Depending on the platform, certain values in this surface format may still
contain the requested values, that is, the values that have been passed to
setFormat(). Typical examples are the OpenGL version, profile and options. These may
not get updated during create() since these are context specific and a single window
may be used together with multiple contexts over its lifetime. Use the
QOpenGLContext's format() instead to query such values.
\sa create(), requestedFormat(), QOpenGLContext::format()
*/
QSurfaceFormat QWindow::format() const
{

View File

@ -80,12 +80,7 @@ public:
float operator[](int i) const;
float length() const;
#ifdef QT_BUILD_GUI_LIB
float lengthSquared() const;
#else
Q_DECL_CONSTEXPR inline float lengthSquared() const
{ return xp * xp + yp * yp; }
#endif
float lengthSquared() const; //In Qt 6 convert to inline and constexpr
QVector2D normalized() const;
void normalize();
@ -99,12 +94,7 @@ public:
QVector2D &operator*=(const QVector2D &vector);
QVector2D &operator/=(float divisor);
#ifdef QT_BUILD_GUI_LIB
static float dotProduct(const QVector2D& v1, const QVector2D& v2);
#else
Q_DECL_CONSTEXPR inline static float dotProduct(const QVector2D& v1, const QVector2D& v2)
{ return v1.xp * v2.xp + v1.yp * v2.yp; }
#endif
static float dotProduct(const QVector2D& v1, const QVector2D& v2); //In Qt 6 convert to inline and constexpr
Q_DECL_CONSTEXPR friend inline bool operator==(const QVector2D &v1, const QVector2D &v2);
Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector2D &v1, const QVector2D &v2);

View File

@ -95,17 +95,9 @@ public:
QVector3D &operator*=(const QVector3D& vector);
QVector3D &operator/=(float divisor);
#ifdef QT_BUILD_GUI_LIB
static float dotProduct(const QVector3D& v1, const QVector3D& v2);
static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2);
#else
Q_DECL_CONSTEXPR inline static float dotProduct(const QVector3D& v1, const QVector3D& v2)
{ return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp; }
Q_DECL_CONSTEXPR inline static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2)
{ return QVector3D(v1.yp * v2.zp - v1.zp * v2.yp,
v1.zp * v2.xp - v1.xp * v2.zp,
v1.xp * v2.yp - v1.yp * v2.xp); }
#endif
static float dotProduct(const QVector3D& v1, const QVector3D& v2); //In Qt 6 convert to inline and constexpr
static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2); //in Qt 6 convert to inline and constexpr
static QVector3D normal(const QVector3D& v1, const QVector3D& v2);
static QVector3D normal
(const QVector3D& v1, const QVector3D& v2, const QVector3D& v3);

View File

@ -86,12 +86,7 @@ public:
float operator[](int i) const;
float length() const;
#ifdef QT_BUILD_GUI_LIB
float lengthSquared() const;
#else
Q_DECL_CONSTEXPR inline float lengthSquared() const
{ return xp * xp + yp * yp + zp * zp + wp * wp; }
#endif
float lengthSquared() const; //In Qt 6 convert to inline and constexpr
QVector4D normalized() const;
void normalize();
@ -102,12 +97,7 @@ public:
QVector4D &operator*=(const QVector4D &vector);
QVector4D &operator/=(float divisor);
#ifdef QT_BUILD_GUI_LIB
static float dotProduct(const QVector4D& v1, const QVector4D& v2);
#else
static float dotProduct(const QVector4D& v1, const QVector4D& v2)
{ return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp + v1.wp * v2.wp; }
#endif
static float dotProduct(const QVector4D& v1, const QVector4D& v2); //In Qt 6 convert to inline and constexpr
Q_DECL_CONSTEXPR friend inline bool operator==(const QVector4D &v1, const QVector4D &v2);
Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector4D &v1, const QVector4D &v2);

View File

@ -122,8 +122,4 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
SOURCES += opengl/qopenglfunctions_es2.cpp
}
contains(QT_CONFIG, dynamicgl) {
win32: SOURCES += opengl/qopenglproxy_win.cpp
}
}

View File

@ -53,7 +53,9 @@ typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
{
const char *extensionStr = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
QOpenGLContext *ctx = QOpenGLContext::currentContext();
QOpenGLFunctions *funcs = ctx->functions();
const char *extensionStr = reinterpret_cast<const char *>(funcs->glGetString(GL_EXTENSIONS));
if (extensionStr) {
QByteArray ba(extensionStr);
@ -64,9 +66,8 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
#else
} else {
// clear error state
while (glGetError()) {}
while (funcs->glGetError()) {}
QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (ctx) {
qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");
@ -74,7 +75,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
return;
GLint numExtensions;
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
funcs->glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
for (int i = 0; i < numExtensions; ++i) {
const char *str = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));

View File

@ -66,7 +66,7 @@
// which the system headers do not.
#if defined(QT_OPENGL_ES_2)
# if defined(Q_OS_MAC)
# if defined(Q_OS_MAC) // iOS
# include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h>
@ -78,7 +78,7 @@
*/
typedef void* GLeglImageOES;
# else // "uncontrolled" platforms
# else // "uncontrolled" ES2 platforms
# include <GLES2/gl2.h>
/*
@ -90,14 +90,14 @@ typedef void* GLeglImageOES;
typedef char GLchar;
# include <QtGui/qopengles2ext.h>
# endif // Q_OS_MAC
# ifndef GL_DOUBLE
# define GL_DOUBLE GL_FLOAT
# endif
# ifndef GLdouble
typedef GLfloat GLdouble;
# endif
# endif // Q_OS_MAC
#else
#else // non-ES2 platforms
# if defined(Q_OS_MAC)
# include <OpenGL/gl.h>
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
@ -107,20 +107,10 @@ typedef GLfloat GLdouble;
# include <OpenGL/glext.h>
# else
# define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h
// In dynamic GL builds qopenglproxy will export the GL functions that are
// called also in QtGui itself. To prevent linker warnings (msvc) or errors (mingw)
// we need to make sure the prototypes do not have dllimport.
# ifdef QT_OPENGL_DYNAMIC_IN_GUI
# undef WINGDIAPI
# define WINGDIAPI
# endif // QT_OPENGL_DYNAMIC_IN_GUI
# include <GL/gl.h>
# ifdef QT_OPENGL_DYNAMIC_IN_GUI
# undef WINGDIAPI
# endif // QT_OPENGL_DYNAMIC_IN_GUI
# include <QtGui/qopenglext.h>
# endif // Q_OS_MAC
#endif
#endif // QT_OPENGL_ES_2
// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3
// and desktops apart from Mac can support OpenGL 4

View File

@ -333,13 +333,13 @@ void QOpenGLBuffer::destroy()
bool QOpenGLBuffer::read(int offset, void *data, int count)
{
#if !defined(QT_OPENGL_ES)
if (QOpenGLFunctions::platformGLType() != QOpenGLFunctions::GLES1) {
if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) {
Q_D(QOpenGLBuffer);
if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
return false;
while (glGetError() != GL_NO_ERROR) ; // Clear error state.
while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state.
d->funcs->glGetBufferSubData(d->type, offset, count, data);
return glGetError() == GL_NO_ERROR;
return d->funcs->glGetError() == GL_NO_ERROR;
}
#else
Q_UNUSED(offset);

View File

@ -1370,7 +1370,7 @@ bool QOpenGLDebugLogger::initialize()
// through wglGetProcAddress
#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2)
{
HMODULE handle = static_cast<HMODULE>(QOpenGLFunctions::platformGLHandle());
HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle());
if (!handle)
handle = GetModuleHandleA("opengl32.dll");
d->glGetPointerv = reinterpret_cast<qt_glGetPointerv_t>(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv")));
@ -1381,7 +1381,7 @@ bool QOpenGLDebugLogger::initialize()
#undef GET_DEBUG_PROC_ADDRESS
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength);
QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength);
#ifndef QT_NO_DEBUG
if (!d->context->format().testOption(QSurfaceFormat::DebugContext)) {
@ -1449,15 +1449,16 @@ void QOpenGLDebugLogger::startLogging(QOpenGLDebugLogger::LoggingMode loggingMod
d->glDebugMessageCallback(&qt_opengl_debug_callback, d);
d->debugWasEnabled = glIsEnabled(GL_DEBUG_OUTPUT);
d->syncDebugWasEnabled = glIsEnabled(GL_DEBUG_OUTPUT_SYNCHRONOUS);
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
d->debugWasEnabled = funcs->glIsEnabled(GL_DEBUG_OUTPUT);
d->syncDebugWasEnabled = funcs->glIsEnabled(GL_DEBUG_OUTPUT_SYNCHRONOUS);
if (d->loggingMode == SynchronousLogging)
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
funcs->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
else
glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
funcs->glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glEnable(GL_DEBUG_OUTPUT);
funcs->glEnable(GL_DEBUG_OUTPUT);
}
/*!
@ -1486,13 +1487,14 @@ void QOpenGLDebugLogger::stopLogging()
d->glDebugMessageCallback(d->oldDebugCallbackFunction, d->oldDebugCallbackParameter);
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
if (!d->debugWasEnabled)
glDisable(GL_DEBUG_OUTPUT);
funcs->glDisable(GL_DEBUG_OUTPUT);
if (d->syncDebugWasEnabled)
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
funcs->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
else
glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
funcs->glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
}
/*!

View File

@ -164,7 +164,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader;
code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader;
if (QOpenGLFunctions::isES())
if (context->isES())
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_ES;
else
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_desktop;

View File

@ -90,7 +90,7 @@
qopenglslMainVertexShader
qopenglslMainWithTexCoordsVertexShader
And the the following position vertex shaders:
And the following position vertex shaders:
qopenglslPositionOnlyVertexShader
qopenglslPositionWithTextureBrushVertexShader
qopenglslPositionWithPatternBrushVertexShader

View File

@ -517,6 +517,41 @@ static const char* const qopenglslRgbMaskFragmentShaderPass2 = "\n\
ExclusionCompositionModeFragmentShader,
*/
// OpenGL 3.2 core profile versions of shaders that are used by QOpenGLTextureGlyphCache
static const char* const qopenglslMainWithTexCoordsVertexShader_core = "#version 150 core \n\
in vec2 textureCoordArray; \n\
out vec2 textureCoords; \n\
void setPosition(); \n\
void main(void) \n\
{ \n\
setPosition(); \n\
textureCoords = textureCoordArray; \n\
}\n";
static const char* const qopenglslUntransformedPositionVertexShader_core = "\n\
in vec4 vertexCoordsArray; \n\
void setPosition(void) \n\
{ \n\
gl_Position = vertexCoordsArray; \n\
}\n";
static const char* const qopenglslMainFragmentShader_core = "#version 150 core \n\
vec4 srcPixel(); \n\
out vec4 fragColor; \n\
void main() \n\
{ \n\
fragColor = srcPixel(); \n\
}\n";
static const char* const qopenglslImageSrcFragmentShader_core = "\n\
in vec2 textureCoords; \n\
uniform sampler2D imageTexture; \n\
vec4 srcPixel() \n\
{ \n"
"return texture(imageTexture, textureCoords); \n"
"}\n";
QT_END_NAMESPACE
#endif // GLGC_SHADER_SOURCE_H

View File

@ -57,11 +57,11 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_DEBUG
#define QT_RESET_GLERROR() \
{ \
while (glGetError() != GL_NO_ERROR) {} \
while (QOpenGLContext::currentContext()->functions()->glGetError() != GL_NO_ERROR) {} \
}
#define QT_CHECK_GLERROR() \
{ \
GLenum err = glGetError(); \
GLenum err = QOpenGLContext::currentContext()->functions()->glGetError(); \
if (err != GL_NO_ERROR) { \
qDebug("[%s line %d] OpenGL Error: %d", \
__FILE__, __LINE__, (int)err); \
@ -405,9 +405,9 @@ namespace
funcs->glDeleteRenderbuffers(1, &id);
}
void freeTextureFunc(QOpenGLFunctions *, GLuint id)
void freeTextureFunc(QOpenGLFunctions *funcs, GLuint id)
{
glDeleteTextures(1, &id);
funcs->glDeleteTextures(1, &id);
}
}
@ -432,7 +432,7 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
#ifndef QT_OPENGL_ES_2
GLint maxSamples;
glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
funcs.glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
samples = qBound(0, int(samples), int(maxSamples));
#endif
@ -497,15 +497,15 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal
QOpenGLContext *ctx = QOpenGLContext::currentContext();
GLuint texture = 0;
glGenTextures(1, &texture);
glBindTexture(target, texture);
funcs.glGenTextures(1, &texture);
funcs.glBindTexture(target, texture);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0,
funcs.glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
if (mipmap) {
int width = size.width();
@ -515,7 +515,7 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal
width = qMax(1, width >> 1);
height = qMax(1, height >> 1);
++level;
glTexImage2D(target, level, internal_format, width, height, 0,
funcs.glTexImage2D(target, level, internal_format, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
}
@ -523,12 +523,12 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal
target, texture, 0);
QT_CHECK_GLERROR();
glBindTexture(target, 0);
funcs.glBindTexture(target, 0);
valid = checkFramebufferStatus(ctx);
if (valid)
texture_guard = new QOpenGLSharedResourceGuard(ctx, texture, freeTextureFunc);
else
glDeleteTextures(1, &texture);
funcs.glDeleteTextures(1, &texture);
}
void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpenGLFramebufferObject::Attachment attachment)
@ -590,7 +590,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) {
if (QOpenGLFunctions::isES()) {
if (ctx->isES()) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24))
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
GL_DEPTH_COMPONENT24, size.width(), size.height());
@ -602,7 +602,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
GL_DEPTH_COMPONENT, size.width(), size.height());
}
} else {
if (QOpenGLFunctions::isES()) {
if (ctx->isES()) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) {
funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
size.width(), size.height());
@ -631,7 +631,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
#ifdef QT_OPENGL_ES
GLenum storage = GL_STENCIL_INDEX8;
#else
GLenum storage = QOpenGLFunctions::isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
GLenum storage = ctx->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
#endif
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
@ -773,7 +773,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
Q_D(QOpenGLFramebufferObject);
d->init(this, size, NoAttachment, target,
#ifndef QT_OPENGL_ES_2
QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8
QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
#else
GL_RGBA
#endif
@ -793,7 +793,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum
Q_D(QOpenGLFramebufferObject);
d->init(this, QSize(width, height), NoAttachment, target,
#ifndef QT_OPENGL_ES_2
QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8
QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
#else
GL_RGBA
#endif
@ -850,7 +850,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attach
#ifdef QT_OPENGL_ES_2
internal_format = GL_RGBA;
#else
internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
#endif
d->init(this, QSize(width, height), attachment, target, internal_format);
}
@ -877,7 +877,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment
#ifdef QT_OPENGL_ES_2
internal_format = GL_RGBA;
#else
internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
#endif
d->init(this, size, attachment, target, internal_format);
}
@ -1084,7 +1084,8 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format,
int w = size.width();
int h = size.height();
while (glGetError());
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
while (funcs->glGetError());
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied
@ -1094,14 +1095,14 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format,
#else
GLint fmt = GL_BGRA;
#endif
glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits());
if (!glGetError())
funcs->glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits());
if (!funcs->glGetError())
return img.mirrored();
#endif
QImage rgbaImage(size, (alpha_format && include_alpha) ? QImage::Format_RGBA8888_Premultiplied
: QImage::Format_RGBX8888);
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits());
funcs->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits());
return rgbaImage.mirrored();
}

View File

@ -70,7 +70,12 @@ public:
mipmap(false)
{
#ifndef QT_OPENGL_ES_2
internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
// There is nothing that says QOpenGLFramebufferObjectFormat needs a current
// context, so we need a fallback just to be safe, even though in pratice there
// will usually be a context current.
QOpenGLContext *ctx = QOpenGLContext::currentContext();
const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL;
internal_format = isES ? GL_RGBA : GL_RGBA8;
#else
internal_format = GL_RGBA;
#endif

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