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

Conflicts:
	src/corelib/io/qdatastream.cpp
	src/corelib/io/qdatastream.h
	src/corelib/json/qjsonwriter.cpp
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/xcb/qxcbkeyboard.cpp

Change-Id: I46fef1455f5a9f2ce1ec394a3c65881093c51b62
This commit is contained in:
Frederik Gladhorn 2013-05-23 21:27:07 +02:00
commit d3a8bc803c
440 changed files with 77232 additions and 3166 deletions

View File

@ -1,44 +0,0 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
:: Contact: http://www.qt-project.org/legal
::
:: This file is part of the tools applications 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$
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
rem ***** This assumes PERL is in the PATH *****
set scriptpath=%~dp0
perl.exe %scriptpath%syncqt %*

View File

@ -0,0 +1,60 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and 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 <xcb/xcb.h>
// This is needed to make Qt compile together with XKB. xkb.h is using a variable
// which is called 'explicit', this is a reserved keyword in c++ */
#define explicit dont_use_cxx_explicit
#include <xcb/xkb.h>
#undef explicit
int main(int, char **)
{
int primaryScreen = 0;
xcb_connection_t *connection = xcb_connect("", &primaryScreen);
// This won't compile unless libxcb >= 1.5 which defines XCB_ATOM_PRIMARY.
int xcbAtomPrimary = XCB_ATOM_PRIMARY;
return 0;
}

View File

@ -0,0 +1,5 @@
SOURCES = xcb-xkb.cpp
CONFIG -= qt
LIBS += -lxcb -lxcb-xkb

355
configure vendored
View File

@ -446,6 +446,8 @@ if [ "$OSTYPE" = "msys" ]; then
BUILD_ON_MSYS=yes
DEV_NULL=/tmp/empty-file
echo "" > $DEV_NULL
relpath=`(cd "$relpath"; pwd -W)`
outpath=`pwd -W`
fi
#-------------------------------------------------------------------------------
@ -901,7 +903,7 @@ CFG_USE_GNUMAKE=no
CFG_XINPUT2=auto
CFG_XINPUT=runtime
CFG_XKB=auto
CFG_XKBCOMMON=no
CFG_XKBCOMMON=auto
CFG_XCB=auto
CFG_XCB_GLX=no
CFG_EGLFS=auto
@ -1001,6 +1003,7 @@ CFG_SYSROOT=
CFG_GCC_SYSROOT="yes"
QT_HOST_PREFIX=
QT_HOST_BINS=
QT_HOST_LIBS=
QT_HOST_DATA=
#flags for SQL drivers
@ -1109,7 +1112,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style options that pass an argument
-prefix|-docdir|-headerdir|-plugindir|-importdir|-qmldir|-archdatadir|-datadir|-libdir|-bindir|-libexecdir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-skip|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig|-android-sdk|-android-ndk|-android-ndk-platform|-android-ndk-host|-android-arch|-android-toolchain-version)
-prefix|-docdir|-headerdir|-plugindir|-importdir|-qmldir|-archdatadir|-datadir|-libdir|-bindir|-libexecdir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-skip|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-hostlibdir|-qpa|-qconfig|-android-sdk|-android-ndk|-android-ndk-platform|-android-ndk-host|-android-arch|-android-toolchain-version)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
shift
VAL="$1"
@ -1294,6 +1297,9 @@ while [ "$#" -gt 0 ]; do
hostbindir)
QT_HOST_BINS="$VAL"
;;
hostlibdir)
QT_HOST_LIBS="$VAL"
;;
pkg-config)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_PKGCONFIG="$VAL"
@ -1409,7 +1415,7 @@ while [ "$#" -gt 0 ]; do
OPT_OBSOLETE_HOST_ARG=yes
;;
harfbuzz)
if [ "$BUILD_ON_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
if ([ "$BUILD_ON_MAC" = "yes" ] && [ "$VAL" = "yes" ]) || [ "$VAL" = "no" ]; then
CFG_MAC_HARFBUZZ="$VAL"
else
UNKNOWN_OPT=yes
@ -1839,6 +1845,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
xkbcommon)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "qt" ] || [ "$VAL" = "system" ]; then
CFG_XKBCOMMON="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
xcb)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ] || [ "$VAL" = "qt" ]; then
CFG_XCB="$VAL"
@ -2360,6 +2373,11 @@ if [ "$PLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then
echo
fi
if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then
echo "Error: -no-xkbcommon is not supported on XCB platform plugin."
exit 101
fi
if [ "$CFG_SILENT" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG silent"
fi
@ -2378,26 +2396,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then
[ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
# make a syncqt script that can be used in the shadow
rm -f "$outpath/bin/syncqt"
if [ -x "$relpath/bin/syncqt" ]; then
mkdir -p "$outpath/bin"
echo "#!/bin/sh" >"$outpath/bin/syncqt"
echo "perl \"$relpath/bin/syncqt\" \"\$@\"" >>"$outpath/bin/syncqt"
chmod 755 "$outpath/bin/syncqt"
fi
for i in elf2e32_qtwrapper createpackage patch_capabilities qtmodule-configtests; do
rm -f "$outpath/bin/$i"
if [ -x "$relpath/bin/$i" ]; then
mkdir -p "$outpath/bin"
echo "#!/bin/sh" >"$outpath/bin/$i"
echo "QTDIR=\"$relpath\"; export QTDIR" >>"$outpath/bin/$i"
echo "\"$relpath/bin/$i\" \"\$@\"" >>"$outpath/bin/$i"
chmod 755 "$outpath/bin/$i"
fi
done
# save a pre-existing mkspecs/modules dir
test -d "$outpath/mkspecs/modules" && \
mv "$outpath/mkspecs/modules" "$outpath/mkspecs-modules"
@ -2485,7 +2483,10 @@ if [ -z "$PLATFORM" ]; then
# about the OS version, since we're not using the clang version that comes
# with the system. We use 'xcrun' to check the clang version that's part of
# the Xcode installation.
if [ "$(/usr/bin/xcrun -sdk macosx clang -v 2>&1 | sed -n 's/.*version \([0-9]\).*/\1/p')" -ge 3 ]; then
XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1`
CLANGVERSION=`echo "$XCRUN" | sed -n 's/.*version \([0-9]\).*/\1/p'`
expr "$CLANGVERSION" : '[0-9]' > /dev/null || { echo "Unable to determine CLANG version from output of xcrun: $XCRUN" ; exit 2 ; }
if [ "$CLANGVERSION" -ge 3 ]; then
PLATFORM=macx-clang
# Advertise g++ as an alternative on Lion and below
@ -2713,10 +2714,6 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then
QT_QPA_DEFAULT_PLATFORM="android"
CFG_LARGEFILE="no"
# FIXME: Qt Creator requires this to be in the lib/ directory of Qt. This line can be removed
# once it's fixed to get the file directly from the NDK.
cp -f $CFG_DEFAULT_ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/libs/$CFG_DEFAULT_ANDROID_TARGET_ARCH/libgnustl_shared.so $outpath/lib
DeviceVar set DEFAULT_ANDROID_SDK_ROOT "$CFG_DEFAULT_ANDROID_SDK_ROOT"
DeviceVar set DEFAULT_ANDROID_NDK_ROOT "$CFG_DEFAULT_ANDROID_NDK_ROOT"
DeviceVar set DEFAULT_ANDROID_PLATFORM "$CFG_DEFAULT_ANDROID_PLATFORM"
@ -3138,6 +3135,15 @@ if [ -z "$QT_HOST_BINS" ]; then #default
fi
QT_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_BINS"`
if [ -z "$QT_HOST_LIBS" ]; then #default
if $haveHpx; then
QT_HOST_LIBS="$QT_HOST_PREFIX/lib" #fallback
else
QT_HOST_LIBS="$QT_INSTALL_LIBS"
fi
fi
QT_HOST_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_LIBS"`
if [ -z "$QT_HOST_DATA" ]; then #default
if $haveHpx; then
QT_HOST_DATA="$QT_HOST_PREFIX"
@ -3311,6 +3317,8 @@ Installation options:
-hostbindir <dir> .. Host executables will be installed to <dir>
(default HOSTPREFIX/bin)
-hostlibdir <dir> .. Host libraries will be installed to <dir>
(default HOSTPREFIX/lib)
-hostdatadir <dir> . Data used by qmake will be installed to <dir>
(default HOSTPREFIX)
@ -3436,6 +3444,9 @@ Third Party Libraries:
(libxcb.so will still be used from operating system).
+ -system-xcb ........ Use xcb- libraries from the operating system.
-qt-xkbcommon ...... Use the xkbcommon library bundled with Qt.
+ -system-xkbcommon .. Use the xkbcommon library from the operating system.
Additional options:
-make <part> ....... Add part to the list of parts to be built at make time.
@ -3822,6 +3833,7 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = {
"qt_ssrtpath=$CFG_SYSROOT",
"qt_hpfxpath=$QT_HOST_PREFIX",
"qt_hbinpath=$QT_HOST_BINS",
"qt_hlibpath=$QT_HOST_LIBS",
"qt_hdatpath=$QT_HOST_DATA",
"qt_targspec=$shortxspec",
"qt_hostspec=$shortspec",
@ -3870,8 +3882,8 @@ fi
# -----------------------------------------------------------------------------
# symlink includes
if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
"$outpath/bin/syncqt" -minimal -module QtCore "$relpath" || exit 1
if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt.pl" ]; then
"$relpath/bin/syncqt.pl" -minimal -module QtCore "$relpath" || exit 1
fi
# $1: input variable name (awk regexp)
@ -5154,6 +5166,16 @@ if [ "$CFG_XCB" != "no" ]; then
XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm"
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
QMAKE_CFLAGS_XKB="`$PKG_CONFIG --cflags xcb xcb-xkb 2>/dev/null`"
QMAKE_LIBS_XKB="`$PKG_CONFIG --libs xcb xcb-xkb 2>/dev/null`"
fi
if compileTest qpa/xcb-xkb "xcb-xkb" $QMAKE_CFLAGS_XKB $QMAKE_LIBS_XKB; then
CFG_XKB=yes
else
CFG_XKB=no
QMakeVar add DEFINES QT_NO_XKB
fi
if compileTest qpa/xcb-syslibs "xcb-syslibs" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
@ -5167,7 +5189,7 @@ if [ "$CFG_XCB" != "no" ]; then
fi
else
echo "The test for linking against libxcb and support libraries failed!"
echo " You might need install dependency packages, or pass -qt-xcb."
echo " You might need to install dependency packages, or pass -qt-xcb."
echo " See src/plugins/platforms/xcb/README."
exit 1
fi
@ -5257,18 +5279,34 @@ if [ "$CFG_KMS" != "no" ]; then
fi
# Detect libxkbcommon
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkbcommon >= 0.2.0" 2>/dev/null; then
QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
QT_CONFIG="$QT_CONFIG xkbcommon"
CFG_XKBCOMMON=yes
elif [ "$CFG_XCB" != "no" ]; then
QMakeVar add DEFINES QT_NO_XKBCOMMON
ORIG_CFG_XKBCOMMON="$CFG_XKBCOMMON"
if [ "$CFG_XKBCOMMON" != "qt" ]; then
# currently only xcb platform plugin requires xkbcommon, for other platforms it can be set to 'no'
if [ "$CFG_XKBCOMMON" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkbcommon >= 0.2.0" 2>/dev/null; then
QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
QMAKE_VERSION_XKBCOMMON="`$PKG_CONFIG --modversion xkbcommon 2>/dev/null`"
QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON"
QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON"
QMakeVar set QMAKE_VERSION_XKBCOMMON "$QMAKE_VERSION_XKBCOMMON"
CFG_XKBCOMMON=yes
else
CFG_XKBCOMMON=no
fi
if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then
# use the bundled version instead
CFG_XKBCOMMON=qt
fi
fi
fi
if [ "$CFG_XKBCOMMON" != "no" ]; then
QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON"
QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON"
if [ "$CFG_XKBCOMMON" = "qt" ]; then
QT_CONFIG="$QT_CONFIG xkbcommon-qt"
elif [ "$CFG_XKBCOMMON" = "no" ]; then
QMakeVar add DEFINES QT_NO_XKBCOMMON
fi
# EGL Support
@ -6575,6 +6613,50 @@ fi
#-------------------------------------------------------------------------------
exec 3>&1 1>$outpath/config.summary # redirect output temporarily to config.summary
report_support()
{
case "$#,$2" in
2,auto)
# 2 arguments and the result is "auto", so just say "yes"
# this is usually an error in the configure script, but oh well..
echo "$1 yes"
return
;;
[012],* | *,no*)
# 0, 1 or 2 arguments, or anything starting with "no"
# print just the first part of the argument (before the dash)
echo "$1 ${2%%-*}"
return
:;
esac
local heading
heading=$1
shift
local value
value=$1
shift
while [ $# -gt 0 ]; do
if [ "$value" = "$1" ]; then
echo "$heading yes ($2)"
return
fi
shift
shift
done
echo "$heading $value"
}
report_support_plugin()
{
report_support "$1" "$2-$3" \
yes-qt "in $4, using bundled copy" \
yes-system "in $4, using system library" \
plugin-qt "plugin, using bundled copy" \
plugin-system "plugin, using system library"
}
echo
echo " Configure summary"
echo
@ -6632,135 +6714,89 @@ fi
# Qt modules
echo
echo "Qt modules and options:"
[ "$CFG_DBUS" = "no" ] && echo " Qt D-Bus ............... no"
[ "$CFG_DBUS" = "yes" ] && echo " Qt D-Bus ............... yes (loading dbus-1 at runtime)"
[ "$CFG_DBUS" = "linked" ] && echo " Qt D-Bus ............... yes (linked to dbus-1)"
echo " Qt Concurrent .......... $CFG_CONCURRENT"
echo " Qt GUI ................. $CFG_GUI"
echo " Qt Widgets ............. $CFG_WIDGETS"
if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
echo " JavaScriptCore JIT ..... To be decided by JavaScriptCore"
else
echo " JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
fi
echo " QML debugging .......... $CFG_QML_DEBUG"
echo " Use system proxies ..... $CFG_SYSTEM_PROXIES"
report_support " Qt D-Bus ..............." "$CFG_DBUS" yes "loading dbus-1 at runtime" linked "linked to dbus-1"
report_support " Qt Concurrent .........." "$CFG_CONCURRENT"
report_support " Qt GUI ................." "$CFG_GUI"
report_support " Qt Widgets ............." "$CFG_WIDGETS"
report_support " JavaScriptCore JIT ....." "$CFG_JAVASCRIPTCORE_JIT" auto "To be decided by JavaScriptCore"
report_support " QML debugging .........." "$CFG_QML_DEBUG"
report_support " Use system proxies ....." "$CFG_SYSTEM_PROXIES"
# Other things
# Please keep sorted and properly grouped! The output is quite long, so it's
# hard to find something you're searching for if it's not sorted.
echo
echo "Support enabled for:"
echo " Accessibility .......... $CFG_ACCESSIBILITY"
echo " ALSA ................... $CFG_ALSA"
echo " CUPS ................... $CFG_CUPS"
report_support " Accessibility .........." "$CFG_ACCESSIBILITY"
report_support " ALSA ..................." "$CFG_ALSA"
report_support " CUPS ..................." "$CFG_CUPS"
[ "$XPLATFORM_MINGW" = "yes" ] && \
echo " DirectWrite ............ $CFG_DIRECTWRITE"
echo " FontConfig ............. $CFG_FONTCONFIG"
echo " Iconv .................. $CFG_ICONV"
echo " ICU .................... $CFG_ICU"
echo " Image formats:"
echo " GIF .................. $CFG_GIF"
if [ "$CFG_JPEG" = "no" ]; then
echo " JPEG ................. $CFG_JPEG"
else
echo " JPEG ................. $CFG_JPEG ($CFG_LIBJPEG)"
fi
if [ "$CFG_PNG" = "no" ]; then
echo " PNG .................. $CFG_PNG"
else
echo " PNG .................. $CFG_PNG ($CFG_LIBPNG)"
fi
echo " Glib ................... $CFG_GLIB"
echo " GStreamer .............. $CFG_GSTREAMER"
echo " GTK theme .............. $CFG_QGTKSTYLE"
echo " Large Files ............ $CFG_LARGEFILE"
echo " Networking:"
report_support " DirectWrite ............" "$CFG_DIRECTWRITE"
report_support " FontConfig ............." "$CFG_FONTCONFIG"
report_support " Iconv .................." "$CFG_ICONV"
report_support " ICU ...................." "$CFG_ICU"
report_support " Image formats:"
report_support_plugin " GIF .................." "$CFG_GIF" system QtGui
report_support_plugin " JPEG ................." "$CFG_JPEG" "$CFG_LIBJPEG" QtGui
report_support_plugin " PNG .................." "$CFG_PNG" "$CFG_LIBPNG" QtGui
report_support " Glib ..................." "$CFG_GLIB"
report_support " GStreamer .............." "$CFG_GSTREAMER"
report_support " GTK theme .............." "$CFG_QGTKSTYLE"
report_support " Large File ............." "$CFG_LARGEFILE"
report_support " libudev ................" "$CFG_LIBUDEV"
report_support " Networking:"
[ "$BUILD_ON_MAC" = "yes" ] && \
echo " CoreWlan ............. $CFG_COREWLAN"
echo " getaddrinfo .......... $CFG_GETADDRINFO"
echo " getifaddrs ........... $CFG_GETIFADDRS"
echo " IPv6 ifname .......... $CFG_IPV6IFNAME"
OPENSSL_LINKAGE=""
if [ "$CFG_OPENSSL" = "yes" ]; then
OPENSSL_LINKAGE="(loading libraries at run-time)"
elif [ "$CFG_OPENSSL" = "linked" ]; then
OPENSSL_LINKAGE="(linked to the libraries)"
fi
echo " OpenSSL .............. $CFG_OPENSSL $OPENSSL_LINKAGE"
unset OPENSSL_LINKAGE
echo " NIS .................... $CFG_NIS"
if [ "$CFG_OPENGL" = "desktop" ]; then
echo " OpenGL ................. yes (Desktop OpenGL)"
elif [ "$CFG_OPENGL" = "es2" ]; then
echo " OpenGL ................. yes (OpenGL ES 2.x)"
else
echo " OpenGL ................. no"
fi
if [ "$CFG_OPENVG" ]; then
if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
echo " OpenVG ................. ShivaVG"
else
echo " OpenVG ................. $CFG_OPENVG"
fi
fi
if [ "$CFG_PCRE" = "no" ]; then
echo " PCRE ................... no"
else
pcre_sys=system
[ "$CFG_PCRE" = "qt" ] && pcre_sys=qt
echo " PCRE ................... yes ($pcre_sys)"
unset pcre_sys
fi
report_support " CoreWlan ............." "$CFG_COREWLAN"
report_support " getaddrinfo .........." "$CFG_GETADDRINFO"
report_support " getifaddrs ..........." "$CFG_GETIFADDRS"
report_support " IPv6 ifname .........." "$CFG_IPV6IFNAME"
report_support " OpenSSL .............." "$CFG_OPENSSL" yes "loading libraries at run-time" linked "linked to the libraries"
report_support " NIS ...................." "$CFG_NIS"
report_support " OpenGL ................." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.x"
report_support " OpenVG ................." "$CFG_OPENVG-$CFG_OPENVG_SHIVA" yes-yes "ShivaVG" yes-no "native"
report_support " PCRE ..................." "$CFG_PCRE" yes "system library" qt "bundled copy"
if [ -n "$PKG_CONFIG" ]; then
echo " pkg-config ............. yes"
report_support " pkg-config ............. yes"
else
echo " pkg-config ............. no"
report_support " pkg-config ............. no"
fi
echo " PulseAudio ............. $CFG_PULSEAUDIO"
echo " QPA backends:"
echo " DirectFB ............. $CFG_DIRECTFB"
echo " EGLFS ................ $CFG_EGLFS"
echo " KMS .................. $CFG_KMS"
echo " LinuxFB .............. $CFG_LINUXFB"
echo " XCB .................. $CFG_XCB"
report_support " PulseAudio ............." "$CFG_PULSEAUDIO"
report_support " QPA backends:"
report_support " DirectFB ............." "$CFG_DIRECTFB"
report_support " EGLFS ................" "$CFG_EGLFS"
report_support " KMS .................." "$CFG_KMS"
report_support " LinuxFB .............." "$CFG_LINUXFB"
report_support " XCB .................." "$CFG_XCB" system "system library" qt "bundled copy"
if [ "$CFG_XCB" != "no" ]; then
echo " MIT-SHM ............ $CFG_MITSHM"
echo " Xcursor ............ $CFG_XCURSOR"
echo " Xfixes ............. $CFG_XFIXES"
echo " Xi ................. $CFG_XINPUT"
echo " Xi2 ................ $CFG_XINPUT2"
echo " Xinerama ........... $CFG_XINERAMA"
echo " Xrandr ............. $CFG_XRANDR"
echo " Xrender ............ $CFG_XRENDER"
echo " XKB ................ $CFG_XKB"
echo " XShape ............. $CFG_XSHAPE"
echo " XSync .............. $CFG_XSYNC"
echo " XVideo ............. $CFG_XVIDEO"
report_support " MIT-SHM ............" "$CFG_MITSHM"
report_support " Xcursor ............" "$CFG_XCURSOR" runtime "loaded at runtime"
report_support " Xfixes ............." "$CFG_XFIXES" runtime "loaded at runtime"
report_support " Xi ................." "$CFG_XINPUT" runtime "loaded at runtime"
report_support " Xi2 ................" "$CFG_XINPUT2" runtime "loaded at runtime"
report_support " Xinerama ..........." "$CFG_XINERAMA" runtime "loaded at runtime"
report_support " Xrandr ............." "$CFG_XRANDR" runtime "loaded at runtime"
report_support " Xrender ............" "$CFG_XRENDER"
report_support " XKB ................" "$CFG_XKB"
report_support " XShape ............." "$CFG_XSHAPE"
report_support " XSync .............." "$CFG_XSYNC"
report_support " XVideo ............." "$CFG_XVIDEO"
fi
echo " Session management ..... $CFG_SM"
report_support " Session management ....." "$CFG_SM"
[ "$XPLATFORM_QNX" = "yes" ] && \
echo " SLOG2 .................. $CFG_SLOG2"
echo " SQL drivers:"
echo " DB2 .................. $CFG_SQL_db2"
echo " InterBase ............ $CFG_SQL_ibase"
echo " MySQL ................ $CFG_SQL_mysql"
echo " OCI .................. $CFG_SQL_oci"
echo " ODBC ................. $CFG_SQL_odbc"
echo " PostgreSQL ........... $CFG_SQL_psql"
echo " SQLite 2 ............. $CFG_SQL_sqlite2"
echo " SQLite ............... $CFG_SQL_sqlite ($CFG_SQLITE)"
echo " TDS .................. $CFG_SQL_tds"
echo " udev ................... $CFG_LIBUDEV"
echo " xkbcommon .............. $CFG_XKBCOMMON"
if [ "$CFG_ZLIB" = "no" ]; then
echo " zlib ................... no"
else
zlib_sys=system
[ "$CFG_ZLIB" = "yes" ] && zlib_sys=qt
echo " zlib ................... yes ($zlib_sys)"
unset zlib_sys
fi
report_support " SLOG2 .................." "$CFG_SLOG2"
report_support " SQL drivers:"
report_support " DB2 .................." "$CFG_SQL_db2" plugin "plugin" yes "built into QtSql"
report_support " InterBase ............" "$CFG_SQL_ibase" plugin "plugin" yes "built into QtSql"
report_support " MySQL ................" "$CFG_SQL_mysql" plugin "plugin" yes "built into QtSql"
report_support " OCI .................." "$CFG_SQL_oci" plugin "plugin" yes "built into QtSql"
report_support " ODBC ................." "$CFG_SQL_odbc" plugin "plugin" yes "built into QtSql"
report_support " PostgreSQL ..........." "$CFG_SQL_psql" plugin "plugin" yes "built into QtSql"
report_support " SQLite 2 ............." "$CFG_SQL_sqlite2" plugin "plugin" yes "built into QtSql"
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 " zlib ..................." "$CFG_ZLIB" system "system library" yes "bundled copy"
echo
@ -6780,10 +6816,9 @@ if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
echo " OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
echo
fi
if [ "$CFG_XCB" != no ] && [ "$CFG_XKBCOMMON" = "no" ]; then
echo "WARNING: XCB support enabled but libxkbcommon 0.2.0 (or higher) not found."
echo "Not satisfying this requirement will disable the compose key functionality,"
echo "which includes text input with dead keys."
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
exec 1>&3 3>&- # restore stdout

View File

@ -55,7 +55,7 @@ if not exist mkspecs (
md mkspecs
if errorlevel 1 goto exit
)
perl %QTSRC%bin\syncqt -minimal -module QtCore -outdir %QTDIR% %QTSRC%
perl %QTSRC%bin\syncqt.pl -minimal -module QtCore -outdir %QTDIR% %QTSRC%
if errorlevel 1 goto exit
if not exist tools\configure (

2
dist/changes-5.0.0 vendored
View File

@ -945,7 +945,7 @@ Qt for Windows CE
* QMAKE_SUBSTITUTES can now copy files verbatim.
* MSVC desktop builds now use -Zc:wchar_t.
* The following variables were added: QMAKESPEC, _QMAKE_CONF_ & _QMAKE_SUPER_CACHE_.
* QDBUSXML2CPP_{INTERFACES,ADAPTORS}_{HEADER,SOURCE}_FLAGS are now understood,
* QDBUSXML2CPP_{INTERFACE,ADAPTOR}_{HEADER,SOURCE}_FLAGS are now understood,
and DBUS_{INTERFACES,ADAPTORS} support file groups with individual flags now.
* QT_PRIVATE and PKGCONFIG_PRIVATE (analogous to LIBS_PRIVATE resp. PKGCONFIG) are now understood.
* INSTALLS entries now support copying with subdirectory (e.g., entry.base = $$dirname(PWD)).

8
dist/changes-5.1.0 vendored
View File

@ -41,6 +41,14 @@ Third party components
* [QTBUG-8836] QAbstractItemView now allows manual deselect in
SingleSelection mode (with control modifier)
- QtCore
* The serialization behavior for QDateTime has reverted to pre-Qt 5,
due to the issue mentioned in section 4 here:
http://lists.qt-project.org/pipermail/development/2013-March/010559.html
This means that the QDataStream version will be 14 with Qt 5.1.
****************************************************************************
* Library *
****************************************************************************

View File

@ -62,28 +62,28 @@
*/
/*!
\externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package
\externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package
\title CMake find_package Documentation
*/
/*!
\externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:AUTOMOC
\externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_tgt:AUTOMOC
\title CMake AUTOMOC Documentation
*/
/*!
\externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:LOCATION
\externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_tgt:LOCATION
\title CMake LOCATION Documentation
*/
/*!
\externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:POSITION_INDEPENDENT_CODE
\externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_tgt:POSITION_INDEPENDENT_CODE
\title CMake POSITION_INDEPENDENT_CODE Documentation
*/
/*!
\externalpage http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:target_link_libraries
\externalpage http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:target_link_libraries
\title CMake target_link_libraries Documentation
*/
@ -259,22 +259,22 @@
*/
/*!
\externalpage http://www.amazon.com/exec/obidos/ASIN/0134436989/trolltech/t
\externalpage http://www.amazon.com/Threads-Primer-Guide-Multithreaded-Programming/dp/0134436989/ref=sr_1_1?ie=UTF8&qid=1354884049&sr=8-1&keywords=a+guide+to+multithreaded+programming
\title Threads Primer: A Guide to Multithreaded Programming
*/
/*!
\externalpage http://www.amazon.com/exec/obidos/ASIN/0131900676/trolltech/t
\externalpage http://www.amazon.com/Thread-Time-MultiThreaded-Programming-Guide/dp/0131900676/ref=sr_1_sc_3?ie=UTF8&qid=1354884427&sr=8-3-spell&keywords=The+Mulltithread+Programming+Guide
\title Thread Time: The Multithreaded Programming Guide
*/
/*!
\externalpage http://www.amazon.com/exec/obidos/ASIN/1565921151/trolltech/t
\externalpage http://www.amazon.com/Pthreads-Programming-Standard-Multiprocessing-Nutshell/dp/1565921151/ref=sr_1_1?s=books&ie=UTF8&qid=1354884565&sr=1-1&keywords=threads+Programming%3A+A+POSIX+Standard+for+Better+Multiprocessing
\title Pthreads Programming: A POSIX Standard for Better Multiprocessing
*/
/*!
\externalpage http://www.amazon.com/exec/obidos/ASIN/1565922964/trolltech/t
\externalpage http://www.amazon.com/Win32-Multithreaded-Programming-Aaron-Cohen/dp/B00007GW3Z/ref=sr_1_1?s=books&ie=UTF8&qid=1354884647&sr=1-1&keywords=Win32+Multithreaded+Programming
\title Win32 Multithreaded Programming
*/

View File

@ -38,7 +38,7 @@
\title external: Publishing Applications to Ovi Store
*/
/*!
\externalpage http://doc.qt.digia.com/qtcreator/index.html
\externalpage http://qt-project.org/doc/qtcreator
\title external: Qt Creator Manual
*/
/*!
@ -90,6 +90,6 @@
\title external: Qt Mobility Examples
*/
/*!
\externalpage http://doc-snapshot.qt-project.org/qtcreator-2.6/creator-overview.html
\externalpage http://qt-project.org/doc/qtcreator/creator-overview.html
\title external: Qt Creator Overview
*/

View File

@ -90,3 +90,18 @@
\externalpage http://qt-project.org/wiki/jom
\title jom
*/
/*!
\externalpage http://qt-project.org/doc/qt-4.8
\title Qt 4.8 Reference Documentation
*/
/*!
\externalpage http://qt-project.org/doc/qt-4.8/qtquick.html
\title Qt Quick 1 Reference Documentation
*/
/*!
\externalpage http://qt-project.org/wiki/Qt-Localization
\title external: Translating Qt Into Other Languages
*/

View File

@ -31,3 +31,42 @@
#
# manifestmeta.global.names = *
# manifestmeta.global.tags = qt5
manifestmeta.filters = highlighted webkit1 webkit2
manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \
"QtQuick/Qt Quick Demo - Photo Surface" \
"QtQuick/Qt Quick Demo - Tweet Search" \
"QtQuick/Qt Quick Demo - Maroon*" \
"QtQuick/Qt Quick Demo - Calqlatr" \
"QtQuick/Qt Quick Particles Examples - Emitters" \
"QtQuick/Qt Quick Examples - Shader Effects" \
"QtWebKitExamples/Fancy Browser" \
"QtWebKitExamples/Flickr View Example" \
"QtWebKitExamples/YouTube View Example" \
"QtQuickControls/Qt Quick Controls - Gallery" \
"QtQuickControls/Qt Quick Controls - Text Editor Example" \
"QtQuickControls/Qt Quick Controls - Table View Example" \
"QtWidgets/Application Example"
manifestmeta.highlighted.attributes = isHighlighted:true
# Add 'webkit1' tag for QtWebKit1 examples
manifestmeta.webkit1.names = "QtWebKitExamples/Tab Browser" \
"QtWebKitExamples/DOM Traversal Example" \
"QtWebKitExamples/Fancy Browser Example" \
"QtWebKitExamples/Form Extractor Example" \
"QtWebKitExamples/WebKit Frame Capture Example" \
"QtWebKitExamples/The Webkit Bridge Tutorial*" \
"QtWebKitExamples/Previewer Example" \
"QtWebKitExamples/Wheel Scroller Example" \
"QtWebKitExamples/Simple Selector Example" \
"QtWebKitExamples/QObject XML Model Example"
manifestmeta.webkit1.tags = webkit1
# Add 'webkit2' tag for QtWebKit2 examples
manifestmeta.webkit2.names = "QtWebKitExamples/Flickr View Example" \
"QtWebKitExamples/YouTube View Example"
manifestmeta.webkit2.tags = webkit2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

View File

@ -26,7 +26,7 @@
****************************************************************************/
/*!
\example dbus/remotecontrolledcar
\example remotecontrolledcar
\title D-Bus Remote Controlled Car Example
The Remote Controlled Car example shows how to use D-Bus to control one

View File

@ -26,7 +26,7 @@
****************************************************************************/
/*!
\example network/download
\example download
\title Network Download Example
\brief Demonstrates how to use networking APIs for multiple downloads
\ingroup examples-network

View File

@ -26,7 +26,7 @@
****************************************************************************/
/*!
\example network/downloadmanager
\example downloadmanager
\title Network Download Manager Example
\brief Demonstrates how to use the networking APIs for multiple downloads
\ingroup examples-network

View File

@ -175,7 +175,7 @@ QSlider *MainWindow::createSlider(const char *changedSignal,
void MainWindow::setPixmap(const QPixmap &pixmap)
{
pixmapLabel->setPixmap(pixmap);
QSize size = pixmap.size();
QSize size = pixmap.size() / pixmap.devicePixelRatio();
if (size - QSize(1, 0) == pixmapLabelArea->maximumViewportSize())
size -= QSize(1, 0);
pixmapLabel->resize(size);

View File

@ -161,7 +161,8 @@ void GLWidget::paintEvent(QPaintEvent *event)
static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
setupViewport(width(), height());
qreal pixelRatio = devicePixelRatio();
setupViewport(width() * pixelRatio, height() * pixelRatio);
//! [6]
//! [7]
@ -200,7 +201,8 @@ void GLWidget::paintEvent(QPaintEvent *event)
//! [11]
void GLWidget::resizeGL(int width, int height)
{
setupViewport(width, height);
qreal pixelRatio = devicePixelRatio();
setupViewport(width*pixelRatio, height*pixelRatio);
}
//! [11]

View File

@ -88,14 +88,10 @@ PaintedWindow::PaintedWindow()
connect(this, SIGNAL(rotationChanged(qreal)), this, SLOT(paint()));
}
void PaintedWindow::resizeEvent(QResizeEvent *)
{
paint();
}
void PaintedWindow::exposeEvent(QExposeEvent *)
{
paint();
if (isExposed())
paint();
}
void PaintedWindow::mousePressEvent(QMouseEvent *)

View File

@ -74,7 +74,6 @@ private slots:
void rotationDone();
private:
void resizeEvent(QResizeEvent *);
void exposeEvent(QExposeEvent *);
void mousePressEvent(QMouseEvent *);

View File

@ -78,55 +78,38 @@ static bool createConnection()
query.exec("insert into person values(104, 'Roberto', 'Robitaille')");
query.exec("insert into person values(105, 'Maria', 'Papadopoulos')");
query.exec("create table offices (id int primary key,"
query.exec("create table items (id int primary key,"
"imagefile int,"
"location varchar(20),"
"country varchar(20),"
"itemtype varchar(20),"
"description varchar(100))");
query.exec("insert into offices "
"values(0, 0, 'Oslo', 'Norway',"
"'Oslo is home to more than 500 000 citizens and has a "
"lot to offer.It has been called \"The city with the big "
"heart\" and this is a nickname we are happy to live up to.')");
query.exec("insert into offices "
"values(1, 1, 'Brisbane', 'Australia',"
"'Brisbane is the capital of Queensland, the Sunshine State, "
"where it is beautiful one day, perfect the next. "
"Brisbane is Australia''s 3rd largest city, being home "
"to almost 2 million people.')");
query.exec("insert into offices "
"values(2, 2, 'Redwood City', 'US',"
"'You find Redwood City in the heart of the Bay Area "
"just north of Silicon Valley. The largest nearby city is "
"San Jose which is the third largest city in California "
"and the 10th largest in the US.')");
query.exec("insert into offices "
"values(3, 3, 'Berlin', 'Germany',"
"'Berlin, the capital of Germany is dynamic, cosmopolitan "
"and creative, allowing for every kind of lifestyle. "
"East meets West in the metropolis at the heart of a "
"changing Europe.')");
query.exec("insert into offices "
"values(4, 4, 'Munich', 'Germany',"
"'Several technology companies are represented in Munich, "
"and the city is often called the \"Bavarian Silicon Valley\". "
"The exciting city is also filled with culture, "
"art and music. ')");
query.exec("insert into offices "
"values(5, 5, 'Beijing', 'China',"
"'Beijing as a capital city has more than 3000 years of "
"history. Today the city counts 12 million citizens, and "
"is the political, economic and cultural centre of China.')");
query.exec("create table images (locationid int, file varchar(20))");
query.exec("insert into images values(0, 'images/oslo.png')");
query.exec("insert into images values(1, 'images/brisbane.png')");
query.exec("insert into images values(2, 'images/redwood.png')");
query.exec("insert into images values(3, 'images/berlin.png')");
query.exec("insert into images values(4, 'images/munich.png')");
query.exec("insert into images values(5, 'images/beijing.png')");
query.exec("insert into items "
"values(0, 0, 'Qt',"
"'Qt is a full development framework with tools designed to "
"streamline the creation of stunning applications and "
"amazing user interfaces for desktop, embedded and mobile "
"platforms.')");
query.exec("insert into items "
"values(1, 1, 'Qt Quick',"
"'Qt Quick is a collection of techniques designed to help "
"developers create intuitive, modern-looking, and fluid "
"user interfaces using a CSS & JavaScript like language.')");
query.exec("insert into items "
"values(2, 2, 'Qt Creator',"
"'Qt Creator is a powerful cross-platform integrated "
"development environment (IDE), including UI design tools "
"and on-device debugging.')");
query.exec("insert into items "
"values(3, 3, 'Qt Project',"
"'The Qt Project governs the open source development of Qt, "
"allowing anyone wanting to contribute to join the effort "
"through a meritocratic structure of approvers and "
"maintainers.')");
query.exec("create table images (itemid int, file varchar(20))");
query.exec("insert into images values(0, 'images/qt-logo.png')");
query.exec("insert into images values(1, 'images/qt-quick.png')");
query.exec("insert into images values(2, 'images/qt-creator.png')");
query.exec("insert into images values(3, 'images/qt-project.png')");
return true;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -37,20 +37,19 @@
\image drilldown-example.png Screenshot of the Drill Down Example
When running the example application, a user can retrieve
information about each of Nokia's Qt offices by clicking the
corresponding image. The application pops up an information window
displaying the data, and allows the users to alter the location
description as well as the image. The main view will be updated
when the users submit their changes.
information about each item by clicking the corresponding image.
The application pops up an information window displaying the data,
and allows the users to alter the description as well as the image.
The main view will be updated when the users submit their changes.
The example consists of three classes:
\list
\li \c ImageItem is a custom graphics item class used to
display the office images.
display the images.
\li \c View is the main application widget allowing the user to
browse through the various locations.
browse through the various items.
\li \c InformationWindow displays the requested information,
allowing the users to alter it and submit their changes to the
@ -70,7 +69,7 @@
\snippet drilldown/informationwindow.h 0
When we create an information window, we pass the associated
location ID, a parent, and a pointer to the database, to the
item ID, a parent, and a pointer to the database, to the
constructor. We will use the database pointer to populate our
window with data, while passing the parent parameter on to the
base class. The ID is stored for future reference.
@ -84,7 +83,7 @@
\snippet drilldown/informationwindow.h 1
Since we allow the users to alter some of the location data, we
Since we allow the users to alter some of the data, we
must provide functionality for reverting and submitting their
changes. The \c enableButtons() slot is provided for convenience
to enable and disable the various buttons when required.
@ -93,15 +92,15 @@
The \c createButtons() function is also a convenience function,
provided to simplify the constructor. As mentioned above we store
the location ID for future reference. We also store the name of
the item ID for future reference. We also store the name of
the currently displayed image file to be able to determine when to
emit the \c imageChanged() signal.
The information window uses the QLabel class to display the office
location and the country. The associated image file is displayed
using a QComboBox instance while the description is displayed using
QTextEdit. In addition, the window has three buttons to control
the data flow and whether the window is shown or not.
The information window uses the QLabel class to display the name of
an item. The associated image file is displayed using a QComboBox
instance while the description is displayed using QTextEdit. In
addition, the window has three buttons to control the data flow and
whether the window is shown or not.
Finally, we declare a \e mapper. The QDataWidgetMapper class
provides mapping between a section of a data model to widgets. We
@ -110,7 +109,7 @@
\section1 InformationWindow Class Implementation
The constructor takes three arguments: a location ID, a database
The constructor takes three arguments: an item ID, a database
pointer and a parent widget. The database pointer is actually a
pointer to a QSqlRelationalTableModel object providing an editable
data model (with foreign key support) for our database table.
@ -125,8 +124,8 @@
\snippet drilldown/informationwindow.cpp 2
In this example, the information about the offices are stored in a
database table called "offices". When creating the model,
In this example, information about the items are stored in a
database table called "items". When creating the model,
we will use a foreign key to establish a relation between this
table and a second data base table, "images", containing the names
of the available image files. We will get back to how this is done
@ -140,7 +139,7 @@
the foreign key (in this case the "imagefile" column number) as
argument. We use QComboBox's \l {QComboBox::}{setModel()} function
to make the combobox use the "images" model. And, since this model
has two columns ("locationid" and "file"), we also specify which
has two columns ("itemid" and "file"), we also specify which
column we want to be visible using the QComboBox::setModelColumn()
function.
@ -156,7 +155,7 @@
section is a column in the model, otherwise it is a row. We call
the \l {QDataWidgetMapper::}{setCurrentIndex()} function to
initialize the widgets with the data associated with the given
location ID. Every time the current index changes, all the widgets
item ID. Every time the current index changes, all the widgets
are updated with the contents from the model.
We also set the mapper's submit policy to
@ -168,14 +167,14 @@
view should use for its items. The QSqlRelationalDelegate class
represents a delegate that unlike the default delegate, enables
combobox functionality for fields that are foreign keys into other
tables (like "imagefile" in our "trolltechoffices" table).
tables (like "imagefile" in our "items" table).
\snippet drilldown/informationwindow.cpp 4
Finally, we connect the "something's changed" signals in the
editors to our custom \c enableButtons() slot, enabling the users
to either submit or revert their changes. We add all the widgets
into a layout, store the location ID and the name of the displayed
into a layout, store the item ID and the name of the displayed
image file for future reference, and set the window title and
initial size.
@ -189,7 +188,7 @@
application exits (i.e., if the user closes the information
window, it is only hidden). For this reason we do not want to
create more than one \c InformationWindow object for each
location, and we provide the public \c id() function to be able to
item, and we provide the public \c id() function to be able to
determine whether a window already exists for a given location
when the user requests information about it.
@ -256,16 +255,15 @@
{QDialogButtonBox::ButtonRole}{reject} role indicates that
clicking the button causes the dialog to be rejected. On the other
hand, since we only hide the information window, any changes that
the user has made wil be preserved until the user expliclity
revert or submit them.
the user has made will be preserved until the user explicitly
reverts or submits them.
\snippet drilldown/informationwindow.cpp 10
The \c enableButtons() slot is called to enable the buttons
whenever the user changes the presented data. Likewise, when the
data the user choose to submit the changes, the buttons are
disabled to indicate that the current data is stored in the
database.
user chooses to submit the changes, the buttons are disabled to
indicate that the current data is stored in the database.
This completes the \c InformationWindow class. Let's take a look
at how we have used it in our example application.
@ -280,19 +278,17 @@
\snippet drilldown/view.h 1
The QGraphicsView class is part of the \l {Graphics View
Framework} which we will use to display the images of Nokia's
Qt offices. To be able to respond to user interaction;
i.e., showing the
appropriate information window whenever the user clicks one of the
office images, we reimplement QGraphicsView's \l
{QGraphicsView::}{mouseReleaseEvent()} function.
Framework} which we will use to display the images. To be able to
respond to user interaction by displaying the appropriate
information window when the image is clicked, we reimplement
QGraphicsView's \l{QGraphicsView::}{mouseReleaseEvent()} function.
Note that the constructor expects the names of two database
tables: One containing the detailed information about the offices,
tables: One containing the detailed information about the items,
and another containing the names of the available image files. We
also provide a private \c updateImage() slot to catch \c
{InformationWindow}'s \c imageChanged() signal that is emitted
whenever the user changes a location's image.
whenever the user changes an image associated with the item.
\snippet drilldown/view.h 2
@ -303,20 +299,20 @@
The \c findWindow() function, on the other hand, is frequently
used. It is called from the \c showInformation() function to
detemine whether a window is already created for the given
location (whenever we create an \c InformationWindow object, we
item (whenever we create an \c InformationWindow object, we
store a reference to it in the \c informationWindows list). The
latter function is in turn called from our custom \c
mouseReleaseEvent() implementation.
\snippet drilldown/view.h 3
Finally we declare a QSqlRelationalTableModel pointer. As
Finally, we declare a QSqlRelationalTableModel pointer. As
previously mentioned, the QSqlRelationalTableModel class provides
an editable data model with foreign key support. There are a
couple of things you should keep in mind when using the
QSqlRelationalTableModel class: The table must have a primary key
declared and this key cannot contain a relation to another table,
i.e., it cannot be a foreign key. Note also that if a relational
that is, it cannot be a foreign key. Also note that if a relational
table contains keys that refer to non-existent rows in the
referenced table, the rows containing the invalid keys will not be
exposed through the model. It is the user's or the database's
@ -327,11 +323,11 @@
Although the constructor requests the names of both the table
containing office details as well as the table containing the
names of the available image files, we only have to create a
QSqlRelationalTableModel object for the office table:
QSqlRelationalTableModel object for the "items" table:
\snippet drilldown/view.cpp 0
The reason is that once we have a model with the office details,
The reason is that once we have a model with the item details,
we can create a relation to the available image files using
QSqlRelationalTableModel's \l
{QSqlRelationalTableModel::}{setRelation()} function. This
@ -348,20 +344,19 @@
\snippet drilldown/view.cpp 1
Then we create the contents of our view, i.e., the scene and its
items. The location labels are regular QGraphicsTextItem objects,
and the "Qt" logo is represented by a QGraphicsPixmapItem
object. The images, on the other hand, are instances of the \c
ImageItem class (derived from QGraphicsPixmapItem). We will get
back to this shortly when reviewing the \c addItems() function.
items. The labels are regular QGraphicsTextItem objects, whereas
the images are instances of the \c ImageItem class, derived from
QGraphicsPixmapItem. We will get back to this shortly when reviewing
the \c addItems() function.
Finally, we set the main application widget's size constraints and
window title.
\snippet drilldown/view.cpp 3
The \c addItems() function is called only once, i.e., when
creating the main application window. For each row in the database
table, we first extract the corresponding record using the model's
The \c addItems() function is called only once when creating the main
application window. For each row in the database table, we first
extract the corresponding record using the model's
\l {QSqlRelationalTableModel::}{record()} function. The QSqlRecord
class encapsulates both the functionality and characteristics of a
database record, and supports adding and removing fields as well
@ -394,7 +389,7 @@
\snippet drilldown/view.cpp 6
The \c showInformation() function is given an \c ImageItem object
as argument, and starts off by extracting the item's location
as argument, and starts off by extracting the item's item
ID. Then it determines if there already is created an information
window for this location. If it is, and the window is visible, it
ensures that the window is raised to the top of the widget stack
@ -402,7 +397,7 @@
{QWidget::}{show()} slot gives the same result.
If no window for the given location exists, we create one by
passing the location ID, a pointer to the model, and our view as a
passing the item ID, a pointer to the model, and our view as a
parent, to the \c InformationWindow constructor. Note that we
connect the information window's \c imageChanged() signal to \e
this widget's \c updateImage() slot, before we give it a suitable
@ -410,16 +405,16 @@
\snippet drilldown/view.cpp 7
The \c updateImage() slot takes a location ID and the name of an
image files as arguments. It filters out the image items, and
updates the one that correspond to the given location ID, with the
The \c updateImage() slot takes an item ID and the name of an
image file as arguments. It filters out the image items, and
updates the one that correspond to the given item ID, with the
provided image file.
\snippet drilldown/view.cpp 8
The \c findWindow() function simply searches through the list of
existing windows, returning a pointer to the window that matches
the given location ID, or 0 if the window doesn't exists.
the given item ID, or 0 if the window doesn't exists.
Finally, let's take a quick look at our custom \c ImageItem class:
@ -442,7 +437,7 @@
returning back to its original size when the cursor leaves its
borders.
Finally, we store the location ID that this particular record is
Finally, we store the item ID that this particular record is
associated with as well as a z-value. In the \l {Graphics View
Framework}, an item's z-value determines its position in the item
stack. An item of high z-value will be drawn on top of an item
@ -460,8 +455,8 @@
\snippet drilldown/imageitem.cpp 0
Then we store the ID for future reference, and ensure that our
item will accept hover events. Hover events are delivered when
there is no current mouse grabber item. They are sent when the
image item will accept hover events. Hover events are delivered
when there is no current mouse grabber item. They are sent when the
mouse cursor enters an item, when it moves around inside the item,
and when the cursor leaves an item. As we mentioned earlier, none
of the \l {Graphics View Framework}'s items accept hover
@ -487,7 +482,7 @@
\codeline
\snippet drilldown/imageitem.cpp 2
Whenever the mouse cursor enters or leave the image item, the
Whenever the mouse cursor enters or leaves the image item, the
corresponding event handlers are triggered: We first set the time
line's direction, making the item expand or shrink,
respectively. Then we alter the item's z-value if it is not already
@ -532,6 +527,6 @@
size regardless of the size of the source image. The \c id()
function is trivial, and is simply provided to be able to identify
the item. In the \c updateItemPosition() slot we call the
QGraphicsItem::setZValue() function, setting the elevation (i.e.,
the position) of the item.
QGraphicsItem::setZValue() function, setting the elevation of the
item.
*/

View File

@ -1,11 +1,8 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>images/oslo.png</file>
<file>images/brisbane.png</file>
<file>images/redwood.png</file>
<file>images/berlin.png</file>
<file>images/munich.png</file>
<file>images/beijing.png</file>
<file>logo.png</file>
</qresource>
<RCC>
<qresource prefix="/">
<file>images/qt-logo.png</file>
<file>images/qt-quick.png</file>
<file>images/qt-creator.png</file>
<file>images/qt-project.png</file>
</qresource>
</RCC>

View File

@ -100,7 +100,7 @@ void ImageItem::setFrame(int frame)
void ImageItem::adjust()
{
QMatrix matrix;
matrix.scale(150/ boundingRect().width(), 120/ boundingRect().height());
matrix.scale(120/ boundingRect().width(), 120/ boundingRect().height());
setMatrix(matrix);
}
//! [4]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@ -41,38 +41,35 @@
#include "informationwindow.h"
//! [0]
InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices,
InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items,
QWidget *parent)
: QDialog(parent)
{
//! [0] //! [1]
QLabel *locationLabel = new QLabel(tr("Location: "));
QLabel *countryLabel = new QLabel(tr("Country: "));
QLabel *itemLabel = new QLabel(tr("Item: "));
QLabel *descriptionLabel = new QLabel(tr("Description: "));
QLabel *imageFileLabel = new QLabel(tr("Image file: "));
createButtons();
locationText = new QLabel;
countryText = new QLabel;
itemText = new QLabel;
descriptionEditor = new QTextEdit;
//! [1]
//! [2]
imageFileEditor = new QComboBox;
imageFileEditor->setModel(offices->relationModel(1));
imageFileEditor->setModelColumn(offices->relationModel(1)->fieldIndex("file"));
imageFileEditor->setModel(items->relationModel(1));
imageFileEditor->setModelColumn(items->relationModel(1)->fieldIndex("file"));
//! [2]
//! [3]
mapper = new QDataWidgetMapper(this);
mapper->setModel(offices);
mapper->setModel(items);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setItemDelegate(new QSqlRelationalDelegate(mapper));
mapper->addMapping(imageFileEditor, 1);
mapper->addMapping(locationText, 2, "text");
mapper->addMapping(countryText, 3, "text");
mapper->addMapping(descriptionEditor, 4);
mapper->addMapping(itemText, 2, "text");
mapper->addMapping(descriptionEditor, 3);
mapper->setCurrentIndex(id);
//! [3]
@ -83,8 +80,7 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices,
this, SLOT(enableButtons()));
QFormLayout *formLayout = new QFormLayout;
formLayout->addRow(locationLabel, locationText);
formLayout->addRow(countryLabel, countryText);
formLayout->addRow(itemLabel, itemText);
formLayout->addRow(imageFileLabel, imageFileEditor);
formLayout->addRow(descriptionLabel, descriptionEditor);
@ -93,23 +89,19 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices,
layout->addWidget(buttonBox);
setLayout(layout);
locationId = id;
itemId = id;
displayedImage = imageFileEditor->currentText();
// Commented the following line. Now the window will look like dialog and the Qt will place the QDialogBox buttons to menu area in Symbian.
// Too bad that the revert button is missing, Should the Qt place the buttons under Option menu in the menu area?!
// If the Qt::Window flag was used, the background of window is white in symbian and the QLabels can't be regognized from the background.
//setWindowFlags(Qt::Window);
setWindowFlags(Qt::Window);
enableButtons(false);
setWindowTitle(tr("Office: %1").arg(locationText->text()));
setWindowTitle(itemText->text());
}
//! [4]
//! [5]
int InformationWindow::id()
{
return locationId;
return itemId;
}
//! [5]
@ -128,11 +120,11 @@ void InformationWindow::submit()
if (displayedImage != newImage) {
displayedImage = newImage;
emit imageChanged(locationId, newImage);
emit imageChanged(itemId, newImage);
}
mapper->submit();
mapper->setCurrentIndex(locationId);
mapper->setCurrentIndex(itemId);
enableButtons(false);
}

View File

@ -50,7 +50,7 @@ class InformationWindow : public QDialog
Q_OBJECT
public:
InformationWindow(int id, QSqlRelationalTableModel *offices,
InformationWindow(int id, QSqlRelationalTableModel *items,
QWidget *parent = 0);
int id();
@ -70,12 +70,11 @@ private slots:
private:
void createButtons();
int locationId;
int itemId;
QString displayedImage;
QComboBox *imageFileEditor;
QLabel *locationText;
QLabel *countryText;
QLabel *itemText;
QTextEdit *descriptionEditor;
QPushButton *closeButton;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -52,7 +52,7 @@ int main(int argc, char *argv[])
if (!createConnection())
return 1;
View view("offices", "images");
View view("items", "images");
view.show();
#ifdef QT_KEYPAD_NAVIGATION
QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);

View File

@ -43,61 +43,62 @@
#include "view.h"
//! [0]
View::View(const QString &offices, const QString &images, QWidget *parent)
View::View(const QString &items, const QString &images, QWidget *parent)
: QGraphicsView(parent)
{
officeTable = new QSqlRelationalTableModel(this);
officeTable->setTable(offices);
officeTable->setRelation(1, QSqlRelation(images, "locationid", "file"));
officeTable->select();
itemTable = new QSqlRelationalTableModel(this);
itemTable->setTable(items);
itemTable->setRelation(1, QSqlRelation(images, "itemid", "file"));
itemTable->select();
//! [0]
//! [1]
scene = new QGraphicsScene(this);
scene->setSceneRect(0, 0, 465, 615);
scene->setSceneRect(0, 0, 465, 365);
setScene(scene);
addItems();
QGraphicsPixmapItem *logo = scene->addPixmap(QPixmap(":/logo.png"));
logo->setPos(30, 515);
setMinimumSize(470, 370);
setMaximumSize(470, 370);
setMinimumSize(470, 620);
setMaximumSize(470, 620);
setWindowTitle(tr("Offices World Wide"));
QLinearGradient gradient(QPointF(0, 0), QPointF(0, 370));
gradient.setColorAt(0, QColor("#868482"));
gradient.setColorAt(1, QColor("#5d5b59"));
setBackgroundBrush(gradient);
}
//! [1]
//! [3]
void View::addItems()
{
int officeCount = officeTable->rowCount();
int itemCount = itemTable->rowCount();
int imageOffset = 150;
int leftMargin = 70;
int topMargin = 40;
for (int i = 0; i < officeCount; i++) {
for (int i = 0; i < itemCount; i++) {
ImageItem *image;
QGraphicsTextItem *label;
QSqlRecord record = officeTable->record(i);
QSqlRecord record = itemTable->record(i);
int id = record.value("id").toInt();
QString file = record.value("file").toString();
QString location = record.value("location").toString();
QString item = record.value("itemtype").toString();
int columnOffset = ((i / 3) * 37);
int x = ((i / 3) * imageOffset) + leftMargin + columnOffset;
int y = ((i % 3) * imageOffset) + topMargin;
int columnOffset = ((i % 2) * 37);
int x = ((i % 2) * imageOffset) + leftMargin + columnOffset;
int y = ((i / 2) * imageOffset) + topMargin;
image = new ImageItem(id, QPixmap(":/" + file));
image->setData(0, i);
image->setPos(x, y);
scene->addItem(image);
label = scene->addText(location);
QPointF labelOffset((150 - label->boundingRect().width()) / 2, 120.0);
label = scene->addText(item);
label->setDefaultTextColor(QColor("#d7d6d5"));
QPointF labelOffset((120 - label->boundingRect().width()) / 2, 120.0);
label->setPos(QPointF(x, y) + labelOffset);
}
}
@ -118,7 +119,7 @@ void View::mouseReleaseEvent(QMouseEvent *event)
void View::showInformation(ImageItem *image)
{
int id = image->id();
if (id < 0 || id >= officeTable->rowCount())
if (id < 0 || id >= itemTable->rowCount())
return;
InformationWindow *window = findWindow(id);
@ -129,7 +130,7 @@ void View::showInformation(ImageItem *image)
window->show();
} else {
InformationWindow *window;
window = new InformationWindow(id, officeTable, this);
window = new InformationWindow(id, itemTable, this);
connect(window, SIGNAL(imageChanged(int,QString)),
this, SLOT(updateImage(int,QString)));

View File

@ -53,7 +53,7 @@ class View : public QGraphicsView
Q_OBJECT
public:
View(const QString &offices, const QString &images, QWidget *parent = 0);
View(const QString &items, const QString &images, QWidget *parent = 0);
protected:
void mouseReleaseEvent(QMouseEvent *event);
@ -73,7 +73,7 @@ private:
QGraphicsScene *scene;
QList<InformationWindow *> informationWindows;
//! [2] //! [3]
QSqlRelationalTableModel *officeTable;
QSqlRelationalTableModel *itemTable;
};
//! [3]

View File

@ -26,7 +26,7 @@
****************************************************************************/
/*!
\example tools/customtype
\example customtype
\title Custom Type Example
\brief The Custom Type example shows how to integrate a custom type into Qt's

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,142 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*! \example widgets/orientation
\title Orientation Example
\brief The example shows a simple way to use different UIs depending on the screen
orientation of a mobile device.
\image orientation-landscape.png The UI in landscape mode
\image orientation-portrait.png The UI in portrait mode
The screen on many mobile devices can be viewed in both portrait and
landscape orientation. The orientation can be swiched with the help of a
hardware or software trigger. Due to the often small physical screen size,
user interfaces has to be very simple and compact to stay usable, and
applications usually occupy the whole screen. Designing a user interface
that works equally well in both landscape and portrait mode is not always
possible, however, so making a different layout for each case usually pays
off.
The example application makes use of two different UI widgets created with
the Qt Designer, one for portrait and one for landscape orientation. The
application has a widget that contains an image and the user is able to
select one of three images for it to show. In addition to the two UIs, the
application consists of a \c MainWindow class.
\section1 Landscape UI
If the screen is in landscape mode, the user probably holds the device with
both hands and is ready to give full attention to the application. The
landscape UI looks like this:
\image orientation-landscape-ui.png The landscape UI
To the left is a QWidget called \c choiceWidget, which will show the
current image, and to the right are three QRadioButton instances. The
active radio button specifies the image to show.
\section1 Portrait UI
When the device is in portrait mode, it usually means that the user holds
it with one hand, and can comfortably use the thumb for small amounts of
input. The layout is simpler, and is focused on consuming content. The
portrait UI looks like this:
\image orientation-portrait-ui.png The portrait UI
Similarly, it contains a QWidget, also called \c choiceWidget, that will
show the current image. In contrast to the landscape UI, this one doesn't
provide any controls to change the image.
\section1 MainWindow Class Definition
\c MainWindow inherits from QWidget and acts as the top level widget of the
application.
\snippet widgets/orientation/mainwindow.h 0
The \c resizeEvent() method is re-implemented, and used to check which
UI to show. The \c onRadioButtonClicked() slot is connected to the
landscape UI's radio button group and selects the current image.
\c landscapeWidget and \c portraitWidget will contain the UI layouts. Only
one of them is visible at a time.
\section1 MainWindow Class Implementation
In the constructor, the widgets that will hold the UIs are created and set
up.
\snippet widgets/orientation/mainwindow.cpp 0
Since the exit buttons on the layouts are different from each other, both
of them have to have their \c clicked() signal connected to the \c close()
slot of the main widget. The first image is also made current with the call
to \c onRadioButtonClicked().
\snippet widgets/orientation/mainwindow.cpp 1
On the Maemo platform, windows are stuck in landscape mode by default. The
application has to explicitly say that rotation is supported.
\snippet widgets/orientation/mainwindow.cpp 2
The \c resizeEvent() is called when the main window is first created, and
also whenever the window has been resized. If the window is shown in
full screen, this is an indication that the orientation of the screen has
changed.
The dimensions of \c landscapeWidget is the transpose of the dimensions of
\c portraitWidget. When the orientation is known, both are set to the
(possibly transposed) size of the window. Depending on the orientation, one
widget is made visible and the other invisible.
\snippet widgets/orientation/mainwindow.cpp 3
When the user selects one of the radio buttons in the landscape UI, the
current image is changed. The image is displayed by specifying the
background style of the choice widget. Since both \c portrait and
\c landscape have a \c choiceWidget of their own, the change has to be
reflected in both instances.
\snippet widgets/orientation/mainwindow.cpp 4
Synchronizing both UIs like this might become unfeasible when there are
many things that can change. In that case it is better to make use of the
\l{Introduction to Model/View Programming}{Model-View-Controller pattern}
more extensively and share the content between both portrait and landscape
widgets. Then an interface for displaying and manipulating it can be tailor
made for both orientations.
\section1 The \c main() Function
The main function creates a \c MainWindow instance and shows it full
screen.
\snippet widgets/orientation/main.cpp 0
*/

View File

@ -1,52 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*! \example widgets/applicationicon
\title Application Icon Example
\brief The example shows how to add an application icon to a mobile application.
\image appicon_screenshot.png The icon on a Nokia XPressMusic 5800
\section1 Adding the icons to the project
For Maemo, we need to add that the \c .desktop and icon file should be
installed.
\quotefile widgets/applicationicon/applicationicon.pro
Currently, Qt Creator doesn't include the icon and desktop files in the
application package for Maemo, merely the executable file is included. As a
workaround for this, the files can be added manually in the Projects tab.
In the "Create Package" build step for the Maemo target, the \c .desktop
file and icon can be added to be a part of the package contents.
Unfortunately, these additions are only stored as a part of the
\c .pro.user file. This issue will be resolved in a future release of
Qt Creator.
\image appicon_packagecontents.png Manual addition of files to the "Create Package" build step
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -1,15 +0,0 @@
QT += core gui widgets
TARGET = applicationicon
TEMPLATE = app
SOURCES += main.cpp
OTHER_FILES += applicationicon.svg \
applicationicon.png \
applicationicon.desktop
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/applicationicon
INSTALLS += target

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" baseProfile="tiny" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 44 44">
<defs>
<linearGradient id="linearGradient2824" y2="1051.4" gradientUnits="userSpaceOnUse" x2="30.217" y1="1009.4" x1="15.109">
<stop stop-color="#41a200" offset="0"/>
<stop stop-color="#9be948" offset="0.63897"/>
<stop stop-color="#beff61" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient2848" y2="1009.4" gradientUnits="userSpaceOnUse" y1="1053.7" gradientTransform="matrix(0.85714286,0,0,0.85714286,2.1428572,146.19467)" x2="15.085" x1="31.027">
<stop stop-color="#41a200" offset="0"/>
<stop stop-color="#9be948" offset="0.88602"/>
<stop stop-color="#beff61" offset="1"/>
</linearGradient>
</defs>
<g id="layer1" transform="translate(0,-1008.3622)">
<path id="rect2816" d="m8.412,1009h27.18c4.106,0,7.412,3.306,7.412,7.412v27.18c0,4.106-3.306,7.412-7.412,7.412h-27.18c-4.106,0-7.412-3-7.412-7v-27.18c0-4.106,3.306-7.412,7.412-7.412z" stroke-linecap="round" stroke-miterlimit="4" stroke-width="0.64300001" fill="url(#linearGradient2824)"/>
<path id="rect2816-4" d="m9.353,1011h25.29c3.52,0,6.353,2.833,6.353,6.353v25.29c0,3.519-2.833,6.353-6.353,6.353h-25.29c-3.52-0.1-6.353-2.1-6.353-6.1v-25.29c0-3.519,2.833-6.353,6.353-6.353z" stroke-linecap="round" stroke-miterlimit="4" stroke-width="0.64300001" fill="url(#linearGradient2848)"/>
<g id="text2893" font-weight="normal" transform="translate(-1.100281,1010.3622)" font-style="normal" font-stretch="normal" font-size="48px" font-variant="normal" font-family="Cambria Math" fill="#e5ffd5">
<path id="path2908" fill="#e5ffd5" d="m11.92,35.44c1.359-1.719,2.672-3.828,3.938-6.328l7.522-14.742c-0.8-3.13-1.54-5.321-2.24-6.586-0.69-1.266-1.76-1.899-3.2-1.899-1.328,0.0000307-2.594,0.6563-3.797,1.969l-1.148-1.266c2.156-2.359,4.289-3.539,6.398-3.539,1.469,0.0000335,2.609,0.418,3.422,1.254,0.8125,0.836,1.492,2.168,2.039,3.996,0.5469,1.828,1.32,5.359,2.32,10.59,1.297,6.828,2.309,11.14,3.035,12.93,0.7265,1.789,1.59,2.684,2.59,2.684,0.7187,0.000002,1.383-0.25,1.992-0.75l0.8906,1.406c-1.547,1.203-2.938,1.805-4.172,1.805-1.75,0-3-0.8984-3.75-2.695-0.75-1.797-1.797-6.633-3.141-14.51h-0.1406c-2.658,5.391-5.258,11.001-7.798,16.831h-4.758z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1,50 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 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: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 <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLabel label(QObject::tr("Hello, world!"));
label.show();
return a.exec();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,7 +0,0 @@
<RCC>
<qresource prefix="/">
<file>image_a.png</file>
<file>image_b.png</file>
<file>image_c.png</file>
</qresource>
</RCC>

View File

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LandscapeUI</class>
<widget class="QWidget" name="LandscapeUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>265</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">font-weight: bold;</string>
</property>
<property name="text">
<string>Landscape mode</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="exitButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Exit</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Choices</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioAButton">
<property name="text">
<string>Long description explaining choice A</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string>buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioBButton">
<property name="text">
<string>Long description explaining choice B</string>
</property>
<attribute name="buttonGroup">
<string>buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioCButton">
<property name="text">
<string>Long description explaining choice C</string>
</property>
<attribute name="buttonGroup">
<string>buttonGroup</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QWidget" name="choiceWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>

View File

@ -1,55 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 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: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 <QtWidgets/QApplication>
#include "mainwindow.h"
//! [0]
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.showFullScreen();
return a.exec();
}
//! [0]

View File

@ -1,112 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 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: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 "mainwindow.h"
#include "ui_landscape.h"
#include "ui_portrait.h"
#include <QDesktopWidget>
#include <QResizeEvent>
//! [0]
MainWindow::MainWindow(QWidget *parent) :
QWidget(parent),
landscapeWidget(0),
portraitWidget(0)
{
landscapeWidget = new QWidget(this);
landscape.setupUi(landscapeWidget);
portraitWidget = new QWidget(this);
portrait.setupUi(portraitWidget);
//! [0]
//! [1]
connect(portrait.exitButton, SIGNAL(clicked()), this, SLOT(close()));
connect(landscape.exitButton, SIGNAL(clicked()), this, SLOT(close()));
connect(landscape.buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)),
this, SLOT(onRadioButtonClicked(QAbstractButton*)));
landscape.radioAButton->setChecked(true);
onRadioButtonClicked(landscape.radioAButton);
//! [1]
//! [2]
}
//! [2]
//! [3]
void MainWindow::resizeEvent(QResizeEvent *event)
{
QSize size = event->size();
bool isLandscape = size.width() > size.height();
if (!isLandscape)
size.transpose();
landscapeWidget->setFixedSize(size);
size.transpose();
portraitWidget->setFixedSize(size);
landscapeWidget->setVisible(isLandscape);
portraitWidget->setVisible(!isLandscape);
}
//! [3]
//! [4]
void MainWindow::onRadioButtonClicked(QAbstractButton *button)
{
QString styleTemplate = "background-image: url(:/image_%1.png);"
"background-repeat: no-repeat;"
"background-position: center center";
QString imageStyle("");
if (button == landscape.radioAButton)
imageStyle = styleTemplate.arg("a");
else if (button == landscape.radioBButton)
imageStyle = styleTemplate.arg("b");
else if (button == landscape.radioCButton)
imageStyle = styleTemplate.arg("c");
portrait.choiceWidget->setStyleSheet(imageStyle);
landscape.choiceWidget->setStyleSheet(imageStyle);
}
//! [4]

View File

@ -1,75 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 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: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 MAINWINDOW_H
#define MAINWINDOW_H
#include <QWidget>
#include "ui_landscape.h"
#include "ui_portrait.h"
QT_BEGIN_NAMESPACE
class QAbstractButton;
QT_END_NAMESPACE
//! [0]
class MainWindow : public QWidget
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
protected:
void resizeEvent(QResizeEvent *event);
private slots:
void onRadioButtonClicked(QAbstractButton *button);
private:
Ui::LandscapeUI landscape;
Ui::PortraitUI portrait;
QWidget *landscapeWidget;
QWidget *portraitWidget;
};
//! [0]
#endif // MAINWINDOW_H

View File

@ -1,29 +0,0 @@
#-------------------------------------------------
#
# Project created by QtCreator 2010-08-04T10:27:31
#
#-------------------------------------------------
QT += core gui widgets
TARGET = orientation
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += \
portrait.ui \
landscape.ui
RESOURCES += \
images.qrc
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/orientation
INSTALLS += target
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PortraitUI</class>
<widget class="QWidget" name="PortraitUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>201</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">font-weight: bold;</string>
</property>
<property name="text">
<string>Portrait mode</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="exitButton">
<property name="text">
<string>Exit</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="helpLabel">
<property name="text">
<string>Switch to landscape mode. In landscape mode you can change visible image.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QWidget" name="choiceWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,6 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = analogclock \
applicationicon \
calculator \
calendarwidget \
charactermap \
@ -13,7 +12,6 @@ SUBDIRS = analogclock \
lineedits \
movie \
mousebuttons \
orientation \
scribble \
shapedclock \
sliders \

View File

@ -26,7 +26,7 @@
****************************************************************************/
/*!
\example xml/streambookmarks
\example streambookmarks
\title QXmlStream Bookmarks Example
\brief Demonstrates how to read and write to XBEL files
\ingroup xml-examples

View File

@ -27,6 +27,10 @@ contains(QMAKE_HOST.os,Windows) {
} else {
MINGW_IN_SHELL = 1
QMAKE_DIR_SEP = /
# Because install's ability to set permissions is not relevant on Windows,
# and git's msys does not provide it to start with.
QMAKE_INSTALL_FILE = cp -f
QMAKE_INSTALL_PROGRAM = cp -f
}
}

View File

@ -1,10 +1,6 @@
#
# compiler settings for iOS clang compilers
#
# Depends on:
#
# QMAKE_XCODE_VERSION - set in xcode.conf
#
# iOS build flags
QMAKE_IOS_CFLAGS += -fvisibility=hidden -fpascal-strings -fmessage-length=0
@ -24,9 +20,6 @@ QMAKE_IOS_CFLAGS += -Wno-missing-field-initializers -Wno-missing-prototype
QMAKE_IOS_CXXFLAGS += -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors
QMAKE_IOS_OBJ_CFLAGS += -Wno-deprecated-implementations -Wprotocol -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector
# Warn about unsupported (later than 4.5) Xcode versions
!lessThan(QMAKE_XCODE_VERSION, "4.7"): warning("The version of Xcode installed on this system is not recognised - custom compiler settings may be necessary")
# Set build flags
QMAKE_CFLAGS += $$QMAKE_IOS_CFLAGS
QMAKE_CXXFLAGS += $$QMAKE_IOS_CFLAGS $$QMAKE_IOS_CXXFLAGS

View File

@ -26,7 +26,4 @@ QMAKE_LIBS_THREAD =
QMAKE_AR = ar cq
QMAKE_RANLIB = ranlib -s
# We rely on Xcode to build
include(xcode.conf)
include(unix.conf)

View File

@ -1,21 +0,0 @@
#
# qmake configuration for Xcode
#
# Get path of Xcode's Developer directory
QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
# Make sure Xcode path is valid
!exists($$QMAKE_XCODE_DEVELOPER_PATH): \
error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
# Make sure Xcode is set up properly
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
# Extract Xcode version using xcodebuild
xcode_version = $$system("/usr/bin/xcodebuild -version")
QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
unset(xcode_version)

View File

@ -41,6 +41,8 @@ contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
}
!exists($$first(QT.$${MODULE}.private_includes)): CMAKE_NO_PRIVATE_INCLUDES = true
CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/

View File

@ -57,7 +57,8 @@ isEmpty(CMAKE_VERSION) {
dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST
dependentmodules = $$cmakeModuleList($$dependentmodules)
contains(QT_CONFIG, angle): CMAKE_ANGLE_DEFINE = -DQT_WITH_ANGLE=True
contains(QT_CONFIG, angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
!contains(QT_CONFIG, egl): CMAKE_GL_DEFINES += -DNO_EGL=True
CMAKE_MODULE_VERSIONS =
CMAKE_MODULES_UNDER_TEST =
@ -76,7 +77,7 @@ isEmpty(CMAKE_VERSION) {
cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR \
-DCMAKE_VERBOSE_MAKEFILE=1 \
$$CMAKE_MODULE_DEFINES \
$$CMAKE_ANGLE_DEFINE \
$$CMAKE_GL_DEFINES \
-DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} \
-DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH \
-DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" \

View File

@ -28,28 +28,48 @@ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION)
set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
macro(_qt5_$${CMAKE_MODULE_NAME}_check_file_exists file)
if(NOT EXISTS \"${file}\" )
message(FATAL_ERROR \"The imported target \\\"Qt5::$${CMAKE_MODULE_NAME}\\\" references the file
\\\"${file}\\\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\\\"${CMAKE_CURRENT_LIST_FILE}\\\"
but not all the files it references.
\")
endif()
endmacro()
macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\")
!!ELSE
set(imported_location \"IMPORTED_LOCATION_${Configuration}\" \"$${CMAKE_LIB_DIR}${LIB_LOCATION}\")
!!ENDIF
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
\"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
\"IMPORTED_LOCATION_${Configuration}\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\"
!!ELSE
\"IMPORTED_LOCATION_${Configuration}\" \"$${CMAKE_LIB_DIR}${LIB_LOCATION}\"
!!ENDIF
\"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
!!IF !isEmpty(CMAKE_LIB_SONAME)
\"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\"
!!ENDIF
)
!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
!!ELSE
set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
!!ENDIF
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
\"IMPORTED_IMPLIB_${Configuration}\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\"
!!ELSE
\"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\"
!!ENDIF
\"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
)
endif()
!!ENDIF
@ -60,21 +80,34 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !no_module_headers
!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\"
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\"
)
!!ELSE
set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
!!ENDIF
!!ELSE
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\")
!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
\"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\"
\"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\"
)
!!ELSE
set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
!!ENDIF
!!ENDIF
!!ELSE
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS)
set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
!!ENDIF
foreach(_dir ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS} ${Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS})
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${_dir})
endforeach()
set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE})
@ -215,4 +248,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake\")
!!ENDIF
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake\")
endif()

View File

@ -2,3 +2,9 @@
unset(MAKEFILE_GENERATOR)
load(default_pre)
# Check for supported Xcode versions
lessThan(QMAKE_XCODE_VERSION, "4.3"): \
error("This mkspec requires Xcode 4.3 or later")
!lessThan(QMAKE_XCODE_VERSION, "4.7"): \
warning("The version of Xcode installed on this system is not recognized - custom compiler settings may be necessary")

View File

@ -7,6 +7,11 @@ android {
isEmpty(API_VERSION): API_VERSION = android-10
}
isEmpty(BUILD_TOOLS_REVISION) {
BUILD_TOOLS_REVISION = $$(ANDROID_BUILD_TOOLS_REVISION)
isEmpty(BUILD_TOOLS_REVISION): BUILD_TOOLS_REVISION = 17.0.0
}
!exists($$SDK_ROOT/platforms/$$API_VERSION/android.jar) {
error("The Path $$SDK_ROOT/platforms/$$API_VERSION/android.jar does not exist. Make sure the ANDROID_SDK_ROOT and ANDROID_API_VERSION environment variables are correctly set.")
}
@ -56,7 +61,9 @@ android:!bundled_jar_file {
DEX_CMD = $$PWD/data/android/dx $$SDK_ROOT
} else {
DEX_CMD = $$SDK_ROOT/platform-tools/dx
!exists($$DEX_CMD): DEX_CMD = $$SDK_ROOT/build-tools/$$BUILD_TOOLS_REVISION/dx
}
!exists($$DEX_CMD): error("The path $$DEX_CMD does not exist. Please set the environment variable ANDROID_BUILD_TOOLS_REVISION to the revision of the build tools installed in your Android SDK.")
QMAKE_LINK_SHLIB_CMD = $$DEX_CMD --dex --output $(TARGET) $$CLASS_DIR
} else {
QMAKE_LINK_SHLIB_CMD = jar cf $(TARGET) -C $$CLASS_DIR .

View File

@ -16,6 +16,14 @@ qt:!isEmpty(QT_CONFIG) {
}
}
isEmpty(_QMAKE_CACHE_) {
warning("No .qmake.cache is present. This significantly slows down qmake with this makespec.")
warning("Call 'cache()' in the top-level project file to rectify this problem.")
} else {
cache(QMAKE_XCODE_DEVELOPER_PATH)
cache(QMAKE_XCODE_VERSION)
}
# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
# and friends that other features/extra compilers may depend on.
sdk: load(sdk)

View File

@ -1,3 +1,25 @@
CONFIG = sdk rez $$CONFIG
load(default_pre)
isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
# Get path of Xcode's Developer directory
QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
# Make sure Xcode path is valid
!exists($$QMAKE_XCODE_DEVELOPER_PATH): \
error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
# Make sure Xcode is set up properly
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
}
isEmpty(QMAKE_XCODE_VERSION) {
# Extract Xcode version using xcodebuild
xcode_version = $$system("/usr/bin/xcodebuild -version")
QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
unset(xcode_version)
}

View File

@ -5,8 +5,13 @@ isEmpty(QMAKE_MAC_SDK): \
contains(QMAKE_MAC_SDK, .*/.*): \
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) {
QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
!isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set, QMAKE_MAC_SDK_PATH)
} else {
QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)
}
!equals(MAKEFILE_GENERATOR, XCODE) {
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
@ -21,6 +26,11 @@ QMAKE_INCDIR_OPENGL = $$sysrootified
# Resolve SDK version of various tools
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB)) {
!isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}) {
$$tool = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool})
next()
}
value = $$eval($$tool)
isEmpty(value): next()
@ -28,15 +38,21 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
isEmpty(sysrooted): next()
$$tool = $$sysrooted $$member(value, 1, -1)
!isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}, set, $$tool)
}
# We use xml as the output format instead of json since plutil on 10.6 does not have that option
QMAKE_MAC_PLATFORM_NAME = $$system("/usr/bin/plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - 2>/dev/null | " \
"sed '/^<!DOCTYPE/d' | " \ # Don't look up http://www.apple.com/DTDs/PropertyList-1.0.dtd
"PERL5LIB= xpath 'string(//key[.=\"PLATFORM_NAME\"]/following-sibling::*[1])' 2>/dev/null | " \
"sed 's/.*Value: \\(.*\\)/\\1/'")
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
# We use xml as the output format instead of json since plutil on 10.6 does not have that option
QMAKE_MAC_PLATFORM_NAME = $$system("/usr/bin/plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - 2>/dev/null | " \
"sed '/^<!DOCTYPE/d' | " \ # Don't look up http://www.apple.com/DTDs/PropertyList-1.0.dtd
"PERL5LIB= xpath 'string(//key[.=\"PLATFORM_NAME\"]/following-sibling::*[1])' 2>/dev/null | " \
"sed 's/.*Value: \\(.*\\)/\\1/'")
isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'")
isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'")
!isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set, QMAKE_MAC_PLATFORM_NAME)
} else {
QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name)
}
!equals(MAKEFILE_GENERATOR, XCODE) {
# FIXME: Get the version_min_flag out of the platform's 'Native Build System.xcspec'

View File

@ -43,7 +43,10 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml
!isEmpty(ANDROID_LIB_DEPENDENCIES) {
for(LIB_FILE, ANDROID_LIB_DEPENDENCIES) {
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" />"
EXTENDS = $$section(LIB_FILE, ":", 1, 1)
!isEmpty(EXTENDS): EXTENDS = "extends=\"$$EXTENDS\""
LIB_FILE = $$section(LIB_FILE, ":", 0, 0)
FILE_CONTENT += "<lib file=\"$$LIB_FILE\" $$EXTENDS />"
}
}

View File

@ -20,6 +20,7 @@ QMAKE_QT_CONFIG = $$[QT_HOST_DATA/get]/mkspecs/qconfig.pri
# qt_<module>.pri forwarding file
QT_MODULE_INCLUDE_BASE = $$[QT_INSTALL_HEADERS]
QT_MODULE_LIB_BASE = $$[QT_INSTALL_LIBS]
QT_MODULE_HOST_LIB_BASE = $$[QT_HOST_LIBS]
QT_MODULE_PLUGIN_BASE = $$[QT_INSTALL_PLUGINS]
QT_MODULE_LIBEXEC_BASE = $$[QT_INSTALL_LIBEXECS]
QT_MODULE_BIN_BASE = $$[QT_INSTALL_BINS]
@ -30,6 +31,7 @@ QMAKE_QT_CONFIG = $$[QT_HOST_DATA/get]/mkspecs/qconfig.pri
}
unset(QT_MODULE_INCLUDE_BASE)
unset(QT_MODULE_LIB_BASE)
unset(QT_MODULE_HOST_LIB_BASE)
unset(QT_MODULE_PLUGIN_BASE)
unset(QT_MODULE_LIBEXEC_BASE)
unset(QT_MODULE_BIN_BASE)

View File

@ -194,12 +194,10 @@ defineTest(qtPrepareTool) {
$$1 = $$eval(QT_TOOL.$${2}.command)
isEmpty($$1) {
$$1 = $$[QT_HOST_BINS]/$$2
contains(QMAKE_HOST.os, Windows):!contains($$1, .*\\.(exe|bat)$) {
exists($$eval($$1).bat) {
$$1 = $$eval($$1).bat
} else {
$$1 = $$eval($$1).exe
}
exists($$eval($$1).pl) {
$$1 = perl -w $$eval($$1).pl
} else: contains(QMAKE_HOST.os, Windows) {
$$1 = $$eval($$1).exe
} else:contains(QMAKE_HOST.os, Darwin) {
BUNDLENAME = $$eval($$1).app/Contents/MacOS/$$2
exists($$BUNDLENAME) {

View File

@ -12,10 +12,16 @@
#library
!qt_no_install_library {
win32 {
dlltarget.path = $$[QT_INSTALL_BINS]
host_build: \
dlltarget.path = $$[QT_HOST_BINS]
else: \
dlltarget.path = $$[QT_INSTALL_BINS]
INSTALLS += dlltarget
}
target.path = $$[QT_INSTALL_LIBS]
host_build: \
target.path = $$[QT_HOST_LIBS]
else: \
target.path = $$[QT_INSTALL_LIBS]
INSTALLS += target
}

View File

@ -128,7 +128,10 @@ load(qt_installs)
unix|win32-g++* {
CONFIG += create_pc
QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS/raw]
host_build: \
QMAKE_PKGCONFIG_LIBDIR = $$[QT_HOST_LIBS]
else: \
QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS/raw]
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS/raw]
QMAKE_PKGCONFIG_CFLAGS = -I${includedir}/$$MODULE_INCNAME
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
@ -139,14 +142,14 @@ unix|win32-g++* {
include_replace.match = $$rplbase/include
include_replace.replace = $$[QT_INSTALL_HEADERS/raw]
lib_replace.match = $$rplbase/lib
lib_replace.replace = $$[QT_INSTALL_LIBS/raw]
lib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR
QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace
QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
}
unix {
CONFIG += create_libtool explicitlib
QMAKE_LIBTOOL_LIBDIR = $$[QT_INSTALL_LIBS/raw]
QMAKE_LIBTOOL_LIBDIR = $$QMAKE_PKGCONFIG_LIBDIR
QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
}

View File

@ -19,10 +19,18 @@ else: \
!build_pass {
# Create a module .pri file
unix:!static: \
module_rpath = "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]"
host_build: \
module_libs = "\$\$QT_MODULE_HOST_LIB_BASE"
else: \
module_libs = "\$\$QT_MODULE_LIB_BASE"
unix:!static {
host_build: \
module_rpath = "QT.$${MODULE}.rpath = $$[QT_HOST_LIBS]"
else: \
module_rpath = "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]"
} else {
module_rpath =
}
!isEmpty(QT_FOR_PRIVATE) {
contains(QT_FOR_PRIVATE, .*-private$):error("QT_FOR_PRIVATE may not contain *-private.")
module_privdep = "QT.$${MODULE}.private_depends = $$QT_FOR_PRIVATE"
@ -55,15 +63,17 @@ else: \
"QT.$${MODULE}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \
"" \
"QT.$${MODULE}.name = $$TARGET" \
"QT.$${MODULE}.bins = \$\$QT_MODULE_BIN_BASE" \
"QT.$${MODULE}.includes = $$MODULE_INCLUDES" \
"QT.$${MODULE}.private_includes = $$MODULE_PRIVATE_INCLUDES" \
"QT.$${MODULE}.libs = \$\$QT_MODULE_LIB_BASE" \
"QT.$${MODULE}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \
"QT.$${MODULE}.libs = $$module_libs" \
$$module_rpath \
"QT.$${MODULE}.private_includes = $$MODULE_PRIVATE_INCLUDES"
!host_build: MODULE_PRI_CONT += \
"QT.$${MODULE}.includes = $$MODULE_INCLUDES" \
"QT.$${MODULE}.bins = \$\$QT_MODULE_BIN_BASE" \
"QT.$${MODULE}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \
"QT.$${MODULE}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \
"QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE" \
"QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE" \
"QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE"
MODULE_PRI_CONT += \
"QT.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
$$module_privdep \
$$module_rundep \
@ -84,6 +94,7 @@ else: \
"QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \
"QT_MODULE_QML_BASE = $$MODULE_BASE_OUTDIR/qml" \
"QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \
"QT_MODULE_HOST_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \
"QT_MODULE_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \
"QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \
"include($$MODULE_PRI)"
@ -99,6 +110,7 @@ else: \
QT_MODULE_IMPORT_BASE = $$[QT_INSTALL_IMPORTS]
QT_MODULE_QML_BASE = $$[QT_INSTALL_QML]
QT_MODULE_LIB_BASE = $$[QT_INSTALL_LIBS]
QT_MODULE_HOST_LIB_BASE = $$[QT_HOST_LIBS]
QT_MODULE_LIBEXEC_BASE = $$[QT_INSTALL_LIBEXECS]
QT_MODULE_PLUGIN_BASE = $$[QT_INSTALL_PLUGINS]

View File

@ -22,6 +22,4 @@ include(../../common/clang-mac.conf)
include(../../common/ios/clang.conf)
include(../../common/ios/qmake.conf)
lessThan(QMAKE_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later")
load(qt_config)

View File

@ -94,6 +94,10 @@ QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain
MINGW_IN_SHELL = 1
QMAKE_DIR_SEP = /
include(../common/shell-unix.conf)
# Because install's ability to set permissions is not relevant on Windows,
# and git's msys does not provide it to start with.
QMAKE_INSTALL_FILE = cp -f
QMAKE_INSTALL_PROGRAM = cp -f
} else {
include(../common/shell-win32.conf)
}

View File

@ -8,7 +8,11 @@ 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
DEFINES += UNICODE WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1400 WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1400 _WIN32
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += WIN64
QMAKE_COMPILER_DEFINES += _WIN64
}
QMAKE_COMPILER = msvc

View File

@ -8,7 +8,11 @@ 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
DEFINES += UNICODE WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1500 WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1500 _WIN32
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += WIN64
QMAKE_COMPILER_DEFINES += _WIN64
}
QMAKE_COMPILER = msvc

View File

@ -8,7 +8,11 @@ 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
DEFINES += UNICODE WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1600 WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1600 _WIN32
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += WIN64
QMAKE_COMPILER_DEFINES += _WIN64
}
QMAKE_COMPILER = msvc

View File

@ -5,9 +5,14 @@
#
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
DEFINES += UNICODE WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32
QMAKE_COMPILER_DEFINES += _MSC_VER=1700 _WIN32
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += WIN64
QMAKE_COMPILER_DEFINES += _WIN64
}
QMAKE_COMPILER = msvc

View File

@ -1412,7 +1412,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool)
<< attrTagT(_StringPooling, tool.StringPooling)
<< attrTagS(_StructMemberAlignment, toString(tool.StructMemberAlignment))
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner)
//unused << attrTagS(_TreatSpecificWarningsAsErrors, tool.TreatSpecificWarningsAsErrors)
<< attrTagX(_TreatSpecificWarningsAsErrors, tool.TreatSpecificWarningsAsErrors, ";")
<< attrTagT(_TreatWarningAsError, tool.WarnAsError)
<< attrTagT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType)
<< attrTagT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions)

View File

@ -779,16 +779,14 @@ bool VCCLCompilerTool::parseOption(const char* option)
found = false; break;
case 'R':
if(second == 'T' && third == 'C') {
if(fourth == '1')
BasicRuntimeChecks = runtimeBasicCheckAll;
else if(fourth == 'c')
SmallerTypeCheck = _True;
else if(fourth == 's')
BasicRuntimeChecks = runtimeCheckStackFrame;
else if(fourth == 'u')
BasicRuntimeChecks = runtimeCheckUninitVariables;
else
found = false; break;
int rtc = BasicRuntimeChecks;
for (size_t i = 4; option[i]; ++i) {
if (!parseRuntimeCheckOption(option[i], &rtc)) {
found = false;
break;
}
}
BasicRuntimeChecks = static_cast<basicRuntimeCheckOption>(rtc);
}
break;
case 'T':
@ -1117,6 +1115,12 @@ bool VCCLCompilerTool::parseOption(const char* option)
case 'd':
DisableSpecificWarnings += option+3;
break;
case 'e':
if (config->CompilerVersion <= NET2008)
AdditionalOptions += option;
else
TreatSpecificWarningsAsErrors += option + 3;
break;
default:
AdditionalOptions += option;
}
@ -1132,6 +1136,21 @@ bool VCCLCompilerTool::parseOption(const char* option)
return true;
}
bool VCCLCompilerTool::parseRuntimeCheckOption(char c, int *rtc)
{
if (c == '1')
*rtc = runtimeBasicCheckAll;
else if (c == 'c')
SmallerTypeCheck = _True;
else if (c == 's')
*rtc |= runtimeCheckStackFrame;
else if (c == 'u')
*rtc |= runtimeCheckUninitVariables;
else
return false;
return true;
}
// VCLinkerTool -----------------------------------------------------
VCLinkerTool::VCLinkerTool()
: DataExecutionPrevention(unset),

View File

@ -106,10 +106,10 @@ enum asmListingOption {
asmListingAsmSrc
};
enum basicRuntimeCheckOption {
runtimeBasicCheckNone,
runtimeCheckStackFrame,
runtimeCheckUninitVariables,
runtimeBasicCheckAll
runtimeBasicCheckNone = 0,
runtimeCheckStackFrame = 1,
runtimeCheckUninitVariables = 2,
runtimeBasicCheckAll = runtimeCheckStackFrame | runtimeCheckUninitVariables
};
enum browseInfoOption {
brInfoNone,
@ -561,6 +561,7 @@ public:
QStringList UndefinePreprocessorDefinitions;
pchOption UsePrecompiledHeader;
triState UseUnicodeForAssemblerListing;
QStringList TreatSpecificWarningsAsErrors;
triState WarnAsError;
warningLevelOption WarningLevel;
triState WholeProgramOptimization;
@ -579,6 +580,9 @@ public:
QString PreprocessOutputPath;
VCConfiguration* config;
private:
bool parseRuntimeCheckOption(char c, int *rtc);
};
class VCLinkerTool : public VCToolBase

View File

@ -622,8 +622,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QHash<QString, VcsolutionDepend*> solution_depends;
QList<VcsolutionDepend*> solution_cleanup;
QString oldpwd = qmake_getpwd();
// Make sure that all temp projects are configured
// for release so that the depends are created
// without the debug <lib>dxxx.lib name mangling
@ -997,7 +995,6 @@ void VcprojGenerator::initCompilerTool()
conf.compiler.Optimization = optimizeDisabled;
}
conf.compiler.AssemblerListingLocation = placement ;
conf.compiler.ProgramDataBaseFileName = ".\\" ;
conf.compiler.ObjectFile = placement ;
conf.compiler.ExceptionHandling = ehNone;
// PCH

View File

@ -345,7 +345,7 @@ QTextStream &operator<<(QTextStream &t, const ProString &str)
return t;
}
static QString ProStringList_join(const ProStringList &this_, const QChar *sep, const size_t sepSize)
static QString ProStringList_join(const ProStringList &this_, const QChar *sep, const int sepSize)
{
int totalLength = 0;
const int sz = this_.size();

View File

@ -275,6 +275,7 @@ enum ProToken {
TokRemove, // variable -=
TokReplace, // variable ~=
// previous literal/expansion is a variable manipulation
// - lower bound for expected output length (1)
// - value expression + TokValueTerminator
TokValueTerminator, // assignment value terminator
TokLiteral, // literal string (fully dequoted)

View File

@ -195,7 +195,7 @@ static bool isTrue(const ProString &_str, QString &tmp)
return !str.compare(statics.strtrue, Qt::CaseInsensitive) || str.toInt();
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && defined(PROEVALUATOR_FULL)
static QString windowsErrorCode()
{
wchar_t *string = 0;

View File

@ -1242,10 +1242,11 @@ void QMakeEvaluator::setupProject()
{
setTemplate();
ProValueMap &vars = m_valuemapStack.top();
vars[ProKey("TARGET")] << ProString(QFileInfo(currentFileName()).baseName());
vars[ProKey("_PRO_FILE_")] << ProString(currentFileName());
vars[ProKey("_PRO_FILE_PWD_")] << ProString(currentDirectory());
vars[ProKey("OUT_PWD")] << ProString(m_outputDir);
ProFile *proFile = currentProFile();
vars[ProKey("TARGET")] << ProString(QFileInfo(currentFileName()).baseName()).setSource(proFile);
vars[ProKey("_PRO_FILE_")] << ProString(currentFileName()).setSource(proFile);
vars[ProKey("_PRO_FILE_PWD_")] << ProString(currentDirectory()).setSource(proFile);
vars[ProKey("OUT_PWD")] << ProString(m_outputDir).setSource(proFile);
}
void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where)
@ -1356,11 +1357,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
loadDefaults();
}
#ifdef QT_BUILD_QMAKE
for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
it != m_extraVars.constEnd(); ++it)
m_valuemapStack.first().insert(it.key(), it.value());
#endif
VisitReturn vr;
@ -1375,11 +1374,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
evaluateCommand(m_option->precmds, fL1S("(command line)"));
#ifdef QT_BUILD_QMAKE
// After user configs, to override them
if (!m_extraConfigs.isEmpty())
evaluateCommand("CONFIG += " + m_extraConfigs.join(' '), fL1S("(extra configs)"));
#endif
evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)"));
}
debugMsg(1, "visiting file %s", qPrintable(pro->fileName()));
@ -1390,13 +1387,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
if (flags & LoadPostFiles) {
evaluateCommand(m_option->postcmds, fL1S("(command line -after)"));
#ifdef QT_BUILD_QMAKE
// Again, to ensure the project does not mess with us.
// Specifically, do not allow a project to override debug/release within a
// debug_and_release build pass - it's too late for that at this point anyway.
if (!m_extraConfigs.isEmpty())
evaluateCommand("CONFIG += " + m_extraConfigs.join(' '), fL1S("(extra configs)"));
#endif
evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)"));
if ((vr = evaluateFeatureFile(QLatin1String("default_post.prf"))) == ReturnError)
goto failed;

View File

@ -112,10 +112,8 @@ public:
QMakeHandler *handler);
~QMakeEvaluator();
#ifdef QT_BUILD_QMAKE
void setExtraVars(const ProValueMap &extraVars) { m_extraVars = extraVars; }
void setExtraConfigs(const ProStringList &extraConfigs) { m_extraConfigs = extraConfigs; }
#endif
void setOutputDir(const QString &outputDir) { m_outputDir = outputDir; }
ProStringList values(const ProKey &variableName) const;
@ -268,10 +266,8 @@ public:
QStack<Location> m_locationStack; // All execution location changes
QStack<ProFile *> m_profileStack; // Includes only
#ifdef QT_BUILD_QMAKE
ProValueMap m_extraVars;
ProStringList m_extraConfigs;
#endif
QString m_outputDir;
int m_listCount;

View File

@ -298,12 +298,12 @@ bool QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
// Worst-case size calculations:
// - line marker adds 1 (2-nl) to 1st token of each line
// - empty assignment "A=":2 =>
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) +
// TokValueTerminator(1) == 7 (8)
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + 0(1) +
// TokValueTerminator(1) == 8 (9)
// - non-empty assignment "A=B C":5 =>
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) +
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + 2(1) +
// TokLiteral(1) + len(1) + "B"(1) +
// TokLiteral(1) + len(1) + "C"(1) + TokValueTerminator(1) == 13 (14)
// TokLiteral(1) + len(1) + "C"(1) + TokValueTerminator(1) == 14 (15)
// - variable expansion: "$$f":3 =>
// TokVariable(1) + hash(2) + len(1) + "f"(1) = 5
// - function expansion: "$$f()":5 =>

View File

@ -74,6 +74,7 @@ static const struct {
{ "QT_HOST_PREFIX", QLibraryInfo::HostPrefixPath, true },
{ "QT_HOST_DATA", QLibraryInfo::HostDataPath, true },
{ "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true },
{ "QT_HOST_LIBS", QLibraryInfo::HostLibrariesPath, true },
{ "QMAKE_SPEC", QLibraryInfo::HostSpecPath, true },
{ "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true },
};

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