Merge remote-tracking branch 'gerrit/master' into newdocs

Change-Id: If7f46d56cf0b0b79f7fc8955a01964121b900d07
bb10
Tor Arne Vestbø 2012-10-19 09:53:42 +02:00
commit 55a36aed79
291 changed files with 7848 additions and 2925 deletions

1
.qmake.conf Normal file
View File

@ -0,0 +1 @@
load(qt_build_config)

View File

@ -83,8 +83,8 @@ our $quoted_basedir;
# Make sure we use Windows line endings for chomp and friends on Windows.
$INPUT_RECORD_SEPARATOR = "\r\n" if ($^O eq "msys");
my $qtbasedir = dirname(dirname($0));
normalizePath(\$qtbasedir) if (defined $qtbasedir);
my $mkspecsdir = dirname(dirname($0));
normalizePath(\$mkspecsdir) if (defined $mkspecsdir);
# will be defined based on the modules sync.profile
our (%modules, %moduleheaders, @allmoduleheadersprivate, %classnames, %modulepris, %explicitheaders, %deprecatedheaders);
@ -128,7 +128,7 @@ sub showUsage
print " -showonly Show action but not perform (default: " . ($showonly ? "yes" : "no") . ")\n";
print " -minimal Do not create CamelCase headers (default: " . ($minimal ? "yes" : "no") . ")\n";
print " -outdir <PATH> Specify output directory for sync (default: $out_basedir)\n";
print " -qtdir <PATH> Set the path to QtBase (detected: " . (defined $qtbasedir ? $qtbasedir : "-none-") . ")\n";
print " -mkspecsdir <PATH> Set the path to the mkspecs (detected: " . (defined $mkspecsdir ? $mkspecsdir : "-none-") . ")\n";
print " -quiet Only report problems, not activity (same as -verbose 0)\n";
print " -v, -verbose <level> Sets the verbosity level (max. 4) (default: $verbose_level)\n";
print " The short form increases the level by +1\n";
@ -669,8 +669,8 @@ while ( @ARGV ) {
} elsif($arg eq "-private") {
$var = "create_private_headers";
$val = "yes";
} elsif($arg eq "-qtdir") {
$var = "qtdir";
} elsif($arg eq "-mkspecsdir") {
$var = "mkspecsdir";
$val = shift @ARGV;
} elsif($arg =~/^-/) {
print "Unknown option: $arg\n\n" if(!$var);
@ -746,12 +746,12 @@ while ( @ARGV ) {
push @modules_to_sync, $module;
$moduleheaders{$module} = $headerdir;
$create_uic_class_map = 0;
} elsif ($var eq "qtdir") {
} elsif ($var eq "mkspecsdir") {
if($val) {
$qtbasedir = $val;
normalizePath(\$qtbasedir);
$mkspecsdir = $val;
normalizePath(\$mkspecsdir);
} else {
die "The -qtdir option requires an argument";
die "The -mkspecsdir option requires an argument";
}
} elsif ($var eq "output") {
my $outdir = $val;
@ -767,9 +767,9 @@ while ( @ARGV ) {
}
die "Cannot automatically detect/use provided path to QtBase's build directory!\n" .
"QTDIR detected/provided: " . (defined $qtbasedir ? $qtbasedir : "-none-") . "\n" .
"Please use the -qtdir option to provide the correct path.\nsyncqt failed"
if (!$qtbasedir || !-d "$qtbasedir/mkspecs");
"QTDIR detected/provided: " . (defined $mkspecsdir ? $mkspecsdir : "-none-") . "\n" .
"Please use the -mkspecsdir option to provide the correct path.\nsyncqt failed"
if (!$mkspecsdir || !-d $mkspecsdir);
# if we have no $basedir we cannot be sure which sources you want, so die
die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
@ -792,12 +792,12 @@ my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate;
$isunix = checkUnix; #cache checkUnix
my $qt_version = fileContents($qtbasedir."/mkspecs/qconfig.pri");
my $qt_version = fileContents($mkspecsdir."/qconfig.pri");
if (length($qt_version)) {
$qt_version =~ s,.*^QT_VERSION\h*=\h*(\S+).*,$1,sm;
$qt_version =~ s,.*^QT_VERSION[ \t]*=[ \t]*(\S+).*,$1,sm;
} else {
$qt_version = fileContents($basedir."/src/corelib/global/qglobal.h");
$qt_version =~ s,.*^#\h*define\h+QT_VERSION_STR\h+"([^"]+)".*,$1,sm;
$qt_version =~ s,.*^#[ \t]*define[ \t]+QT_VERSION_STR[ \t]+"([^"]+)".*,$1,sm;
}
foreach my $lib (@modules_to_sync) {
die "No such module: $lib" unless(defined $modules{$lib});
@ -808,7 +808,7 @@ foreach my $lib (@modules_to_sync) {
my $project = $dir;
$project =~ s,/([^/]+)$,/$1/$1.pro,;
my $module_version = fileContents($project);
$module_version = $qt_version unless ($module_version =~ s,.*^VERSION\h*=\h*(\S+).*,$1,sm);
$module_version = $qt_version unless ($module_version =~ s,.*^VERSION[ \t]*=[ \t]*(\S+).*,$1,sm);
# Backwards compatibility for modules with checked in .pri files.
if (defined $modulepris{$lib} and -e "$modulepris{$lib}") {

10
configure vendored
View File

@ -727,7 +727,7 @@ mkdir -p "$outpath/config.tests"
rm -f "$outpath/config.tests/.qmake.cache"
cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
QMakeVar add styles "cde mac motif plastique cleanlooks windows"
QMakeVar add styles "cde mac motif fusion plastique cleanlooks windows"
# QTDIR may be set and point to an old or system-wide Qt installation
unset QTDIR
@ -2200,7 +2200,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then
if [ -x "$relpath/bin/syncqt" ]; then
mkdir -p "$outpath/bin"
echo "#!/bin/sh" >"$outpath/bin/syncqt"
echo "perl \"$relpath/bin/syncqt\" -qtdir \"$outpath\" \"\$@\"" >>"$outpath/bin/syncqt"
echo "perl \"$relpath/bin/syncqt\" -mkspecsdir \"$outpath/mkspecs\" \"\$@\"" >>"$outpath/bin/syncqt"
chmod 755 "$outpath/bin/syncqt"
fi
@ -3281,11 +3281,6 @@ Additional options:
-feature-<feature> .. Compile in <feature>. The available features
are described in src/corelib/global/qfeatures.txt
-no-freetype ........ Do not compile in Freetype2 support.
-qt-freetype ........ Use the libfreetype bundled with Qt.
* -system-freetype .... Use libfreetype from the operating system.
See http://www.freetype.org/
-qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
default ($CFG_QCONFIG).
@ -6119,7 +6114,6 @@ cat >>"$CACHEFILE.tmp" <<EOF
QT_SOURCE_TREE = \$\$quote($relpath)
QT_BUILD_TREE = \$\$quote($outpath)
include(\$\$PWD/mkspecs/qmodule.pri)
CONFIG += fix_output_dirs no_private_qt_headers_warning QTDIR_build
EOF

12
dist/changes-5.0.0 vendored
View File

@ -508,6 +508,15 @@ QtGui
the existent image data will be invalidated, so that isNull() is guaranteed
to return true in this case.
* Behavioral change regarding QPainter fill rules when not using antialiased
painting: The fill rules have changed so that the aliased and antialiased
coordinate systems match. Earlier there used to be an offset of slightly less
than half a pixel when doing sub-pixel rendering, in order to be consistent
with the old X11 paint engine. The new behavior should be more predictable and
gives the same consistent rounding for images / pixmaps as for paths and
rectangle filling. It's possible to still get the old behavior by setting the
QPainter::Qt4CompatiblePainting render hint.
QtWidgets
---------
* QInputContext removed as well as related getters and setters on QWidget and QApplication.
@ -608,6 +617,9 @@ QtOpenGL
QGLWidget and a QOpenGLFramebufferObject. It is recommended that applications
using QGLPixelBuffer for offscreen rendering to a texture switch to using
QOpenGLFramebufferObject directly instead, for improved performance.
* The default major version of QGLFormat has been changed to 2 to be aligned
with QSurfaceFormat. Applications that want to use a different version should
explicitly request it using QGLFormat::setVersion().
QtScript
--------

View File

@ -75,7 +75,7 @@ MapZoom::MapZoom()
QNetworkConfigurationManager manager;
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
// Get saved network configuration
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
const QString id =
settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
@ -112,7 +112,7 @@ void MapZoom::sessionOpened()
id = config.identifier();
}
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id);
settings.endGroup();

View File

@ -129,7 +129,7 @@ Client::Client(QWidget *parent)
QNetworkConfigurationManager manager;
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
// Get saved network configuration
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
settings.endGroup();
@ -248,7 +248,7 @@ void Client::sessionOpened()
else
id = config.identifier();
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id);
settings.endGroup();

View File

@ -55,7 +55,7 @@ Server::Server(QWidget *parent)
QNetworkConfigurationManager manager;
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
// Get saved network configuration
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
settings.endGroup();
@ -115,7 +115,7 @@ void Server::sessionOpened()
else
id = config.identifier();
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id);
settings.endGroup();

View File

@ -53,7 +53,7 @@ int main(int argc, char *argv[])
QNetworkConfigurationManager manager;
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
// Get saved network configuration
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
settings.endGroup();
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
id = config.identifier();
}
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
settings.beginGroup(QLatin1String("QtNetwork"));
settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id);
settings.endGroup();

View File

@ -234,7 +234,7 @@ int MainWindow::rowOfClient(TorrentClient *client) const
void MainWindow::loadSettings()
{
// Load base settings (last working directory, upload/download limits).
QSettings settings("Trolltech", "Torrent");
QSettings settings("QtProject", "Torrent");
lastDirectory = settings.value("LastDirectory").toString();
if (lastDirectory.isEmpty())
lastDirectory = QDir::currentPath();
@ -411,7 +411,7 @@ void MainWindow::saveSettings()
saveChanges = false;
// Prepare and reset the settings
QSettings settings("Trolltech", "Torrent");
QSettings settings("QtProject", "Torrent");
settings.clear();
settings.setValue("LastDirectory", lastDirectory);

View File

@ -55,7 +55,8 @@ MainWidget::MainWidget(QWidget *parent) :
QGLWidget(parent),
timer(new QBasicTimer),
program(new QGLShaderProgram),
geometries(new GeometryEngine)
geometries(new GeometryEngine),
angularSpeed(0)
{
}

View File

@ -48,7 +48,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
app.setOrganizationName("Trolltech");
app.setOrganizationName("QtProject");
app.setApplicationName("Application Example");
MainWindow mainWin;
mainWin.show();

View File

@ -276,7 +276,7 @@ void MainWindow::createStatusBar()
void MainWindow::readSettings()
//! [34] //! [36]
{
QSettings settings("Trolltech", "Application Example");
QSettings settings("QtProject", "Application Example");
QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
QSize size = settings.value("size", QSize(400, 400)).toSize();
resize(size);
@ -288,7 +288,7 @@ void MainWindow::readSettings()
void MainWindow::writeSettings()
//! [37] //! [39]
{
QSettings settings("Trolltech", "Application Example");
QSettings settings("QtProject", "Application Example");
settings.setValue("pos", pos());
settings.setValue("size", size());
}

View File

@ -362,7 +362,7 @@ void MainWindow::createStatusBar()
void MainWindow::readSettings()
{
QSettings settings("Trolltech", "MDI Example");
QSettings settings("QtProject", "MDI Example");
QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
QSize size = settings.value("size", QSize(400, 400)).toSize();
move(pos);
@ -371,7 +371,7 @@ void MainWindow::readSettings()
void MainWindow::writeSettings()
{
QSettings settings("Trolltech", "MDI Example");
QSettings settings("QtProject", "MDI Example");
settings.setValue("pos", pos());
settings.setValue("size", size());
}

View File

@ -45,7 +45,7 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setOrganizationName("Trolltech");
app.setOrganizationName("QtProject");
app.setApplicationName("Recent Files Example");
MainWindow *mainWin = new MainWindow;
mainWin->show();

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(sdi);
QApplication app(argc, argv);
app.setApplicationName("SDI Example");
app.setOrganizationName("Trolltech");
app.setOrganizationName("QtProject");
MainWindow *mainWin = new MainWindow;
mainWin->show();
return app.exec();

View File

@ -21,7 +21,7 @@ QMAKE_CFLAGS_DEBUG = -g
QMAKE_CFLAGS_SHLIB =
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_THREAD = -qthreaded
QMAKE_CFLAGS_THREAD = -qthreaded -qtls
QMAKE_CXX = xlC
QMAKE_CXX_THREAD = xlC_r

View File

@ -70,48 +70,11 @@ endif()
set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\")
!!IF !isEmpty(CMAKE_STATIC_TYPE)
if (NOT Qt5_EXCLUDE_STATIC_DEPENDENCIES)
# For static builds, we also list the dependencies of
# Qt so that consumers can build easily.
macro(macro_process_prl_file prl_file_location Configuration)
if (EXISTS \"${prl_file_location}\")
file(STRINGS \"${prl_file_location}\" prl_strings REGEX \"QMAKE_PRL_LIBS_FOR_CMAKE\")
string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE *= *([^\\n]*)\" \"\\\\1\" static_depends ${prl_strings} )
if (_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES)
set(_list_sep \";\")
endif()
set(_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES \"${_list_sep}${static_depends}\")
endif()
endmacro()
!!IF !isEmpty(CMAKE_DEBUG_TYPE)
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
macro_process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG)
!!ELSE
macro_process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG)
!!ENDIF
!!ENDIF
!!IF !isEmpty(CMAKE_RELEASE_TYPE)
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
macro_process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE)
!!ELSE
macro_process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE)
!!ENDIF
!!ENDIF
endif()
!!ENDIF # Static
macro(_populate_imported_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
\"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES}\"
\"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
\"IMPORTED_LOCATION_${Configuration}\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\"
!!ELSE

View File

@ -3,9 +3,9 @@ set(PACKAGE_VERSION $$eval(QT.$${MODULE}.VERSION))
if(\"\${PACKAGE_VERSION}\" VERSION_LESS \"\${PACKAGE_FIND_VERSION}\")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else(\"\${PACKAGE_VERSION}\" VERSION_LESS \"\${PACKAGE_FIND_VERSION}\")
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(\"\${PACKAGE_FIND_VERSION}\" STREQUAL \"\${PACKAGE_VERSION}\")
set(PACKAGE_VERSION_EXACT TRUE)
endif(\"\${PACKAGE_FIND_VERSION}\" STREQUAL \"\${PACKAGE_VERSION}\")
endif(\"\${PACKAGE_VERSION}\" VERSION_LESS \"\${PACKAGE_FIND_VERSION}\")
endif()
endif()

View File

@ -50,42 +50,16 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
# Let every project have a standard GNU `check' target
!contains(QMAKE_EXTRA_TARGETS, check) {
# `make check' should iterate through all subdirs
# (except those with no_default_target or no_check_target)
contains(TEMPLATE, subdirs) {
for(subdir, SUBDIRS) {
subdir_config=$$eval($${subdir}.CONFIG)
!contains(subdir_config, no_check_target):!contains(subdir_config, no_default_target):check.recurse += $$subdir
unset(subdir_config)
}
!isEmpty(check.recurse) {
# setup the recurse target only when there is to recurse into
check.CONFIG = recursive
check.recurse_target = check
}
}
# `make check' should imply building the project
else {
check.depends = first
}
contains(TEMPLATE, subdirs): \
prepareRecursiveTarget(check)
else: \
check.depends = first # `make check' implies build
QMAKE_EXTRA_TARGETS += check
}
# Let every project have a 'docs' target
!contains(QMAKE_EXTRA_TARGETS, docs) {
contains(TEMPLATE, subdirs) {
# `make docs' should iterate through all subdirs
# (except those with no_default_target or no_docs_target)
!contains(CONFIG, no_docs_target):for(subdir, SUBDIRS) {
subdir_config = $$eval($${subdir}.CONFIG)
!contains(subdir_config, no_docs_target):!contains(subdir_config, no_default_target):docs.recurse += $$subdir
unset(subdir_config)
}
!isEmpty(docs.recurse) {
# setup the recurse target only when there is something to recurse into
docs.CONFIG = recursive
docs.recurse_target = docs
}
prepareRecursiveTarget(docs)
} else {
# apps and libs only generate docs if QMAKE_DOCS is set
!isEmpty(QMAKE_DOCS) {
@ -99,3 +73,11 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
}
QMAKE_EXTRA_TARGETS += docs
}
!contains(QMAKE_EXTRA_TARGETS, install_docs) {
contains(TEMPLATE, subdirs) {
prepareRecursiveTarget(install_docs)
prepareRecursiveTarget(uninstall_docs)
}
QMAKE_EXTRA_TARGETS += install_docs uninstall_docs
}

View File

@ -3,6 +3,15 @@ load(qt_build_config)
TEMPLATE = lib
CONFIG += plugin
if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release
contains(QT_CONFIG, build_all):CONFIG += build_all
}
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
contains(QT_CONFIG, c++11):CONFIG += c++11
isEmpty(CXX_MODULE) {
CXX_MODULE = $$TARGET
TARGET = declarative_$${TARGET}
@ -21,7 +30,6 @@ INSTALLS += target
# Some final setup
TARGET = $$qtLibraryTarget($$TARGET)
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
load(qt_targets)

View File

@ -15,5 +15,6 @@ mac {
}
}
# Qt modules get compiled without exceptions enabled by default
CONFIG += exceptions_off
# Qt modules get compiled without exceptions enabled by default.
# However, testcases should be still built with exceptions.
CONFIG += exceptions_off testcase_exceptions

View File

@ -267,3 +267,29 @@ defineTest(packagesExist) {
return(true)
}
# Prepares target that will iterate through all subdirs (except those
# with no_default_target or no_{name_of_target}_target. The prepared
# target must still be manually added to QMAKE_EXTRA_TARGETS.
defineTest(prepareRecursiveTarget) {
target = $$1
no_$${target}_target: return()
for(subdir, SUBDIRS) {
subdir_config = $$eval($${subdir}.CONFIG)
contains(subdir_config, no_default_target): next()
contains(subdir_config, no_$${target}_target): next()
$${target}.recurse += $$subdir
}
# Set up the recurse target only when there
# is something to recurse into.
isEmpty($${target}.recurse): return()
$${target}.CONFIG = recursive
$${target}.recurse_target = $${target}
export($${target}.recurse)
export($${target}.CONFIG)
export($${target}.recurse_target)
}

View File

@ -51,7 +51,11 @@ qt_install_module {
qt_install_module_docs {
module_docs.files = $$QMAKE_DOCS_OUTPUTDIR
module_docs.path = $$[QT_INSTALL_DOCS]
module_docs.CONFIG += no_check_exist directory
module_docs.CONFIG += no_check_exist directory no_default_install
module_docs.depends += docs
INSTALLS += module_docs
install_docs.depends = install_module_docs
uninstall_docs.depends = uninstall_module_docs
QMAKE_EXTRA_TARGETS += install_docs uninstall_docs
}

View File

@ -8,7 +8,7 @@ else: \
qtPrepareTool(QMAKE_SYNCQT, syncqt)
contains(QT_CONFIG, private_tests): \ # -developer-build
QMAKE_SYNCQT += -check-includes
QMAKE_SYNCQT += -module $$TARGET -qtdir $$[QT_HOST_DATA/get] -outdir $$mod_component_base $$MODULE_BASE_DIR
QMAKE_SYNCQT += -module $$TARGET -mkspecsdir $$[QT_HOST_DATA/get]/mkspecs -outdir $$mod_component_base $$MODULE_BASE_DIR
!silent: message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")
}

View File

@ -41,6 +41,6 @@ isEmpty(QMAKE_COMPILER) {
QMAKE_COMPILER = msvc
else: \
error("qmake spec does not announce the compiler family, and it cannot be guessed.")
warning("qmake spec does not announce the compiler family. Guessed $$QMAKE_COMPILER.")
warning("qmake spec does not announce the compiler family. Guessed $${QMAKE_COMPILER}.")
}
CONFIG += $$QMAKE_COMPILER

View File

@ -1,5 +1,11 @@
have_target {
# qt_build_config.prf disables execptions for all Qt modules which don't
# explicitly turn it on again, while the qmake default is to build with
# exceptions. As we want tests to be built like 3rd party applications,
# qt_build_config tells us to re-enable exceptions here.
testcase_exceptions: CONFIG += exceptions
check.files =
check.path = .

View File

@ -1,4 +1,3 @@
qtPrepareTool(QMAKE_UIC3, uic3)
qtPrepareTool(QMAKE_UIC, uic)
isEmpty(UI_DIR):UI_DIR = .
@ -32,78 +31,3 @@ isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_
contains(ui_dir_short, ^[/\\\\].*):INCLUDEPATH += $$UI_HEADERS_DIR
else:INCLUDEPATH += $$OUT_PWD/$$UI_HEADERS_DIR
}
uic3 {
isEmpty(FORMS3) {
UIC3_FORMS = FORMS
!build_pass:message("Project contains CONFIG+=uic3, but no files in FORMS3; UI files in FORMS treated as UIC3 form files.")
} else {
UIC3_FORMS = FORMS3
}
uic3_decl.commands = $$QMAKE_UIC3 ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
uic3_decl.dependency_type = TYPE_UI
uic3_decl.output = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
uic3_decl.input = $$UIC3_FORMS
uic3_decl.CONFIG += no_link
uic3_decl.variable_out = GENERATED_FILES UIC3_HEADERS
uic3_decl.name = UIC3 Decl ${QMAKE_FILE_IN}
silent:uic3_decl.commands = @echo uic3 ${QMAKE_FILE_IN} && $$uic3_decl.commands
QMAKE_EXTRA_COMPILERS += uic3_decl
uic3_impl.commands = $$QMAKE_UIC3 -impl ${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
uic3_impl.dependency_type = TYPE_UI
uic3_impl.output = $$UI_SOURCES_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)}
uic3_impl.depends = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
uic3_impl.input = $$UIC3_FORMS
uic3_impl.variable_out = GENERATED_SOURCES
uic3_impl.name = UIC3 Impl ${QMAKE_FILE_IN}
silent:uic3_impl.commands = @echo uic3 -impl ${QMAKE_FILE_IN} && $$uic3_impl.commands
QMAKE_EXTRA_COMPILERS += uic3_impl
### add a moc step
load(moc)
uic3_moc.commands = $$moc_header.commands
uic3_moc.output = $$moc_header.output
uic3_moc.depends = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
uic3_moc.input = UIC3_HEADERS
uic3_moc.variable_out = GENERATED_SOURCES
uic3_moc.name = $$moc_header.name
!contains(TEMPLATE, "vc.*"):!isEmpty(INCLUDETEMP):uic3_moc.depends += $$INCLUDETEMP
QMAKE_EXTRA_COMPILERS += uic3_moc
}
defineReplace(imageCollectionCmd) {
unset(EMBEDDED_IMAGES)
RET =
for(image, $$list($$split(1))) {
EMBEDDED_IMAGES += $$image
count(EMBEDDED_IMAGES, 5) {
isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > $${UI_DIR}/images.tmp $$escape_expand(\\n\\t)
else: RET += echo $$EMBEDDED_IMAGES >> $${UI_DIR}/images.tmp $$escape_expand(\\n\\t)
unset(EMBEDDED_IMAGES)
}
}
!isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> $${UI_DIR}/images.tmp $$escape_expand(\\n\\t)
!isEmpty(RET) {
RET += $$QMAKE_UIC3 -embed $$TARGET -f $${UI_DIR}/images.tmp -o $$2 $$escape_expand(\\n\\t)
return($$RET)
}
return($$QMAKE_UIC3 -embed $$TARGET $$1 -o $$2)
}
image_collection.output = $${UI_DIR}/qmake_image_collection$${first(QMAKE_EXT_CPP)}
image_collection.variable_out = SOURCES
image_collection.input = IMAGES
image_collection.CONFIG += combine
image_collection.name = UIC3 Image collection in ${QMAKE_FILE_OUT}
!win32 {
image_collection.commands = $$QMAKE_UIC3 -embed $$TARGET ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
silent:image_collection.commands = @echo uic3 -embed ${QMAKE_FILE_IN} && $$image_collection.commands
} else {
image_collection.commands = ${QMAKE_FUNC_imageCollectionCmd}
silent:image_collection.commands = @echo uic3 -embed $$TARGET -f $${UI_DIR}/images.tmp && $image_collection.commands
}
QMAKE_EXTRA_COMPILERS += image_collection

View File

@ -1010,13 +1010,6 @@ MakefileGenerator::writePrlFile(QTextStream &t)
for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
t << project->values((*it).toKey()).join(' ').replace('\\', "\\\\") << " ";
t << endl;
t << "QMAKE_PRL_LIBS_FOR_CMAKE = ";
QString sep;
for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) {
t << sep << project->values((*it).toKey()).join(';').replace('\\', "\\\\");
sep = ';';
}
t << endl;
}
}

View File

@ -40,5 +40,5 @@
//! [0]
// {67C8770B-44F1-410A-AB9A-F9B5446F13EE}
QUuid IID_MyInterface(0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee)
QUuid IID_MyInterface(0x67c8770b, 0x44f1, 0x410a, 0xab, 0x9a, 0xf9, 0xb5, 0x44, 0x6f, 0x13, 0xee);
//! [0]

View File

@ -53,7 +53,8 @@ int main(int argc, char *argv[])
//! [1]
if (label)
//! [1] //! [2]
//! [1]
//! [2]
label->show();
//! [2]
return 0;

View File

@ -9,6 +9,7 @@ HEADERS += \
global/qendian.h \
global/qnumeric_p.h \
global/qnumeric.h \
global/qlibraryinfo.h \
global/qlogging.h \
global/qtypeinfo.h \
global/qsysinfo.h \

View File

@ -780,6 +780,12 @@ Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogCont
return message;
}
#if !QT_DEPRECATED_SINCE(5, 0)
// make sure they're defined to be exported
typedef void (*QtMsgHandler)(QtMsgType, const char *);
Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
#endif
static QtMsgHandler msgHandler = 0; // pointer to debug handler (without context)
static QtMessageHandler messageHandler = 0; // pointer to debug handler (with context)

View File

@ -161,9 +161,10 @@ Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &contex
Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);
Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
// deprecated. Use qInstallMessageHandler instead!
#if QT_DEPRECATED_SINCE(5, 0)// deprecated. Use qInstallMessageHandler instead!
typedef void (*QtMsgHandler)(QtMsgType, const char *);
Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
Q_CORE_EXPORT QT_DEPRECATED QtMsgHandler qInstallMsgHandler(QtMsgHandler);
#endif
typedef void (*QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &);
Q_CORE_EXPORT QtMessageHandler qInstallMessageHandler(QtMessageHandler);

View File

@ -853,12 +853,18 @@ static QItemSelection mergeIndexes(const QVector<QPersistentModelIndex> &indexes
int i = 0;
while (i < indexes.count()) {
const QPersistentModelIndex &tl = indexes.at(i);
if (!tl.isValid()) {
++i;
continue;
}
QPersistentModelIndex br = tl;
QModelIndex brParent = br.parent();
int brRow = br.row();
int brColumn = br.column();
while (++i < indexes.count()) {
const QPersistentModelIndex &next = indexes.at(i);
if (!next.isValid())
continue;
const QModelIndex nextParent = next.parent();
const int nextRow = next.row();
const int nextColumn = next.column();

View File

@ -243,28 +243,6 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif
}
}
static inline bool updateTimeout(int *timeout, const struct timeval &start)
{
// A timeout of -1 means we should block indefinitely. If we get here, we got woken up by a
// non-IO BPS event, and that event has been processed already. This means we can go back and
// block in bps_get_event().
// Note that processing the BPS event might have triggered a wakeup, in that case we get a
// IO event in the next bps_get_event() right away.
if (*timeout == -1)
return true;
if (Q_UNLIKELY(!QElapsedTimer::isMonotonic())) {
// we cannot recalculate the timeout without a monotonic clock as the time may have changed
return false;
}
// clock source is monotonic, so we can recalculate how much timeout is left
timeval t2 = qt_gettime();
int elapsed = (t2.tv_sec * 1000 + t2.tv_usec / 1000) - (start.tv_sec * 1000 + start.tv_usec / 1000);
*timeout -= elapsed;
return *timeout >= 0;
}
int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
timeval *timeout)
{
@ -291,60 +269,70 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
FD_ZERO(exceptfds);
// Convert timeout to milliseconds
int timeout_bps = -1;
int timeoutTotal = -1;
if (timeout)
timeout_bps = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
timeoutTotal = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
int timeoutLeft = timeoutTotal;
bool hasProcessedEventsOnce = false;
bps_event_t *event = 0;
unsigned int eventCount = 0;
// This loop exists such that we can drain the bps event queue of all native events
// more efficiently than if we were to return control to Qt after each event. This
// is important for handling touch events which can come in rapidly.
forever {
Q_ASSERT(!hasProcessedEventsOnce || event);
// Only emit the awake() and aboutToBlock() signals in the second iteration. For the
// first iteration, the UNIX event dispatcher will have taken care of that already.
// Also native events are actually processed one loop iteration after they were
// retrieved with bps_get_event().
// Only emit the awake() and aboutToBlock() signals in the second iteration. For the first
// iteration, the UNIX event dispatcher will have taken care of that already.
if (hasProcessedEventsOnce)
emit awake();
// Filtering the native event should happen between the awake() and aboutToBlock()
// signal emissions. The calls awake() - filterNativeEvent() - aboutToBlock() -
// bps_get_event() need not to be interrupted by a break or return statement.
if (eventCount > 0) {
if (event) {
emit awake();
filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
emit aboutToBlock();
}
// Filtering the native event should happen between the awake() and aboutToBlock() signal
// emissions. The calls awake() - filterNativeEvent() - aboutToBlock() - bps_get_event()
// need not to be interrupted by a break or return statement.
//
// Because of this, the native event is actually processed one loop iteration
// after it was retrieved with bps_get_event().
if (event)
filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
if (hasProcessedEventsOnce)
emit aboutToBlock();
// Update the timeout
// Clock source is monotonic, so we can recalculate how much timeout is left
if (timeoutTotal != -1) {
timeval t2 = qt_gettime();
timeoutLeft = timeoutTotal - ((t2.tv_sec * 1000 + t2.tv_usec / 1000)
- (startTime.tv_sec * 1000 + startTime.tv_usec / 1000));
if (timeoutLeft < 0)
timeoutLeft = 0;
}
}
// Wait for event or file to be ready
event = 0;
const int result = bps_get_event(&event, timeout_bps);
const int result = bps_get_event(&event, timeoutLeft);
if (result != BPS_SUCCESS)
qWarning("QEventDispatcherBlackberry::select: bps_get_event() failed");
// In the case of !event, we break out of the loop to let Qt process the timers
// that are now ready (since timeout has expired).
// In the case of bpsIOReadyDomain, we break out to let Qt process the FDs that
// are ready. If we do not do this activation of QSocketNotifiers etc would be
// delayed.
if (!event || bps_event_get_domain(event) == bpsIOReadyDomain)
break;
if (!event) // In case of !event, we break out of the loop to let Qt process the timers
break; // (since timeout has expired) and socket notifiers that are now ready.
// Update the timeout. If this fails we have exceeded our alloted time or the system
// clock has changed time and we cannot calculate a new timeout so we bail out.
if (!updateTimeout(&timeout_bps, startTime)) {
// No more loop iteration, so we need to filter the event here.
filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
break;
if (bps_event_get_domain(event) == bpsIOReadyDomain) {
timeoutTotal = 0; // in order to immediately drain the event queue of native events
event = 0; // (especially touch move events) we don't break out here
}
hasProcessedEventsOnce = true;
++eventCount;
// Make sure we are not trapped in this loop due to continuous native events
// also we cannot recalculate the timeout without a monotonic clock as the time may have changed
const unsigned int maximumEventCount = 12;
if (Q_UNLIKELY((eventCount > maximumEventCount && timeoutLeft == 0)
|| !QElapsedTimer::isMonotonic())) {
if (event)
filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
break;
}
}
// the number of bits set in the file sets

View File

@ -123,7 +123,7 @@
/*!
\fn QPointer::QPointer(T* p)
Constructs a guarded pointer that points to same object that \a p
Constructs a guarded pointer that points to the same object that \a p
points to.
*/
@ -273,3 +273,11 @@
\a p2 are not pointing to the same object, otherwise
returns false.
*/
/*!
\fn QPointer<T> qPointerFromVariant(const QVariant &variant)
\internal
Returns a guarded pointer that points to the same object that
\a variant holds.
*/

View File

@ -695,7 +695,7 @@ static QString find_translation(const QLocale & locale,
\li File name with ui language part stripped further, etc.
\endlist
For example, an application running in the locale with the following
For example, an application running in the \a locale with the following
\l{QLocale::uiLanguages()}{ui languages} - "es", "fr-CA", "de" might call
load(QLocale::system(), "foo", ".", "/opt/foolib", ".qm"). load() would
replace '-' (dash) with '_' (underscore) in the ui language and then try to

View File

@ -181,7 +181,7 @@ static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCrypto
are in use. Each UUID contains a bit field that specifies which
type (variant) of UUID it is. Call variant() to discover which
type of UUID an instance of QUuid contains. It extracts the three
most signifcant bits of byte 8 of the 16 bytes. In QUuid, byte 8
most significant bits of byte 8 of the 16 bytes. In QUuid, byte 8
is \c{QUuid::data4[0]}. If you create instances of QUuid using the
constructor that accepts all the numeric values as parameters, use
the following table to set the three most significant bits of
@ -428,7 +428,17 @@ QUuid::QUuid(const QByteArray &text)
\since 5.0
\fn QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData);
This functions returns a new UUID with variant QUuid::DCE and version QUuid::Md5.
This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5.
\a ns is the namespace and \a baseData is the basic data as described by RFC 4122.
\sa variant(), version(), createUuidV5()
*/
/*!
\since 5.0
\fn QUuid QUuid::createUuidV3(const QUuid &ns, const QString &baseData);
This function returns a new UUID with variant QUuid::DCE and version QUuid::Md5.
\a ns is the namespace and \a baseData is the basic data as described by RFC 4122.
\sa variant(), version(), createUuidV5()
@ -438,7 +448,17 @@ QUuid::QUuid(const QByteArray &text)
\since 5.0
\fn QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData);
This functions returns a new UUID with variant QUuid::DCE and version QUuid::Sha1.
This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1.
\a ns is the namespace and \a baseData is the basic data as described by RFC 4122.
\sa variant(), version(), createUuidV3()
*/
/*!
\since 5.0
\fn QUuid QUuid::createUuidV5(const QUuid &ns, const QString &baseData);
This function returns a new UUID with variant QUuid::DCE and version QUuid::Sha1.
\a ns is the namespace and \a baseData is the basic data as described by RFC 4122.
\sa variant(), version(), createUuidV3()
@ -990,6 +1010,10 @@ QUuid QUuid::createUuid()
*/
#ifndef QT_NO_DEBUG_STREAM
/*!
\relates QUuid
Writes the UUID \a id to the output stream for debugging information \a dbg.
*/
QDebug operator<<(QDebug dbg, const QUuid &id)
{
#ifndef QT_NO_QUUID_STRING

View File

@ -176,7 +176,10 @@ public:
int addResults(int index, const QVector<T> *results, int totalCount)
{
return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), totalCount);
if (m_filterMode == true && results->count() != totalCount && 0 == results->count())
return ResultStoreBase::addResults(index, 0, 0, totalCount);
else
return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), totalCount);
}
int addCanceledResult(int index)

View File

@ -209,12 +209,12 @@ struct QTypedArrayData
T *data() { return static_cast<T *>(QArrayData::data()); }
const T *data() const { return static_cast<const T *>(QArrayData::data()); }
iterator begin() { return data(); }
iterator end() { return data() + size; }
const_iterator begin() const { return data(); }
const_iterator end() const { return data() + size; }
const_iterator constBegin() const { return data(); }
const_iterator constEnd() const { return data() + size; }
iterator begin(iterator = iterator()) { return data(); }
iterator end(iterator = iterator()) { return data() + size; }
const_iterator begin(const_iterator = const_iterator()) const { return data(); }
const_iterator end(const_iterator = const_iterator()) const { return data() + size; }
const_iterator constBegin(const_iterator = const_iterator()) const { return data(); }
const_iterator constEnd(const_iterator = const_iterator()) const { return data() + size; }
class AlignmentDummy { QArrayData header; T data; };

View File

@ -121,7 +121,7 @@ QT_BEGIN_NAMESPACE
isDigit() (decimal digits). All of these are wrappers around
category() which return the Unicode-defined category of each
character. Some of these also calculate the derived properties
(i.e. isSpace() returns true if the character is of category
(for example isSpace() returns true if the character is of category
Separator_* or an exceptional code point from Other_Control category).
QChar also provides direction(), which indicates the "natural"
@ -766,14 +766,14 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4)
\fn bool QChar::isHighSurrogate() const
Returns true if the QChar is the high part of a UTF16 surrogate
(i.e. if its code point is in range [0xd800..0xdbff]); false otherwise.
(for example if its code point is in range [0xd800..0xdbff]); false otherwise.
*/
/*!
\fn bool QChar::isLowSurrogate() const
Returns true if the QChar is the low part of a UTF16 surrogate
(i.e. if its code point is in range [0xdc00..0xdfff]); false otherwise.
(for example if its code point is in range [0xdc00..0xdfff]); false otherwise.
*/
/*!
@ -782,7 +782,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4)
Returns true if the QChar contains a code point that is in either
the high or the low part of the UTF-16 surrogate range
(i.e. if its code point is in range [0xd800..0xdfff]); false otherwise.
(for example if its code point is in range [0xd800..0xdfff]); false otherwise.
*/
/*!
@ -806,7 +806,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4)
Returns true if the UCS-4-encoded character specified by \a ucs4
is the high part of a UTF16 surrogate
(i.e. if its code point is in range [0xd800..0xdbff]); false otherwise.
(for example if its code point is in range [0xd800..0xdbff]); false otherwise.
*/
/*!
@ -815,7 +815,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4)
Returns true if the UCS-4-encoded character specified by \a ucs4
is the low part of a UTF16 surrogate
(i.e. if its code point is in range [0xdc00..0xdfff]); false otherwise.
(for example if its code point is in range [0xdc00..0xdfff]); false otherwise.
*/
/*!
@ -825,7 +825,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4)
Returns true if the UCS-4-encoded character specified by \a ucs4
contains a code point that is in either the high or the low part of the
UTF-16 surrogate range (i.e. if its code point is in range [0xd800..0xdfff]);
UTF-16 surrogate range (for example if its code point is in range [0xd800..0xdfff]);
false otherwise.
*/
@ -834,7 +834,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4)
Returns true if the UCS-4-encoded character specified by \a ucs4
can be split into the high and low parts of a UTF16 surrogate
(i.e. if its code point is greater than or equals to 0x10000);
(for example if its code point is greater than or equals to 0x10000);
false otherwise.
*/
@ -969,30 +969,62 @@ bool QChar::hasMirrored(uint ucs4)
/*!
\fn bool QChar::isLower() const
Returns true if the character is a lowercase letter, i.e.
Returns true if the character is a lowercase letter, for example
category() is Letter_Lowercase.
\sa isUpper(), toLower(), toUpper()
*/
/*!
\fn static bool QChar::isLower(uint ucs4)
\overload
\since 5.0
Returns true if the UCS-4-encoded character specified by \a ucs4
is a lowercase letter, for example category() is Letter_Lowercase.
\sa isUpper(), toLower(), toUpper()
*/
/*!
\fn bool QChar::isUpper() const
Returns true if the character is an uppercase letter, i.e.
Returns true if the character is an uppercase letter, for example
category() is Letter_Uppercase.
\sa isLower(), toUpper(), toLower()
*/
/*!
\fn static bool QChar::isUpper(uint ucs4)
\overload
\since 5.0
Returns true if the UCS-4-encoded character specified by \a ucs4
is an uppercase letter, for example category() is Letter_Uppercase.
\sa isLower(), toUpper(), toLower()
*/
/*!
\fn bool QChar::isTitleCase() const
Returns true if the character is a titlecase letter, i.e.
Returns true if the character is a titlecase letter, for example
category() is Letter_Titlecase.
\sa isLower(), toUpper(), toLower(), toTitleCase()
*/
/*!
\fn static bool QChar::isTitleCase(uint ucs4)
\overload
\since 5.0
Returns true if the UCS-4-encoded character specified by \a ucs4
is a titlecase letter, for example category() is Letter_Titlecase.
\sa isLower(), toUpper(), toLower(), toTitleCase()
*/
/*!
\fn QChar QChar::mirroredChar() const

View File

@ -80,8 +80,15 @@ void QContiguousCacheData::freeData(QContiguousCacheData *data)
of matching how user interface views most commonly request data, as
a set of rows localized around the current scrolled position. This
restriction allows the cache to consume less memory and processor
cycles than QCache. The QContiguousCache class also can provide
an upper bound on memory usage via setCapacity().
cycles than QCache.
QContiguousCache operates on a fixed capacity, set with setCapacity() or
passed as a parameter to the constructor. This capacity is the upper bound
on memory usage by the cache itself, not including the memory allocated by
the elements themselves. Note that a cache with a capacity of zero (the
default) means no items will be stored: the insert(), append() and
prepend() operations will effectively be no-ops. Therefore, it's important
to set the capacity to a reasonable value before adding items to the cache.
The simplest way of using a contiguous cache is to use the append()
and prepend().

View File

@ -341,6 +341,8 @@ void QContiguousCache<T>::freeData(Data *x)
template <typename T>
void QContiguousCache<T>::append(const T &value)
{
if (!d->alloc)
return; // zero capacity
detach();
if (QTypeInfo<T>::isComplex) {
if (d->count == d->alloc)
@ -362,6 +364,8 @@ void QContiguousCache<T>::append(const T &value)
template<typename T>
void QContiguousCache<T>::prepend(const T &value)
{
if (!d->alloc)
return; // zero capacity
detach();
if (d->start)
d->start--;
@ -385,6 +389,8 @@ template<typename T>
void QContiguousCache<T>::insert(int pos, const T &value)
{
Q_ASSERT_X(pos >= 0 && pos < INT_MAX, "QContiguousCache<T>::insert", "index out of range");
if (!d->alloc)
return; // zero capacity
detach();
if (containsIndex(pos)) {
if (QTypeInfo<T>::isComplex) {

View File

@ -847,6 +847,7 @@ QString QDate::toString(const QString& format) const
If \a y is in the range 0 to 99, it is interpreted as 1900 to
1999.
Returns \c false if the date is invalid.
Use setDate() instead.
*/

View File

@ -2345,7 +2345,9 @@ static const char *pcreCompileErrorCodes[] =
QT_TRANSLATE_NOOP("QRegularExpression", "\\N is not supported in a class"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many forward references"),
QT_TRANSLATE_NOOP("QRegularExpression", "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid UTF-16 string")
QT_TRANSLATE_NOOP("QRegularExpression", "invalid UTF-16 string"),
QT_TRANSLATE_NOOP("QRegularExpression", "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"),
QT_TRANSLATE_NOOP("QRegularExpression", "character value in \\u.... sequence is too large")
};
#endif // #if 0

View File

@ -151,6 +151,7 @@ public:
// STL-style
typedef typename Data::iterator iterator;
typedef typename Data::const_iterator const_iterator;
#if !defined(QT_STRICT_ITERATORS) || defined(Q_QDOC)
inline iterator begin() { detach(); return d->begin(); }
inline const_iterator begin() const { return d->constBegin(); }
inline const_iterator cbegin() const { return d->constBegin(); }
@ -159,6 +160,16 @@ public:
inline const_iterator end() const { return d->constEnd(); }
inline const_iterator cend() const { return d->constEnd(); }
inline const_iterator constEnd() const { return d->constEnd(); }
#else
inline iterator begin(iterator = iterator()) { detach(); return d->begin(); }
inline const_iterator begin(const_iterator = const_iterator()) const { return d->constBegin(); }
inline const_iterator cbegin(const_iterator = const_iterator()) const { return d->constBegin(); }
inline const_iterator constBegin(const_iterator = const_iterator()) const { return d->constBegin(); }
inline iterator end(iterator = iterator()) { detach(); return d->end(); }
inline const_iterator end(const_iterator = const_iterator()) const { return d->constEnd(); }
inline const_iterator cend(const_iterator = const_iterator()) const { return d->constEnd(); }
inline const_iterator constEnd(const_iterator = const_iterator()) const { return d->constEnd(); }
#endif
iterator insert(iterator before, int n, const T &x);
inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); }
iterator erase(iterator begin, iterator end);

View File

@ -297,10 +297,6 @@ DEFINEFUNC(void , dbus_message_unref, (DBusMessage *message),
(message), )
/* dbus-misc.h */
DEFINEFUNC(void , dbus_get_version , (int *major_version_p,
int *minor_version_p,
int *micro_version_p),
(major_version_p, minor_version_p, micro_version_p), )
DEFINEFUNC(char* , dbus_get_local_machine_id , (void), (), return)
@ -363,14 +359,6 @@ DEFINEFUNC(void , dbus_server_unref, (DBusServer *server),
/* dbus-thread.h */
DEFINEFUNC(dbus_bool_t , dbus_threads_init_default, (), (), return)
/* D-Bus 1.4 symbols */
#if !defined(QT_LINKED_LIBDBUS) || (DBUS_VERSION >= 0x010400)
DEFINEFUNC(dbus_bool_t , dbus_connection_can_send_type , (DBusConnection *connection,
int type),
(connection, type), return)
#endif
QT_END_NAMESPACE
#endif // QT_NO_DBUS

View File

@ -112,7 +112,7 @@ static inline QDebug operator<<(QDebug dbg, const QDBusConnectionPrivate *conn)
return dbg.space();
}
Q_AUTOTEST_EXPORT void qdbusDefaultThreadDebug(int action, int condition, QDBusConnectionPrivate *conn)
void qdbusDefaultThreadDebug(int action, int condition, QDBusConnectionPrivate *conn)
{
qDBusDebug() << QThread::currentThread()
<< "QtDBus threading action" << action
@ -131,7 +131,7 @@ Q_AUTOTEST_EXPORT void qdbusDefaultThreadDebug(int action, int condition, QDBusC
"condition unknown")
<< "in connection" << conn;
}
Q_AUTOTEST_EXPORT qdbusThreadDebugFunc qdbusThreadDebug = 0;
qdbusThreadDebugFunc qdbusThreadDebug = 0;
#endif
typedef void (*QDBusSpyHook)(const QDBusMessage&);
@ -1687,24 +1687,23 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal
static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnection *connection)
{
QDBusConnection::ConnectionCapabilities result = 0;
typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int);
static can_send_type_t can_send_type = 0;
#if defined(QT_LINKED_LIBDBUS) && DBUS_VERSION < 0x010400
// no capabilities are possible
#else
# if !defined(QT_LINKED_LIBDBUS)
// run-time check if the next functions are available
int major, minor, micro;
q_dbus_get_version(&major, &minor, &micro);
if (major == 1 && minor < 4)
return result;
#if defined(QT_LINKED_LIBDBUS)
# if DBUS_VERSION-0 >= 0x010400
can_send_type = dbus_connection_can_send_type;
# endif
#else
// run-time check if the next functions are available
can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type");
#endif
#ifndef DBUS_TYPE_UNIX_FD
# define DBUS_TYPE_UNIX_FD int('h')
#endif
if (q_dbus_connection_can_send_type(connection, DBUS_TYPE_UNIX_FD))
if (can_send_type && can_send_type(connection, DBUS_TYPE_UNIX_FD))
result |= QDBusConnection::UnixFileDescriptorPassing;
#endif
return result;
}

View File

@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
class QModelIndex;
namespace QAccessible2
{
enum BoundaryType {

View File

@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QDrag
\inmodule QtGui
\ingroup draganddrop
\brief The QDrag class provides support for MIME-based drag and drop data
transfer.

View File

@ -43,6 +43,7 @@
#include <QtCore/QVariant>
#include <QtCore/QStringList>
#include <QtCore/qfileinfo.h>
#include <qpalette.h>
#include <qtextformat.h>
@ -164,6 +165,22 @@ const QFont *QPlatformTheme::font(Font type) const
return 0;
}
QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
{
Q_UNUSED(sp);
Q_UNUSED(size);
// TODO Should return QCommonStyle pixmaps?
return QPixmap();
}
QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const
{
Q_UNUSED(fileInfo);
Q_UNUSED(size);
// TODO Should return QCommonStyle pixmaps?
return QPixmap();
}
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
{
return QPlatformTheme::defaultThemeHint(hint);
@ -223,6 +240,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(int(QTextCharFormat::SpellCheckUnderline));
case TabAllWidgets:
return QVariant(true);
case IconPixmapSizes:
return QVariant::fromValue(QList<int>());
}
return QVariant();
}

View File

@ -67,6 +67,9 @@ class QPlatformSystemTrayIcon;
class QVariant;
class QPalette;
class QFont;
class QPixmap;
class QSizeF;
class QFileInfo;
class Q_GUI_EXPORT QPlatformTheme
{
@ -97,7 +100,8 @@ public:
KeyboardScheme,
UiEffects,
SpellCheckUnderlineStyle,
TabAllWidgets
TabAllWidgets,
IconPixmapSizes
};
enum DialogType {
@ -150,6 +154,81 @@ public:
NFonts
};
enum StandardPixmap { // Keep in sync with QStyle::StandardPixmap
TitleBarMenuButton,
TitleBarMinButton,
TitleBarMaxButton,
TitleBarCloseButton,
TitleBarNormalButton,
TitleBarShadeButton,
TitleBarUnshadeButton,
TitleBarContextHelpButton,
DockWidgetCloseButton,
MessageBoxInformation,
MessageBoxWarning,
MessageBoxCritical,
MessageBoxQuestion,
DesktopIcon,
TrashIcon,
ComputerIcon,
DriveFDIcon,
DriveHDIcon,
DriveCDIcon,
DriveDVDIcon,
DriveNetIcon,
DirOpenIcon,
DirClosedIcon,
DirLinkIcon,
DirLinkOpenIcon,
FileIcon,
FileLinkIcon,
ToolBarHorizontalExtensionButton,
ToolBarVerticalExtensionButton,
FileDialogStart,
FileDialogEnd,
FileDialogToParent,
FileDialogNewFolder,
FileDialogDetailedView,
FileDialogInfoView,
FileDialogContentsView,
FileDialogListView,
FileDialogBack,
DirIcon,
DialogOkButton,
DialogCancelButton,
DialogHelpButton,
DialogOpenButton,
DialogSaveButton,
DialogCloseButton,
DialogApplyButton,
DialogResetButton,
DialogDiscardButton,
DialogYesButton,
DialogNoButton,
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight,
ArrowBack,
ArrowForward,
DirHomeIcon,
CommandLink,
VistaShield,
BrowserReload,
BrowserStop,
MediaPlay,
MediaStop,
MediaPause,
MediaSkipForward,
MediaSkipBackward,
MediaSeekForward,
MediaSeekBackward,
MediaVolume,
MediaVolumeMuted,
// do not add any values below/greater than this
CustomBase = 0xf0000000
};
enum KeyboardSchemes
{
WindowsKeyboardScheme,
@ -190,6 +269,9 @@ public:
virtual QVariant themeHint(ThemeHint hint) const;
virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
virtual QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const;
static QVariant defaultThemeHint(ThemeHint hint);
};

View File

@ -213,13 +213,12 @@ QPoint QPlatformWindow::mapFromGlobal(const QPoint &pos) const
/*!
Requests setting the window state of this surface
to \a type. Returns the actual state set.
to \a type.
Qt::WindowActive can be ignored.
*/
Qt::WindowState QPlatformWindow::setWindowState(Qt::WindowState)
void QPlatformWindow::setWindowState(Qt::WindowState)
{
return Qt::WindowNoState;
}
/*!

View File

@ -91,7 +91,7 @@ public:
virtual void setVisible(bool visible);
virtual void setWindowFlags(Qt::WindowFlags flags);
virtual Qt::WindowState setWindowState(Qt::WindowState state);
virtual void setWindowState(Qt::WindowState state);
virtual WId winId() const;
virtual void setParent(const QPlatformWindow *window);

View File

@ -286,6 +286,10 @@ void QWindow::setVisible(bool visible)
QGuiApplicationPrivate::hideModalWindow(this);
}
#ifndef QT_NO_CURSOR
if (visible)
d->applyCursor();
#endif
d->platformWindow->setVisible(visible);
if (!visible) {
@ -824,9 +828,8 @@ void QWindow::setWindowState(Qt::WindowState state)
Q_D(QWindow);
if (d->platformWindow)
d->windowState = d->platformWindow->setWindowState(state);
else
d->windowState = state;
d->platformWindow->setWindowState(state);
d->windowState = state;
}
/*!
@ -1853,11 +1856,10 @@ QCursor QWindow::cursor() const
void QWindow::setCursor(const QCursor &cursor)
{
Q_D(QWindow);
if (QPlatformCursor *platformCursor = d->screen->handle()->cursor()) {
d->cursor = cursor;
QCursor *oc = QGuiApplication::overrideCursor();
QCursor c = oc ? *oc : d->cursor;
platformCursor->changeCursor(&c, this);
d->cursor = cursor;
// Only attempt to set cursor and emit signal if there is an actual platform cursor
if (d->screen->handle()->cursor()) {
d->applyCursor();
QEvent event(QEvent::CursorChange);
QGuiApplication::sendEvent(this, &event);
}
@ -1868,19 +1870,20 @@ void QWindow::setCursor(const QCursor &cursor)
*/
void QWindow::unsetCursor()
{
Q_D(QWindow);
if (QPlatformCursor *platformCursor = d->screen->handle()->cursor()) {
d->cursor = Qt::ArrowCursor;
QCursor *oc = QGuiApplication::overrideCursor();
if (!oc) {
QCursor c = d->cursor;
platformCursor->changeCursor(&c, this);
}
QEvent event(QEvent::CursorChange);
QGuiApplication::sendEvent(this, &event);
}
setCursor(Qt::ArrowCursor);
}
void QWindowPrivate::applyCursor()
{
Q_Q(QWindow);
if (platformWindow) {
if (QPlatformCursor *platformCursor = screen->handle()->cursor()) {
QCursor *oc = QGuiApplication::overrideCursor();
QCursor c = oc ? *oc : cursor;
platformCursor->changeCursor(&c, q);
}
}
}
#endif
QT_END_NAMESPACE

View File

@ -97,6 +97,9 @@ public:
}
void maybeQuitOnLastWindowClosed();
#ifndef QT_NO_CURSOR
void applyCursor();
#endif
QPoint globalPosition() const {
Q_Q(const QWindow);

View File

@ -414,7 +414,7 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
if (clipLine(rx1, ry1, rx2, ry2))
return;
const int half = 31;
const int half = legacyRounding ? 31 : 0;
int x1 = toF26Dot6(rx1) + half;
int y1 = toF26Dot6(ry1) + half;
int x2 = toF26Dot6(rx2) + half;
@ -707,7 +707,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
if (stroker->clipLine(rx1, ry1, rx2, ry2))
return;
static const int half = 31;
const int half = stroker->legacyRounding ? 31 : 0;
int x1 = toF26Dot6(rx1) + half;
int y1 = toF26Dot6(ry1) + half;
int x2 = toF26Dot6(rx2) + half;

View File

@ -93,11 +93,16 @@ public:
patternSize(0),
patternLength(0),
patternOffset(0),
legacyRounding(false),
current_span(0),
lastDir(LeftToRight),
lastAxisAligned(false)
{ setup(); }
~QCosmeticStroker() { free(pattern); free(reversePattern); }
void setLegacyRoundingEnabled(bool legacyRoundingEnabled) { legacyRounding = legacyRoundingEnabled; }
void drawLine(const QPointF &p1, const QPointF &p2);
void drawPath(const QVectorPath &path);
void drawPoints(const QPoint *points, int num);
@ -119,6 +124,8 @@ public:
int patternLength;
int patternOffset;
bool legacyRounding;
enum { NSPANS = 255 };
QT_FT_Span spans[NSPANS];
int current_span;

View File

@ -1467,6 +1467,8 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
painter->setRenderHint(QPainter::SmoothPixmapTransform, nh & QPainter::SmoothPixmapTransform);
if (xored & QPainter::NonCosmeticDefaultPen)
painter->setRenderHint(QPainter::NonCosmeticDefaultPen, nh & QPainter::NonCosmeticDefaultPen);
if (xored & QPainter::Qt4CompatiblePainting)
painter->setRenderHint(QPainter::Qt4CompatiblePainting, nh & QPainter::Qt4CompatiblePainting);
break; }
case QPaintBufferPrivate::Cmd_SetOpacity: {

View File

@ -644,6 +644,7 @@ QRasterPaintEngineState::QRasterPaintEngineState()
flags.fast_pen = true;
flags.antialiased = false;
flags.bilinear = false;
flags.legacy_rounding = false;
flags.fast_text = true;
flags.int_xform = true;
flags.tx_noshear = true;
@ -927,6 +928,7 @@ void QRasterPaintEngine::renderHintsChanged()
s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing);
s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform);
s->flags.legacy_rounding = !bool(s->renderHints & QPainter::Antialiasing) && bool(s->renderHints & QPainter::Qt4CompatiblePainting);
if (was_aa != s->flags.antialiased)
s->strokeFlags |= DirtyHints;
@ -1524,6 +1526,7 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount)
QRectVectorPath path;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]);
stroker.drawPath(path);
@ -1570,6 +1573,7 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount)
QRectVectorPath path;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]);
stroker.drawPath(path);
@ -1603,6 +1607,7 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(path);
} else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) {
qreal width = s->lastPen.isCosmetic()
@ -1658,12 +1663,16 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
QPaintEngineEx::stroke(path, pen);
}
static inline QRect toNormalizedFillRect(const QRectF &rect)
QRect QRasterPaintEngine::toNormalizedFillRect(const QRectF &rect)
{
int x1 = qRound(rect.x() + aliasedCoordinateDelta);
int y1 = qRound(rect.y() + aliasedCoordinateDelta);
int x2 = qRound(rect.right() + aliasedCoordinateDelta);
int y2 = qRound(rect.bottom() + aliasedCoordinateDelta);
QRasterPaintEngineState *s = state();
qreal delta = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0);
int x1 = qRound(rect.x() + delta);
int y1 = qRound(rect.y() + delta);
int x2 = qRound(rect.right() + delta);
int y2 = qRound(rect.bottom() + delta);
if (x2 < x1)
qSwap(x1, x2);
@ -1941,6 +1950,7 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly
QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode));
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp);
} else {
QPaintEngineEx::stroke(vp, s->lastPen);
@ -2005,6 +2015,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp);
} else {
QPaintEngineEx::stroke(vp, s->lastPen);
@ -2233,7 +2244,9 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
// as fillRect will apply the aliased coordinate delta we need to
// subtract it here as we don't use it for image drawing
QTransform old = s->matrix;
s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta);
if (s->flags.legacy_rounding)
s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta);
// Do whatever fillRect() does, but without premultiplying the color if it's already premultiplied.
QRgb color = img.pixel(sr_l, sr_t);
@ -2376,8 +2389,9 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
const QPointF offs = s->flags.antialiased ? QPointF() : QPointF(aliasedCoordinateDelta, aliasedCoordinateDelta);
const QPointF offs = s->flags.legacy_rounding ? QPointF(aliasedCoordinateDelta, aliasedCoordinateDelta) : QPointF();
const QRectF &rect = r.normalized();
const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs;
@ -2390,7 +2404,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
return;
}
#endif
const qreal offs = s->flags.antialiased ? qreal(0) : aliasedCoordinateDelta;
const qreal offs = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0);
QPainterPath path;
path.addRect(r);
QTransform m = s->matrix;
@ -2471,6 +2485,7 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
const QRectF &rect = r.normalized();
const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f);
@ -2802,7 +2817,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
rightShift = 3; // divide by 8
int margin = fontEngine->glyphMargin(glyphType);
const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta);
const QFixed offs = s->flags.legacy_rounding ? QFixed::fromReal(aliasedCoordinateDelta) : QFixed();
const uchar *bits = image.bits();
for (int i=0; i<numGlyphs; ++i) {
@ -3078,6 +3093,7 @@ void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount)
}
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount);
}
@ -3097,6 +3113,7 @@ void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount)
}
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount);
}
@ -3117,6 +3134,7 @@ void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount)
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) {
const QLine &l = lines[i];
stroker.drawLine(l.p1(), l.p2());
@ -3188,6 +3206,7 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount)
return;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) {
QLineF line = lines[i];
stroker.drawLine(line.p1(), line.p2());
@ -3420,6 +3439,7 @@ void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data)
QRasterPaintEngineState *s = q->state();
rasterizer->setAntialiased(s->flags.antialiased);
rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
QRect clipRect(deviceRect);
ProcessSpans blend;
@ -3484,6 +3504,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
if (!s->flags.antialiased) {
rasterizer->setAntialiased(s->flags.antialiased);
rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
rasterizer->setClipRect(deviceRect);
rasterizer->initialize(callback, userData);

View File

@ -110,6 +110,7 @@ public:
uint non_complex_pen : 1; // can use rasterizer, rather than stroker
uint antialiased : 1;
uint bilinear : 1;
uint legacy_rounding : 1;
uint fast_text : 1;
uint int_xform : 1;
uint tx_noshear : 1;
@ -246,6 +247,8 @@ private:
bool setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op);
QRect toNormalizedFillRect(const QRectF &rect);
inline void ensureBrush(const QBrush &brush) {
if (!qbrush_fast_equals(state()->lastBrush, brush) || (brush.style() != Qt::NoBrush && state()->fillFlags))
updateBrush(brush);

View File

@ -1421,6 +1421,11 @@ void QPainterPrivate::updateState(QPainterState *newState)
of 0 (which otherwise enables QPen::isCosmetic()) as being a non-cosmetic
pen with a width of 1.
\value Qt4CompatiblePainting Compatibility hint telling the engine to use the
same X11 based fill rules as in Qt 4, where aliased rendering is offset
by slightly less than half a pixel. Potentially useful when porting a
Qt 4 application to Qt 5.
\sa renderHints(), setRenderHint(), {QPainter#Rendering
Quality}{Rendering Quality}, {Concentric Circles Example}

View File

@ -94,7 +94,8 @@ public:
TextAntialiasing = 0x02,
SmoothPixmapTransform = 0x04,
HighQualityAntialiasing = 0x08,
NonCosmeticDefaultPen = 0x10
NonCosmeticDefaultPen = 0x10,
Qt4CompatiblePainting = 0x20
};
Q_DECLARE_FLAGS(RenderHints, RenderHint)

View File

@ -129,7 +129,7 @@ public:
~QScanConverter();
void begin(int top, int bottom, int left, int right,
Qt::FillRule fillRule, QSpanBuffer *spanBuffer);
Qt::FillRule fillRule, bool legacyRounding, QSpanBuffer *spanBuffer);
void end();
void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b,
@ -177,6 +177,7 @@ private:
Q16Dot16 m_rightFP;
int m_fillRuleMask;
bool m_legacyRounding;
int m_x;
int m_y;
@ -196,6 +197,7 @@ class QRasterizerPrivate
{
public:
bool antialiased;
bool legacyRounding;
ProcessSpans blend;
void *data;
QRect clipRect;
@ -219,7 +221,8 @@ QScanConverter::~QScanConverter()
}
void QScanConverter::begin(int top, int bottom, int left, int right,
Qt::FillRule fillRule, QSpanBuffer *spanBuffer)
Qt::FillRule fillRule, bool legacyRounding,
QSpanBuffer *spanBuffer)
{
m_top = top;
m_bottom = bottom;
@ -229,6 +232,7 @@ void QScanConverter::begin(int top, int bottom, int left, int right,
m_lines.reset();
m_fillRuleMask = fillRule == Qt::WindingFill ? ~0x0 : 0x1;
m_legacyRounding = legacyRounding;
m_spanBuffer = spanBuffer;
}
@ -595,16 +599,20 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
winding = -1;
}
a.x += COORD_OFFSET;
a.y += COORD_OFFSET;
b.x += COORD_OFFSET;
b.y += COORD_OFFSET;
if (m_legacyRounding) {
a.x += COORD_OFFSET;
a.y += COORD_OFFSET;
b.x += COORD_OFFSET;
b.y += COORD_OFFSET;
}
int iTop = qMax(m_top, int((a.y + 32 - COORD_ROUNDING) >> 6));
int iBottom = qMin(m_bottom, int((b.y - 32 - COORD_ROUNDING) >> 6));
int rounding = m_legacyRounding ? COORD_ROUNDING : 0;
int iTop = qMax(m_top, int((a.y + 32 - rounding) >> 6));
int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6));
if (iTop <= iBottom) {
Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x << 10) - COORD_ROUNDING;
Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x << 10) - rounding;
if (b.x == a.x) {
Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding };
@ -635,6 +643,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
QRasterizer::QRasterizer()
: d(new QRasterizerPrivate)
{
d->legacyRounding = false;
}
QRasterizer::~QRasterizer()
@ -658,6 +667,11 @@ void QRasterizer::setClipRect(const QRect &clipRect)
d->clipRect = clipRect;
}
void QRasterizer::setLegacyRoundingEnabled(bool legacyRoundingEnabled)
{
d->legacyRounding = legacyRoundingEnabled;
}
static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 leftIntersectX, Q16Dot16 rightIntersectX, Q16Dot16 slope, Q16Dot16 invSlope)
{
Q16Dot16 leftX = IntToQ16Dot16(x);
@ -775,7 +789,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
pb = npb;
}
if (!d->antialiased) {
if (!d->antialiased && d->legacyRounding) {
pa.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
pa.ry() += (COORD_OFFSET - COORD_ROUNDING)/64.;
pb.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
@ -1174,13 +1188,15 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule)
max_y = qMax(p.y, max_y);
}
int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + COORD_OFFSET - COORD_ROUNDING) >> 6));
int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + COORD_OFFSET - COORD_ROUNDING) >> 6));
int rounding = d->legacyRounding ? COORD_OFFSET - COORD_ROUNDING : 0;
int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + rounding) >> 6));
int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + rounding) >> 6));
if (iTopBound > iBottomBound)
return;
d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer);
d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer);
int first = 0;
for (int i = 0; i < outline->n_contours; ++i) {
@ -1210,13 +1226,15 @@ void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule)
QRectF bounds = path.controlPointRect();
int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.));
int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.));
double rounding = d->legacyRounding ? (COORD_OFFSET - COORD_ROUNDING) / 64. : 0.0;
int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + rounding));
int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + rounding));
if (iTopBound > iBottomBound)
return;
d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer);
d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer);
int subpathStart = 0;
QT_FT_Vector last = { 0, 0 };

View File

@ -74,6 +74,7 @@ public:
void setAntialiased(bool antialiased);
void setClipRect(const QRect &clipRect);
void setLegacyRoundingEnabled(bool legacyRoundingEnabled);
void initialize(ProcessSpans blend, void *data);

View File

@ -666,13 +666,13 @@ void QTextOdfWriter::writeFrameFormat(QXmlStreamWriter &writer, QTextFrameFormat
writer.writeAttribute(styleNS, QString::fromLatin1("name"), QString::fromLatin1("s%1").arg(formatIndex));
writer.writeAttribute(styleNS, QString::fromLatin1("family"), QString::fromLatin1("section"));
writer.writeEmptyElement(styleNS, QString::fromLatin1("section-properties"));
if (format.hasProperty(QTextFormat::BlockTopMargin))
if (format.hasProperty(QTextFormat::FrameTopMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-top"), pixelToPoint(qMax(qreal(0.), format.topMargin())) );
if (format.hasProperty(QTextFormat::BlockBottomMargin))
if (format.hasProperty(QTextFormat::FrameBottomMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-bottom"), pixelToPoint(qMax(qreal(0.), format.bottomMargin())) );
if (format.hasProperty(QTextFormat::BlockLeftMargin))
if (format.hasProperty(QTextFormat::FrameLeftMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-left"), pixelToPoint(qMax(qreal(0.), format.leftMargin())) );
if (format.hasProperty(QTextFormat::BlockRightMargin))
if (format.hasProperty(QTextFormat::FrameRightMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-right"), pixelToPoint(qMax(qreal(0.), format.rightMargin())) );
writer.writeEndElement(); // style

View File

@ -86,7 +86,7 @@ public:
depthSize = accumSize = stencilSize = redSize = greenSize = blueSize = alphaSize = -1;
numSamples = -1;
swapInterval = -1;
majorVersion = 1;
majorVersion = 2;
minorVersion = 0;
profile = QGLFormat::NoProfile;
}

View File

@ -149,6 +149,7 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
// layout of the primary display
NSDictionary *d = (NSDictionary *) IODisplayCreateInfoDictionary(iodisplay, kIODisplayOnlyPreferredName);
uint displaySubpixelLayout = [[d objectForKey:@kDisplaySubPixelLayout] unsignedIntValue];
[d release];
font_smoothing = (displaySubpixelLayout == kDisplaySubPixelLayoutUndefined ? 0 : 1);
[pool release];
@ -382,6 +383,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
NSLog(@"Unable to register font: %@", error);
CFRelease(error);
}
CGFontRelease(cgFont);
}
} else {
CFErrorRef error;

View File

@ -501,6 +501,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
}
CGContextRelease(ctx);
CGColorSpaceRelease(colorspace);
return im;
}

View File

@ -42,7 +42,7 @@
#include "application_p.h"
#include <QtWidgets/qapplication.h>
#include <QtCore/qcoreapplication.h>
#include <QtDBus/qdbuspendingreply.h>
#include <qdebug.h>
@ -204,7 +204,7 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerCallback(const QDBusMessage&
delete event.second;
} else {
QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
QApplication::postEvent(event.first, event.second);
QCoreApplication::postEvent(event.first, event.second);
}
}
@ -213,7 +213,7 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerError(const QDBusError& error
qWarning() << QStringLiteral("QSpiApplication::keyEventError ") << error.name() << error.message();
while (!keyEvents.isEmpty()) {
QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
QApplication::postEvent(event.first, event.second);
QCoreApplication::postEvent(event.first, event.second);
}
}

View File

@ -42,10 +42,9 @@
#include "atspiadaptor_p.h"
#include <QtGui/qwindow.h>
#include <QtWidgets/qapplication.h>
#include <QtGui/qguiapplication.h>
#include <qdbusmessage.h>
#include <qdbusreply.h>
#include <QtWidgets/qwidget.h>
#include <qclipboard.h>
#include <qdebug.h>
@ -1405,7 +1404,7 @@ bool AtSpiAdaptor::accessibleInterface(const QAIPointer &interface, const QStrin
}
connection.send(message.createReply(QVariant::fromValue(children)));
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::handleMessage does not implement " << function << message.path();
qAtspiDebug() << "WARNING: AtSpiAdaptor::accessibleInterface does not implement " << function << message.path();
return false;
}
return true;
@ -1519,8 +1518,9 @@ QString AtSpiAdaptor::pathForInterface(const QAIPointer &interface, bool inDestr
QAIPointer interfaceWithObject = interface;
QString path;
if (interface->role() == QAccessible::MenuItem && interface->object() &&
inheritsQAction(interface->object())) {
QAccessible::Role role = interface->role();
if (((role == QAccessible::MenuItem) || (role == QAccessible::Separator)) &&
interface->object() && inheritsQAction(interface->object())) {
interfaceWithObject = QAIPointer(interface->parent());
int childIndex = interfaceWithObject->indexOfChild(interface.data());
path.append(QString::fromLatin1("/%1").arg(childIndex));
@ -1541,7 +1541,7 @@ QString AtSpiAdaptor::pathForInterface(const QAIPointer &interface, bool inDestr
quintptr uintptr = reinterpret_cast<quintptr>(interfaceWithObject->object());
path.prepend(QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(uintptr));
if (!inDestructor && !m_handledObjects.contains(uintptr))
if (!inDestructor && (!m_handledObjects.contains(uintptr) || m_handledObjects.value(uintptr) == 0))
m_handledObjects[uintptr] = QPointer<QObject>(interfaceWithObject->object());
return path;
@ -1673,7 +1673,7 @@ bool AtSpiAdaptor::componentInterface(const QAIPointer &interface, const QString
qAtspiDebug() << "SetSize is not implemented.";
sendReply(connection, message, false);
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::handleMessage does not implement " << function << message.path();
qAtspiDebug() << "WARNING: AtSpiAdaptor::componentInterface does not implement " << function << message.path();
return false;
}
return true;
@ -1727,7 +1727,7 @@ bool AtSpiAdaptor::actionInterface(const QAIPointer &interface, const QString &f
else
sendReply(connection, message, QString());
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::handleMessage does not implement " << function << message.path();
qAtspiDebug() << "WARNING: AtSpiAdaptor::actionInterface does not implement " << function << message.path();
return false;
}
return true;
@ -1884,7 +1884,7 @@ bool AtSpiAdaptor::textInterface(const QAIPointer &interface, const QString &fun
interface->textInterface()->setSelection(selectionNum, startOffset, endOffset);
sendReply(connection, message, true);
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::handleMessage does not implement " << function << message.path();
qAtspiDebug() << "WARNING: AtSpiAdaptor::textInterface does not implement " << function << message.path();
return false;
}
return true;
@ -2080,7 +2080,7 @@ bool AtSpiAdaptor::editableTextInterface(const QAIPointer &interface, const QStr
} else if (function == QLatin1String("")) {
connection.send(message.createReply());
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::handleMessage does not implement " << function << message.path();
qAtspiDebug() << "WARNING: AtSpiAdaptor::editableTextInterface does not implement " << function << message.path();
return false;
}
return true;
@ -2125,7 +2125,7 @@ bool AtSpiAdaptor::valueInterface(const QAIPointer &interface, const QString &fu
connection.send(message.createReply(
QVariant::fromValue(QDBusVariant(QVariant::fromValue(val)))));
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::handleMessage does not implement " << function << message.path();
qAtspiDebug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path();
return false;
}
return true;
@ -2335,7 +2335,7 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
int row = message.arguments().at(0).toInt();
connection.send(message.createReply(interface->tableInterface()->unselectRow(row)));
} else {
qAtspiDebug() << "WARNING: AtSpiAdaptor::handleMessage does not implement " << function << message.path();
qAtspiDebug() << "WARNING: AtSpiAdaptor::tableInterface does not implement " << function << message.path();
return false;
}
return true;

View File

@ -107,80 +107,79 @@ struct RoleMapping {
QAccessible::Role role;
AtspiRole spiRole;
const char *name;
const char *localizedName;
};
static RoleMapping map[] = {
{ QAccessible::NoRole, ATSPI_ROLE_INVALID, "invalid", QT_TR_NOOP("invalid role") },
{ QAccessible::TitleBar, ATSPI_ROLE_TEXT, "text", QT_TR_NOOP("title bar") },
{ QAccessible::MenuBar, ATSPI_ROLE_MENU_BAR, "menu bar", QT_TR_NOOP("menu bar") },
{ QAccessible::ScrollBar, ATSPI_ROLE_SCROLL_BAR, "scroll bar", QT_TR_NOOP("scroll bar") },
{ QAccessible::Grip, ATSPI_ROLE_UNKNOWN, "unknown", QT_TR_NOOP("grip") },
{ QAccessible::Sound, ATSPI_ROLE_UNKNOWN, "unknown", QT_TR_NOOP("sound") },
{ QAccessible::Cursor, ATSPI_ROLE_ARROW, "arrow", QT_TR_NOOP("cursor") },
{ QAccessible::Caret, ATSPI_ROLE_UNKNOWN, "unknown", QT_TR_NOOP("caret") },
{ QAccessible::AlertMessage, ATSPI_ROLE_ALERT, "alert", QT_TR_NOOP("alert message") },
{ QAccessible::Window, ATSPI_ROLE_WINDOW, "window", QT_TR_NOOP("window") },
{ QAccessible::Client, ATSPI_ROLE_FILLER, "filler", QT_TR_NOOP("filler") },
{ QAccessible::PopupMenu, ATSPI_ROLE_POPUP_MENU, "popup menu", QT_TR_NOOP("popup menu") },
{ QAccessible::MenuItem, ATSPI_ROLE_MENU_ITEM, "menu item", QT_TR_NOOP("menu item") },
{ QAccessible::ToolTip, ATSPI_ROLE_TOOL_TIP, "tool tip", QT_TR_NOOP("tool tip") },
{ QAccessible::Application, ATSPI_ROLE_APPLICATION, "application", QT_TR_NOOP("application") },
{ QAccessible::Document, ATSPI_ROLE_DOCUMENT_FRAME, "document frame", QT_TR_NOOP("document") },
{ QAccessible::Pane, ATSPI_ROLE_PANEL, "panel", QT_TR_NOOP("pane") },
{ QAccessible::Chart, ATSPI_ROLE_CHART, "chart", QT_TR_NOOP("chart") },
{ QAccessible::Dialog, ATSPI_ROLE_DIALOG, "dialog", QT_TR_NOOP("dialog") },
{ QAccessible::Border, ATSPI_ROLE_FRAME, "frame", QT_TR_NOOP("border") },
{ QAccessible::Grouping, ATSPI_ROLE_PANEL, "panel", QT_TR_NOOP("grouping") },
{ QAccessible::Separator, ATSPI_ROLE_SEPARATOR, "separator", QT_TR_NOOP("separator") },
{ QAccessible::ToolBar, ATSPI_ROLE_TOOL_BAR, "tool bar", QT_TR_NOOP("tool bar") },
{ QAccessible::StatusBar, ATSPI_ROLE_STATUS_BAR, "statusbar", QT_TR_NOOP("status bar") },
{ QAccessible::Table, ATSPI_ROLE_TABLE, "table", QT_TR_NOOP("table") },
{ QAccessible::ColumnHeader, ATSPI_ROLE_TABLE_COLUMN_HEADER, "column header", QT_TR_NOOP("column header") },
{ QAccessible::RowHeader, ATSPI_ROLE_TABLE_ROW_HEADER, "row header", QT_TR_NOOP("row header") },
{ QAccessible::Column, ATSPI_ROLE_TABLE_CELL, "table cell", QT_TR_NOOP("column") },
{ QAccessible::Row, ATSPI_ROLE_TABLE_CELL, "table cell", QT_TR_NOOP("row") },
{ QAccessible::Cell, ATSPI_ROLE_TABLE_CELL, "table cell", QT_TR_NOOP("cell") },
{ QAccessible::Link, ATSPI_ROLE_LINK, "link", QT_TR_NOOP("link") },
{ QAccessible::HelpBalloon, ATSPI_ROLE_DIALOG, "dialog", QT_TR_NOOP("help balloon") },
{ QAccessible::Assistant, ATSPI_ROLE_DIALOG, "dialog", QT_TR_NOOP("assistant") },
{ QAccessible::List, ATSPI_ROLE_LIST, "list", QT_TR_NOOP("list") },
{ QAccessible::ListItem, ATSPI_ROLE_LIST_ITEM, "list item", QT_TR_NOOP("list item") },
{ QAccessible::Tree, ATSPI_ROLE_TREE, "tree", QT_TR_NOOP("tree") },
{ QAccessible::TreeItem, ATSPI_ROLE_TABLE_CELL, "tree item", QT_TR_NOOP("tree item") },
{ QAccessible::PageTab, ATSPI_ROLE_PAGE_TAB, "page tab", QT_TR_NOOP("page tab") },
{ QAccessible::PropertyPage, ATSPI_ROLE_PAGE_TAB, "page tab", QT_TR_NOOP("property page") },
{ QAccessible::Indicator, ATSPI_ROLE_UNKNOWN, "unknown", QT_TR_NOOP("indicator") },
{ QAccessible::Graphic, ATSPI_ROLE_IMAGE, "image", QT_TR_NOOP("graphic") },
{ QAccessible::StaticText, ATSPI_ROLE_LABEL, "label", QT_TR_NOOP("label") },
{ QAccessible::EditableText, ATSPI_ROLE_TEXT, "text", QT_TR_NOOP("text") },
{ QAccessible::PushButton, ATSPI_ROLE_PUSH_BUTTON, "push button", QT_TR_NOOP("push button") },
{ QAccessible::CheckBox, ATSPI_ROLE_CHECK_BOX, "check box", QT_TR_NOOP("check box") },
{ QAccessible::RadioButton, ATSPI_ROLE_RADIO_BUTTON, "radio button", QT_TR_NOOP("radio box") },
{ QAccessible::ComboBox, ATSPI_ROLE_COMBO_BOX, "combo box", QT_TR_NOOP("combo box") },
{ QAccessible::ProgressBar, ATSPI_ROLE_PROGRESS_BAR, "progress bar", QT_TR_NOOP("progress bar") },
{ QAccessible::Dial, ATSPI_ROLE_DIAL, "accelerator label", QT_TR_NOOP("dial") },
{ QAccessible::HotkeyField, ATSPI_ROLE_TEXT, "text", QT_TR_NOOP("hotkey field") }, //FIXME text?
{ QAccessible::Slider, ATSPI_ROLE_SLIDER, "slider", QT_TR_NOOP("slider") },
{ QAccessible::SpinBox, ATSPI_ROLE_SPIN_BUTTON, "spin button", QT_TR_NOOP("spin box") },
{ QAccessible::Canvas, ATSPI_ROLE_CANVAS, "canvas", QT_TR_NOOP("canvas") },
{ QAccessible::Animation, ATSPI_ROLE_ANIMATION, "animation", QT_TR_NOOP("animation") },
{ QAccessible::Equation, ATSPI_ROLE_TEXT, "text", QT_TR_NOOP("equation") },
{ QAccessible::ButtonDropDown, ATSPI_ROLE_PUSH_BUTTON, "push button", QT_TR_NOOP("button drop down") },
{ QAccessible::ButtonMenu, ATSPI_ROLE_PUSH_BUTTON, "push button", QT_TR_NOOP("button menu") },
{ QAccessible::ButtonDropGrid, ATSPI_ROLE_PUSH_BUTTON, "push button", QT_TR_NOOP("button drop grid") },
{ QAccessible::Whitespace, ATSPI_ROLE_FILLER, "filler", QT_TR_NOOP("whitespace") },
{ QAccessible::PageTabList, ATSPI_ROLE_PAGE_TAB_LIST, "page tab list", QT_TR_NOOP("page tab list") },
{ QAccessible::Clock, ATSPI_ROLE_UNKNOWN, "unknown", QT_TR_NOOP("clock") },
{ QAccessible::Splitter, ATSPI_ROLE_SPLIT_PANE, "split pane", QT_TR_NOOP("splitter") },
{ QAccessible::LayeredPane, ATSPI_ROLE_LAYERED_PANE, "layered pane", QT_TR_NOOP("layered pane") },
{ QAccessible::UserRole, ATSPI_ROLE_UNKNOWN, "unknown", QT_TR_NOOP("user role") }
{ QAccessible::NoRole, ATSPI_ROLE_INVALID, QT_TR_NOOP("invalid role") },
{ QAccessible::TitleBar, ATSPI_ROLE_TEXT, QT_TR_NOOP("title bar") },
{ QAccessible::MenuBar, ATSPI_ROLE_MENU_BAR, QT_TR_NOOP("menu bar") },
{ QAccessible::ScrollBar, ATSPI_ROLE_SCROLL_BAR, QT_TR_NOOP("scroll bar") },
{ QAccessible::Grip, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("grip") },
{ QAccessible::Sound, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("sound") },
{ QAccessible::Cursor, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("cursor") },
{ QAccessible::Caret, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("cursor") },
{ QAccessible::AlertMessage, ATSPI_ROLE_ALERT, QT_TR_NOOP("alert message") },
{ QAccessible::Window, ATSPI_ROLE_WINDOW, QT_TR_NOOP("window") },
{ QAccessible::Client, ATSPI_ROLE_FILLER, QT_TR_NOOP("filler") },
{ QAccessible::PopupMenu, ATSPI_ROLE_POPUP_MENU, QT_TR_NOOP("popup menu") },
{ QAccessible::MenuItem, ATSPI_ROLE_MENU_ITEM, QT_TR_NOOP("menu item") },
{ QAccessible::ToolTip, ATSPI_ROLE_TOOL_TIP, QT_TR_NOOP("tool tip") },
{ QAccessible::Application, ATSPI_ROLE_APPLICATION, QT_TR_NOOP("application") },
{ QAccessible::Document, ATSPI_ROLE_DOCUMENT_FRAME, QT_TR_NOOP("document") },
{ QAccessible::Pane, ATSPI_ROLE_PANEL, QT_TR_NOOP("panel") },
{ QAccessible::Chart, ATSPI_ROLE_CHART, QT_TR_NOOP("chart") },
{ QAccessible::Dialog, ATSPI_ROLE_DIALOG, QT_TR_NOOP("dialog") },
{ QAccessible::Border, ATSPI_ROLE_FRAME, QT_TR_NOOP("frame") },
{ QAccessible::Grouping, ATSPI_ROLE_PANEL, QT_TR_NOOP("panel") },
{ QAccessible::Separator, ATSPI_ROLE_SEPARATOR, QT_TR_NOOP("separator") },
{ QAccessible::ToolBar, ATSPI_ROLE_TOOL_BAR, QT_TR_NOOP("tool bar") },
{ QAccessible::StatusBar, ATSPI_ROLE_STATUS_BAR, QT_TR_NOOP("status bar") },
{ QAccessible::Table, ATSPI_ROLE_TABLE, QT_TR_NOOP("table") },
{ QAccessible::ColumnHeader, ATSPI_ROLE_TABLE_COLUMN_HEADER, QT_TR_NOOP("column header") },
{ QAccessible::RowHeader, ATSPI_ROLE_TABLE_ROW_HEADER, QT_TR_NOOP("row header") },
{ QAccessible::Column, ATSPI_ROLE_TABLE_CELL, QT_TR_NOOP("column") },
{ QAccessible::Row, ATSPI_ROLE_TABLE_ROW, QT_TR_NOOP("row") },
{ QAccessible::Cell, ATSPI_ROLE_TABLE_CELL, QT_TR_NOOP("cell") },
{ QAccessible::Link, ATSPI_ROLE_LINK, QT_TR_NOOP("link") },
{ QAccessible::HelpBalloon, ATSPI_ROLE_DIALOG, QT_TR_NOOP("help balloon") },
{ QAccessible::Assistant, ATSPI_ROLE_DIALOG, QT_TR_NOOP("assistant") },
{ QAccessible::List, ATSPI_ROLE_LIST, QT_TR_NOOP("list") },
{ QAccessible::ListItem, ATSPI_ROLE_LIST_ITEM, QT_TR_NOOP("list item") },
{ QAccessible::Tree, ATSPI_ROLE_TREE, QT_TR_NOOP("tree") },
{ QAccessible::TreeItem, ATSPI_ROLE_TABLE_CELL, QT_TR_NOOP("tree item") },
{ QAccessible::PageTab, ATSPI_ROLE_PAGE_TAB, QT_TR_NOOP("page tab") },
{ QAccessible::PropertyPage, ATSPI_ROLE_PAGE_TAB, QT_TR_NOOP("property page") },
{ QAccessible::Indicator, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("indicator") },
{ QAccessible::Graphic, ATSPI_ROLE_IMAGE, QT_TR_NOOP("graphic") },
{ QAccessible::StaticText, ATSPI_ROLE_LABEL, QT_TR_NOOP("label") },
{ QAccessible::EditableText, ATSPI_ROLE_TEXT, QT_TR_NOOP("text") },
{ QAccessible::PushButton, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("push button") },
{ QAccessible::CheckBox, ATSPI_ROLE_CHECK_BOX, QT_TR_NOOP("check box") },
{ QAccessible::RadioButton, ATSPI_ROLE_RADIO_BUTTON, QT_TR_NOOP("radio button") },
{ QAccessible::ComboBox, ATSPI_ROLE_COMBO_BOX, QT_TR_NOOP("combo box") },
{ QAccessible::ProgressBar, ATSPI_ROLE_PROGRESS_BAR, QT_TR_NOOP("progress bar") },
{ QAccessible::Dial, ATSPI_ROLE_DIAL, QT_TR_NOOP("dial") },
{ QAccessible::HotkeyField, ATSPI_ROLE_TEXT, QT_TR_NOOP("hotkey field") },
{ QAccessible::Slider, ATSPI_ROLE_SLIDER, QT_TR_NOOP("slider") },
{ QAccessible::SpinBox, ATSPI_ROLE_SPIN_BUTTON, QT_TR_NOOP("spin box") },
{ QAccessible::Canvas, ATSPI_ROLE_CANVAS, QT_TR_NOOP("canvas") },
{ QAccessible::Animation, ATSPI_ROLE_ANIMATION, QT_TR_NOOP("animation") },
{ QAccessible::Equation, ATSPI_ROLE_TEXT, QT_TR_NOOP("equation") },
{ QAccessible::ButtonDropDown, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("button drop down") },
{ QAccessible::ButtonMenu, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("button menu") },
{ QAccessible::ButtonDropGrid, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("button drop grid") },
{ QAccessible::Whitespace, ATSPI_ROLE_FILLER, QT_TR_NOOP("whitespace") },
{ QAccessible::PageTabList, ATSPI_ROLE_PAGE_TAB_LIST, QT_TR_NOOP("page tab list") },
{ QAccessible::Clock, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("clock") },
{ QAccessible::Splitter, ATSPI_ROLE_SPLIT_PANE, QT_TR_NOOP("splitter") },
{ QAccessible::LayeredPane, ATSPI_ROLE_LAYERED_PANE, QT_TR_NOOP("layered pane") },
{ QAccessible::UserRole, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("unknown") }
};
void QSpiAccessibleBridge::initializeConstantMappings()
{
for (uint i = 0; i < sizeof(map) / sizeof(RoleMapping); ++i)
qSpiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1String(map[i].name), tr(map[i].localizedName)));
qSpiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1String(map[i].name), tr(map[i].name)));
}
QT_END_NAMESPACE

View File

@ -75,7 +75,7 @@ QAbstractItemView *QAccessibleTable::view() const
int QAccessibleTable::logicalIndex(const QModelIndex &index) const
{
if (!index.isValid())
if (!view()->model() || !index.isValid())
return -1;
int vHeader = verticalHeader() ? 1 : 0;
int hHeader = horizontalHeader() ? 1 : 0;
@ -85,7 +85,7 @@ int QAccessibleTable::logicalIndex(const QModelIndex &index) const
QAccessibleInterface *QAccessibleTable::childFromLogical(int logicalIndex) const
{
if (!isValid())
if (!view()->model())
return 0;
logicalIndex--; // one based counting ftw
@ -179,6 +179,8 @@ QAccessibleTableCell *QAccessibleTable::cell(const QModelIndex &index) const
QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const
{
if (!view()->model())
return 0;
Q_ASSERT(role() != QAccessible::Tree);
QModelIndex index = view()->model()->index(row, column, view()->rootIndex());
if (!index.isValid()) {
@ -195,42 +197,58 @@ QAccessibleInterface *QAccessibleTable::caption() const
QString QAccessibleTable::columnDescription(int column) const
{
if (!view()->model())
return QString();
return view()->model()->headerData(column, Qt::Horizontal).toString();
}
int QAccessibleTable::columnCount() const
{
if (!view()->model())
return 0;
return view()->model()->columnCount();
}
int QAccessibleTable::rowCount() const
{
if (!view()->model())
return 0;
return view()->model()->rowCount();
}
int QAccessibleTable::selectedCellCount() const
{
if (!view()->selectionModel())
return 0;
return view()->selectionModel()->selectedIndexes().count();
}
int QAccessibleTable::selectedColumnCount() const
{
if (!view()->selectionModel())
return 0;
return view()->selectionModel()->selectedColumns().count();
}
int QAccessibleTable::selectedRowCount() const
{
if (!view()->selectionModel())
return 0;
return view()->selectionModel()->selectedRows().count();
}
QString QAccessibleTable::rowDescription(int row) const
{
if (!view()->model())
return QString();
return view()->model()->headerData(row, Qt::Vertical).toString();
}
QList<QAccessibleInterface *> QAccessibleTable::selectedCells() const
{
QList<QAccessibleInterface*> cells;
if (!view()->selectionModel())
return cells;
Q_FOREACH (const QModelIndex &index, view()->selectionModel()->selectedIndexes()) {
cells.append(cell(index));
}
@ -239,6 +257,8 @@ QList<QAccessibleInterface *> QAccessibleTable::selectedCells() const
QList<int> QAccessibleTable::selectedColumns() const
{
if (!view()->selectionModel())
return QList<int>();
QList<int> columns;
Q_FOREACH (const QModelIndex &index, view()->selectionModel()->selectedColumns()) {
columns.append(index.column());
@ -248,6 +268,8 @@ QList<int> QAccessibleTable::selectedColumns() const
QList<int> QAccessibleTable::selectedRows() const
{
if (!view()->selectionModel())
return QList<int>();
QList<int> rows;
Q_FOREACH (const QModelIndex &index, view()->selectionModel()->selectedRows()) {
rows.append(index.row());
@ -262,16 +284,22 @@ QAccessibleInterface *QAccessibleTable::summary() const
bool QAccessibleTable::isColumnSelected(int column) const
{
if (!view()->selectionModel())
return false;
return view()->selectionModel()->isColumnSelected(column, QModelIndex());
}
bool QAccessibleTable::isRowSelected(int row) const
{
if (!view()->selectionModel())
return false;
return view()->selectionModel()->isRowSelected(row, QModelIndex());
}
bool QAccessibleTable::selectRow(int row)
{
if (!view()->model() || !view()->selectionModel())
return false;
QModelIndex index = view()->model()->index(row, 0, view()->rootIndex());
if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection)
return false;
@ -281,6 +309,8 @@ bool QAccessibleTable::selectRow(int row)
bool QAccessibleTable::selectColumn(int column)
{
if (!view()->model() || !view()->selectionModel())
return false;
QModelIndex index = view()->model()->index(0, column, view()->rootIndex());
if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection)
return false;
@ -290,6 +320,8 @@ bool QAccessibleTable::selectColumn(int column)
bool QAccessibleTable::unselectRow(int row)
{
if (!view()->model() || !view()->selectionModel())
return false;
QModelIndex index = view()->model()->index(row, 0, view()->rootIndex());
if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection)
return false;
@ -299,6 +331,8 @@ bool QAccessibleTable::unselectRow(int row)
bool QAccessibleTable::unselectColumn(int column)
{
if (!view()->model() || !view()->selectionModel())
return false;
QModelIndex index = view()->model()->index(0, column, view()->rootIndex());
if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection)
return false;
@ -340,6 +374,8 @@ int QAccessibleTable::childCount() const
int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
{
if (!view()->model())
return -1;
Q_ASSERT(iface->role() != QAccessible::TreeItem); // should be handled by tree class
if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
@ -403,7 +439,7 @@ void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
{
if (!isValid())
if (!isValid() || !view()->model())
return QModelIndex();
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
@ -421,6 +457,8 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
QAccessibleInterface *QAccessibleTree::childAt(int x, int y) const
{
if (!view()->model())
return 0;
QPoint viewportOffset = view()->viewport()->mapTo(view(), QPoint(0,0));
QPoint indexPosition = view()->mapFromGlobal(QPoint(x, y) - viewportOffset);
@ -451,7 +489,8 @@ int QAccessibleTree::childCount() const
QAccessibleInterface *QAccessibleTree::child(int index) const
{
Q_ASSERT(index >= 0);
if ((index < 0) || (!view()->model()))
return 0;
int hHeader = horizontalHeader() ? 1 : 0;
if (hHeader) {
@ -480,6 +519,8 @@ int QAccessibleTree::rowCount() const
int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
{
if (!view()->model())
return -1;
if (iface->role() == QAccessible::TreeItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
@ -520,12 +561,16 @@ QString QAccessibleTree::rowDescription(int) const
bool QAccessibleTree::isRowSelected(int row) const
{
if (!view()->selectionModel())
return false;
QModelIndex index = indexFromLogical(row);
return view()->selectionModel()->isRowSelected(index.row(), index.parent());
}
bool QAccessibleTree::selectRow(int row)
{
if (!view()->selectionModel())
return false;
QModelIndex index = indexFromLogical(row);
if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection)
return false;

View File

@ -119,7 +119,11 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
m_drag = o;
m_executed_drop_action = Qt::IgnoreAction;
NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(m_drag->pixmap()));
QPixmap pm = m_drag->pixmap();
if (pm.isNull())
pm = defaultPixmap();
NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pm));
QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND);
m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));

View File

@ -73,9 +73,12 @@ NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
NSSize qt_mac_toNSSize(const QSize &qtSize);
NSRect qt_mac_toNSRect(const QRect &rect);
QRect qt_mac_toQRect(const NSRect &rect);
QColor qt_mac_toQColor(const NSColor *color);
// Creates a mutable shape, it's the caller's responsibility to release.
HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region);

View File

@ -135,7 +135,10 @@ NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
NSImage *qt_mac_create_nsimage(const QPixmap &pm)
{
QImage image = pm.toImage();
return qt_mac_cgimage_to_nsimage(qt_mac_image_to_cgimage(image));
CGImageRef cgImage = qt_mac_image_to_cgimage(image);
NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
CGImageRelease(cgImage);
return nsImage;
}
HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region)
@ -159,6 +162,16 @@ NSSize qt_mac_toNSSize(const QSize &qtSize)
return NSMakeSize(qtSize.width(), qtSize.height());
}
NSRect qt_mac_toNSRect(const QRect &rect)
{
return NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
}
QRect qt_mac_toQRect(const NSRect &rect)
{
return QRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
}
QColor qt_mac_toQColor(const NSColor *color)
{
QColor qtColor;

View File

@ -218,10 +218,9 @@ void QCocoaMenu::syncMenuItem(QPlatformMenuItem *menuItem)
NSMenuItem *oldItem = [m_nativeMenu itemWithTag:(NSInteger) cocoaItem];
if (cocoaItem->sync() != oldItem) {
// native item was changed for some reason
if (!wasMerged) {
// native item was changed for some reason
if (!wasMerged && oldItem)
[m_nativeMenu removeItem:oldItem];
}
QCocoaMenuItem* beforeItem = itemOrNull(m_menuItems.indexOf(cocoaItem) + 1);
insertNative(cocoaItem, beforeItem);

View File

@ -67,6 +67,8 @@ public:
const QPalette *palette(Palette type = SystemPalette) const;
const QFont *font(Font type = SystemFont) const;
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const;
QVariant themeHint(ThemeHint hint) const;

View File

@ -54,7 +54,9 @@
#include "qcocoamenu.h"
#include "qcocoamenubar.h"
#include <QtCore/qfileinfo.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpainter.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
@ -135,6 +137,143 @@ const QFont *QCocoaTheme::font(Font type) const
return m_fonts.value(type, 0);
}
// Defined in qpaintengine_mac.mm
extern CGContextRef qt_mac_cg_context(const QPaintDevice *pdev);
//! \internal
QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
{
QPixmap ret(width, height);
ret.fill(QColor(0, 0, 0, 0));
CGRect rect = CGRectMake(0, 0, width, height);
CGContextRef ctx = qt_mac_cg_context(&ret);
CGAffineTransform old_xform = CGContextGetCTM(ctx);
CGContextConcatCTM(ctx, CGAffineTransformInvert(old_xform));
CGContextConcatCTM(ctx, CGAffineTransformIdentity);
::RGBColor b;
b.blue = b.green = b.red = 255*255;
PlotIconRefInContext(ctx, &rect, kAlignNone, kTransformNone, &b, kPlotIconRefNormalFlags, icon);
CGContextRelease(ctx);
return ret;
}
QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
{
OSType iconType = 0;
switch (sp) {
case MessageBoxQuestion:
iconType = kQuestionMarkIcon;
break;
case MessageBoxInformation:
iconType = kAlertNoteIcon;
break;
case MessageBoxWarning:
iconType = kAlertCautionIcon;
break;
case MessageBoxCritical:
iconType = kAlertStopIcon;
break;
case DesktopIcon:
iconType = kDesktopIcon;
break;
case TrashIcon:
iconType = kTrashIcon;
break;
case ComputerIcon:
iconType = kComputerIcon;
break;
case DriveFDIcon:
iconType = kGenericFloppyIcon;
break;
case DriveHDIcon:
iconType = kGenericHardDiskIcon;
break;
case DriveCDIcon:
case DriveDVDIcon:
iconType = kGenericCDROMIcon;
break;
case DriveNetIcon:
iconType = kGenericNetworkIcon;
break;
case DirOpenIcon:
iconType = kOpenFolderIcon;
break;
case DirClosedIcon:
case DirLinkIcon:
iconType = kGenericFolderIcon;
break;
case FileLinkIcon:
case FileIcon:
iconType = kGenericDocumentIcon;
break;
default:
break;
}
if (iconType != 0) {
QPixmap pixmap;
IconRef icon;
IconRef overlayIcon = 0;
if (iconType != kGenericApplicationIcon) {
GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
} else {
FSRef fsRef;
ProcessSerialNumber psn = { 0, kCurrentProcess };
GetProcessBundleLocation(&psn, &fsRef);
GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
if (sp == MessageBoxCritical) {
overlayIcon = icon;
GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
}
}
if (icon) {
pixmap = qt_mac_convert_iconref(icon, size.width(), size.height());
ReleaseIconRef(icon);
}
if (overlayIcon) {
QSizeF littleSize = size / 2;
QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize.width(), littleSize.height());
QPainter painter(&pixmap);
painter.drawPixmap(littleSize.width(), littleSize.height(), overlayPix);
ReleaseIconRef(overlayIcon);
}
return pixmap;
}
return QPlatformTheme::standardPixmap(sp, size);
}
QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const
{
FSRef macRef;
OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fileInfo.canonicalFilePath().toUtf8().constData()),
&macRef, 0);
if (status != noErr)
return QPixmap();
FSCatalogInfo info;
HFSUniStr255 macName;
status = FSGetCatalogInfo(&macRef, kIconServicesCatalogInfoMask, &info, &macName, 0, 0);
if (status != noErr)
return QPixmap();
IconRef iconRef;
SInt16 iconLabel;
status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode,
kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag,
&iconRef, &iconLabel);
if (status != noErr)
return QPixmap();
QPixmap pixmap = qt_mac_convert_iconref(iconRef, size.width(), size.height());
ReleaseIconRef(iconRef);
return pixmap;
}
QVariant QCocoaTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
@ -146,6 +285,11 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
return QVariant(int(MacKeyboardScheme));
case TabAllWidgets:
return QVariant(bool([[NSApplication sharedApplication] isFullKeyboardAccessEnabled]));
case IconPixmapSizes: {
QList<int> sizes;
sizes << 16 << 32 << 64 << 128;
return QVariant::fromValue(sizes);
}
default:
break;
}

View File

@ -99,9 +99,10 @@ public:
void setCocoaGeometry(const QRect &rect);
void setVisible(bool visible);
void setWindowFlags(Qt::WindowFlags flags);
Qt::WindowState setWindowState(Qt::WindowState state);
void setWindowState(Qt::WindowState state);
void setWindowTitle(const QString &title);
void setWindowFilePath(const QString &filePath);
void setWindowIcon(const QIcon &icon);
void raise();
void lower();
void propagateSizeHints();

View File

@ -400,12 +400,10 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
m_windowFlags = flags;
}
Qt::WindowState QCocoaWindow::setWindowState(Qt::WindowState state)
void QCocoaWindow::setWindowState(Qt::WindowState state)
{
if ([m_nsWindow isVisible])
syncWindowState(state); // Window state set for hidden windows take effect when show() is called.
return state;
}
void QCocoaWindow::setWindowTitle(const QString &title)
@ -429,6 +427,26 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath)
[m_nsWindow setRepresentedFilename: fi.exists() ? QCFString::toNSString(filePath) : @""];
}
void QCocoaWindow::setWindowIcon(const QIcon &icon)
{
QCocoaAutoReleasePool pool;
NSButton *iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
if (iconButton == nil) {
NSString *title = QCFString::toNSString(window()->windowTitle());
[m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]];
iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
}
if (icon.isNull()) {
[iconButton setImage:nil];
} else {
QPixmap pixmap = icon.pixmap(QSize(22, 22));
NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
[iconButton setImage:image];
[image release];
}
}
void QCocoaWindow::raise()
{
//qDebug() << "raise" << this;
@ -695,6 +713,7 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
void QCocoaWindow::clearNSWindow(NSWindow *window)
{
[window setContentView:nil];
[window setDelegate:nil];
[window clearPlatformWindow];
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView];

View File

@ -89,6 +89,14 @@ static QTouchDevice *touchDevice = 0;
return self;
}
- (void)dealloc
{
CGImageRelease(m_cgImage);
m_cgImage = 0;
m_window = 0;
[super dealloc];
}
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow
{
self = [self init];
@ -129,22 +137,29 @@ static QTouchDevice *touchDevice = 0;
- (void)updateGeometry
{
NSRect rect = [self frame];
NSRect windowRect = [[self window] frame];
QRect geo(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
QRect geometry;
if (m_platformWindow->m_nsWindow) {
// top level window, get window rect and flip y.
NSRect rect = [self frame];
NSRect windowRect = [[self window] frame];
geometry = QRect(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
} else {
// child window, use the frame rect
geometry = qt_mac_toQRect([self frame]);
}
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
qDebug() << "QNSView::udpateGeometry" << geo;
qDebug() << "QNSView::udpateGeometry" << m_platformWindow << geometry;
#endif
// Call setGeometry on QPlatformWindow. (not on QCocoaWindow,
// doing that will initiate a geometry change it and possibly create
// an infinite loop when this notification is triggered again.)
m_platformWindow->QPlatformWindow::setGeometry(geo);
m_platformWindow->QPlatformWindow::setGeometry(geometry);
// Send a geometry change event to Qt, if it's ready to handle events
if (!m_platformWindow->m_inConstructor) {
QWindowSystemInterface::handleGeometryChange(m_window, geo);
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
QWindowSystemInterface::flushWindowSystemEvents();
}
}
@ -343,11 +358,15 @@ static QTouchDevice *touchDevice = 0;
}
NSWindow *window = [self window];
int windowHeight = [window frame].size.height;
NSPoint windowPoint = [theEvent locationInWindow];
int windowScreenY = [window frame].origin.y + [window frame].size.height;
int viewScreenY = [window convertBaseToScreen:[self convertPoint:[self frame].origin toView:nil]].y;
int titleBarHeight = windowScreenY - viewScreenY;
NSPoint nsViewPoint = [self convertPoint: windowPoint fromView: nil];
QPoint qtWindowPoint = QPoint(nsViewPoint.x, windowHeight - nsViewPoint.y);
NSPoint screenPoint = [window convertBaseToScreen : windowPoint];
QPoint qtWindowPoint = QPoint(nsViewPoint.x, titleBarHeight + nsViewPoint.y);
NSPoint screenPoint = [window convertBaseToScreen:windowPoint];
QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
ulong timestamp = [theEvent timestamp] * 1000;

View File

@ -117,10 +117,9 @@ void QEglFSWindow::setGeometry(const QRect &)
QPlatformWindow::setGeometry(rect);
}
Qt::WindowState QEglFSWindow::setWindowState(Qt::WindowState)
void QEglFSWindow::setWindowState(Qt::WindowState)
{
setGeometry(QRect());
return Qt::WindowFullScreen;
}
WId QEglFSWindow::winId() const

View File

@ -56,7 +56,7 @@ public:
~QEglFSWindow();
void setGeometry(const QRect &);
Qt::WindowState setWindowState(Qt::WindowState state);
void setWindowState(Qt::WindowState state);
WId winId() const;
EGLSurface surface() const { return m_surface; }

View File

@ -48,11 +48,13 @@ QT_BEGIN_NAMESPACE
QHash<QPlatformTheme::Font, QFont *> qt_qnx_createRoleFonts(QPlatformFontDatabase *fontDatabase)
{
// See http://docs.blackberry.com/en/developers/deliverables/27299/Text_tablet_1526156_11.jsp
// which recommends using normal font size of 21 pixels and 36 pixels for titles (not covered
// by the theme system).
// See http://docs.blackberry.com/en/developers/deliverables/41577/typography.jsp
// which recommends using
// - small font size of 6 points
// - normal font size of 8 points
// - 11 points for titles (not covered by the theme system).
QFont baseFont = fontDatabase->defaultFont();
baseFont.setPixelSize(21);
baseFont.setPointSize(8);
QHash<QPlatformTheme::Font, QFont *> fonts;
fonts.insert(QPlatformTheme::SystemFont, new QFont(baseFont));
@ -70,7 +72,7 @@ QHash<QPlatformTheme::Font, QFont *> qt_qnx_createRoleFonts(QPlatformFontDatabas
fonts.insert(QPlatformTheme::ComboLineEditFont, new QFont(baseFont));
QFont smallFont(baseFont);
smallFont.setPixelSize(15);
smallFont.setPointSize(6);
fonts.insert(QPlatformTheme::SmallFont, new QFont(smallFont));
fonts.insert(QPlatformTheme::MiniFont, new QFont(smallFont));

View File

@ -580,13 +580,13 @@ void QQnxWindow::requestActivateWindow()
}
Qt::WindowState QQnxWindow::setWindowState(Qt::WindowState state)
void QQnxWindow::setWindowState(Qt::WindowState state)
{
qWindowDebug() << Q_FUNC_INFO << "state =" << state;
// Prevent two calls with Qt::WindowFullScreen from changing m_unmaximizedGeometry
if (m_windowState == state)
return state;
return;
switch (state) {
@ -594,7 +594,7 @@ Qt::WindowState QQnxWindow::setWindowState(Qt::WindowState state)
// WindowActive is not an accepted parameter according to the docs
case Qt::WindowMinimized:
case Qt::WindowActive:
return m_windowState;
return;
case Qt::WindowMaximized:
case Qt::WindowFullScreen:
@ -609,7 +609,6 @@ Qt::WindowState QQnxWindow::setWindowState(Qt::WindowState state)
}
m_windowState = state;
return state;
}
void QQnxWindow::gainedFocus()

View File

@ -101,7 +101,7 @@ public:
void raise();
void lower();
void requestActivateWindow();
Qt::WindowState setWindowState(Qt::WindowState state);
void setWindowState(Qt::WindowState state);
void gainedFocus();

View File

@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
\section1 Tips
\list
\li The environment variable \c QT_LIGHTHOUSE_WINDOWS_VERBOSE controls
\li The environment variable \c QT_QPA_VERBOSE controls
the debug level. It takes the form
\c{<keyword1>:<level1>,<keyword2>:<level2>}, where
keyword is one of \c integration, \c windows, \c backingstore and
@ -112,9 +112,8 @@ public:
QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
if (system.compare(system, QStringLiteral("windows"), Qt::CaseInsensitive) == 0)
return new QWindowsIntegration;
return new QWindowsIntegration(paramList);
return 0;
}

View File

@ -83,6 +83,21 @@
#define CHILDID_SELF 0
#define WM_GETOBJECT 0x003D
#ifndef SHGFI_ADDOVERLAYS // Shell structures for icons.
typedef struct _SHSTOCKICONINFO
{
DWORD cbSize;
HICON hIcon;
int iSysImageIndex;
int iIcon;
WCHAR szPath[MAX_PATH];
} SHSTOCKICONINFO;
# define SIID_SHIELD 77
# define SHGFI_ADDOVERLAYS 0x20
# define SHGFI_OVERLAYINDEX 0x40
#endif // SIID_SHIELD
#if !defined(__MINGW64_VERSION_MAJOR)
#define STATE_SYSTEM_HASPOPUP 0x40000000

View File

@ -210,7 +210,9 @@ bool QWindowsUser32DLL::initTouch()
\ingroup qt-lighthouse-win
*/
QWindowsShell32DLL::QWindowsShell32DLL() : sHCreateItemFromParsingName(0)
QWindowsShell32DLL::QWindowsShell32DLL()
: sHCreateItemFromParsingName(0)
, sHGetStockIconInfo(0)
{
}
@ -218,6 +220,7 @@ void QWindowsShell32DLL::init()
{
QSystemLibrary library(QStringLiteral("shell32"));
sHCreateItemFromParsingName = (SHCreateItemFromParsingName)(library.resolve("SHCreateItemFromParsingName"));
sHGetStockIconInfo = (SHGetStockIconInfo)library.resolve("SHGetStockIconInfo");
}
QWindowsUser32DLL QWindowsContext::user32dll;

View File

@ -49,6 +49,7 @@
#include <QtCore/QSharedPointer>
struct IBindCtx;
struct _SHSTOCKICONINFO;
QT_BEGIN_NAMESPACE
@ -99,8 +100,10 @@ struct QWindowsShell32DLL
inline void init();
typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **);
typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *);
SHCreateItemFromParsingName sHCreateItemFromParsingName;
SHGetStockIconInfo sHGetStockIconInfo;
};
#endif // Q_OS_WINCE
@ -115,7 +118,7 @@ public:
SI_SupportsTouch = 0x2
};
// Verbose flag set by environment variable QT_LIGHTHOUSE_WINDOWS_VERBOSE
// Verbose flag set by environment variable QT_QPA_VERBOSE
static int verboseIntegration;
static int verboseWindows;
static int verboseBackingStore;

View File

@ -42,6 +42,7 @@
#include "qwindowsglcontext.h"
#include "qwindowscontext.h"
#include "qwindowswindow.h"
#include "qwindowsintegration.h"
#include <QtCore/QDebug>
#include <QtCore/QSysInfo>
@ -439,7 +440,7 @@ static int choosePixelFormat(HDC hdc,
iAttributes[i++] = WGL_SAMPLES_ARB;
samplesValuePosition = i;
iAttributes[i++] = format.samples();
} else if (samples == 0 || samples == 1 ) {
} else {
iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB;
iAttributes[i++] = FALSE;
}
@ -855,16 +856,6 @@ QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
return d;
}
// Use ARB unless explicitly turned off on command line.
static inline bool useARB()
{
const QVariant glExtension = qApp->platformNativeInterface()->property("gl");
if (glExtension.type() == QVariant::String
&& !glExtension.toString().compare(QStringLiteral("gdi"), Qt::CaseInsensitive))
return false;
return true;
}
/*!
\class QWindowsGLContext
\brief Open GL context.
@ -914,12 +905,13 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
if (QWindowsContext::verboseGL > 1)
describeFormats(hdc);
// Preferably use direct rendering and ARB extensions (unless pixmap)
// Preferably use direct rendering and ARB extensions (unless pixmap
// or explicitly turned off on command line).
const QWindowsOpenGLAdditionalFormat
requestedAdditional(QWindowsGLDirectRendering);
tryExtensions = m_staticContext->hasExtensions()
&& !testFlag(requestedAdditional.formatFlags, QWindowsGLRenderToPixmap)
&& useARB();
&& !(QWindowsIntegration::instance()->options() & QWindowsIntegration::DisableArb);
QWindowsOpenGLAdditionalFormat obtainedAdditional;
if (tryExtensions) {
m_pixelFormat =

View File

@ -187,6 +187,40 @@ void *QWindowsNativeInterface::createMessageWindow(const QString &classNameTempl
\class QWindowsIntegration
\brief QPlatformIntegration implementation for Windows.
\internal
\section1 Programming Considerations
The platform plugin should run on Desktop Windows from Windows XP onwards
and Windows Embedded.
It should compile with:
\list
\li Microsoft Visual Studio 2008 or later (using the Microsoft Windows SDK,
(\c Q_CC_MSVC).
\li Stock \l{http://mingw.org/}{MinGW} (\c Q_CC_MINGW).
This version ships with headers that are missing a lot of WinAPI.
\li MinGW distributions using GCC 4.7 or higher and a recent MinGW-w64 runtime API,
such as \l{http://tdm-gcc.tdragon.net/}{TDM-GCC}, or
\l{http://mingwbuilds.sourceforge.net/}{MinGW-builds}
(\c Q_CC_MINGW and \c __MINGW64_VERSION_MAJOR indicating the version).
MinGW-w64 provides more complete headers (compared to stock MinGW from mingw.org),
including a considerable part of the Windows SDK.
\li Visual Studio 2008 for Windows Embedded (\c Q_OS_WINCE).
\endlist
The file \c qtwindows_additional.h contains defines and declarations that
are missing in MinGW. When encountering missing declarations, it should
be added there so that \c #ifdefs for MinGW can be avoided. Similarly,
\c qplatformfunctions_wince.h contains defines and declarations for
Windows Embedded.
When using a function from the WinAPI, the minimum supported Windows version
and Windows Embedded support should be checked. If the function is not supported
on Windows XP or is not present in the MinGW-headers, it should be dynamically
resolved. For this purpose, QWindowsContext has static structs like
QWindowsUser32DLL and QWindowsShell32DLL. All function pointers should go to
these structs to avoid lookups in several places.
\ingroup qt-lighthouse-win
*/
@ -198,9 +232,10 @@ struct QWindowsIntegrationPrivate
typedef QSharedPointer<QOpenGLStaticContext> QOpenGLStaticContextPtr;
#endif
QWindowsIntegrationPrivate();
explicit QWindowsIntegrationPrivate(const QStringList &paramList);
~QWindowsIntegrationPrivate();
const unsigned m_options;
QWindowsContext m_context;
QPlatformFontDatabase *m_fontDatabase;
QWindowsNativeInterface m_nativeInterface;
@ -221,8 +256,27 @@ struct QWindowsIntegrationPrivate
QWindowsServices m_services;
};
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate()
: m_fontDatabase(0), m_eventDispatcher(new QWindowsGuiEventDispatcher)
static inline unsigned parseOptions(const QStringList &paramList)
{
unsigned options = 0;
foreach (const QString &param, paramList) {
if (param.startsWith(QLatin1String("fontengine="))) {
if (param.endsWith(QLatin1String("freetype"))) {
options |= QWindowsIntegration::FontDatabaseFreeType;
} else if (param.endsWith(QLatin1String("native"))) {
options |= QWindowsIntegration::FontDatabaseNative;
}
} else if (param == QLatin1String("gl=gdi")) {
options |= QWindowsIntegration::DisableArb;
}
}
return options;
}
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramList)
: m_options(parseOptions(paramList))
, m_fontDatabase(0)
, m_eventDispatcher(new QWindowsGuiEventDispatcher)
{
}
@ -232,8 +286,8 @@ QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
delete m_fontDatabase;
}
QWindowsIntegration::QWindowsIntegration() :
d(new QWindowsIntegrationPrivate)
QWindowsIntegration::QWindowsIntegration(const QStringList &paramList) :
d(new QWindowsIntegrationPrivate(paramList))
{
QGuiApplicationPrivate::instance()->setEventDispatcher(d->m_eventDispatcher);
#ifndef QT_NO_CLIPBOARD
@ -337,25 +391,6 @@ QPlatformOpenGLContext
/* Workaround for QTBUG-24205: In 'Auto', pick the FreeType engine for
* QML2 applications. */
enum FontDatabaseOption {
FontDatabaseFreeType,
FontDatabaseNative,
FontDatabaseAuto
};
static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterface)
{
const QVariant argumentV = nativeInterface.property("fontengine");
if (argumentV.isValid()) {
const QString argument = argumentV.toString();
if (argument == QLatin1String("freetype"))
return FontDatabaseFreeType;
if (argument == QLatin1String("native"))
return FontDatabaseNative;
}
return FontDatabaseAuto;
}
#ifdef Q_OS_WINCE
// It's not easy to detect if we are running a QML application
// Let's try to do so by checking if the QtQuick module is loaded.
@ -377,10 +412,9 @@ QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
#ifdef QT_NO_FREETYPE
d->m_fontDatabase = new QWindowsFontDatabase();
#else // QT_NO_FREETYPE
FontDatabaseOption option = fontDatabaseOption(d->m_nativeInterface);
if (option == FontDatabaseFreeType) {
if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) {
d->m_fontDatabase = new QWindowsFontDatabaseFT;
} else if (option == FontDatabaseNative){
} else if (d->m_options & QWindowsIntegration::FontDatabaseNative){
d->m_fontDatabase = new QWindowsFontDatabase;
} else {
#ifndef Q_OS_WINCE
@ -486,6 +520,11 @@ QWindowsIntegration *QWindowsIntegration::instance()
return static_cast<QWindowsIntegration *>(QGuiApplicationPrivate::platformIntegration());
}
unsigned QWindowsIntegration::options() const
{
return d->m_options;
}
QAbstractEventDispatcher * QWindowsIntegration::guiThreadEventDispatcher() const
{
return d->m_eventDispatcher;

View File

@ -53,7 +53,13 @@ struct QWindowsIntegrationPrivate;
class QWindowsIntegration : public QPlatformIntegration
{
public:
QWindowsIntegration();
enum Options { // Options to be passed on command line.
FontDatabaseFreeType = 0x1,
FontDatabaseNative = 0x2,
DisableArb = 0x4
};
explicit QWindowsIntegration(const QStringList &paramList);
virtual ~QWindowsIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const;
@ -87,6 +93,8 @@ public:
inline void emitScreenAdded(QPlatformScreen *s) { screenAdded(s); }
unsigned options() const;
private:
QScopedPointer<QWindowsIntegrationPrivate> d;
};

View File

@ -68,7 +68,6 @@ QWindowsKeyMapper::QWindowsKeyMapper()
QWindowsKeyMapper::~QWindowsKeyMapper()
{
deleteLayouts();
}
#ifndef LANG_PASHTO
@ -436,6 +435,8 @@ static const Qt::KeyboardModifiers ModsTbl[] = {
Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7
Qt::NoModifier, // Fall-back to raw Key_*
};
static const size_t NumMods = sizeof ModsTbl / sizeof *ModsTbl;
Q_STATIC_ASSERT((NumMods == KeyboardLayoutItem::NumQtKeys));
/**
Remap return or action key to select key for windows mobile.
@ -520,32 +521,10 @@ static inline bool isModifierKey(int code)
// Keyboard map private ----------------------------------------------------------------[ start ]---
/*
\internal
A Windows KeyboardLayoutItem has 8 possible states:
1. Unmodified
2. Shift
3. Control
4. Control + Shift
5. Alt
6. Alt + Shift
7. Alt + Control
8. Alt + Control + Shift
*/
struct KeyboardLayoutItem {
bool dirty;
quint8 deadkeys;
quint32 qtKey[9]; // Can by any Qt::Key_<foo>, or unicode character
};
void QWindowsKeyMapper::deleteLayouts()
{
for (int i = 0; i < 255; ++i) {
if (keyLayout[i]) {
delete keyLayout[i];
keyLayout[i] = 0;
}
}
for (size_t i = 0; i < NumKeyboardLayoutItems; ++i)
keyLayout[i].exists = false;
}
void QWindowsKeyMapper::changeKeyboard()
@ -594,12 +573,9 @@ void QWindowsKeyMapper::updateKeyMap(const MSG &msg)
void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode,
quint32 vk_key)
{
if (!vk_key || (keyLayout[vk_key] && !keyLayout[vk_key]->dirty))
if (!vk_key || (keyLayout[vk_key].exists && !keyLayout[vk_key].dirty))
return;
if (!keyLayout[vk_key])
keyLayout[vk_key] = new KeyboardLayoutItem;
// Copy keyboard state, so we can modify and query output for each possible permutation
unsigned char buffer[256];
memcpy(buffer, kbdBuffer, sizeof(buffer));
@ -615,40 +591,41 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
buffer[VK_LMENU ] = 0; // Use right Alt, since left Ctrl + right Alt is considered AltGraph
bool isDeadKey = false;
keyLayout[vk_key]->deadkeys = 0;
keyLayout[vk_key]->dirty = false;
keyLayout[vk_key].deadkeys = 0;
keyLayout[vk_key].dirty = false;
keyLayout[vk_key].exists = true;
setKbdState(buffer, false, false, false);
keyLayout[vk_key]->qtKey[0] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x01 : 0;
keyLayout[vk_key].qtKey[0] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x01 : 0;
setKbdState(buffer, true, false, false);
keyLayout[vk_key]->qtKey[1] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x02 : 0;
keyLayout[vk_key].qtKey[1] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x02 : 0;
setKbdState(buffer, false, true, false);
keyLayout[vk_key]->qtKey[2] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x04 : 0;
keyLayout[vk_key].qtKey[2] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x04 : 0;
setKbdState(buffer, true, true, false);
keyLayout[vk_key]->qtKey[3] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x08 : 0;
keyLayout[vk_key].qtKey[3] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x08 : 0;
setKbdState(buffer, false, false, true);
keyLayout[vk_key]->qtKey[4] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x10 : 0;
keyLayout[vk_key].qtKey[4] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x10 : 0;
setKbdState(buffer, true, false, true);
keyLayout[vk_key]->qtKey[5] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x20 : 0;
keyLayout[vk_key].qtKey[5] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x20 : 0;
setKbdState(buffer, false, true, true);
keyLayout[vk_key]->qtKey[6] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x40 : 0;
keyLayout[vk_key].qtKey[6] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x40 : 0;
setKbdState(buffer, true, true, true);
keyLayout[vk_key]->qtKey[7] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x80 : 0;
keyLayout[vk_key].qtKey[7] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x80 : 0;
// Add a fall back key for layouts which don't do composition and show non-latin1 characters
int fallbackKey = winceKeyBend(vk_key);
if (!fallbackKey || fallbackKey == Qt::Key_unknown) {
fallbackKey = 0;
if (vk_key != keyLayout[vk_key]->qtKey[0] && vk_key < 0x5B && vk_key > 0x2F)
if (vk_key != keyLayout[vk_key].qtKey[0] && vk_key < 0x5B && vk_key > 0x2F)
fallbackKey = vk_key;
}
keyLayout[vk_key]->qtKey[8] = fallbackKey;
keyLayout[vk_key].qtKey[8] = fallbackKey;
// If this vk_key a Dead Key
if (MapVirtualKey(vk_key, 2) & 0x80000000) {
@ -666,22 +643,22 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
if (QWindowsContext::verboseEvents > 1) {
qDebug("updatePossibleKeyCodes for virtual key = 0x%02x!", vk_key);
for (int i = 0; i < 9; ++i) {
qDebug(" [%d] (%d,0x%02x,'%c') %s", i,
keyLayout[vk_key]->qtKey[i],
keyLayout[vk_key]->qtKey[i],
keyLayout[vk_key]->qtKey[i] ? keyLayout[vk_key]->qtKey[i] : 0x03,
keyLayout[vk_key]->deadkeys & (1<<i) ? "deadkey" : "");
for (size_t i = 0; i < NumMods; ++i) {
qDebug(" [%d] (%d,0x%02x,'%c') %s", int(i),
keyLayout[vk_key].qtKey[i],
keyLayout[vk_key].qtKey[i],
keyLayout[vk_key].qtKey[i] ? keyLayout[vk_key].qtKey[i] : 0x03,
keyLayout[vk_key].deadkeys & (1<<i) ? "deadkey" : "");
}
}
}
bool QWindowsKeyMapper::isADeadKey(unsigned int vk_key, unsigned int modifiers)
{
if (keyLayout && (vk_key < 256) && keyLayout[vk_key]) {
for (register int i = 0; i < 9; ++i) {
if ((vk_key < NumKeyboardLayoutItems) && keyLayout[vk_key].exists) {
for (register size_t i = 0; i < NumMods; ++i) {
if (uint(ModsTbl[i]) == modifiers)
return bool(keyLayout[vk_key]->deadkeys & 1<<i);
return bool(keyLayout[vk_key].deadkeys & 1<<i);
}
}
return false;
@ -1123,11 +1100,11 @@ QList<int> QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const
{
QList<int> result;
KeyboardLayoutItem *kbItem = keyLayout[e->nativeVirtualKey()];
if (!kbItem)
const KeyboardLayoutItem &kbItem = keyLayout[e->nativeVirtualKey()];
if (!kbItem.exists)
return result;
quint32 baseKey = kbItem->qtKey[0];
quint32 baseKey = kbItem.qtKey[0];
Qt::KeyboardModifiers keyMods = e->modifiers();
if (baseKey == Qt::Key_Return && (e->nativeModifiers() & ExtendedKey)) {
result << int(Qt::Key_Enter + keyMods);
@ -1135,9 +1112,9 @@ QList<int> QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const
}
result << int(baseKey + keyMods); // The base key is _always_ valid, of course
for (int i = 1; i < 9; ++i) {
for (int i = 1; i < NumMods; ++i) {
Qt::KeyboardModifiers neededMods = ModsTbl[i];
quint32 key = kbItem->qtKey[i];
quint32 key = kbItem.qtKey[i];
if (key && key != baseKey && ((keyMods & neededMods) == neededMods))
result << int(key + (keyMods & ~neededMods));
}

View File

@ -51,7 +51,25 @@ QT_BEGIN_NAMESPACE
class QKeyEvent;
class QWindow;
struct KeyboardLayoutItem;
/*
\internal
A Windows KeyboardLayoutItem has 8 possible states:
1. Unmodified
2. Shift
3. Control
4. Control + Shift
5. Alt
6. Alt + Shift
7. Alt + Control
8. Alt + Control + Shift
*/
struct KeyboardLayoutItem {
uint dirty : 1;
uint exists : 1; // whether this item has been initialized (by updatePossibleKeyCodes)
quint8 deadkeys;
static const size_t NumQtKeys = 9;
quint32 qtKey[NumQtKeys]; // Can by any Qt::Key_<foo>, or unicode character
};
class QWindowsKeyMapper
{
@ -87,8 +105,9 @@ private:
bool isADeadKey(unsigned int vk_key, unsigned int modifiers);
void deleteLayouts();
KeyboardLayoutItem *keyLayout[256];
QWindow *m_keyGrabber;
static const size_t NumKeyboardLayoutItems = 256;
KeyboardLayoutItem keyLayout[NumKeyboardLayoutItems];
};
enum WindowsNativeModifiers {

View File

@ -55,9 +55,13 @@
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
#include <QtCore/QSysInfo>
#include <QtCore/QCache>
#include <QtGui/QPalette>
#include <QtGui/QGuiApplication>
#include <QtGui/QPainter>
#include <QtGui/QPixmapCache>
#include <qpa/qwindowsysteminterface.h>
#include <private/qsystemlibrary_p.h>
QT_BEGIN_NAMESPACE
@ -348,6 +352,11 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
return QVariant(int(WindowsKeyboardScheme));
case UiEffects:
return QVariant(uiEffects());
case IconPixmapSizes: {
QList<int> sizes;
sizes << 16 << 32;
return QVariant::fromValue(sizes);
}
default:
break;
}
@ -433,4 +442,225 @@ void QWindowsTheme::windowsThemeChanged(QWindow * window)
QWindowSystemInterface::handleThemeChange(window);
}
// Defined in qpixmap_win.cpp
Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
static QPixmap loadIconFromShell32(int resourceId, QSizeF size)
{
#ifdef Q_OS_WINCE
HMODULE hmod = LoadLibrary(L"ceshell");
#else
HMODULE hmod = QSystemLibrary::load(L"shell32");
#endif
if (hmod) {
HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size.width(), size.height(), 0);
if (iconHandle) {
QPixmap iconpixmap = qt_pixmapFromWinHICON(iconHandle);
DestroyIcon(iconHandle);
return iconpixmap;
}
}
return QPixmap();
}
QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
{
int resourceId = -1;
LPCTSTR iconName = 0;
switch (sp) {
case DriveCDIcon:
case DriveDVDIcon:
resourceId = 12;
break;
case DriveNetIcon:
resourceId = 10;
break;
case DriveHDIcon:
resourceId = 9;
break;
case DriveFDIcon:
resourceId = 7;
break;
case FileIcon:
case FileLinkIcon:
resourceId = 1;
break;
case DirIcon:
case DirLinkIcon:
case DirClosedIcon:
resourceId = 4;
break;
case DesktopIcon:
resourceId = 35;
break;
case ComputerIcon:
resourceId = 16;
break;
case DirOpenIcon:
case DirLinkOpenIcon:
resourceId = 5;
break;
case FileDialogNewFolder:
resourceId = 319;
break;
case DirHomeIcon:
resourceId = 235;
break;
case TrashIcon:
resourceId = 191;
break;
case MessageBoxInformation:
iconName = IDI_INFORMATION;
break;
case MessageBoxWarning:
iconName = IDI_WARNING;
break;
case MessageBoxCritical:
iconName = IDI_ERROR;
break;
case MessageBoxQuestion:
iconName = IDI_QUESTION;
break;
case VistaShield:
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
if (!QWindowsContext::shell32dll.sHGetStockIconInfo)
return QPixmap();
QPixmap pixmap;
SHSTOCKICONINFO iconInfo;
memset(&iconInfo, 0, sizeof(iconInfo));
iconInfo.cbSize = sizeof(iconInfo);
const int iconSize = size.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON;
if (QWindowsContext::shell32dll.sHGetStockIconInfo(SIID_SHIELD, SHGFI_ICON | iconSize, &iconInfo) == S_OK) {
pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon);
DestroyIcon(iconInfo.hIcon);
return pixmap;
}
}
break;
default:
break;
}
if (resourceId != -1) {
QPixmap pixmap = loadIconFromShell32(resourceId, size);
if (!pixmap.isNull()) {
if (sp == FileLinkIcon || sp == DirLinkIcon || sp == DirLinkOpenIcon) {
QPainter painter(&pixmap);
QPixmap link = loadIconFromShell32(30, size);
painter.drawPixmap(0, 0, size.width(), size.height(), link);
}
return pixmap;
}
}
if (iconName) {
HICON iconHandle = LoadIcon(NULL, iconName);
QPixmap pixmap = qt_pixmapFromWinHICON(iconHandle);
DestroyIcon(iconHandle);
if (!pixmap.isNull())
return pixmap;
}
return QPlatformTheme::standardPixmap(sp, size);
}
static QString dirIconPixmapCacheKey(int iIcon, int iconSize)
{
QString key = QLatin1String("qt_dir_") + QString::number(iIcon);
if (iconSize == SHGFI_LARGEICON)
key += QLatin1Char('l');
return key;
}
template <typename T>
class FakePointer
{
public:
Q_STATIC_ASSERT_X(sizeof(T) <= sizeof(void *), "FakePointers can only go that far.");
static FakePointer *create(T thing)
{
return reinterpret_cast<FakePointer *>(thing);
}
T operator * () const
{
return T(qintptr(this));
}
void operator delete (void *) {}
};
QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const
{
/* We don't use the variable, but by storing it statically, we
* ensure CoInitialize is only called once. */
static HRESULT comInit = CoInitialize(NULL);
Q_UNUSED(comInit);
static QCache<QString, FakePointer<int> > dirIconEntryCache(1000);
static QMutex mx;
QPixmap pixmap;
const QString filePath = QDir::toNativeSeparators(fileInfo.filePath());
int iconSize = size.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON;
bool cacheableDirIcon = fileInfo.isDir() && !fileInfo.isRoot();
if (cacheableDirIcon) {
QMutexLocker locker(&mx);
int iIcon = **dirIconEntryCache.object(filePath);
if (iIcon) {
QPixmapCache::find(dirIconPixmapCacheKey(iIcon, iconSize), pixmap);
if (pixmap.isNull()) // Let's keep both caches in sync
dirIconEntryCache.remove(filePath);
else
return pixmap;
}
}
SHFILEINFO info;
unsigned int flags =
#ifndef Q_OS_WINCE
SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX;
#else
iconSize|SHGFI_SYSICONINDEX;
#endif // Q_OS_WINCE
unsigned long val = SHGetFileInfo((const wchar_t *)filePath.utf16(), 0,
&info, sizeof(SHFILEINFO), flags);
// Even if GetFileInfo returns a valid result, hIcon can be empty in some cases
if (val && info.hIcon) {
QString key;
if (cacheableDirIcon) {
//using the unique icon index provided by windows save us from duplicate keys
key = dirIconPixmapCacheKey(info.iIcon, iconSize);
QPixmapCache::find(key, pixmap);
if (!pixmap.isNull()) {
QMutexLocker locker(&mx);
dirIconEntryCache.insert(filePath, FakePointer<int>::create(info.iIcon));
}
}
if (pixmap.isNull()) {
pixmap = qt_pixmapFromWinHICON(info.hIcon);
if (!pixmap.isNull()) {
if (cacheableDirIcon) {
QMutexLocker locker(&mx);
QPixmapCache::insert(key, pixmap);
dirIconEntryCache.insert(filePath, FakePointer<int>::create(info.iIcon));
}
} else {
qWarning("QWindowsTheme::fileIconPixmap() no icon found");
}
}
DestroyIcon(info.hIcon);
}
if (!pixmap.isNull())
return pixmap;
return QPlatformTheme::fileIconPixmap(fileInfo, size);
}
QT_END_NAMESPACE

View File

@ -67,6 +67,9 @@ public:
virtual const QFont *font(Font type = SystemFont) const
{ return m_fonts[type]; }
virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
virtual QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const;
void windowsThemeChanged(QWindow *window);
static const char *name;

View File

@ -61,6 +61,8 @@
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
static QByteArray debugWinStyle(DWORD style)
{
QByteArray rc = "0x";
@ -699,13 +701,15 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
m_cursor(QWindowsScreen::screenOf(aWindow)->windowsCursor()->standardWindowCursor()),
m_dropTarget(0),
m_savedStyle(0),
m_format(aWindow->format())
m_format(aWindow->format()),
#ifdef QT_OPENGL_ES_2
, m_eglSurface(0)
m_eglSurface(0),
#endif
#ifdef Q_OS_WINCE
, m_previouslyHidden(false)
m_previouslyHidden(false),
#endif
m_iconSmall(0),
m_iconBig(0)
{
if (aWindow->surfaceType() == QWindow::OpenGLSurface)
setFlag(OpenGLSurface);
@ -730,6 +734,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
QWindowsWindow::~QWindowsWindow()
{
destroyWindow();
destroyIcon();
}
void QWindowsWindow::destroyWindow()
@ -1230,13 +1235,12 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowState state)
QWindowSystemInterface::handleWindowStateChanged(window(), state);
}
Qt::WindowState QWindowsWindow::setWindowState(Qt::WindowState state)
void QWindowsWindow::setWindowState(Qt::WindowState state)
{
if (m_data.hwnd) {
setWindowState_sys(state);
m_windowState = state;
}
return state;
}
bool QWindowsWindow::isFullScreen_sys() const
@ -1754,4 +1758,32 @@ QByteArray QWindowsWindow::debugWindowFlags(Qt::WindowFlags wf)
return rc;
}
static HICON createHIcon(const QIcon &icon, int xSize, int ySize)
{
if (!icon.isNull()) {
const QPixmap pm = icon.pixmap(icon.actualSize(QSize(xSize, ySize)));
if (!pm.isNull())
return qt_pixmapToWinHICON(pm);
}
return 0;
}
void QWindowsWindow::setWindowIcon(const QIcon &icon)
{
if (m_data.hwnd) {
destroyIcon();
m_iconSmall = createHIcon(icon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
m_iconBig = createHIcon(icon, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
if (m_iconBig) {
SendMessage(m_data.hwnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)m_iconSmall);
SendMessage(m_data.hwnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)m_iconBig);
} else {
SendMessage(m_data.hwnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)m_iconSmall);
SendMessage(m_data.hwnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)m_iconSmall);
}
}
}
QT_END_NAMESPACE

View File

@ -160,7 +160,7 @@ public:
virtual QPoint mapFromGlobal(const QPoint &pos) const;
virtual void setWindowFlags(Qt::WindowFlags flags);
virtual Qt::WindowState setWindowState(Qt::WindowState state);
virtual void setWindowState(Qt::WindowState state);
HWND handle() const { return m_data.hwnd; }
@ -238,6 +238,7 @@ public:
void setEnabled(bool enabled);
bool isEnabled() const;
void setWindowIcon(const QIcon &icon);
#ifndef Q_OS_WINCE
void alertWindow(int durationMs = 0);
@ -259,6 +260,7 @@ private:
void unregisterDropSite();
void handleGeometryChange();
void handleWindowStateChange(Qt::WindowState state);
inline void destroyIcon();
mutable WindowData m_data;
mutable unsigned m_flags;
@ -277,6 +279,8 @@ private:
#ifdef Q_OS_WINCE
bool m_previouslyHidden;
#endif
HICON m_iconSmall;
HICON m_iconBig;
};
// Conveniences for window frames.
@ -346,6 +350,18 @@ void QWindowsWindow::setUserDataOf(HWND hwnd, void *ud)
SetWindowLongPtr(hwnd, GWLP_USERDATA, LONG_PTR(ud));
}
inline void QWindowsWindow::destroyIcon()
{
if (m_iconBig) {
DestroyIcon(m_iconBig);
m_iconBig = 0;
}
if (m_iconSmall) {
DestroyIcon(m_iconSmall);
m_iconSmall = 0;
}
}
QT_END_NAMESPACE
#endif // QWINDOWSWINDOW_H

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