Merge branch 'dev' into stable

This starts Qt 5.1 release cycle

Conflicts:
	src/gui/text/qfontdatabase.cpp
	src/gui/text/qharfbuzz_copy_p.h
	src/widgets/kernel/qapplication.cpp
	src/widgets/kernel/qcoreapplication.cpp

Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
This commit is contained in:
Oswald Buddenhagen 2013-03-20 13:46:57 +01:00
commit 76c0be34cd
2616 changed files with 204410 additions and 32108 deletions

2
.gitignore vendored
View File

@ -48,6 +48,7 @@ pcviewer.cfg
core
.qmake.cache
.qmake.vars
.device.vars
*.prl
tags
.DS_Store
@ -306,6 +307,7 @@ tests/auto/corelib/thread/qthreadstorage/crashOnExit
tests/auto/corelib/io/qresourceengine/qresourceengine
tests/auto/corelib/codecs/qtextcodec/echo/echo
tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness
tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper
tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver
tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger
tests/auto/dbus/qdbusinterface/qmyserver/qmyserver

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl
#############################################################################
##
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
@ -771,7 +771,6 @@ my $class_lib_map_contents = "";
our @ignore_headers = ();
our @ignore_for_master_contents = ();
our @ignore_for_include_check = ();
our @ignore_for_qt_begin_header_check = ();
our @ignore_for_qt_begin_namespace_check = ();
our @ignore_for_qt_module_check = ();
our %inject_headers = ();
@ -1137,7 +1136,6 @@ if($check_includes) {
foreach my $subdir (@subdirs) {
my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
foreach my $header (@headers) {
my $header_skip_qt_begin_header_test = 0;
my $header_skip_qt_begin_namespace_test = 0;
$header = 0 if($header =~ /^ui_.*.h/);
foreach (@ignore_headers) {
@ -1157,9 +1155,6 @@ if($check_includes) {
foreach (@ignore_for_include_check) {
$public_header = 0 if($header eq $_);
}
foreach(@ignore_for_qt_begin_header_check) {
$header_skip_qt_begin_header_test = 1 if ($header eq $_);
}
foreach(@ignore_for_qt_begin_namespace_check) {
$header_skip_qt_begin_namespace_test = 1 if ($header eq $_);
}
@ -1169,10 +1164,9 @@ if($check_includes) {
my $iheader = $subdir . "/" . $header;
if($public_header) {
if(open(F, "<$iheader")) {
my $qt_begin_header_found = 0;
my $qt_end_header_found = 0;
my $qt_begin_namespace_found = 0;
my $qt_end_namespace_found = 0;
my $qt_namespace_suffix = "";
my $line;
my $stop_processing = 0;
while($line = <F>) {
@ -1197,25 +1191,13 @@ if($check_includes) {
}
}
}
} elsif ($header_skip_qt_begin_header_test == 0 and $line =~ /^QT_BEGIN_HEADER\s*$/) {
$qt_begin_header_found = 1;
} elsif ($header_skip_qt_begin_header_test == 0 and $line =~ /^QT_END_HEADER\s*$/) {
$qt_end_header_found = 1;
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE\s*$/) {
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) {
$qt_namespace_suffix = $1 // "";
$qt_begin_namespace_found = 1;
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE\s*$/) {
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) {
$qt_end_namespace_found = 1;
}
}
if ($header_skip_qt_begin_header_test == 0 and $stop_processing == 0) {
if ($qt_begin_header_found == 0) {
print "$lib: WARNING: $iheader does not include QT_BEGIN_HEADER\n";
}
if ($qt_begin_header_found && $qt_end_header_found == 0) {
print "$lib: WARNING: $iheader has QT_BEGIN_HEADER but no QT_END_HEADER\n";
}
}
if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) {
if ($qt_begin_namespace_found == 0) {
@ -1223,7 +1205,7 @@ if($check_includes) {
}
if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) {
print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE but no QT_END_NAMESPACE\n";
print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n";
}
}

View File

@ -1,3 +1,4 @@
TARGET = arch
SOURCES = arch.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console

View File

@ -0,0 +1,2 @@
option(host_build)
include(arch.pro)

View File

@ -40,6 +40,7 @@
****************************************************************************/
#include <linux/fb.h>
#include <sys/kd.h>
#include <sys/ioctl.h>
int main(int, char **)

View File

@ -5,26 +5,20 @@ VERBOSE=$2
SRCDIR=$3
OUTDIR=$4
RESULTFILE=$5
VARPREFIX=$6
TARGET=$6
shift 6
if [ "$TARGET" = "host" ]; then
VARPREFIX="CFG_HOST"
PROSUFFIX="_host"
else
VARPREFIX="CFG"
PROSUFFIX=""
fi
LFLAGS="$SYSROOT_FLAG"
CXXFLAGS="$SYSROOT_FLAG"
while [ "$#" -gt 0 ]; do
PARAM=$1
case $PARAM in
-sdk)
LFLAGS="$LFLAGS -Wl,-syslibroot,$2"
CXXFLAGS="$CXXFLAGS -isysroot $2"
shift
;;
*) ;;
esac
shift
done
# debuggery
[ "$VERBOSE" = "yes" ] && echo "Determining architecture... ($*)"
@ -32,7 +26,7 @@ done
test -d "$OUTDIR/config.tests/arch" || mkdir -p "$OUTDIR/config.tests/arch"
cd "$OUTDIR/config.tests/arch"
[ -f Makefile ] && $MAKE distclean >/dev/null 2>&1
OUTDIR=$OUTDIR "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "LIBS+=$LFLAGS" "QMAKE_CXXFLAGS+=$CXXFLAGS" "$SRCDIR/config.tests/arch/arch.pro" >/dev/null 2>&1 || echo "qmake is broken" >&2
OUTDIR=$OUTDIR "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "LIBS+=$LFLAGS" "QMAKE_CXXFLAGS+=$CXXFLAGS" "$SRCDIR/config.tests/arch/arch$PROSUFFIX.pro" >/dev/null 2>&1 || echo "qmake is broken" >&2
ARCH=""
@ -42,6 +36,8 @@ if [ -f ./arch.exe ]; then
binary=./arch.exe
elif [ -f ./arch ]; then
binary=./arch
elif [ -f ./libarch.so ]; then
binary=./libarch.so
else
[ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!"
exit 2

View File

@ -50,7 +50,7 @@ int main(int, char **)
#else
# error "Feature _POSIX_MONOTONIC_CLOCK not available"
// MIPSpro doesn't understand #error, so force a compiler error
force_compiler_error = true;
force_compiler_error = true;
#endif
return 0;
}

View File

@ -32,11 +32,6 @@ while [ "$#" -gt 0 ]; do
MAC_ARCH_LFLAGS="$MAC_ARCH_LFLAGS -arch $2"
shift
;;
-sdk)
LFLAGS="$LFLAGS -Wl,-syslibroot,$2"
CXXFLAGS="$CXXFLAGS -isysroot $2"
shift
;;
-F*|-m*|-x*)
LFLAGS="$LFLAGS $PARAM"
CXXFLAGS="$CXXFLAGS $PARAM"
@ -72,7 +67,7 @@ test -r Makefile && $MAKE distclean >/dev/null 2>&1
# Make sure output from possible previous tests is gone
rm -f "$EXE" "${EXE}.exe"
set -- "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
set -- "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG+=android_app" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
if [ "$VERBOSE" = "yes" ]; then
OUTDIR=$OUTDIR "$@"
$MAKE
@ -81,7 +76,7 @@ else
$MAKE >/dev/null 2>&1
fi
( [ -x "$EXE" ] || [ -x "${EXE}.exe" ] ) && SUCCESS=yes
( [ -f "$EXE" ] || [ -f "${EXE}.exe" ] ) && SUCCESS=yes
# done
if [ "$SUCCESS" != "yes" ]; then

View File

@ -0,0 +1,3 @@
SOURCES = main.cpp
CONFIG -= qt dylib
mac:CONFIG -= app_bundle

View File

@ -1,9 +1,9 @@
/****************************************************************************
**
** Copyright (C) 2012 Collabora Ltd, author <robin.burchell@collabora.co.uk>
** Copyright (C) 2012 Intel Corporation
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@ -39,4 +39,13 @@
**
****************************************************************************/
#include "../../common/android/qplatformdefs.h"
#include <sys/eventfd.h>
int main()
{
eventfd_t value;
int fd = eventfd(0, EFD_CLOEXEC);
eventfd_read(fd, &value);
eventfd_write(fd, value);
return 0;
}

View File

@ -59,6 +59,6 @@ int main()
if (getaddrinfo("foo", 0, 0, &res) == 0)
freeaddrinfo(res);
gai_strerror(0);
return 0;
}

535
configure vendored
View File

@ -2,6 +2,7 @@
#############################################################################
##
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## Copyright (C) 2013 Intel Corporation.
## Contact: http://www.qt-project.org/legal
##
## This file is the build configuration utility of the Qt Toolkit.
@ -125,7 +126,7 @@ shellArgumentListToQMakeList()
# Helper function for getQMakeConf. It parses include statements in
# qmake.conf and prints out the expanded file
getQMakeConf1()
expandQMakeConf()
{
while read line; do case "$line" in
include*)
@ -136,7 +137,7 @@ getQMakeConf1()
echo "WARNING: Unable to find file $conf_file" >&2
continue
fi
getQMakeConf1 "$conf_file"
expandQMakeConf "$conf_file"
;;
*load\(device_config\)*)
conf_file="$DEVICE_VARS_FILE"
@ -144,7 +145,7 @@ getQMakeConf1()
echo "WARNING: Unable to find file $conf_file" >&2
continue
fi
getQMakeConf1 "$conf_file"
expandQMakeConf "$conf_file"
;;
*)
echo "$line"
@ -152,13 +153,19 @@ getQMakeConf1()
esac; done < "$1"
}
getQMakeConf2()
extractQMakeVariables()
{
$AWK '
BEGIN {
values["LITERAL_WHITESPACE"] = " "
values["LITERAL_DOLLAR"] = "$"
}
/^!?host_build:/ {
scopeStart = index($0, ":") + 1
condition = substr($0, 0, scopeStart - 2)
if (condition != "'"$1"'") { next }
$0 = substr($0, scopeStart)
}
/^[_A-Z0-9.]+[ \t]*\+?=/ {
valStart = index($0, "=") + 1
@ -183,13 +190,26 @@ BEGIN {
}
ovalue = ovalue values[var]
}
ovalue = ovalue value
value = ovalue value
ovalue = ""
while (match(value, /\$\$system\(("[^"]*"|[^)]*)\)/)) {
ovalue = ovalue substr(value, 1, RSTART - 1)
cmd = substr(value, RSTART + 9, RLENGTH - 10)
gsub(/^"|"$/, "", cmd)
value = substr(value, RSTART + RLENGTH)
while ((cmd | getline line) > 0) {
ovalue = ovalue line
}
close(cmd)
}
value = ovalue value
combinedValue = values[variable]
if (append == 1 && length(combinedValue) > 0) {
combinedValue = combinedValue " " ovalue
combinedValue = combinedValue " " value
} else {
combinedValue = ovalue
combinedValue = value
}
values[variable] = combinedValue
}
@ -201,27 +221,76 @@ END {
'
}
getQMakeConf3()
getSingleQMakeVariable()
{
echo "$2" | $AWK "/^($1)=/ { print substr(\$0, index(\$0, \"=\") + 1) }"
}
macSDKify()
{
# Normally we take care of sysrootifying in sdk.prf, but configure extracts some
# values before qmake is even built, so we have to duplicate the logic here.
sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1")
if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi
sysroot=$(xcodebuild -sdk $sdk -version Path 2>/dev/null)
if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
case "$sdk" in
macosx*)
version_min_flag="-mmacosx-version-min=$(getSingleQMakeVariable QMAKE_MACOSX_DEPLOYMENT_TARGET "$1")"
;;
iphoneos*)
version_min_flag="-miphoneos-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
;;
iphonesimulator*)
version_min_flag="-mios-simulator-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
;;
*)
;;
esac
echo "$1" | while read line; do
case "$line" in
QMAKE_CC=*|QMAKE_CXX=*|QMAKE_FIX_RPATH=*|QMAKE_AR=*|QMAKE_RANLIB=*|QMAKE_LINK=*|QMAKE_LINK_SHLIB=*)
# Prefix tool with toolchain path
var=$(echo "$line" | cut -d '=' -f 1)
val=$(echo "$line" | cut -d '=' -f 2-)
sdk_val=$(xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
echo "$var=$val"
;;
QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*|QMAKE_OBJECTIVE_CFLAGS=*)
echo "$line -isysroot $sysroot $version_min_flag"
;;
QMAKE_LFLAGS=*)
echo "$line -Wl,-syslibroot,$sysroot $version_min_flag"
;;
*)
echo "$line"
;;
esac
done
}
# relies on $QMAKESPEC being set correctly. parses include statements in
# qmake.conf and prints out the expanded file
getQMakeConf()
{
if [ -z "$specvals" ]; then
specvals=`getQMakeConf1 "$QMAKESPEC/qmake.conf" | getQMakeConf2`
specvals=`expandQMakeConf "$QMAKESPEC/qmake.conf" | extractQMakeVariables "host_build"`
if [ "$BUILD_ON_MAC" = "yes" ]; then specvals=$(macSDKify "$specvals"); fi
fi
getQMakeConf3 "$1" "$specvals"
getSingleQMakeVariable "$1" "$specvals"
}
getXQMakeConf()
{
if [ -z "$xspecvals" ]; then
xspecvals=`getQMakeConf1 "$XQMAKESPEC/qmake.conf" | getQMakeConf2`
xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" | extractQMakeVariables "!host_build"`
if [ "$BUILD_ON_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi
fi
getQMakeConf3 "$1" "$xspecvals"
getSingleQMakeVariable "$1" "$xspecvals"
}
compilerSupportsFlag()
@ -369,6 +438,12 @@ if [ -d /System/Library/Frameworks/Carbon.framework ]; then
BUILD_ON_MAC=yes
PLATFORM_MAC=maybe
fi
BUILD_ON_MSYS=no
HOST_DIRLIST_SEP=":"
if [ "$OSTYPE" = "msys" ]; then
HOST_DIRLIST_SEP=";"
BUILD_ON_MSYS=yes
fi
#-----------------------------------------------------------------------------
# Qt version detection
@ -733,7 +808,7 @@ QMakeVar add styles "mac fusion windows"
unset QTDIR
# the minimum version of libdbus-1 that we require:
MIN_DBUS_1_VERSION=0.93
MIN_DBUS_1_VERSION=1.2
# initalize internal variables
CFG_CONFIGURE_EXIT_ON_ERROR=yes
@ -844,10 +919,10 @@ CFG_GETADDRINFO=auto
CFG_IPV6IFNAME=auto
CFG_GETIFADDRS=auto
CFG_INOTIFY=auto
CFG_EVENTFD=auto
CFG_RPATH=yes
CFG_FRAMEWORK=auto
CFG_MAC_HARFBUZZ=no
CFG_SDK=
DEFINES=
D_FLAGS=
I_FLAGS=
@ -856,6 +931,7 @@ RPATH_FLAGS=
W_FLAGS=
QCONFIG_FLAGS=
XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
XPLATFORM_ANDROID=no
XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
XPLATFORM_MAEMO=no
XPLATFORM_QNX=no
@ -876,6 +952,7 @@ CFG_PCRE=auto
QPA_PLATFORM_GUARD=yes
CFG_CXX11=auto
CFG_DIRECTWRITE=no
CFG_WERROR=auto
# initalize variables used for installation
QT_INSTALL_PREFIX=
@ -935,6 +1012,15 @@ CFG_SQL_oci=no
CFG_SQL_db2=no
CFG_SQL_AVAILABLE=
# Android vars
CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
CFG_DEFAULT_ANDROID_PLATFORM=android-9
CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.7
CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST
if [ -d "$relpath/src/plugins/sqldrivers" ]; then
for a in "$relpath/src/plugins/sqldrivers/"*; do
if [ -d "$a" ]; then
@ -996,7 +1082,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)
-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)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
shift
VAL="$1"
@ -1299,8 +1385,7 @@ while [ "$#" -gt 0 ]; do
;;
sdk)
if [ "$BUILD_ON_MAC" = "yes" ]; then
CFG_SDK="$VAL"
DeviceVar set QMAKE_MAC_SDK "$VAL"
DeviceVar set !host_build:QMAKE_MAC_SDK "$VAL"
else
UNKNOWN_OPT=yes
fi
@ -2130,6 +2215,31 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
warnings-are-errors|Werror)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_WERROR="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
android-sdk)
CFG_DEFAULT_ANDROID_SDK_ROOT="$VAL"
;;
android-ndk)
CFG_DEFAULT_ANDROID_NDK_ROOT="$VAL"
;;
android-ndk-platform)
CFG_DEFAULT_ANDROID_PLATFORM="$VAL"
;;
android-ndk-host)
CFG_DEFAULT_ANDROID_NDK_HOST="$VAL"
;;
android-arch)
CFG_DEFAULT_ANDROID_TARGET_ARCH="$VAL"
;;
android-toolchain-version)
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL"
;;
*)
UNKNOWN_OPT=yes
;;
@ -2335,20 +2445,25 @@ if [ -z "$PLATFORM" ]; then
PLATFORM_NOTES=
case "$UNAME_SYSTEM:$UNAME_RELEASE" in
Darwin:*)
OSX_VERSION=`uname -r | cut -d. -f1`
# Select compiler. Use g++ unless we find a usable Clang version
PLATFORM=macx-g++
if [ "$OSX_VERSION" -ge 12 ]; then
# We're on Mountain Lion or above. Use Clang. Don't advertise gcc.
# Select compiler. Use g++ unless we find a usable Clang version. Note that
# we are checking the "Apple" clang/LLVM version number, not the actual
# clang/LLVM version number that the Apple version was based on. We look
# for Apple clang version 3.0 or higher, which was branched off LLVM 3.0
# from SVN, and first included in Xcode 4.2. Also note that we do not care
# 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 [ "$(xcrun -sdk macosx clang -v 2>&1 | sed -n 's/.*version \([0-9]\).*/\1/p')" -ge 3 ]; then
PLATFORM=macx-clang
elif [ "$OSX_VERSION" -eq 11 ]; then
# We're on Lion. Check if we have a supported Clang version
if [ "$(clang -v 2>&1 | grep -Po '(?<=version )[\d]')" -ge 3 ]; then
PLATFORM=macx-clang
PLATFORM_NOTES="\n - Also available for Mac OS X: macx-g++\n"
fi
fi
;;
# Advertise g++ as an alternative on Lion and below
if [ "$(uname -r | cut -d. -f1)" -le 11 ]; then
PLATFORM_NOTES="\n - Also available for Mac OS X: macx-g++\n"
fi
else
PLATFORM=macx-g++
fi
;;
AIX:*)
#PLATFORM=aix-g++
#PLATFORM=aix-g++-64
@ -2502,8 +2617,89 @@ fi
[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
case "$XPLATFORM" in *-maemo*) XPLATFORM_MAEMO=yes;; esac
case "$XPLATFORM" in *qnx-*|*blackberry-*) XPLATFORM_QNX=yes;; esac
case "$XPLATFORM" in
*-maemo*)
XPLATFORM_MAEMO=yes
;;
*qnx-*|*blackberry-*)
XPLATFORM_QNX=yes
;;
*ios*)
XPLATFORM_IOS=yes
;;
# XPLATFORM_ANDROID should not be set for unsupported/android-g++
*unsupported*)
;;
*android-g++*)
XPLATFORM_ANDROID=yes
;;
esac
if [ "$XPLATFORM_ANDROID" = "yes" ]; then
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
case $PLATFORM in
linux-*-64)
if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/linux-x86_64" ]; then
CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86_64
else
CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86
fi
;;
linux-*)
CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86
;;
macx-*)
CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86
if [ ! -z "$NATIVE_64_ARCH" ] && [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/darwin-x86_64" ]; then
CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86_64
fi
;;
win32-*)
CFG_DEFAULT_ANDROID_NDK_HOST=windows
if [ ! -z "$NATIVE_64_ARCH" ] && [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/windows-x86_64" ]; then
CFG_DEFAULT_ANDROID_NDK_HOST=windows-x86_64
fi
;;
esac
fi
if [ "$OPT_HELP" != "yes" ]; then
if [ -z "$CFG_DEFAULT_ANDROID_NDK_ROOT" ]; then
echo
echo "Can not find Android NDK. Please use -android-ndk option to specify one"
exit 1
fi
if [ -z "$CFG_DEFAULT_ANDROID_SDK_ROOT" ]; then
echo
echo "Can not find Android SDK. Please use -android-sdk option to specify one"
exit 1
fi
if [ -z "CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt" ]; then
echo
echo "Can not detect Android NDK toolchain. Please use -android-toolchain-version to specify"
exit 1
fi
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
echo
echo "Can not detect the android host. Please use -android-ndk-host option to specify one"
exit 1
fi
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"
DeviceVar set DEFAULT_ANDROID_NDK_HOST "$CFG_DEFAULT_ANDROID_NDK_HOST"
DeviceVar set DEFAULT_ANDROID_TARGET_ARCH "$CFG_DEFAULT_ANDROID_TARGET_ARCH"
DeviceVar set DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION "$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION"
fi
fi
if [ -d "$PLATFORM" ]; then
QMAKESPEC="$PLATFORM"
@ -2612,25 +2808,9 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
fi
# pass on $CFG_SDK to the arch/configure tests.
if [ -n "$CFG_SDK" ]; then
MAC_SDK_FLAG="-sdk $CFG_SDK"
else
MAC_SDK_FLAG=
fi
# find the default framework value
if [ "$BUILD_ON_MAC" = "yes" ]; then
if [ "$CFG_FRAMEWORK" = "auto" ]; then
CFG_FRAMEWORK="$CFG_SHARED"
elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
echo
echo "WARNING: Using static linking will disable the use of Mac frameworks."
echo
CFG_FRAMEWORK="no"
fi
else
CFG_FRAMEWORK=no
# iOS builds should be static to be able to submit to the App Store
if [ "$XPLATFORM_IOS" = "yes" ]; then
CFG_SHARED="no"
fi
# disable GTK style support auto-detection on Mac
@ -2641,6 +2821,32 @@ fi
QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`
TEST_COMPILER=$QMAKE_CONF_COMPILER
if [ "$OPT_HELP" != "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ] ; then
ANDROID_NDK_TOOLS_PREFIX=
ANDROID_PLATFORM_ARCH=
case $CFG_DEFAULT_ANDROID_TARGET_ARCH in
armeabi*)
ANDROID_NDK_TOOLS_PREFIX=arm-linux-androideabi
ANDROID_PLATFORM_ARCH=arch-arm
;;
x86)
ANDROID_NDK_TOOLS_PREFIX=x86
ANDROID_PLATFORM_ARCH=arch-x86
;;
mips)
ANDROID_NDK_TOOLS_PREFIX=mipsel-linux-android
ANDROID_PLATFORM_ARCH=arch-mips
;;
*)
echo "ERROR: Unknown android arch $CFG_DEFAULT_ANDROID_TARGET_ARCH"
exit 1
;;
esac
QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/$ANDROID_NDK_TOOLS_PREFIX-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/$ANDROID_NDK_TOOLS_PREFIX-g++
TEST_COMPILER="$QMAKE_CONF_COMPILER --sysroot=$CFG_DEFAULT_ANDROID_NDK_ROOT/platforms/$CFG_DEFAULT_ANDROID_PLATFORM/$ANDROID_PLATFORM_ARCH/"
fi
if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
if [ -z "$TEST_COMPILER" ]; then
echo "ERROR: Cannot set the compiler for the configuration tests"
@ -2751,7 +2957,7 @@ fi
# auto-detect default include and library search paths
gccout=`$TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null`
libdirs=`echo "$gccout" | sed -n -e 's/^LIBRARY_PATH=\(.*\)/\1/p'`
DEFAULT_LIBDIRS=`IFS=:; for i in $libdirs; do test -d "$i" && cd "$i" && pwd; done | sort -u`
DEFAULT_LIBDIRS=`IFS=${HOST_DIRLIST_SEP}; for i in $libdirs; do test -d "$i" && cd "$i" && pwd; done | sort -u`
DEFAULT_INCDIRS=`echo "$gccout" | awk '
/^End of search/ { yup=0 }
/ \(framework directory\)$/ { next }
@ -3308,6 +3514,10 @@ Additional options:
* -no-system-proxies .. Do not use system network proxies by default.
-system-proxies ..... Use system network proxies by default.
-no-warnings-are-errors Make warnings be treated normally
-warnings-are-errors Make warnings be treated as errors
(enabled if -developer-build is active)
$GBN -no-glib ........... Do not compile Glib support.
$GBY -glib .............. Compile Glib support.
EOF
@ -3344,14 +3554,39 @@ Qt/Mac only:
link tools against those frameworks.
-no-framework ...... Do not build Qt as a series of frameworks.
-sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
-sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be
one of the available SDKs as listed by 'xcodebuild -showsdks'.
-harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible.
* -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting
QT_ENABLE_HARFBUZZ environment variable.
EOF
fi
if [ "$XPLATFORM_ANDROID" = "yes" ]; then
cat << EOF
Android options:
-android-sdk path .............. The Android SDK root path.
(default $CFG_DEFAULT_ANDROID_SDK_ROOT)
-android-ndk path .............. The Android NDK root path.
(default $CFG_DEFAULT_ANDROID_NDK_ROOT)
-android-ndk-platform .......... Sets the android platform
(default $CFG_DEFAULT_ANDROID_PLATFORM)
-android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.)
(default $CFG_DEFAULT_ANDROID_NDK_HOST)
-android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips)
(default $CFG_DEFAULT_ANDROID_TARGET_ARCH)
-android-toolchain-version ..... Sets the android toolchain version
(default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION)
EOF
fi
[ "x$ERROR" = "xyes" ] && exit 1
@ -3662,10 +3897,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
setBootstrapVariable QMAKE_CXXFLAGS
setBootstrapVariable QMAKE_LFLAGS
if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DQMAKE_OPENSOURCE_EDITION"
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -DQMAKE_OPENSOURCE_EDITION"
fi
if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
setBootstrapVariable QMAKE_CFLAGS_RELEASE
setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
@ -3684,22 +3915,48 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
EXTRA_LFLAGS="\$(QMAKE_LFLAGS_RPATH)\"$rpath\" $EXTRA_LFLAGS"
done
fi
if [ "$BUILD_ON_MSYS" = "yes" ]; then
EXTRA_CFLAGS="-DUNICODE"
EXTRA_CXXFLAGS="-DUNICODE"
EXTRA_OBJS="qfilesystemengine_win.o \
qfilesystemiterator_win.o \
qfsfileengine_win.o \
qlocale_win.o \
qsettings_win.o \
qsystemlibrary.o \
registry.o"
EXTRA_SRCS="\"\$(SOURCE_PATH)/src/corelib/corelib/io/qfilesystemengine_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \
\"\$(SOURCE_PATH)/tools/shared/windows/registry.cpp\""
EXTRA_LFLAGS="-static -s -lole32 -luuid -ladvapi32 -lkernel32"
EXEEXT=".exe"
else
EXTRA_OBJS="qfilesystemengine_unix.o \
qfilesystemiterator_unix.o \
qfsfileengine_unix.o \
qlocale_unix.o"
EXTRA_SRCS="\"\$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/tools/qlocal_unix.cpp\""
EXEEXT=
fi
if [ "$BUILD_ON_MAC" = "yes" ]; then
echo "export MACOSX_DEPLOYMENT_TARGET = 10.6" >> "$mkfile"
echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
if [ '!' -z "$CFG_SDK" ]; then
echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
EXTRA_CFLAGS="$EXTRA_CFLAGS \$(SDK_CFLAGS)"
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(SDK_CFLAGS)"
EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
fi
EXTRA_OBJS="$EXTRA_OBJS \
qsettings_mac.o \
qcore_mac.o"
EXTRA_SRCS="$EXTRA_SRCS \
\"\$(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp\""
fi
if [ '!' -z "$D_FLAGS" ]; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $D_FLAGS"
@ -3712,13 +3969,25 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
-e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
-e "s,@QMAKE_CXXFLAGS@,$EXTRA_CXXFLAGS,g" \
-e "s,@QT_INSTALL_BINS@,\$(INSTALL_ROOT)$QMAKE_BIN_DIR,g" \
-e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
-e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
-e "s,@QMAKESPEC@,$adjqmakespec,g" -e "s,@QT_VERSION@,$QT_VERSION,g" "$in_mkfile" >>"$mkfile"
echo "BUILD_PATH = $adjoutpath" >> "$mkfile"
echo "SOURCE_PATH = $adjrelpath" >> "$mkfile"
echo "QMAKESPEC = $adjqmakespec" >> "$mkfile"
echo "QT_VERSION = $QT_VERSION" >> "$mkfile"
echo "EXTRA_CFLAGS = $EXTRA_CFLAGS" >> "$mkfile"
echo "EXTRA_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile"
echo "QTOBJS = $EXTRA_OBJS" >> "$mkfile"
echo "QTSRCS = $EXTRA_SRCS" >> "$mkfile"
echo "LFLAGS = $EXTRA_LFLAGS" >> "$mkfile"
echo "QT_INSTALL_BINS = \$(INSTALL_ROOT)$QMAKE_BIN_DIR" >> "$mkfile"
echo "QT_INSTALL_DATA = \$(INSTALL_ROOT)$QMAKE_DATA_DIR" >> "$mkfile"
echo "EXEEXT = $EXEEXT" >> "$mkfile"
echo "RM_F = rm -f" >> "$mkfile"
echo "RM_RF = rm -rf" >> "$mkfile"
if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
echo "EXTRA_CPPFLAGS = -DQMAKE_OPENSOURCE_EDITION" >> "$mkfile"
fi
cat "$in_mkfile" >> "$mkfile"
if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
(cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
@ -3752,6 +4021,20 @@ else
DEVICE_VARS_FILE="$DEVICE_VARS_OUTFILE"
fi
#-------------------------------------------------------------------------------
# Verify makespec
#-------------------------------------------------------------------------------
QMAKE_OUTPUT=`$outpath/bin/qmake -E -nocache -spec "$XQMAKESPEC" "QT=" /dev/null 2>&1 >/dev/null`
if [ $? != "0" ]; then
echo "Failed to process makespec for platform '$XPLATFORM'"
if [ "$OPT_VERBOSE" = "yes" ]; then
echo "$QMAKE_OUTPUT"
else
echo "Turn on verbose messaging (-v) to see the final report."
fi
exit 101
fi
#-------------------------------------------------------------------------------
# Detect pkg-config
#-------------------------------------------------------------------------------
@ -3829,7 +4112,7 @@ compileTest()
path=config.tests/$1
name=$2
shift 2
"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS $MAC_SDK_FLAG "$@"
"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@"
}
#-------------------------------------------------------------------------------
@ -3838,7 +4121,7 @@ compileTest()
# Use config.tests/arch/arch.pro to have the compiler tell us what the target architecture is
OUTFILE=$outpath/arch.result
"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG" $MAC_SDK_FLAG
"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "target"
if [ $? -eq 0 ]; then
eval `cat "$OUTFILE"`
else
@ -3851,7 +4134,7 @@ rm -f "$OUTFILE" 2>/dev/null
if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
# Do the same test again, using the host compiler
SYSROOT_FLAG= "$unixtests/arch.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG_HOST" $MAC_SDK_FLAG
SYSROOT_FLAG= "$unixtests/arch.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "host"
if [ $? -eq 0 ]; then
eval `cat "$OUTFILE"`
else
@ -3951,7 +4234,7 @@ if [ "${CFG_AVX}" = "auto" ]; then
*g++*|*-clang*)
# Some clang versions produce internal compiler errors compiling Qt AVX code
case `$TEST_COMPILER --version` in
Apple\ clang\ version\ 2*|Apple\ clang\ version\ 3.0*)
Apple\ clang\ version\ [23]*)
CFG_AVX=no
if [ "$OPT_VERBOSE" = "yes" ]; then
echo 'AVX support disabled for blacklisted clang compiler'
@ -3995,7 +4278,8 @@ fi
# detect neon support
if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
if compileTest unix/neon "neon"; then
# The iOS toolchain has trouble building the pixman NEON draw-helpers
if [ "$XPLATFORM_IOS" != "yes" ] && compileTest unix/neon "neon"; then
CFG_NEON=yes
else
CFG_NEON=no
@ -4027,6 +4311,7 @@ elif [ "$CFG_ARCH" != "mips" ]; then
fi
[ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
[ "$XPLATFORM_ANDROID" = "yes" ] && QMakeVar add styles "android"
# detect zlib
if [ "$CFG_ZLIB" = "no" ]; then
@ -4491,14 +4776,17 @@ fi
# auto-detect GTK style support
if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
if [ -n "$PKG_CONFIG" ]; then
QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.18 atk 2>/dev/null`
QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
QT_CFLAGS_QGTK2=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.18 atk 2>/dev/null`
QT_LIBS_QGTK2=`$PKG_CONFIG --libs gtk+-2.0 2>/dev/null`
QT_LIBS_QGOBJECT=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
fi
if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
if [ -n "$QT_CFLAGS_QGTK2" ] ; then
CFG_QGTKSTYLE=yes
QT_CONFIG="$QT_CONFIG gtkstyle"
QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
QT_CONFIG="$QT_CONFIG gtk2 gtkstyle"
QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTK2"
QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGOBJECT"
QMakeVar set QT_CFLAGS_QGTK2 "$QT_CFLAGS_QGTK2"
QMakeVar set QT_LIBS_QGTK2 "$QT_LIBS_QGTK2"
else
if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "Gtk theme support cannot be enabled due to functionality tests!"
@ -4920,13 +5208,20 @@ if [ "$CFG_KMS" != "no" ]; then
fi
# Detect libxkbcommon
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; 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_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
QT_CONFIG="$QT_CONFIG xkbcommon"
else
QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
echo "WARNING: Qt requires the libxkbcommon version 0.2.0 (or higher)."
echo "Not satisfying this requirement will disable the compose key functionality,"
echo "which includes text input with dead keys."
QMakeVar add DEFINES QT_NO_XKBCOMMON
fi
if [ -n "$QMAKE_CFLAGS_XKBCOMMON" ] || [ -n "$QMAKE_LIBS_XKBCOMMON" ]; then
QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON"
QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON"
fi
# EGL Support
@ -5011,8 +5306,8 @@ fi
if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
fi
if [ "$CFG_DIRECTFB" = "yes" ]; then
QT_CONFIG="$QT_CONFIG directfb"
QMakeVar set QMAKE_CFLAGS_DIRECTFB "$QMAKE_CFLAGS_DIRECTFB"
@ -5033,7 +5328,7 @@ if [ "$BUILD_ON_MAC" = "yes" ]; then
fi
fi
if [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ]; then
if [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then
if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_KMS" = "no" ]; then
if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_KMS" = "auto" ] ); then
@ -5129,6 +5424,23 @@ if [ "$CFG_INOTIFY" != "no" ]; then
fi
fi
# find if the platform provides eventfd
if [ "$CFG_EVENTFD" != "no" ]; then
if compileTest unix/eventfd "eventfd"; then
CFG_EVENTFD=yes
else
if [ "$CFG_EVENTFD" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "eventfd support cannot be enabled due to functionality tests!"
echo " Turn on verbose messaging (-v) to $0 to see the final report."
echo " If you believe this message is in error you may use the continue"
echo " switch (-continue) to $0 to continue."
exit 101
else
CFG_EVENTFD=no
fi
fi
fi
# find if the platform provides if_nametoindex (ipv6 interface name support)
if [ "$CFG_IPV6IFNAME" != "no" ]; then
if compileTest unix/ipv6ifname "IPv6 interface name"; then
@ -5170,7 +5482,7 @@ if [ "$CFG_OPENSSL" != "no" ]; then
CFG_OPENSSL=yes
fi
else
if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then
echo "OpenSSL support cannot be enabled due to functionality tests!"
echo " Turn on verbose messaging (-v) to $0 to see the final report."
echo " If you believe this message is in error you may use the continue"
@ -5418,6 +5730,9 @@ fi
if [ "$CFG_INOTIFY" = "yes" ]; then
QT_CONFIG="$QT_CONFIG inotify"
fi
if [ "$CFG_EVENTFD" = "yes" ]; then
QT_CONFIG="$QT_CONFIG eventfd"
fi
if [ "$CFG_LIBJPEG" = "no" ]; then
CFG_JPEG="no"
elif [ "$CFG_LIBJPEG" = "system" ]; then
@ -5739,6 +6054,19 @@ if [ "$CFG_QML_DEBUG" = "no" ]; then
fi
case "$QMAKE_CONF_COMPILER" in
*clang++*)
# Clang
COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -v 2>&1 | sed -n '
/^Apple clang version /{s///; s/^\([0-9]*\)\.\([0-9]*\).*$/QT_APPLE_CLANG_MAJOR_VERSION=\1; QT_APPLE_CLANG_MINOR_VERSION=\2/;p;q;}
/^clang version /{s///; s/^\([0-9]*\)\.\([0-9]*\).*$/QT_CLANG_MAJOR_VERSION=\1; QT_CLANG_MINOR_VERSION=\2/;p;q;}'`
eval "$COMPILER_VERSION"
;;
*icpc)
# Intel CC
COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -v 2>&1 | sed -n '
s/icpc version \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\) .*$/QT_ICC_MAJOR_VERSION=\1; QT_ICC_MINOR_VERSION=\2; QT_ICC_PATCH_VERSION=\3/p'`
eval "$COMPILER_VERSION"
;;
*g++*)
# GNU C++
COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
@ -5894,6 +6222,7 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
[ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
[ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
[ "$CFG_INOTIFY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
[ "$CFG_EVENTFD" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EVENTFD"
[ "$CFG_NIS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
[ "$CFG_OPENSSL" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
[ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
@ -6023,6 +6352,11 @@ else
fi
if [ "$CFG_DEV" = "yes" ]; then
QT_CONFIG="$QT_CONFIG private_tests"
if [ "$CFG_WERROR" != "no" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG warnings_are_errors"
fi
elif [ "$CFG_WERROR" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG warnings_are_errors"
fi
cat >>"$QTCONFIG.tmp" <<EOF
@ -6078,6 +6412,19 @@ if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION" >> "$QTCONFIG.tmp"
echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION" >> "$QTCONFIG.tmp"
fi
if [ -n "$QT_ICC_MAJOR_VERSION" ]; then
echo "QT_ICC_MAJOR_VERSION = $QT_ICC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
echo "QT_ICC_MINOR_VERSION = $QT_ICC_MINOR_VERSION" >> "$QTCONFIG.tmp"
echo "QT_ICC_PATCH_VERSION = $QT_ICC_PATCH_VERSION" >> "$QTCONFIG.tmp"
fi
if [ -n "$QT_CLANG_MAJOR_VERSION" ]; then
echo "QT_CLANG_MAJOR_VERSION = $QT_CLANG_MAJOR_VERSION" >> "$QTCONFIG.tmp"
echo "QT_CLANG_MINOR_VERSION = $QT_CLANG_MINOR_VERSION" >> "$QTCONFIG.tmp"
fi
if [ -n "$QT_APPLE_CLANG_MAJOR_VERSION" ]; then
echo "QT_APPLE_CLANG_MAJOR_VERSION = $QT_APPLE_CLANG_MAJOR_VERSION" >> "$QTCONFIG.tmp"
echo "QT_APPLE_CLANG_MINOR_VERSION = $QT_APPLE_CLANG_MINOR_VERSION" >> "$QTCONFIG.tmp"
fi
if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
@ -6300,7 +6647,7 @@ echo "Xi support ............. $CFG_XINPUT"
echo "Xi2 support ............ $CFG_XINPUT2"
echo "MIT-SHM support ........ $CFG_MITSHM"
echo "FontConfig support ..... $CFG_FONTCONFIG"
echo "XKB Support ............ $CFG_XKB"
echo "XKB support ............ $CFG_XKB"
echo "GTK theme support ...... $CFG_QGTKSTYLE"
if [ "$XPLATFORM_MINGW" = "yes" ] ; then

129
dist/changes-5.1.0 vendored Normal file
View File

@ -0,0 +1,129 @@
Qt 5.1 introduces many new features and improvements as well as bugfixes
over the 5.0.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
http://qt-project.org/doc/qt-5.1
The Qt version 5.1 series is binary compatible with the 5.0.x series.
Applications compiled for 5.0 will continue to run with 5.1.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
http://bugreports.qt-project.org/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* General *
****************************************************************************
General Improvements
--------------------
- Q_PROPERTY gained a MEMBER attribute that let you associate a property to a
class member without requiring to explicitly writing a getter or a setter
Third party components
----------------------
-
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- QtWidgets
* [QTBUG-8836] QAbstractItemView now allows manual deselect in
SingleSelection mode (with control modifier)
****************************************************************************
* Library *
****************************************************************************
QtCore
------
- QRect:
* Added marginsAdded(), marginsRemoved() and operators +, -, +=, -=
taking a QMargins object allowing for conveniently adding or removing
margins.
- QMargins:
* Added operators for adding and subtracting QMargins objects,
multiplication and division for int/qreal and unary minus.
- QMessageAuthenticationCode
* New class for hash-based message authentication code added to QtCore.
- QRegularExpression
* It's now possible to know the names of the named capturing groups
inside the pattern string, as well as the numerical index of each
named capturing group.
- QPointer
* It is now possible to create a QPointer with a const templated type.
-
QtGui
-----
- QOffscreenSurface
* New class for rendering graphics using OpenGL in an arbitrary thread
without needing to use a hidden QWindow.
QtNetwork
---------
-
QtWidgets
---------
- QGraphicsView:
* Added function rubberBandRect() and signal rubberBandChanged.
****************************************************************************
* Database Drivers *
****************************************************************************
****************************************************************************
* Platform Specific Changes *
****************************************************************************
Qt for Linux/X11
----------------
-
Qt for Windows
--------------
-
Qt for Mac OS X
---------------
-
Qt for Embedded Linux
---------------------
Qt for Windows CE
-----------------
****************************************************************************
* Compiler Specific Changes *
****************************************************************************
****************************************************************************
* Plugins *
****************************************************************************

View File

@ -75,12 +75,10 @@ Cpp.ignoretokens += \
QM_EXPORT_XML \
QT_ASCII_CAST_WARN \
QT_ASCII_CAST_WARN_CONSTRUCTOR \
QT_BEGIN_HEADER \
QT_BEGIN_INCLUDE_NAMESPACE \
QT_BEGIN_NAMESPACE \
QT_BOOTSTRAPPED \
QT_DESIGNER_STATIC \
QT_END_HEADER \
QT_END_INCLUDE_NAMESPACE \
QT_END_NAMESPACE \
QT_FASTCALL \

View File

@ -66,6 +66,11 @@ color: #44a51c;
text-align:left;
}
/*
-----------
offline viewing: HTML links display an icon
-----------
*/
a[href*="http://"], a[href*="ftp://"],a[href*="https://"]
{
text-decoration: none;
@ -127,7 +132,6 @@ Top navigation
.qtref{
display: block;
position: relative;
top: -76px;
height:15px;
z-index: 1;
font-size:11px;
@ -136,10 +140,11 @@ float:right;
}
.naviNextPrevious{
clear: both;
display: block;
position: relative;
text-align: right;
top: -53px;
top: -47px;
float:right;
height:20px;
z-index:1;
@ -167,6 +172,14 @@ padding-right:20px;
height:20px;
margin-left:30px;
}
/*
-----------
footer and license
-----------
*/
.footer{
text-align:center
}
/* table of content
no display
@ -390,10 +403,15 @@ text-align: left;
.cpp{
display: block;
margin: 10;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
.js{
display: block;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
@ -424,9 +442,7 @@ padding: 3px 15px 3px 0;
.qml{
display: block;
margin: 10;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
overflow: auto;
padding: 20px 20px 20px 20px;
}
@ -459,6 +475,7 @@ Content table
@media print{
.toc {
float: right;
clear: right;
padding-bottom: 10px;
padding-top: 50px;
width: 100%;
@ -470,8 +487,8 @@ background-repeat:no-repeat;
@media screen{
.toc{
clear:both;
float:right;
clear: right;
vertical-align:top;
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
@ -485,11 +502,7 @@ padding-bottom:10px;
height: auto;
width: 200px;
text-align:left;
z-index:2;
margin-left:20px;
margin-right:20px;
margin-top:0px;
padding-top:0px;
}
}

View File

@ -127,7 +127,6 @@ margin-left: 20px;
text-align:left
}
.nav-main-content{
font-weight:bold;
margin-right: 20px;
display:inline-block;
}
@ -156,9 +155,7 @@ left: 30px;
}
.qtref{
display: block;
position: relative;
top: -76px;
height:15px;
z-index: 1;
font-size:11px;
padding-right:10px;
@ -171,7 +168,7 @@ text-align: right;
float:right;
z-index:1;
padding-right:10px;
vertical-align:top;
padding-top:4px;
}
@ -196,16 +193,12 @@ margin-left:30px;
.breadcrumb{
display: block;
position: relative;
top:-20px;
/*border-top:2px solid #ffffff;*/
border-bottom: 1px solid #cecece;
background-color:#F2F2F2;
z-index:1;
height:20px;
padding:0px;
margin:0px;
padding-left:10px;
padding-top:2px;
padding-top:12px;
margin-left:-5px;
margin-right:-5px;
}
@ -216,7 +209,6 @@ margin-right:-5px;
}
.breadcrumb ul li{
background-color:#F2F2F2;
list-style-type:none;
padding:0;
margin:0;
@ -236,7 +228,6 @@ padding-left:20px;
.breadcrumb li a{
color:#2C418D;
display:block;
text-decoration:none;
background:url(../images/arrow.png);
@ -506,10 +497,15 @@ text-align: left;
.cpp{
display: block;
margin: 10;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
.js{
display: block;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
@ -539,10 +535,8 @@ padding: 3px 15px 3px 0;
.qml{
display: block;
margin: 10;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
@ -576,6 +570,7 @@ Content table
@media print{
.toc {
float: right;
clear: right;
padding-bottom: 10px;
padding-top: 50px;
width: 100%;
@ -587,7 +582,10 @@ background-repeat:no-repeat;
@media screen{
.toc{
clear:both;
clear: both;
clear: right;
position: relative;
top: 83px;
float:right;
vertical-align:top;
-moz-border-radius: 7px 7px 7px 7px;
@ -602,11 +600,7 @@ padding-bottom:10px;
height: auto;
width: 200px;
text-align:left;
z-index:2;
margin-left:20px;
margin-right:20px;
margin-top:0px;
padding-top:0px;
}
}

View File

@ -61,7 +61,7 @@
message to be sent.
The \c Message class is defined in the following way:
\snippet examples/tools/customtypesending/message.h custom type definition
The type is declared to the meta-type system with the Q_DECLARE_METATYPE()

View File

@ -82,7 +82,7 @@ void Ping::start(const QString &name, const QString &oldValue, const QString &ne
if (!reply.isNull())
printf("value = %s\n", qPrintable(reply.toString()));
} else if (line.startsWith("value=")) {
iface->setProperty("value", line.mid(6));
iface->setProperty("value", line.mid(6));
} else {
QDBusReply<QDBusVariant> reply = iface->call("query", line);
if (reply.isValid())
@ -92,7 +92,7 @@ void Ping::start(const QString &name, const QString &oldValue, const QString &ne
if (iface->lastError().isValid())
fprintf(stderr, "Call failed: %s\n", qPrintable(iface->lastError().message()));
}
}
}
int main(int argc, char **argv)
{

View File

@ -94,10 +94,10 @@ int main(int argc, char **argv)
if (!QDBusConnection::sessionBus().registerService(SERVICE_NAME)) {
fprintf(stderr, "%s\n",
qPrintable(QDBusConnection::sessionBus().lastError().message()));
qPrintable(QDBusConnection::sessionBus().lastError().message()));
exit(1);
}
app.exec();
return 0;
}

View File

@ -67,13 +67,13 @@ int main(int argc, char **argv)
if (!QDBusConnection::sessionBus().registerService(SERVICE_NAME)) {
fprintf(stderr, "%s\n",
qPrintable(QDBusConnection::sessionBus().lastError().message()));
qPrintable(QDBusConnection::sessionBus().lastError().message()));
exit(1);
}
Pong pong;
QDBusConnection::sessionBus().registerObject("/", &pong, QDBusConnection::ExportAllSlots);
app.exec();
return 0;
}

View File

@ -3,4 +3,4 @@ requires(qtHaveModule(widgets))
TEMPLATE = subdirs
# no QSharedMemory
!vxworks:!qnx:SUBDIRS = sharedmemory
!wince*: SUBDIRS += localfortuneserver localfortuneclient
!wince*:qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient

View File

@ -182,7 +182,7 @@ void Dialog::loadFromMemory()
*/
void Dialog::detach()
{
if (!sharedMemory.detach())
if (!sharedMemory.detach())
ui.label->setText(tr("Unable to detach from shared memory."));
}

View File

@ -43,7 +43,7 @@
QTcpSocket::connectToHost() returns immediately, and when the connection
has been established, QTcpSocket emits
\l{QTcpSocket::connected()}{connected()}.
\li \e{The synchronous (blocking) approach.} In non-GUI and multithreaded
applications, you can call the \c waitFor...() functions (e.g.,
QTcpSocket::waitForConnected()) to suspend the calling thread until the
@ -208,7 +208,7 @@
\snippet blockingfortuneclient/blockingclient.cpp 3
\codeline
\snippet blockingfortuneclient/blockingclient.cpp 4
Here, we simply display the fortune we received as the argument.
\sa {Fortune Client Example}, {Fortune Server Example}

View File

@ -48,8 +48,8 @@
FortuneServer inherits QTcpServer and reimplements
QTcpServer::incomingConnection(). We also use it for storing the list of
random fortunes.
random fortunes.
\snippet threadedfortuneserver/fortuneserver.cpp 0
We use FortuneServer's constructor to simply generate the list of
@ -71,7 +71,7 @@
QThread::run(), and it has a signal for reporting errors.
\snippet threadedfortuneserver/fortunethread.cpp 0
FortuneThread's constructor simply stores the socket descriptor and
fortune text, so that they are available for run() later on.
@ -101,7 +101,7 @@
But unlike the previous example, we finish off by calling
QTcpSocket::waitForDisconnected(), which blocks the calling thread until
the socket has disconnected. Because we are running in a separate thread,
the GUI will remain responsive.
the GUI will remain responsive.
\sa {Fortune Server Example}, {Fortune Client Example}, {Blocking Fortune
Client Example}

View File

@ -180,7 +180,7 @@ void HttpWindow::httpFinished()
tr("Download failed: %1.")
.arg(reply->errorString()));
downloadButton->setEnabled(true);
} else if (!redirectionTarget.isNull()) {
} else if (!redirectionTarget.isNull()) {
QUrl newUrl = url.resolved(redirectionTarget.toUrl());
if (QMessageBox::question(this, tr("HTTP"),
tr("Redirect to %1 ?").arg(newUrl.toString()),
@ -256,7 +256,7 @@ void HttpWindow::sslErrors(QNetworkReply*,const QList<QSslError> &errors)
errorString += ", ";
errorString += error.errorString();
}
if (QMessageBox::warning(this, tr("HTTP"),
tr("One or more SSL errors has occurred: %1").arg(errorString),
QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {

View File

@ -1,3 +1,5 @@
requires(qtHaveModule(network))
TEMPLATE = subdirs
SUBDIRS = \
dnslookup \

View File

@ -57,7 +57,7 @@ class SslClient : public QWidget
public:
SslClient(QWidget *parent = 0);
~SslClient();
private slots:
void updateEnabledState();
void secureConnect();

View File

@ -117,14 +117,14 @@ void AddTorrentDialog::setTorrent(const QString &torrentFile)
if (lastDestinationDirectory.isEmpty())
lastDestinationDirectory = lastDirectory;
MetaInfo metaInfo;
QFile torrent(torrentFile);
if (!torrent.open(QFile::ReadOnly) || !metaInfo.parse(torrent.readAll())) {
enableOkButton();
return;
}
ui.torrentFile->setText(torrentFile);
ui.announceUrl->setText(metaInfo.announceUrl());
if (metaInfo.comment().isEmpty())

View File

@ -81,26 +81,26 @@ bool BencodeParser::getByteString(QByteArray *byteString)
const int contentSize = content.size();
int size = -1;
do {
char c = content.at(index);
if (c < '0' || c > '9') {
if (size == -1)
return false;
if (c != ':') {
errString = QString("Unexpected character at pos %1: %2")
.arg(index).arg(c);
return false;
}
++index;
break;
}
if (size == -1)
size = 0;
size *= 10;
size += c - '0';
char c = content.at(index);
if (c < '0' || c > '9') {
if (size == -1)
return false;
if (c != ':') {
errString = QString("Unexpected character at pos %1: %2")
.arg(index).arg(c);
return false;
}
++index;
break;
}
if (size == -1)
size = 0;
size *= 10;
size += c - '0';
} while (++index < contentSize);
if (byteString)
*byteString = content.mid(index, size);
*byteString = content.mid(index, size);
index += size;
return true;
}
@ -109,38 +109,38 @@ bool BencodeParser::getInteger(qint64 *integer)
{
const int contentSize = content.size();
if (content.at(index) != 'i')
return false;
return false;
++index;
qint64 num = -1;
bool negative = false;
do {
char c = content.at(index);
if (c < '0' || c > '9') {
if (num == -1) {
if (c != '-' || negative)
return false;
negative = true;
continue;
} else {
if (c != 'e') {
errString = QString("Unexpected character at pos %1: %2")
.arg(index).arg(c);
return false;
}
++index;
break;
}
}
if (num == -1)
num = 0;
num *= 10;
num += c - '0';
char c = content.at(index);
if (c < '0' || c > '9') {
if (num == -1) {
if (c != '-' || negative)
return false;
negative = true;
continue;
} else {
if (c != 'e') {
errString = QString("Unexpected character at pos %1: %2")
.arg(index).arg(c);
return false;
}
++index;
break;
}
}
if (num == -1)
num = 0;
num *= 10;
num += c - '0';
} while (++index < contentSize);
if (integer)
*integer = negative ? -num : num;
*integer = negative ? -num : num;
return true;
}
@ -148,38 +148,38 @@ bool BencodeParser::getList(QList<QVariant> *list)
{
const int contentSize = content.size();
if (content.at(index) != 'l')
return false;
return false;
QList<QVariant> tmp;
QList<QVariant> tmp;
++index;
do {
if (content.at(index) == 'e') {
++index;
break;
}
if (content.at(index) == 'e') {
++index;
break;
}
qint64 number;
QByteArray byteString;
QList<QVariant> tmpList;
QMap<QByteArray, QVariant> dictionary;
qint64 number;
QByteArray byteString;
QList<QVariant> tmpList;
QMap<QByteArray, QVariant> dictionary;
if (getInteger(&number))
tmp << number;
else if (getByteString(&byteString))
tmp << byteString;
else if (getList(&tmpList))
tmp << tmpList;
else if (getDictionary(&dictionary))
tmp << QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary);
else {
errString = QString("error at index %1").arg(index);
return false;
}
if (getInteger(&number))
tmp << number;
else if (getByteString(&byteString))
tmp << byteString;
else if (getList(&tmpList))
tmp << tmpList;
else if (getDictionary(&dictionary))
tmp << QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary);
else {
errString = QString("error at index %1").arg(index);
return false;
}
} while (index < contentSize);
if (list)
*list = tmp;
*list = tmp;
return true;
}
@ -187,48 +187,48 @@ bool BencodeParser::getDictionary(QMap<QByteArray, QVariant> *dictionary)
{
const int contentSize = content.size();
if (content.at(index) != 'd')
return false;
return false;
QMap<QByteArray, QVariant> tmp;
QMap<QByteArray, QVariant> tmp;
++index;
do {
if (content.at(index) == 'e') {
++index;
break;
}
if (content.at(index) == 'e') {
++index;
break;
}
QByteArray key;
if (!getByteString(&key))
break;
QByteArray key;
if (!getByteString(&key))
break;
if (key == "info")
infoStart = index;
if (key == "info")
infoStart = index;
qint64 number;
QByteArray byteString;
QList<QVariant> tmpList;
QMap<QByteArray, QVariant> dictionary;
qint64 number;
QByteArray byteString;
QList<QVariant> tmpList;
QMap<QByteArray, QVariant> dictionary;
if (getInteger(&number))
tmp.insert(key, number);
else if (getByteString(&byteString))
tmp.insert(key, byteString);
else if (getList(&tmpList))
tmp.insert(key, tmpList);
else if (getDictionary(&dictionary))
tmp.insert(key, QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary));
else {
errString = QString("error at index %1").arg(index);
return false;
}
if (getInteger(&number))
tmp.insert(key, number);
else if (getByteString(&byteString))
tmp.insert(key, byteString);
else if (getList(&tmpList))
tmp.insert(key, tmpList);
else if (getDictionary(&dictionary))
tmp.insert(key, QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary));
else {
errString = QString("error at index %1").arg(index);
return false;
}
if (key == "info")
infoLength = index - infoStart;
if (key == "info")
infoLength = index - infoStart;
} while (index < contentSize);
if (dictionary)
*dictionary = tmp;
*dictionary = tmp;
return true;
}

View File

@ -54,7 +54,7 @@ class BencodeParser
{
public:
BencodeParser();
bool parse(const QByteArray &content);
QString errorString() const;

View File

@ -65,7 +65,7 @@ public:
inline void setMetaInfo(const MetaInfo &info) { metaInfo = info; }
inline void setDestinationFolder(const QString &directory) { destinationPath = directory; }
int read(int pieceIndex, int offset, int length);
void write(int pieceIndex, int offset, const QByteArray &data);
void verifyPiece(int pieceIndex);

View File

@ -130,7 +130,7 @@ MainWindow::MainWindow(QWidget *parent)
QAction *newTorrentAction = new QAction(QIcon(":/icons/bottom.png"), tr("Add &new torrent"), this);
pauseTorrentAction = new QAction(QIcon(":/icons/player_pause.png"), tr("&Pause torrent"), this);
removeTorrentAction = new QAction(QIcon(":/icons/player_stop.png"), tr("&Remove torrent"), this);
// File menu
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(newTorrentAction);

View File

@ -65,7 +65,7 @@ public:
QSize sizeHint() const;
const TorrentClient *clientForRow(int row) const;
protected:
void closeEvent(QCloseEvent *event);
@ -94,12 +94,12 @@ private slots:
void about();
void setActionsEnabled();
void acceptFileDrop(const QString &fileName);
private:
int rowOfClient(TorrentClient *client) const;
bool addTorrent(const QString &fileName, const QString &destinationFolder,
const QByteArray &resumeState = QByteArray());
TorrentView *torrentView;
QAction *pauseTorrentAction;
QAction *removeTorrentAction;

View File

@ -100,7 +100,7 @@ public:
// Total size
qint64 totalSize() const;
private:
private:
QString errString;
QByteArray content;
QByteArray infoData;

View File

@ -63,7 +63,7 @@ struct TorrentBlock
&& offset == other.offset
&& length == other.length;
}
int pieceIndex;
int offset;
int length;

View File

@ -1020,7 +1020,7 @@ void TorrentClient::blockReceived(int pieceIndex, int begin, const QByteArray &d
if (blocksLeftForPiece(piece) == 0) {
// Ask the file manager to verify the newly downloaded piece
d->fileManager.verifyPiece(piece->index);
// Remove this piece from all payloads
QMultiMap<PeerWireClient *, TorrentPiece *>::Iterator it = d->payloads.begin();
while (it != d->payloads.end()) {
@ -1103,7 +1103,7 @@ void TorrentClient::scheduleUploads()
}
if ((client->peerWireState() & PeerWireClient::ChokingPeer) == 0) {
if ((qrand() % 10) == 0)
if ((qrand() % 10) == 0)
client->abort();
else
client->chokePeer();
@ -1245,7 +1245,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
if (d->state == WarmingUp || (qrand() & 4) == 0) {
int *occurrences = new int[d->pieceCount];
memset(occurrences, 0, d->pieceCount * sizeof(int));
// Count how many of each piece are available.
foreach (PeerWireClient *peer, d->connections) {
QBitArray peerPieces = peer->availablePieces();
@ -1342,7 +1342,7 @@ void TorrentClient::requestMore(PeerWireClient *client)
? MaxBlocksInMultiMode : MaxBlocksInProgress);
if (numBlocksInProgress == maxInProgress)
return;
// Starting with the first piece that we're waiting for, request
// blocks until the quota is filled up.
foreach (TorrentPiece *piece, piecesInProgress) {
@ -1446,7 +1446,7 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
// Skip our own server.
continue;
}
bool known = false;
foreach (TorrentPeer *knownPeer, d->peers) {
if (knownPeer->port == peer.port

View File

@ -124,7 +124,7 @@ public:
qint64 uploadedBytes() const;
int connectedPeerCount() const;
int seedCount() const;
// Accessors for the tracker
QByteArray peerId() const;
QByteArray infoHash() const;
@ -142,7 +142,7 @@ signals:
void downloadCompleted();
void peerInfoUpdated();
void dataSent(int uploadedBytes);
void dataReceived(int downloadedBytes);
void progressUpdated(int percentProgress);

View File

@ -74,7 +74,7 @@ signals:
void uploadCountUpdated(qint64 newUploadCount);
void downloadCountUpdated(qint64 newDownloadCount);
void stopped();
protected:
@ -99,7 +99,7 @@ private:
qint64 length;
QString uname;
QString pwd;
bool firstTrackerRequest;
bool lastTrackerRequest;
bool firstSeeding;

View File

@ -50,7 +50,7 @@ struct VertexData
};
GeometryEngine::GeometryEngine()
{
{
}
GeometryEngine::~GeometryEngine()

View File

@ -68,7 +68,7 @@ void MainWidget::mouseReleaseEvent(QMouseEvent *e)
// Mouse release position - mouse press position
QVector2D diff = QVector2D(e->localPos()) - mousePressPosition;
// Rotation axis is perpendicular to the mouse position difference
// Rotation axis is perpendicular to the mouse position difference
// vector
QVector3D n = QVector3D(diff.y(), diff.x(), 0.0).normalized();

View File

@ -116,7 +116,7 @@ void GLWidget::initializeGL()
gear3 = makeGear(reflectance3, 1.3, 2.0, 0.5, 0.7, 10);
glEnable(GL_NORMALIZE);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
void GLWidget::paintGL()

View File

@ -90,7 +90,7 @@ private:
int yRot;
int zRot;
int gear1Rot;
QPoint lastPos;
};

View File

@ -114,7 +114,7 @@ void Bubble::move(const QRect &bbox)
qreal rightOverflow = position.x() + radius - bbox.right();
qreal topOverflow = position.y() - radius - bbox.top();
qreal bottomOverflow = position.y() + radius - bbox.bottom();
if (leftOverflow < 0.0) {
position.setX(position.x() - 2 * leftOverflow);
vel.setX(-vel.x());

View File

@ -70,7 +70,7 @@ void GLWidget::setScaling(int scale) {
m_fScale = 1 + qreal(scale -50) / 50 * 0.5;
else if (scale < 50)
m_fScale = 1- (qreal(50 - scale) / 50 * 1/2);
else
else
m_fScale = 1;
}
@ -316,7 +316,7 @@ void GLWidget::paintGL()
painter.drawText(20, 40, framesPerSecond + " fps");
painter.end();
swapBuffers();
QMutableListIterator<Bubble*> iter(bubbles);

View File

@ -55,7 +55,7 @@ class GLWidget : public QGLWidget {
public:
GLWidget(QWidget *parent = 0);
~GLWidget();
public slots:
public slots:
void setScaling(int scale);
void setLogo();
void setTexture();

View File

@ -57,7 +57,7 @@ MainWindow::MainWindow()
QTimer *timer = new QTimer(this);
QSlider *slider = new QSlider(this);
slider->setOrientation(Qt::Horizontal);
slider->setRange(0, 100);
slider->setSliderPosition(50);
timer->setInterval(10);

View File

@ -85,7 +85,7 @@ void Bubble::move(const QRect &bbox)
qreal rightOverflow = position.x() + radius - bbox.right();
qreal topOverflow = position.y() - radius - bbox.top();
qreal bottomOverflow = position.y() + radius - bbox.bottom();
if (leftOverflow < 0.0) {
position.setX(position.x() - 2 * leftOverflow);
vel.setX(-vel.x());

View File

@ -56,7 +56,7 @@ PaintedWindow::PaintedWindow()
format.setSamples(4);
setSurfaceType(QWindow::OpenGLSurface);
setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
setFormat(format);
create();

View File

@ -50,8 +50,8 @@ QImage scale(const QString &imageFileName)
return image.scaled(QSize(imageSize, imageSize), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
Images::Images(QWidget *parent)
: QWidget(parent)
Images::Images(QWidget *parent)
: QWidget(parent)
{
setWindowTitle(tr("Image loading and scaling example"));
resize(800, 600);
@ -66,11 +66,11 @@ Images::Images(QWidget *parent)
cancelButton = new QPushButton(tr("Cancel"));
cancelButton->setEnabled(false);
connect(cancelButton, SIGNAL(clicked()), imageScaling, SLOT(cancel()));
pauseButton = new QPushButton(tr("Pause/Resume"));
pauseButton->setEnabled(false);
connect(pauseButton, SIGNAL(clicked()), imageScaling, SLOT(togglePaused()));
QHBoxLayout *buttonLayout = new QHBoxLayout();
buttonLayout->addWidget(openButton);
buttonLayout->addWidget(cancelButton);
@ -101,7 +101,7 @@ void Images::open()
}
// Show a file open dialog at QStandardPaths::PicturesLocation.
QStringList files = QFileDialog::getOpenFileNames(this, tr("Select Images"),
QStringList files = QFileDialog::getOpenFileNames(this, tr("Select Images"),
QStandardPaths::writableLocation(QStandardPaths::PicturesLocation),
"*.jpg *.png");
@ -143,4 +143,3 @@ void Images::finished()
}
#endif // QT_NO_CONCURRENT

View File

@ -69,7 +69,7 @@ int main(int argc, char **argv)
// Create a progress dialog.
QProgressDialog dialog;
dialog.setLabelText(QString("Progressing using %1 thread(s)...").arg(QThread::idealThreadCount()));
// Create a QFutureWatcher and connect signals and slots.
QFutureWatcher<void> futureWatcher;
QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset()));
@ -82,7 +82,7 @@ int main(int argc, char **argv)
// Display the dialog and start the event loop.
dialog.exec();
futureWatcher.waitForFinished();
// Query the future to check if was canceled.

View File

@ -81,7 +81,7 @@ void TestBenchmark::multiple()
QFETCH(bool, useLocaleCompare);
QString str1 = QLatin1String("This is a test string");
QString str2 = QLatin1String("This is a test string");
int result;
if (useLocaleCompare) {
QBENCHMARK {
@ -101,7 +101,7 @@ void TestBenchmark::series_data()
{
QTest::addColumn<bool>("useLocaleCompare");
QTest::addColumn<int>("stringSize");
for (int i = 1; i < 10000; i += 2000) {
QByteArray size = QByteArray::number(i);
QTest::newRow(("locale aware compare--" + size).constData()) << true << i;

View File

@ -32,7 +32,7 @@
\brief The Query Model example shows how to make customized versions of
data obtained from a SQL query, using a model that encapsulates
the query and table views to display the results.
the query and table views to display the results.
\image querymodel-example.png
*/

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example relationaltablemodel
\title Relational Table Model Example
\ingroup sql_examples

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example tablemodel
\title Table Model Example
\ingroup sql_examples

View File

@ -81,7 +81,7 @@ QImage createImage(int width, int height)
int x = 0;
int y = 0;
int starWidth = image.width()/3;
int starHeight = image.height()/3;
int starHeight = image.height()/3;
QRect rect(x, y, starWidth, starHeight);

View File

@ -70,7 +70,7 @@
And thats it. A perfectly reasonable cache, using minimal memory for a very large
list. In this case the accessor for getting the words into the cache
generates random information rather than fixed information. This allows you
generates random information rather than fixed information. This allows you
to see how the cache range is kept for a local number of rows when running the
example.

View File

@ -104,7 +104,7 @@
With the type fully defined, implemented, and integrated with the
meta-object system, we can now use it.
\section1 Using the Message
\section1 Using the Message
In the example's \c{main()} function, we show how a \c Message object can
be printed to the console by sending it to the debug stream:

View File

@ -154,7 +154,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
//! [21]
void ScribbleArea::print()
{
#ifndef QT_NO_PRINTER
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this);

View File

@ -158,7 +158,7 @@ void Mouse::timerEvent(QTimerEvent *)
foreach (QGraphicsItem *item, dangerMice) {
if (item == this)
continue;
QLineF lineToMouse(QPointF(0, 0), mapFromItem(item, 0, 0));
qreal angleToMouse = ::acos(lineToMouse.dx() / lineToMouse.length());
if (lineToMouse.dy() < 0)

View File

@ -108,7 +108,7 @@ void createStates(const QObjectList &objects,
void createAnimations(const QObjectList &objects, QStateMachine *machine)
{
for (int i=0; i<objects.size(); ++i)
machine->addDefaultAnimation(new QPropertyAnimation(objects.at(i), "geometry"));
machine->addDefaultAnimation(new QPropertyAnimation(objects.at(i), "geometry"));
}
int main(int argc, char **argv)

View File

@ -63,11 +63,11 @@ private slots:
void periodChanged(double);
void amplitudeChanged(double);
void overshootChanged(double);
private:
void createCurveIcons();
void startAnimation();
Ui::Form m_ui;
QGraphicsScene m_scene;
PixmapItem *m_item;

View File

@ -45,13 +45,13 @@
#include <QIODevice>
#include <QDataStream>
class Frame
class Frame
{
public:
Frame() {
}
int nodeCount() const
int nodeCount() const
{
return m_nodePositions.size();
}
@ -70,7 +70,7 @@ public:
{
m_nodePositions[idx] = pos;
}
private:
QVector<QPointF> m_nodePositions;
};
@ -81,7 +81,7 @@ Animation::Animation()
m_frames.append(new Frame);
}
Animation::~Animation()
Animation::~Animation()
{
qDeleteAll(m_frames);
}
@ -89,10 +89,10 @@ Animation::~Animation()
void Animation::setTotalFrames(int totalFrames)
{
while (m_frames.size() < totalFrames)
m_frames.append(new Frame);
m_frames.append(new Frame);
while (totalFrames < m_frames.size())
delete m_frames.takeLast();
delete m_frames.takeLast();
}
int Animation::totalFrames() const
@ -165,15 +165,15 @@ void Animation::load(QIODevice *device)
QDataStream stream(device);
stream >> m_name;
int frameCount;
stream >> frameCount;
for (int i=0; i<frameCount; ++i) {
int nodeCount;
stream >> nodeCount;
Frame *frame = new Frame;
frame->setNodeCount(nodeCount);

View File

@ -65,7 +65,7 @@ public:
if (QSignalTransition::eventTest(e)) {
QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0);
return (key.toInt() == int(m_key));
}
}
return false;
}
@ -100,7 +100,7 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
const int stickManNodeCount = m_stickMan->nodeCount();
for (int i=0; i<stickManNodeCount; ++i) {
QPropertyAnimation *pa = new QPropertyAnimation(m_stickMan->node(i), "pos");
m_animationGroup->addAnimation(pa);
m_animationGroup->addAnimation(pa);
}
// Set up initial state graph
@ -111,14 +111,14 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
m_alive = new QState(m_machine);
m_alive->setObjectName("alive");
// Make it blink when lightning strikes before entering dead animation
QState *lightningBlink = new QState(m_machine);
QState *lightningBlink = new QState(m_machine);
lightningBlink->assignProperty(m_stickMan->scene(), "backgroundBrush", QColor(Qt::white));
lightningBlink->assignProperty(m_stickMan, "penColor", QColor(Qt::black));
lightningBlink->assignProperty(m_stickMan, "fillColor", QColor(Qt::white));
lightningBlink->assignProperty(m_stickMan, "isDead", true);
//! [5]
QTimer *timer = new QTimer(lightningBlink);
timer->setSingleShot(true);
@ -126,13 +126,13 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
QObject::connect(lightningBlink, SIGNAL(entered()), timer, SLOT(start()));
QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop()));
//! [5]
m_dead = new QState(m_machine);
m_dead->assignProperty(m_stickMan->scene(), "backgroundBrush", QColor(Qt::black));
m_dead->assignProperty(m_stickMan, "penColor", QColor(Qt::white));
m_dead->assignProperty(m_stickMan, "fillColor", QColor(Qt::black));
m_dead->setObjectName("dead");
// Idle state (sets no properties)
m_idle = new QState(m_alive);
m_idle->setObjectName("idle");
@ -172,7 +172,7 @@ void LifeCycle::addActivity(const QString &fileName, Qt::Key key, QObject *sende
QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName)
{
QState *topLevel = new QState(parentState);
Animation animation;
{
QFile file(animationFileName);
@ -186,7 +186,7 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa
animation.setCurrentFrame(i);
//! [1]
QState *frameState = new QState(topLevel);
QState *frameState = new QState(topLevel);
const int nodeCount = animation.nodeCount();
for (int j=0; j<nodeCount; ++j)
frameState->assignProperty(m_stickMan->node(j), "pos", animation.nodePos(j));
@ -199,7 +199,7 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa
//! [2]
previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), frameState);
//! [2]
previousState = frameState;
}

View File

@ -62,7 +62,7 @@ QRectF Node::boundingRect() const
}
void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
{
painter->setPen(Qt::white);
painter->drawEllipse(QPointF(0.0, 0.0), 5.0, 5.0);
}
@ -83,7 +83,7 @@ void Node::mousePressEvent(QGraphicsSceneMouseEvent *)
void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (m_dragging)
setPos(mapToParent(event->pos()));
setPos(mapToParent(event->pos()));
}
void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *)

View File

@ -62,7 +62,7 @@ public:
virtual QRectF boundingRect() const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
int nodeCount() const;
int nodeCount() const;
Node *node(int idx) const;
void setDrawSticks(bool on);
@ -90,7 +90,7 @@ private:
Node *m_nodes[NodeCount];
qreal m_perfectBoneLengths[BoneCount];
uint m_sticks : 1;
uint m_isDead : 1;
uint m_reserved : 30;

View File

@ -68,7 +68,7 @@ class KeyStopTransition : public QKeyEventTransition
{
public:
KeyStopTransition(Boat *b, QEvent::Type t, int k)
: QKeyEventTransition(b, t, k), boat(b), key(k)
: QKeyEventTransition(b, t, k), boat(b)
{
}
protected:
@ -80,7 +80,6 @@ protected:
}
private:
Boat * boat;
int key;
};
//These transtion test if we have to move the boat (i.e current speed was 0 or another value)

View File

@ -50,8 +50,6 @@
# include "qabstractanimation.h"
#endif
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@ -86,6 +84,4 @@ private:
QT_END_NAMESPACE
QT_END_HEADER
#endif // QANIMATIONSTATE_H

View File

@ -123,7 +123,7 @@ void PlayState::onEntry(QEvent *)
levelState->addTransition(winTransition);
//This state is an animation when the score changed
UpdateScoreState *scoreState = new UpdateScoreState(this, levelState);
UpdateScoreState *scoreState = new UpdateScoreState(levelState);
//This transition update the score when a submarine die
UpdateScoreTransition *scoreTransition = new UpdateScoreTransition(scene, this, levelState);
@ -275,7 +275,7 @@ void WinState::onExit(QEvent *)
}
/** UpdateScore State */
UpdateScoreState::UpdateScoreState(PlayState *g, QState *parent) : QState(parent), game(g)
UpdateScoreState::UpdateScoreState(QState *parent) : QState(parent)
{
}

View File

@ -70,7 +70,6 @@ private :
QStateMachine *machine;
int currentLevel;
int score;
QState *parallelChild;
friend class UpdateScoreState;
friend class UpdateScoreTransition;
@ -103,7 +102,6 @@ protected:
void onExit(QEvent *);
private :
GraphicsScene *scene;
Boat *boat;
};
class LostState : public QState
@ -135,10 +133,8 @@ private :
class UpdateScoreState : public QState
{
public:
UpdateScoreState(PlayState *game, QState *parent);
UpdateScoreState(QState *parent);
private:
QPropertyAnimation *scoreAnimation;
PlayState *game;
};
//These transtion is used to update the score
@ -174,7 +170,6 @@ protected:
virtual bool eventTest(QEvent *event);
private:
PlayState *game;
int key;
};
#endif // STATES_H

View File

@ -124,7 +124,7 @@ class OutputFilesPage : public QWizardPage
{
Q_OBJECT
public:
public:
OutputFilesPage(QWidget *parent = 0);
protected:

View File

@ -48,7 +48,7 @@
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(classwizard);
QApplication app(argc, argv);
#ifndef QT_NO_TRANSLATION

View File

@ -9,5 +9,6 @@ SUBDIRS = classwizard \
extension \
findfiles
!qtHaveModule(printsupport): SUBDIRS -= licensewizard
contains(DEFINES, QT_NO_WIZARD): SUBDIRS -= trivialwizard licensewizard classwizard
wince*: SUBDIRS += sipdialog

View File

@ -352,7 +352,7 @@ void ConclusionPage::setVisible(bool visible)
void ConclusionPage::printButtonClicked()
{
#ifndef QT_NO_PRINTER
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
QPrinter printer;
QPrintDialog dialog(&printer, this);
if (dialog.exec())

View File

@ -91,7 +91,7 @@ Dialog::Dialog()
//! [Dialog constructor part5]
connect(button, SIGNAL(clicked()),
qApp, SLOT(closeAllWindows()));
connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
this, SLOT(desktopResized(int)));
}
//! [Dialog constructor part5]

View File

@ -36,7 +36,7 @@
\image addressbook-tutorial-screenshot.png
Ce tutoriel va nous amener à découvrir quelques technologies fondamentales fournies
Ce tutoriel va nous amener à découvrir quelques technologies fondamentales fournies
par Qt, tel que:
\list
@ -124,7 +124,7 @@
réutilisé dans d'autres projets
\endlist
Comme Qt ne fournit pas de widget standard pour un carnet d'adresses, nous
Comme Qt ne fournit pas de widget standard pour un carnet d'adresses, nous
partirons d'une classe de widget Qt standard et y ajouterons des fonctionnalités.
La classe \c AddressBook crée dans ce tutoriel peut être réutilisée si on a besoin d'un
widget carnet d'adresses basique.
@ -148,12 +148,12 @@
dans \c nameLine et \c addressText sont nécessaires à de nombreuses méthodes
du carnet d'adresses.
Il n'est pas nécessaire de déclarer les objets QLabel que nous allons utiliser
Il n'est pas nécessaire de déclarer les objets QLabel que nous allons utiliser
puisque nous n'aurons pas besoin d'y faire référence après leur création.
La façon dont Qt gère la parenté des objets est traitée dans la section suivante.
La macro Q_OBJECT implémente des fonctionnalités parmi les plus avancées de Qt.
Pour le moment, il est bon de voir la macro Q_OBJECT comme un raccourci nous
Pour le moment, il est bon de voir la macro Q_OBJECT comme un raccourci nous
permettant d'utiliser les méthodes \l{QObject::}{tr()} et \l{QObject::}{connect()}.
Nous en avons maintenant terminé avec le fichier \c addressbook.h et allons
@ -295,13 +295,13 @@
Le bouton \c addButton est affiché en invoquant la méthode \l{QPushButton::show()}
{show()}, tandis que \c submitButton et \c cancelButton sont cachés en invoquant
\l{QPushButton::hide()}{hide()}. Ces deux boutons ne seront affichés que lorsque
\l{QPushButton::hide()}{hide()}. Ces deux boutons ne seront affichés que lorsque
l'utilisateur cliquera sur "Add", et ceci est géré par la méthode \c addContact()
décrite plus loin.
\snippet tutorials/addressbook/part2/addressbook.cpp connecting signals and slots
Nous connectons le signal \l{QPushButton::clicked()}{clicked()} de chaque bouton
Nous connectons le signal \l{QPushButton::clicked()}{clicked()} de chaque bouton
au slot qui gèrera l'action.
L'image ci-dessous illustre ceci:
@ -379,8 +379,8 @@
\snippet tutorials/addressbook/part2/addressbook.cpp cancel
L'idée générale pour augmenter la flexibilité lors de l'ajout d'un
contact est de donner la possiblité de cliquer sur "Add"
L'idée générale pour augmenter la flexibilité lors de l'ajout d'un
contact est de donner la possiblité de cliquer sur "Add"
ou "Cancel" à n'importe quel moment.
L'organigramme ci-dessous reprend l'ensemble des interactions dévelopées
jusqu'ici:
@ -458,15 +458,15 @@
\c mainLayout.
\image addressbook-tutorial-part3-labeled-layout.png
Dans notre méthode \c addContact(), nous avons desactivé ces boutons
pour être sûr que l'utilisateur n'utilise pas la navigation lors de
Dans notre méthode \c addContact(), nous avons desactivé ces boutons
pour être sûr que l'utilisateur n'utilise pas la navigation lors de
l'ajout d'un contact.
\snippet tutorials/addressbook/part3/addressbook.cpp disabling navigation
Dans notre méthode \c submitContact(), nous activons les boutons de
navigation, \c nextButton et \c previousButton, en fonction de la
taille de \c contacts. Commen mentionné plus tôt, la navigation n'est
taille de \c contacts. Commen mentionné plus tôt, la navigation n'est
activée que si il y a plus d'un contact dans le carnet d'adresses.
Les lignes suivantes montrent comment faire cela:
@ -475,13 +475,13 @@
Nous incluons aussi ces lignes de code dans le bouton \c cancel().
Souvenez vous que nous voulons émuler une liste-liée ciruculaire à
l'aide de l'objet QMap, \c contacts. Pour faire cela, nous obtenons un itérateur
l'aide de l'objet QMap, \c contacts. Pour faire cela, nous obtenons un itérateur
sur \c contact dans la méthode \c next(), et ensuite:
\list
\li Si l'itérateur n'est pas à la fin de \c contacts, nous l'incrémentons
\li Si l'itérateur est à la fin de \c contacts, nous changeons sa position
jusqu'au début de \c contacts. Cela donne l'illusion que notre QMap
jusqu'au début de \c contacts. Cela donne l'illusion que notre QMap
fonctionne comme une liste circulaire.
\endlist
@ -490,7 +490,7 @@
Une fois que nous avons itéré jusqu'à l'objet recherché dans \c contacts,
nous affichons son contenu sur \c nameLine et \c addressText.
De la même façon, pour la méthode \c previous(), nous obtenons un
De la même façon, pour la méthode \c previous(), nous obtenons un
itérateur sur \c contacts et ensuite:
\list
@ -522,7 +522,7 @@
\image addressbook-tutorial-screenshot.png
Nous avons maintenant un carnet d'adresses qui ne se contente pas de
lister des contacts de façon ordonnée, mais permet également la
lister des contacts de façon ordonnée, mais permet également la
navigation. Il serait pratique d'inclure des fonctions telles qu'éditer et
supprimer, afin que les détails associés à un contact puissent être
modifiés lorsque c'est nécessaire. Cependant, cela requiert une légère
@ -563,7 +563,7 @@
\dots
\snippet tutorials/addressbook/part4/addressbook.h mode declaration
Enfin, on déclare \c currentMode pour garder une trace du mode
Enfin, on déclare \c currentMode pour garder une trace du mode
actuellement utilisé.
\section1 Implémentation de la classe AddressBook
@ -637,7 +637,7 @@
avant de tester sa valeur.
Chacun des boutons est ensuite activé ou désactivé, en fonction du mode.
Le code source pour les cas \c AddingMode et \c EditingMode est visible
Le code source pour les cas \c AddingMode et \c EditingMode est visible
ci-dessous:
\snippet tutorials/addressbook/part4/addressbook.cpp update interface() part 1
@ -840,7 +840,7 @@
\section1 Définition de la classe AddressBook
On déclare deux slots publics, \c saveToFile() et \c loadFromFile(),
On déclare deux slots publics, \c saveToFile() et \c loadFromFile(),
ainsi que deux objets QPushButton, \c loadButton et \c saveButton.
\snippet tutorials/addressbook/part6/addressbook.h save and load functions declaration
@ -863,11 +863,11 @@
\snippet tutorials/addressbook/part6/addressbook.cpp tooltip 2
Bien qu'on ne cite pas le code correspondant ici, nous ajoutons ces deux boutons au
layout de droite, \c button1Layout, comme pour les fonctionnalités précédentes, et
layout de droite, \c button1Layout, comme pour les fonctionnalités précédentes, et
nous connectons leurs signaux
\l{QPushButton::clicked()}{clicked()} à leurs slots respectifs.
Pour la sauvegarde, on commence par récupérer le nom de fichier
Pour la sauvegarde, on commence par récupérer le nom de fichier
\c fileName, en utilisant QFileDialog::getSaveFileName(). C'est une
méthode pratique fournie par QFileDialog, qui ouvre une boîte de
dialogue modale et permet à l'utilisateur d'entrer un nom de fichier ou
@ -966,7 +966,7 @@
\section1 Définition de la classe AddressBook
Nous ajoutons un objet QPushButton, \c exportButton, et un slot
public correspondant, \c exportAsVCard(), à notre classe \c AddressBook
public correspondant, \c exportAsVCard(), à notre classe \c AddressBook
dans le fichier \c addressbook.h.
\snippet tutorials/addressbook/part7/addressbook.h exportAsVCard() declaration
@ -1001,7 +1001,7 @@
cela échoue, nous affichons un QMessageBox pour informer l'utilisateur
à propos de l'origine du problème et nous quittons la méthode. Sinon, nous passons le
fichier comme paramètre pour créer un objet QTextStream, \c out. De la même façon que
QDataStream, la classe QTextStream fournit les fonctionnalités pour
QDataStream, la classe QTextStream fournit les fonctionnalités pour
lire et écrire des fichiers de texte. Grâce à celà, le fichier \c{.vcf}
généré pourra être ouvert et édité à l'aide d'un simple éditeur de texte.
@ -1014,7 +1014,7 @@
à un nom de famille défini ou non. Si oui, nous utilions les détails de
\c nameList pour remplir le champ, dans le cas contraire on écrit uniquement le contenu
de \c firstName.
\snippet tutorials/addressbook/part7/addressbook.cpp export function part3
Nous continuons en écrivant l'adresse du contact. Les points-virgules
@ -1026,7 +1026,7 @@
\snippet tutorials/addressbook/part7/addressbook.cpp export function part4
À la fin de la méthode, un QMessageBox est affiché pour informer l'utilisateur
que la vCard a été exportée avec succès.
que la vCard a été exportée avec succès.
\e{vCard est une marque déposée de \l{http://www.imc.org}
{Internet Mail Consortium}}.

View File

@ -73,7 +73,7 @@
have worked through this tutorial, we recommend reading the
\l{mainwindows/application}{Application} example, which presents a
small GUI application, with menus, toolbars, a status bar, and so
on.
on.
*/
/*!
@ -199,7 +199,7 @@
Notice that \c addressLabel is positioned using Qt::AlignTop as an
additional argument. This is to make sure it is not vertically centered in
cell (1,0). For a basic overview on Qt Layouts, refer to the
cell (1,0). For a basic overview on Qt Layouts, refer to the
\l{Layout Management} documentation.
In order to install the layout object onto the widget, we have to invoke
@ -431,7 +431,7 @@
\snippet tutorials/addressbook/part3/addressbook.cpp connecting navigation signals
The image below is the expected graphical user interface.
The image below is the expected graphical user interface.
\image addressbook-tutorial-part3-screenshot.png

View File

@ -273,7 +273,7 @@
\snippet itemviews/addressbook/addresswidget.cpp 4a
Next we extract data from the row the user intends to
Next we extract data from the row the user intends to
edit. This data is displayed in an instance of \c AddDialog
with a different window title. The \c table is only
updated if changes have been made to data in \c aDialog.

View File

@ -60,7 +60,7 @@
We will now move on to the definitions and implementations of \c
CodeEditor and \c LineNumberArea. Let's start with the \c
LineNumberArea class.
LineNumberArea class.
\section1 The LineNumberArea Class
@ -130,7 +130,7 @@
\snippet widgets/codeeditor/codeeditor.cpp resizeEvent
When the size of the editor changes, we also need to resize the
line number area.
line number area.
\snippet widgets/codeeditor/codeeditor.cpp cursorPositionChanged
@ -155,7 +155,7 @@
The \c lineNumberAreaPaintEvent() is called from \c LineNumberArea
whenever it receives a paint event. We start off by painting the
widget's background.
widget's background.
\snippet widgets/codeeditor/codeeditor.cpp extraAreaPaintEvent_1
@ -163,11 +163,11 @@
numbers in the extra area for each line. Notice that in a plain
text edit each line will consist of one QTextBlock; though, if
line wrapping is enabled, a line may span several rows in the text
edit's viewport.
edit's viewport.
We get the top and bottom y-coordinate of the first text block,
and adjust these values by the height of the current text block in
each iteration in the loop.
each iteration in the loop.
\snippet widgets/codeeditor/codeeditor.cpp extraAreaPaintEvent_2
@ -183,7 +183,7 @@
In addition to line numbers, you can add more to the extra area,
for instance, break points.
QSyntaxHighlighter gives the possibility to add user data to each
text block with
\l{QSyntaxHighlighter::}{setCurrentBlockUserData()}. This can be

View File

@ -78,7 +78,7 @@
After the new factory has been set, all standard item delegates
will use it (i.e, also delegates that were created before the new
default factory was set).
default factory was set).
The \c createGUI() function sets up the table and fills it
with data.
@ -135,17 +135,17 @@
\list
\li If the editor widget has no user property defined, the delegate
asks the factory for the property name, which it in turn
asks the item editor creator for. In this case, you can use
the QItemEditorCreator class, which takes the property
name to use for editing as a constructor argument.
asks the factory for the property name, which it in turn
asks the item editor creator for. In this case, you can use
the QItemEditorCreator class, which takes the property
name to use for editing as a constructor argument.
\li If the editor requires other constructors or other
initialization than provided by QItemEditorCreatorBase, you
must reimplement
QItemEditorCreatorBase::createWidget().
initialization than provided by QItemEditorCreatorBase, you
must reimplement
QItemEditorCreatorBase::createWidget().
\li You could also subclass QItemEditorFactory if you only want
to provide editors for certain kinds of data or use another
method of creating the editors than using creator bases.
to provide editors for certain kinds of data or use another
method of creating the editors than using creator bases.
\endlist
In this example, we use a standard QVariant data type. You can

View File

@ -50,7 +50,7 @@
In this example we show how to create such custom graphics
scenes and items by implementing classes that inherit
QGraphicsScene and QGraphicsItem.
QGraphicsScene and QGraphicsItem.
In particular we show how to:
@ -65,21 +65,21 @@
The example consists of the following classes:
\list
\li \c MainWindow creates the widgets and display
them in a QMainWindow. It also manages the interaction
between the widgets and the graphics scene, view and
items.
them in a QMainWindow. It also manages the interaction
between the widgets and the graphics scene, view and
items.
\li \c DiagramItem inherits QGraphicsPolygonItem and
represents a flowchart shape.
represents a flowchart shape.
\li \c TextDiagramItem inherits QGraphicsTextItem and
represents text items in the diagram. The class adds
support for moving the item with the mouse, which is not
supported by QGraphicsTextItem.
represents text items in the diagram. The class adds
support for moving the item with the mouse, which is not
supported by QGraphicsTextItem.
\li \c Arrow inherits QGraphicsLineItem and is an arrow
that connect two DiagramItems.
that connect two DiagramItems.
\li \c DiagramScene inherits QGraphicsDiagramScene and
provides support for \c DiagramItem, \c Arrow and
\c DiagramTextItem (In addition to the support already
handled by QGraphicsScene).
provides support for \c DiagramItem, \c Arrow and
\c DiagramTextItem (In addition to the support already
handled by QGraphicsScene).
\endlist
\section1 MainWindow Class Definition
@ -88,7 +88,7 @@
The \c MainWindow class creates and lays out the widgets in a
QMainWindow. The class forwards input from the widgets to the
DiagramScene. It also updates its widgets when the diagram
DiagramScene. It also updates its widgets when the diagram
scene's text item changes, or a diagram item or a diagram text item
is inserted into the scene.
@ -104,8 +104,8 @@
\snippet graphicsview/diagramscene/mainwindow.cpp 0
In the constructor we call methods to create the widgets and
layouts of the example before we create the diagram scene.
The toolbars must be created after the scene as they connect
layouts of the example before we create the diagram scene.
The toolbars must be created after the scene as they connect
to its signals. We then lay the widgets out in the window.
We connect to the \c itemInserted() and \c textInserted() slots of
@ -115,20 +115,20 @@
update the widgets that display font properties if the item
selected is a \c DiagramTextItem.
The \c createToolBox() function creates and lays out the widgets
The \c createToolBox() function creates and lays out the widgets
of the \c toolBox QToolBox. We will not examine it with a
high level of detail as it does not deal with graphics framework
high level of detail as it does not deal with graphics framework
specific functionality. Here is its implementation:
\snippet graphicsview/diagramscene/mainwindow.cpp 21
This part of the function sets up the tabbed widget item that
contains the flowchart shapes. An exclusive QButtonGroup always
contains the flowchart shapes. An exclusive QButtonGroup always
keeps one button checked; we want the group to allow all buttons
to be unchecked.
We still use a button group since we can associate user
data, which we use to store the diagram type, with each button.
The \c createCellWidget() function sets up the buttons in the
data, which we use to store the diagram type, with each button.
The \c createCellWidget() function sets up the buttons in the
tabbed widget item and is examined later.
The buttons of the background tabbed widget item is set up in the
@ -137,7 +137,7 @@
\snippet graphicsview/diagramscene/mainwindow.cpp 22
We set the preferred size of the toolbox as its maximum. This
way, more space is given to the graphics view.
way, more space is given to the graphics view.
Here is the \c createActions() function:
@ -202,7 +202,7 @@
with this function is used in the tool box.
Here is the \c createColorMenu() function:
\snippet graphicsview/diagramscene/mainwindow.cpp 30
This function creates a color menu that is used as the
@ -224,7 +224,7 @@
\snippet graphicsview/diagramscene/mainwindow.cpp 32
This function creates an icon with a filled rectangle in the
This function creates an icon with a filled rectangle in the
color of \a color. It is used for creating icons for the color
menus in the \c fillColorToolButton, \c fontColorToolButton, and
\c lineColorToolButton.
@ -240,8 +240,8 @@
with.
When one of the buttons in the background tabbed widget item is
clicked we change the brush; we find out which button it is by
checking its text.
clicked we change the brush; we find out which button it is by
checking its text.
Here is the implementation of \c buttonGroupClicked():
@ -255,37 +255,37 @@
checked at a time.
\c QButtonGroup assigns an id to each button. We have set the id
of each button to the diagram type, as given by DiagramItem::DiagramType
that will be inserted into the scene when it is clicked. We can
then use the button id when we set the diagram type with
of each button to the diagram type, as given by DiagramItem::DiagramType
that will be inserted into the scene when it is clicked. We can
then use the button id when we set the diagram type with
\c setItemType(). In the case of text we assigned an id that has a
value that is not in the DiagramType enum.
Here is the implementation of \c deleteItem():
\snippet graphicsview/diagramscene/mainwindow.cpp 3
This slot deletes the selected item, if any, from the scene. It
deletes the arrows first in order to avoid to delete them twice. If
the item to be deleted is a \c DiagramItem, we also need to delete
arrows connected to it; we don't want arrows in the scene that
aren't connected to items in both ends.
This is the implementation of pointerGroupClicked():
\snippet graphicsview/diagramscene/mainwindow.cpp 4
The \c pointerTypeGroup decides whether the scene is in ItemMove
or InsertLine mode. This button group is exclusive, i.e., only
or InsertLine mode. This button group is exclusive, i.e., only
one button is checked at any time. As with the \c buttonGroup above
we have assigned an id to the buttons that matches values of the
DiagramScene::Mode enum, so that we can use the id to set the
correct mode.
Here is the \c bringToFront() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 5
Several items may collide, i.e., overlap, with each other in
the scene. This slot is called when the user requests that an
item should be placed on top of the items it collides with.
@ -296,169 +296,169 @@
lower values. When we bring an item to the front we can loop
through the items it collides with and set a z-value that is
higher than all of them.
Here is the \c sendToBack() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 6
This slot works in the same way as \c bringToFront() described
above, but sets a z-value that is lower than items the item that
should be send to the back collides with.
This is the implementation of \c itemInserted():
\snippet graphicsview/diagramscene/mainwindow.cpp 7
This slot is called from the \c DiagramScene when an item has been
added to the scene. We set the mode of the scene back to the mode
before the item was inserted, which is ItemMove or InsertText
depending on which button is checked in the \c pointerTypeGroup.
depending on which button is checked in the \c pointerTypeGroup.
We must also uncheck the button in the in the \c buttonGroup.
Here is the implementation of \c textInserted():
\snippet graphicsview/diagramscene/mainwindow.cpp 8
We simply set the mode of the scene back to the mode it had before
the text was inserted.
Here is the \c currentFontChanged() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 9
When the user requests a font change, by using one of the
widgets in the \c fontToolBar, we create a new QFont object and
set its properties to match the state of the widgets. This is done
in \c handleFontChange(), so we simply call that slot.
Here is the \c fontSizeChanged() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 10
When the user requests a font change, by using one of the
widgets in the \c fontToolBar, we create a new QFont object and
set its properties to match the state of the widgets. This is done
in \c handleFontChange(), so we simply call that slot.
Here is the implementation of \c sceneScaleChanged():
\snippet graphicsview/diagramscene/mainwindow.cpp 11
The user can increase or decrease the scale, with the \c
sceneScaleCombo, the scene is drawn in.
It is not the scene itself that changes its scale, but only the
view.
view.
Here is the \c textColorChanged() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 12
This slot is called when an item in the drop-down menu of the \c
fontColorToolButton is pressed. We need to change the icon on
fontColorToolButton is pressed. We need to change the icon on
the button to the color of the selected QAction. We keep a pointer
to the selected action in \c textAction. It is in \c
textButtonTriggered() we change the text color to the color of \c
textAction, so we call that slot.
Here is the \c itemColorChanged() implementation:
\snippet graphicsview/diagramscene/mainwindow.cpp 13
This slot handles requests for changing the color of \c
DiagramItems in the same manner as \c textColorChanged() does for
\c DiagramTextItems.
Here is the implementation of \c lineColorChanged():
\snippet graphicsview/diagramscene/mainwindow.cpp 14
This slot handles requests for changing the color of \c Arrows in
the same manner that \c textColorChanged() does it for \c
DiagramTextItems.
Here is the \c textButtonTriggered() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 15
\c textAction points to the QAction of the currently selected menu item
in the \c fontColorToolButton's color drop-down menu. We have set
the data of the action to the QColor the action represents, so we
can simply fetch this when we set the color of text with \c
setTextColor().
Here is the \c fillButtonTriggered() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 16
\c fillAction points to the selected menu item in the drop-down
menu of \c fillColorToolButton(). We can therefore use the data of
this action when we set the item color with \c setItemColor().
Here is the \c lineButtonTriggered() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 17
\c lineAction point to the selected item in the drop-down menu of
\c lineColorToolButton. We use its data when we set the arrow
\c lineColorToolButton. We use its data when we set the arrow
color with \c setLineColor().
Here is the \c handleFontChange() function:
\snippet graphicsview/diagramscene/mainwindow.cpp 18
\c handleFontChange() is called when any of the widgets that show
font properties changes. We create a new QFont object and set its
properties based on the widgets. We then call the \c setFont()
function of \c DiagramScene; it is the scene that set the font of
the \c DiagramTextItems it manages.
Here is the \c itemSelected() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 19
This slot is called when an item in the \c DiagramScene is
selected. In the case of this example it is only text items that
emit signals when they are selected, so we do not need to check
what kind of graphics \a item is.
We set the state of the widgets to match the properties of the
font of the selected text item.
This is the \c about() slot:
\snippet graphicsview/diagramscene/mainwindow.cpp 20
This slot displays an about box for the example when the user
selects the about menu item from the help menu.
\section1 DiagramScene Class Definition
The \c DiagramScene class inherits QGraphicsScene and adds
functionality to handle \c DiagramItems, \c Arrows, and \c
DiagramTextItems in addition to the items handled by its super
class.
\snippet graphicsview/diagramscene/diagramscene.h 0
In the \c DiagramScene a mouse click can give three different
actions: the item under the mouse can be moved, an item may be
inserted, or an arrow may be connected between to diagram items.
Which action a mouse click has depends on the mode, given by the
Mode enum, the scene is in. The mode is set with the \c setMode()
function.
The scene also sets the color of its items and the font of its
text items. The colors and font used by the scene can be set with
the \c setLineColor(), \c setTextColor(), \c setItemColor() and \c
setFont() functions. The type of \c DiagramItem, given by the
DiagramItem::DiagramType function, to be created when an item is
inserted is set with the \c setItemType() slot.
The \c MainWindow and \c DiagramScene share responsibility for
the examples functionality. \c MainWindow handles the following
tasks: the deletion of items, text, and arrows; moving diagram
items to the back and front; and setting the scale of the scene.
items to the back and front; and setting the scale of the scene.
\section1 DiagramScene Class Implementation
@ -492,12 +492,12 @@
\snippet graphicsview/diagramscene/diagramscene.cpp 3
This function sets the color the scene will use when creating
This function sets the color the scene will use when creating
\c DiagramItems. It also changes the color of a selected \c
DiagramItem.
This is the implementation of \c setFont():
\snippet graphicsview/diagramscene/diagramscene.cpp 4
Set the font to use for new and selected, if a text item is
@ -511,15 +511,15 @@
connected to this slot. We remove the item if it has no text.
If not, we would leak memory and confuse the user as the items
will be edited when pressed on by the mouse.
The \c mousePressEvent() function handles mouse press event's
different depending on which mode the \c DiagramScene is in. We
examine its implementation for each mode:
\snippet graphicsview/diagramscene/diagramscene.cpp 6
We simply create a new \c DiagramItem and add it to the scene at
the position the mouse was pressed. Note that the origin of its
the position the mouse was pressed. Note that the origin of its
local coordinate system will be under the mouse pointer position.
\snippet graphicsview/diagramscene/diagramscene.cpp 7
@ -534,7 +534,7 @@
line.
\snippet graphicsview/diagramscene/diagramscene.cpp 8
The \c DiagramTextItem is editable when the
Qt::TextEditorInteraction flag is set, else it is movable by the
mouse. We always want the text to be drawn on top of the other
@ -547,12 +547,12 @@
can then call the QGraphicsScene implementation, which
handles movement of items with the mouse. We make this call even
if we are in another mode making it possible to add an item and
then keep the mouse button pressed down and start moving
then keep the mouse button pressed down and start moving
the item. In the case of text items, this is not possible as they
do not propagate mouse events when they are editable.
This is the \c mouseMoveEvent() function:
\snippet graphicsview/diagramscene/diagramscene.cpp 10
We must draw the line if we are in InsertMode and the mouse button
@ -567,7 +567,7 @@
should be added to the scene:
\snippet graphicsview/diagramscene/diagramscene.cpp 11
First we need to get the items (if any) under the line's start
and end points. The line itself is the first item at these points,
so we remove it from the lists. As a precaution, we check if the
@ -603,7 +603,7 @@
DiagramScene. It inherits QGraphicsPolygonItem and has a polygon
for each shape. The enum DiagramType has a value for each of the
flowchart shapes.
The class has a list of the arrows that are connected to it.
This is necessary because only the item knows when it is being
moved (with the \c itemChanged() function) at which time the
@ -612,7 +612,7 @@
buttons in \c MainWindow, see \c createColorToolButtonIcon() in
\c MainWindow.
The Type enum is a unique identifier of the class. It is used by
The Type enum is a unique identifier of the class. It is used by
\c qgraphicsitem_cast(), which does dynamic casts of graphics
items. The UserType constant is the minimum value a custom
graphics item type can be.
@ -646,7 +646,7 @@
item.
Here is the \c addArrow() function:
\snippet graphicsview/diagramscene/diagramitem.cpp 3
This function simply adds the \a arrow to the items \c arrows list.
@ -695,7 +695,7 @@
possible to alter the mouse behavior of QGraphicsTextItem.
\section1 DiagramTextItem Implementation
We start with the constructor:
\snippet graphicsview/diagramscene/diagramtextitem.cpp 0
@ -717,7 +717,7 @@
\c DiagramScene uses the signal emitted when the text item looses
focus to remove the item if it is empty, i.e., it contains no
text.
text.
This is the implementation of \c mouseDoubleClickEvent():
@ -740,7 +740,7 @@
The item's color can be set with \c setColor().
\c boundingRect() and \c shape() are reimplemented
\c boundingRect() and \c shape() are reimplemented
from QGraphicsLineItem and are used by the scene
to check for collisions and selections.
@ -769,7 +769,7 @@
We need to reimplement this function because the arrow is
larger than the bounding rectangle of the QGraphicsLineItem. The
graphics scene uses the bounding rectangle to know which regions
of the scene to update.
of the scene to update.
Here is the \c shape() function:
@ -779,14 +779,14 @@
shape of the item. The QGraphicsLineItem::shape() returns a path
with a line drawn with the current pen, so we only need to add
the arrow head. This function is used to check for collisions and
selections with the mouse.
selections with the mouse.
Here is the \c updatePosition() slot:
\snippet graphicsview/diagramscene/arrow.cpp 3
This slot updates the arrow by setting the start and end
points of its line to the center of the items it connects.
points of its line to the center of the items it connects.
Here is the \c paint() function:
@ -809,7 +809,7 @@
one of the lines of the polygon. Note that the points in the
polygon are relative to the local coordinate system of the item.
We must therefore add the position of the end item to make the
coordinates relative to the scene.
coordinates relative to the scene.
\snippet graphicsview/diagramscene/arrow.cpp 6

View File

@ -133,7 +133,7 @@
that the entire name and address insertion is treated as a single
operation by the QTextEdit, so a single undo will revert all the
insertions.
\snippet mainwindows/dockwidgets/mainwindow.cpp 7
This function works in a similar way to \c insertCustomer(). First
@ -141,7 +141,7 @@
replace it with the standard paragraph that the user clicked. Again
we use a \c beginEditBlock() ... \c endEditBlock() pair so that the
insertion can be undone as a single operation.
\snippet mainwindows/dockwidgets/mainwindow.cpp 3
Qt's QTextDocument class makes printing documents easy. We simply

View File

@ -31,7 +31,7 @@
\brief The Easing Curves example shows how to use easing curves to
control the speed of an animation.
\image easing-example.png
*/

View File

@ -46,7 +46,7 @@
System}{meta-object system}. The plugin \l{How to Create Qt
Plugins}{overview document} gives a high-level introduction to
plugins.
We have implemented a plugin, the \c EchoPlugin, which implements
the \c EchoInterface. The interface consists of \c echo(), which
takes a QString as argument. The \c EchoPlugin returns the string
@ -68,8 +68,8 @@
\snippet tools/echoplugin/echowindow/echowindow.h 0
We load the plugin in \c loadPlugin() and cast it to \c
EchoInterface. When the user clicks the \c button we take the
text in \c lineEdit and call the interface's \c echo() with it.
EchoInterface. When the user clicks the \c button we take the
text in \c lineEdit and call the interface's \c echo() with it.
\section1 EchoWindow Class Implementation
@ -136,15 +136,15 @@
System}{Qt's meta object system} aware of the interface. We do
this so that it will be possible to identify plugins that
implements the interface at run-time. The second argument is a
string that must identify the interface in a unique way.
string that must identify the interface in a unique way.
\section1 EchoPlugin Class Definition
We inherit both QObject and \c EchoInterface to make this class a
plugin. The Q_INTERFACES macro tells Qt which interfaces the class
implements. In our case we only implement the \c EchoInterface.
If a class implements more than one interface, they are given as
implements. In our case we only implement the \c EchoInterface.
If a class implements more than one interface, they are given as
a comma separated list. The Q_PLUGIN_METADATA macro is included next
to the Q_OBJECT macro. It contains the plugins IID and a filename
pointing to a json file containing the metadata for the plugin.
@ -158,7 +158,7 @@
\snippet tools/echoplugin/plugin/echoplugin.cpp 0
We simply return the functions parameter.
We simply return the functions parameter.
\section1 The \c main() function
@ -169,7 +169,7 @@
\section1 The Profiles
When creating plugins the profiles need to be adjusted.
We show here what changes need to be done.
We show here what changes need to be done.
The profile in the echoplugin directory uses the \c subdirs
template and simply includes includes to directories in which
@ -196,7 +196,7 @@
You can find an overview of the macros needed to create plugins
\l{Macros for Defining Plugins}{here}.
We give an example of a plugin that extend Qt in the \l{Style
Plugin Example}{style plugin} example. The \l{Plug & Paint
Example}{plug and paint} example shows how to create static

View File

@ -62,7 +62,7 @@
\l{QAbstractItemModel::}{fetchMore()} and
\l{QAbstractItemModel::}{canFetchMore()} from QAbstractItemModel.
These functions are called by the item view when it needs more
items.
items.
The \c setDirPath() function sets the directory the model will
work on. We emit \c numberPopulated() each time we add a batch of

View File

@ -35,27 +35,27 @@
\image flowlayout-example.png Screenshot of the Flow Layout example
The items are first laid out horizontally and then vertically when each line
in the layout runs out of space.
in the layout runs out of space.
The Flowlayout class mainly uses QLayout and QWidgetItem, while the
Window uses QWidget and QLabel. We will only document the definition
and implementation of \c FlowLayout below.
The Flowlayout class mainly uses QLayout and QWidgetItem, while the
Window uses QWidget and QLabel. We will only document the definition
and implementation of \c FlowLayout below.
\section1 FlowLayout Class Definition
The \c FlowLayout class inherits QLayout. It is a custom layout class
that arranges its child widgets horizontally and vertically.
The \c FlowLayout class inherits QLayout. It is a custom layout class
that arranges its child widgets horizontally and vertically.
\snippet layouts/flowlayout/flowlayout.h 0
We reimplement functions inherited from QLayout. These functions add items to
the layout and handle their orientation and geometry.
the layout and handle their orientation and geometry.
We also declare two private methods, \c doLayout() and \c smartSpacing().
\c doLayout() lays out the layout items, while the \c
smartSpacing() function calculates the spacing between them.
\section1 FlowLayout Class Implementation
\section1 FlowLayout Class Implementation
We start off by looking at the constructor:
@ -63,32 +63,32 @@
In the constructor we call \c setContentsMargins() to set the left, top,
right and bottom margin. By default, QLayout uses values provided by
the current style (see QStyle::PixelMetric).
the current style (see QStyle::PixelMetric).
\snippet layouts/flowlayout/flowlayout.cpp 2
In this example we reimplement \c addItem(), which is a pure virtual
function. When using \c addItem() the ownership of the layout items is
transferred to the layout, and it is therefore the layout's
responsibility to delete them.
In this example we reimplement \c addItem(), which is a pure virtual
function. When using \c addItem() the ownership of the layout items is
transferred to the layout, and it is therefore the layout's
responsibility to delete them.
\snippet layouts/flowlayout/flowlayout.cpp 3
\c addItem() is implemented to add items to the layout.
\c addItem() is implemented to add items to the layout.
\snippet layouts/flowlayout/flowlayout.cpp 4
We implement \c horizontalSpacing() and \c verticalSpacing() to get
hold of the spacing between the widgets inside the layout. If the value
is less than or equal to 0, this value will be used. If not,
hold of the spacing between the widgets inside the layout. If the value
is less than or equal to 0, this value will be used. If not,
\c smartSpacing() will be called to calculate the spacing.
\snippet layouts/flowlayout/flowlayout.cpp 5
We then implement \c count() to return the number of items in the
layout. To navigate the list of items we use \c itemAt() and
takeAt() to remove and return items from the list. If an item is
removed, the remaining items will be renumbered. All three
We then implement \c count() to return the number of items in the
layout. To navigate the list of items we use \c itemAt() and
takeAt() to remove and return items from the list. If an item is
removed, the remaining items will be renumbered. All three
functions are pure virtual functions from QLayout.
\snippet layouts/flowlayout/flowlayout.cpp 6
@ -103,7 +103,7 @@
dependency, and \c heightForWidth() passes the width on to \c doLayout() which
in turn uses the width as an argument for the layout rect, i.e., the bounds in
which the items are laid out. This rect does not include the layout margin().
\snippet layouts/flowlayout/flowlayout.cpp 8
\c setGeometry() is normally used to do the actual layout, i.e., calculate
@ -116,30 +116,30 @@
\snippet layouts/flowlayout/flowlayout.cpp 9
\c doLayout() handles the layout if \c horizontalSpacing() or \c
verticalSpacing() don't return the default value. It uses
\c getContentsMargins() to calculate the area available to the
layout items.
verticalSpacing() don't return the default value. It uses
\c getContentsMargins() to calculate the area available to the
layout items.
\snippet layouts/flowlayout/flowlayout.cpp 10
It then sets the proper amount of spacing for each widget in the
layout, based on the current style.
It then sets the proper amount of spacing for each widget in the
layout, based on the current style.
\snippet layouts/flowlayout/flowlayout.cpp 11
The position of each item in the layout is then calculated by
adding the items width and the line height to the initial x and y
coordinates. This in turn lets us find out whether the next item
will fit on the current line or if it must be moved down to the next.
We also find the height of the current line based on the widgets height.
The position of each item in the layout is then calculated by
adding the items width and the line height to the initial x and y
coordinates. This in turn lets us find out whether the next item
will fit on the current line or if it must be moved down to the next.
We also find the height of the current line based on the widgets height.
\snippet layouts/flowlayout/flowlayout.cpp 12
\c smartSpacing() is designed to get the default spacing for either
the top-level layouts or the sublayouts. The default spacing for
top-level layouts, when the parent is a QWidget, will be determined
by querying the style. The default spacing for sublayouts, when
the parent is a QLayout, will be determined by querying the spacing
of the parent layout.
\c smartSpacing() is designed to get the default spacing for either
the top-level layouts or the sublayouts. The default spacing for
top-level layouts, when the parent is a QWidget, will be determined
by querying the style. The default spacing for sublayouts, when
the parent is a QLayout, will be determined by querying the spacing
of the parent layout.
*/

View File

@ -30,7 +30,7 @@
\title Font Sampler Example
\ingroup examples-painting
\brief The Font Sampler example shows how to preview and print multi-page documents.
The Font Sampler example shows how to preview and print multi-page documents.
\image fontsampler-example.png

View File

@ -230,7 +230,7 @@
top-level corner of the drag pixmap, to be the point we calculated
above. This makes the process of dragging the label feel more natural
because the cursor always points to the same place on the label
during the drag operation.
during the drag operation.
We start the drag operation using QDrag's \l{QDrag::}{exec()} function,
requesting that the magnet is copied when the drag is completed.

View File

@ -32,7 +32,9 @@
\brief The Internationalization (I18N) example demonstrates Qt's support for translated
text. Developers can write the initial application text in one language, and
translations can be provided later without any modifications to the code.
translations can be provided later without any modifications to the code. It also
demonstrates how to detect the system language settings and show the UI in the appropriate
language.
\image i18n-example.png
*/

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example mainwindows/mdi
\title MDI Example
\ingroup examples-mainwindow

View File

@ -43,7 +43,7 @@
\li \c StateSwitcher inherits QState and can add
\c {StateSwitchTransition}s to other states.
When entered, it will randomly transition to one of these
states.
states.
\li \c StateSwitchTransition is a custom transition that
triggers on \c{StateSwitchEvent}s.
\li \c StateSwitchEvent is a QEvent that triggers \c{StateSwitchTransition}s.
@ -152,7 +152,7 @@
\c StateSwitcher is a state designed for a particular purpose and
will always be a top-level state. We use \c m_stateCount to keep
track of how many states we are managing, and \c m_lastIndex to
remember which state was the last state to which we transitioned.
remember which state was the last state to which we transitioned.
\snippet animation/moveblocks/main.cpp 11

View File

@ -216,7 +216,7 @@
This enables the items to be drawn without any gaps between them. Removing
the headers also prevents the user from adjusting the sizes of individual
rows and columns.
rows and columns.
We also set the minimum section size to 1 on the headers. If we
didn't, the headers would default to a larger size, preventing

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example mainwindows/recentfiles
\title Recent Files Example
\ingroup examples-mainwindow

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example tools/regexp
\title Regular Expressions Example
\ingroup examples-widgets-tools

View File

@ -151,7 +151,7 @@
When we enter \c quitState, we update the status bar of the
window.
\c QKeyEventTransition is a utility class that removes the hassle
of implementing transitions for \l{QKeyEvent}s. We simply need to
specify the key on which the transition should trigger and the
@ -161,7 +161,7 @@
The transition from \c inputState allows triggering the quit state
when the player types \c {q}.
\snippet statemachine/rogue/window.cpp 5
The machine is set up, so it's time to start it.

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example mainwindows/sdi
\title SDI Example
\ingroup examples-mainwindow

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example tools/settingseditor
\title Settings Editor Example
\ingroup examples-widgets-tools

View File

@ -61,7 +61,7 @@
The constructor of the \c Window class can be explained in three parts.
In the first part, we set up the widgets used for the user interface:
\snippet itemviews/simplewidgetmapper/window.cpp Set up widgets
We also set up the buddy relationships between various labels and the

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example widgets/spinboxes
\title Spin Boxes Example
\ingroup examples-widgets

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
/*!
\example dialogs/standarddialogs
\title Standard Dialogs Example
\ingroup examples-dialogs

View File

@ -257,7 +257,7 @@
\l{QAbstractItemView::editTriggers()}{edit triggers}, so that the
editor is opened with a single click when the star rating item is
selected.
The \c populateTableWidget() function fills the QTableWidget with
data:

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