diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-28 16:01:01 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-28 16:01:01 (GMT) |
commit | f25f5b41a620b6d46e78eb97e3b2784c646493d0 (patch) | |
tree | 2083c23d547ae703df66441e1cb7c03ed9849374 | |
parent | 9b6edd75d37b25d76349ba7b84677d4c9922cc58 (diff) | |
parent | 31affef31b3743a23cf6f099d6a8f72b371586b4 (diff) | |
download | Qt-f25f5b41a620b6d46e78eb97e3b2784c646493d0.zip Qt-f25f5b41a620b6d46e78eb97e3b2784c646493d0.tar.gz Qt-f25f5b41a620b6d46e78eb97e3b2784c646493d0.tar.bz2 |
Merge branch '4.6'
70 files changed, 1438 insertions, 728 deletions
diff --git a/bin/createpackage.bat b/bin/createpackage.bat index 116d52b..b5ede18 100644 --- a/bin/createpackage.bat +++ b/bin/createpackage.bat @@ -1,106 +1,3 @@ @echo off - -set installsigned_old=%installsigned% -set pkgfile_old=%pkgfile% -set basename_old=%basename% -set signsis1_old=%signsis1% -set signsis2_old=%signsis2% -set signsis3_old=%signsis3% -set unsigned_sis_name_old=%unsigned_sis_name% -set signed_sis_name_old=%signed_sis_name% -set scriptpath_old=%scriptpath% -set certificate_old=%certificate% - -rem Help text -if "%1"=="" ( - echo Convenience script for creating signed packages you can install on your phone. - echo Usage: createpackage.bat [-i] myexample_armv5_udeb.pkg [certificate key [passphrase]] - echo. - echo If no certificate and key files are provided, either a RnD certificate or - echo a self-signed certificate from Qt installation root directory is used. - echo. - echo To install the package right away using PC suite, use -i argument. - goto done -) - -if "%1"=="-i" ( - set installsigned=true - set pkgfile=%2 - set basename=%~n2 - set signsis1=%3 - set signsis2=%4 - set signsis3=%5 -) else ( - set installsigned=false - set pkgfile=%1 - set basename=%~n1 - set signsis1=%2 - set signsis2=%3 - set signsis3=%4 -) - -set unsigned_sis_name=%basename%_unsigned.sis -set signed_sis_name=%basename%.sis - -rem Get absolute path to this script set scriptpath=%~dp0 - -rem Check the .pkg actually exists. -if not exist %pkgfile% ( - echo Error: Package description file '%pkgfile%' does not exist. - goto done -) - -rem Remove any existing .sis packages -if exist %signed_sis_name% del %signed_sis_name% -if exist %unsigned_sis_name% del %unsigned_sis_name% - -rem Create .sis package -makesis %pkgfile% %unsigned_sis_name% - -rem If no certificate is given, check default options -if x%signsis1% == x ( - rem If RnD certificate is not found, sign with self signed certificate - if not exist %scriptpath%..\rd.cer ( - set certificate=Self signed - signsis %unsigned_sis_name% %signed_sis_name% %scriptpath%..\selfsigned.cer %scriptpath%..\selfsigned.key - goto install - ) - - rem Sign with RnD certificate - set certificate=RnD - signsis %unsigned_sis_name% %signed_sis_name% %scriptpath%..\rd.cer %scriptpath%..\rd-key.pem -) else ( - if x%signsis2% == x ( - echo Custom certificate key file parameter missing. - goto cleanup - ) - - set certificate=%signsis1% - signsis %unsigned_sis_name% %signed_sis_name% %signsis1% %signsis2% %signsis3% -) - -:install -if exist %signed_sis_name% ( - echo Successfully created %signed_sis_name% using certificate %certificate% - if "%installsigned%" == "true" ( - echo Installing %signed_sis_name%... - call %signed_sis_name% - ) -) - -:cleanup -if exist %unsigned_sis_name% del %unsigned_sis_name% - -:done - -set installsigned=%installsigned_old% -set pkgfile=%pkgfile_old% -set basename=%basename_old% -set signsis1=%signsis1_old% -set signsis2=%signsis2_old% -set signsis3=%signsis3_old% -set unsigned_sis_name=%unsigned_sis_name_old% -set signed_sis_name=%signed_sis_name_old% -set scriptpath=%scriptpath_old% -set certificate=%certificate_old% +perl %scriptpath%createpackage.pl %*
\ No newline at end of file diff --git a/bin/createpackage.pl b/bin/createpackage.pl new file mode 100644 index 0000000..af46e04 --- /dev/null +++ b/bin/createpackage.pl @@ -0,0 +1,169 @@ +#!\usr\bin\perl +############################################################################################ +# +# Convenience script for creating signed packages you can install on your phone. +# +# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Contact: Qt Software Information (qt-info@nokia.com) +# +############################################################################################ + +use strict; + +# use a command-line parsing module +use Getopt::Long; +# Use file name parsing module +use File::Basename; + +sub Usage() { + print "\n"; + print "==========================================================================================\n"; + print "Convenience script for creating signed packages you can install on your phone.\n"; + print "\n"; + print "Usage: createpackage.pl [-i] templatepkg target-platform [certificate key [passphrase]]\n"; + print "\n"; + print "Where parameters are as follows:\n"; + print " [-i|install] = Install the package right away using PC suite\n"; + print " [-p|preprocess] = Only preprocess the template .pkg file.\n"; + print " templatepkg = Name of .pkg file template\n"; + print " target = Either debug or release\n"; + print " platform = One of the supported platform\n"; + print " winscw | gcce | armv5 | armv6 | armv7\n"; + print " certificate = The certificate file used for signing\n"; + print " key = The certificate's private key file\n"; + print " passphrase = The certificate's private key file's passphrase\n"; + print "\n"; + print "For example:\n"; + print " createpackage.pl fluidlauncher_template.pkg release-armv5\n"; + print "\n"; + print "If no certificate and key files are provided, either a RnD certificate or\n"; + print "a self-signed certificate from Qt installation root directory is used.\n"; + print "\n"; + print "==========================================================================================\n"; + exit(); +} + +# Read given options +my $install = ""; +my $preprocessonly = ""; +unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly)){ + Usage(); +} + +# Read params to variables +my $templatepkg = $ARGV[0]; +my $targetplatform = uc $ARGV[1]; + +my @tmpvalues = split('-', $targetplatform); +my $target = $tmpvalues[0]; +my $platform = $tmpvalues[1];; + +# Convert visual target to real target (debug->udeb and release->urel) +$target =~ s/debug/udeb/i; +$target =~ s/release/urel/i; + +my $certificate = $ARGV[2]; +my $key = $ARGV[3]; +my $passphrase = $ARGV[4]; + +# Generate output pkg basename (i.e. file name without extension) +my $pkgoutputbasename = $templatepkg; +$pkgoutputbasename =~ s/_template\.pkg/_$targetplatform/g; +$pkgoutputbasename = lc($pkgoutputbasename); + +# Store output file names to variables +my $pkgoutput = lc($pkgoutputbasename.".pkg"); +my $unsigned_sis_name = $pkgoutputbasename."_unsigned.sis"; +my $signed_sis_name = $pkgoutputbasename.".sis"; + +# Store some utility variables +my $scriptpath = dirname(__FILE__); +my $certtext = $certificate; +my $certpath = $scriptpath; +$certpath =~ s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash +$certpath = $certpath."../"; # certificates are one step up in hierarcy +$certpath =~ s-/-\\-go; # for those working with UNIX shells + +# Check some pre-conditions and print error messages if needed +unless (length($templatepkg) && length($platform) && length($target)) { + print "\nError: Template PKG filename, platform or target is not defined!\n"; + Usage(); +} + +# Check template exist +stat($templatepkg); +unless( -e _ ) { + print "\nError: Package description file '$templatepkg' does not exist!\n"; + Usage(); +} + +# Check certifcate preconditions and set default certificate variables if needed +if (length($certificate)) { + unless(length($key)) { + print "\nError: Custom certificate key file parameter missing.!\n"; + Usage(); + } +} else { + #If no certificate is given, check default options + $certtext = "RnD"; + $certificate = $certpath."rd.cer"; + $key = $certpath."rd-key.pem"; + + stat($certificate); + unless( -e _ ) { + $certtext = "Self Signed"; + $certificate = $certpath."selfsigned.cer"; + $key = $certpath."selfsigned.key"; + } +} + +# Remove any existing .sis packages +unlink $unsigned_sis_name; +unlink $signed_sis_name; +unlink $pkgoutput; + +# Preprocess PKG +local $/; +# read template file +open( TEMPLATE, $templatepkg) or die "Error '$templatepkg': $!\n"; +$_=<TEMPLATE>; +close (TEMPLATE); + +# replace the PKG variables +s/\$\(PLATFORM\)/$platform/gm; +s/\$\(TARGET\)/$target/gm; + +#write the output +open( OUTPUT, ">$pkgoutput" ) or die "Error '$pkgoutput' $!\n"; +print OUTPUT $_; +close OUTPUT; + +if ($preprocessonly) { + exit; +} + +# Create and sign SIS +system ("makesis $pkgoutput $unsigned_sis_name"); +system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphrase"); + +# Check if creating signed SIS Succeeded +stat($signed_sis_name); +if( -e _ ) { + print ("\nSuccessfully created $signed_sis_name using certificate $certtext!\n"); + + # remove temporary pkg and unsigned sis + unlink $pkgoutput; + unlink $unsigned_sis_name; + + # Install the sis if requested + if ($install) { + print ("\nInstalling $signed_sis_name...\n"); + system ("$signed_sis_name"); + } +} else { + # Lets leave the generated PKG for problem solving purposes + print ("\nSIS creation failed!\n"); +} + + +#end of file diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro index 3eff37b..522ccf3 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.pro +++ b/demos/embedded/fluidlauncher/fluidlauncher.pro @@ -67,15 +67,14 @@ symbian { pathstroke.exe \ wiggly.exe \ ftp.exe \ - context2d.exe \ saxbookmarks.exe \ desktopservices.exe \ fridgemagnets.exe \ drilldown.exe \ softkeys.exe - contains(QT_CONFIG, webkit) { - executables.sources += anomaly.exe - } + + contains(QT_CONFIG, webkit): executables.sources += anomaly.exe + contains(QT_CONFIG, script): executables.sources += context2d.exe executables.path = /sys/bin @@ -86,15 +85,14 @@ symbian { $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/pathstroke_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/wiggly_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/ftp_reg.rsc\ - $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/context2d_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/saxbookmarks_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/desktopservices_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/fridgemagnets_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/drilldown_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/softkeys_reg.rsc - contains(QT_CONFIG, webkit) { - reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/anomaly_reg.rsc - } + + contains(QT_CONFIG, webkit): reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/anomaly_reg.rsc + contains(QT_CONFIG, script): reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/context2d_reg.rsc reg_resource.path = $$REG_RESOURCE_IMPORT_DIR @@ -105,16 +103,14 @@ symbian { $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/pathstroke.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/wiggly.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/ftp.rsc\ - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/saxbookmarks.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/desktopservices.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fridgemagnets.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/drilldown.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/softkeys.rsc - contains(QT_CONFIG, webkit) { - resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc - } - + contains(QT_CONFIG, webkit): resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc + contains(QT_CONFIG, script): resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.rsc + resource.path = $$APP_RESOURCE_DIR mifs.sources = \ diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 9bf774b..ec50060 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -520,7 +520,7 @@ in the \l{Qt for S60 Requirements} document. We've included a subset of the Qt demos in this package for you to try out. An excellent starting point is the "fluidlauncher" demo. To run the demo on a real device, you first have to install - \c{qt_libs.sis} and \c{fluidlauncher.sis} found in the Qt installation + \c{qt_for_s60.sis} and \c{fluidlauncher.sis} found in the Qt installation directory. Begin by connecting your phone using the USB cable and selecting "PC Suite mode". In Windows Explorer right click on the \c{.sis} files and select "Install with Nokia Application Installer" diff --git a/doc/src/snippets/code/doc_src_sql-driver.qdoc b/doc/src/snippets/code/doc_src_sql-driver.qdoc index ab6f5e2..6e2a3fb 100644 --- a/doc/src/snippets/code/doc_src_sql-driver.qdoc +++ b/doc/src/snippets/code/doc_src_sql-driver.qdoc @@ -98,7 +98,7 @@ make //! [7] cd $QTDIR/src/plugins/sqldrivers/oci -qmake "INCLUDEPATH+=/usr/include/oracle/10.1.0.3/client/" "LIBS+=-L/usr/lib/oracle/10.1.0.3/client/lib" oci.pro +qmake "INCLUDEPATH+=/usr/include/oracle/10.1.0.3/client/" "LIBS+=-L/usr/lib/oracle/10.1.0.3/client/lib -lclntsh" oci.pro make //! [7] diff --git a/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc index 08729e8..1b9c509 100644 --- a/doc/src/snippets/code/doc_src_stylesheet.qdoc +++ b/doc/src/snippets/code/doc_src_stylesheet.qdoc @@ -165,7 +165,7 @@ LI {} /* a=0 b=0 c=1 -> specificity = 1 */ UL LI {} /* a=0 b=0 c=2 -> specificity = 2 */ UL OL+LI {} /* a=0 b=0 c=3 -> specificity = 3 */ H1 + *[REL=up]{} /* a=0 b=1 c=1 -> specificity = 11 */ -UL OL LI.red {} /* a=0 b=1 c=3 -> specificity = 13 */ +UL OL LI.red {} /* a=0 b=1 c=3 -> specificity = 13 */ LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */ #x34y {} /* a=1 b=0 c=0 -> specificity = 100 */ //! [20] @@ -260,7 +260,7 @@ QTextEdit { background: yellow } //! [35] -QLabel { +QLabel { background-image: url(dense6pattern.png); background-repeat: repeat-xy; } @@ -596,9 +596,9 @@ QTextEdit { /* radial gradient from white to green */ QTextEdit { - background: qradialgradient(cx:0, cy:0, radius: 1, + background: qradialgradient(cx:0, cy:0, radius: 1, fx:0.5, fy:0.5, stop:0 white, stop:1 green) -} +} //! [85] @@ -871,7 +871,7 @@ QComboBox::down-arrow { QComboBox::down-arrow:on { /* shift the arrow when popup is open */ top: 1px; left: 1px; -} +} //! [109] @@ -1002,8 +1002,8 @@ QGroupBox::indicator:unchecked { //! [116] QHeaderView::section { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #616161, stop: 0.5 #505050, + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, + stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); color: white; padding-left: 4px; @@ -1066,17 +1066,17 @@ QListView::item:selected { } QListView::item:selected:!active { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ABAFE5, stop: 1 #8588B2); } QListView::item:selected:active { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6a6ea9, stop: 1 #888dd9); } QListView::item:hover { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FAFBFE, stop: 1 #DCDEF1); } //! [121] @@ -1098,13 +1098,13 @@ QMainWindow::separator:hover { //! [123] QMenu { background-color: #ABABAB; /* sets background of the menu */ - border: 1px solid black; + border: 1px solid black; } QMenu::item { - /* sets background of menu item. set this to something non-transparent + /* sets background of menu item. set this to something non-transparent if you want menu color and menu item color to be different */ - background-color: transparent; + background-color: transparent; } QMenu::item:selected { /* when user selects item using mouse or keyboard */ @@ -1133,16 +1133,16 @@ QMenu::icon:checked { /* appearance of a 'checked' icon */ background: gray; border: 1px inset gray; position: absolute; - top: 1px; - right: 1px; - bottom: 1px; + top: 1px; + right: 1px; + bottom: 1px; left: 1px; } QMenu::separator { height: 2px; background: lightblue; - margin-left: 10px; + margin-left: 10px; margin-right: 5px; } @@ -1246,13 +1246,13 @@ QProgressBar::chunk { QPushButton { border: 2px solid #8f8f91; border-radius: 6px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f6f7fa, stop: 1 #dadbde); min-width: 80px; } QPushButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); } @@ -1268,18 +1268,18 @@ QPushButton:default { //! [130] QPushButton:open { /* when the button has its menu open */ - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); } -QPushButton::menu-indicator { +QPushButton::menu-indicator { image: url(menu_indicator.png); - subcontrol-origin: padding; + subcontrol-origin: padding; subcontrol-position: bottom right; } QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open { - position: relative; + position: relative; top: 2px; left: 2px; /* shift the arrow by 2 px */ } //! [130] @@ -1615,11 +1615,11 @@ QTabWidget::tab-bar { left: 5px; /* move to the right by 5px */ } -/* Style the tab using the tab sub-control. Note that +/* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ QTabBar::tab { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 2px solid #C4C4C3; border-bottom-color: #C2C7CB; /* same as the pane color */ @@ -1630,8 +1630,8 @@ QTabBar::tab { } QTabBar::tab:selected, QTabBar::tab:hover { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #fafafa, stop: 0.4 #f4f4f4, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #fafafa, stop: 0.4 #f4f4f4, stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); } @@ -1655,11 +1655,11 @@ QTabWidget::tab-bar { left: 5px; /* move to the right by 5px */ } -/* Style the tab using the tab sub-control. Note that +/* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ QTabBar::tab { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 2px solid #C4C4C3; border-bottom-color: #C2C7CB; /* same as the pane color */ @@ -1670,8 +1670,8 @@ QTabBar::tab { } QTabBar::tab:selected, QTabBar::tab:hover { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #fafafa, stop: 0.4 #f4f4f4, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #fafafa, stop: 0.4 #f4f4f4, stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); } @@ -1708,19 +1708,19 @@ QTabBar::tab:only-one { //! [147] QTabWidget::pane { /* The tab widget frame */ border-top: 2px solid #C2C7CB; - position: absolute; - top: -0.5em; + position: absolute; + top: -0.5em; } -QTabWidget::tab-bar { - alignment: center; +QTabWidget::tab-bar { + alignment: center; } -/* Style the tab using the tab sub-control. Note that +/* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ QTabBar::tab { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 2px solid #C4C4C3; border-bottom-color: #C2C7CB; /* same as the pane color */ @@ -1731,8 +1731,8 @@ QTabBar::tab { } QTabBar::tab:selected, QTabBar::tab:hover { - background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #fafafa, stop: 0.4 #f4f4f4, + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #fafafa, stop: 0.4 #f4f4f4, stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); } @@ -1955,3 +1955,14 @@ QTreeView::branch:open:has-children:has-siblings { image: url(branch-open.png); } //! [158] + +//! [159] +QTabBar::close-button { + image: url(close.png) + subcontrol-position: left; +} +QTabBar::close-button:hover { + image: url(close-hover.png) +} + +//! [159] diff --git a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp index 6265c80..152b04f 100644 --- a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp +++ b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp @@ -31,3 +31,13 @@ MyGraphicsEffect::draw(QPainter *painter, QGraphicsEffectSource *source) } //! [1] +//! [2] +... +QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft()); +alphaGradient.setColorAt(0.0, Qt::transparent); +alphaGradient.setColorAt(0.5, Qt::black); +alphaGradient.setColorAt(1.0, Qt::transparent); +QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect; +effect->setOpacityMask(alphaGradient); +... +//! [2] diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index 6a3fcb2..24f3171 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -158,7 +158,7 @@ Qt Style Sheet terminology and syntactic rules are almost identical to those of HTML CSS. If you already know CSS, you can probably skim quickly through this section. - + \tableofcontents \section1 Style Rules @@ -176,8 +176,8 @@ QPushButton and its subclasses (e.g., \c MyPushButton) should use red as their foreground color. - Qt Style Sheet is generally case insensitive (i.e., \c color, - \c Color, \c COLOR, and \c cOloR refer to the same property). + Qt Style Sheet is generally case insensitive (i.e., \c color, + \c Color, \c COLOR, and \c cOloR refer to the same property). The only exceptions are class names, \l{QObject::setObjectName()}{object names}, and Qt property names, which are case sensitive. @@ -233,7 +233,7 @@ for any Qt property specified using Q_PROPERTY(). In addition, the special \c class property is supported, for the name of the class. - + This selector may also be used to test dynamic properties. For more information on customization using dynamic properties, refer to \l{Customizing Using Dynamic Properties}. @@ -287,7 +287,7 @@ Although the double-colon (\c{::}) syntax is reminiscent of CSS3 Pseudo-Elements, Qt Sub-Controls differ conceptually from these and have different cascading semantics. - + Sub-controls are always positioned with respect to another element - a reference element. This reference element could be the widget or another Sub-control. For example, the \l{Qt Style Sheets Reference#drop-down-sub} @@ -304,10 +304,10 @@ property. For example, if we want to place the drop-down in the margin rectangle of the QComboBox instead of the default Padding rectangle, we can specify: - + \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 6 - - The alignment of the drop-down within the Margin rectangle is changed + + The alignment of the drop-down within the Margin rectangle is changed using \l{Qt Style Sheets Reference#subcontrol-position-prop} {subcontrol-position} property. @@ -514,7 +514,7 @@ The QPushButton does not have an explicit color set. Hence, instead of inheriting color of its parent QGroupBox, it has the system color. - If we want to set the color on a QGroupBox and its children, + If we want to set the color on a QGroupBox and its children, we can write: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 25 @@ -523,26 +523,26 @@ QWidget::setPalette() propagates to child widgets. \section1 Widgets inside C++ namespaces - + The Type Selector can be used to style widgets of a particular type. For example, \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 26 Qt Style Sheet uses QObject::className() of the widget to determine - when to apply the Type Selector. When custom widgets are inside namespaces, + when to apply the Type Selector. When custom widgets are inside namespaces, the QObject::className() returns <namespace>::<classname>. This conflicts - with the syntax for \l{Sub-Controls}. To overcome this problem, + with the syntax for \l{Sub-Controls}. To overcome this problem, when using the Type Selector for widgets inside namespaces, we must replace the "::" with "--". For example, \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 27 \section1 Setting QObject properties - - From 4.3 and above, any designable Q_PROPERTY + + From 4.3 and above, any designable Q_PROPERTY can be set using the qproperty-<property name> syntax. - + For example, \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 28 @@ -615,12 +615,12 @@ properties all default to zero. In that case, all four rectangles (\c margin, \c border, \c padding, and \c content) coincide exactly. - You can specify a background for the widget using the - \l{Qt Style Sheets Reference#background-image-prop}{background-image} - property. By default, the background-image is drawn only for the area - inside the border. This can be changed using the + You can specify a background for the widget using the + \l{Qt Style Sheets Reference#background-image-prop}{background-image} + property. By default, the background-image is drawn only for the area + inside the border. This can be changed using the \l{Qt Style Sheets Reference#background-clip-prop}{background-clip} - property. You can use + property. You can use \l{Qt Style Sheets Reference#background-repeat-prop}{background-repeat} and \l{Qt Style Sheets Reference#background-origin-prop}{background-origin} @@ -632,14 +632,14 @@ \l{Qt Style Sheets Reference#border-image-prop}{border-image}. Since the border-image property provides an alternate background, it is not required to specify a background-image when border-image is specified. In the case, - when both of them are specified, the border-image draws over the + when both of them are specified, the border-image draws over the background-image. In addition, the \l{Qt Style Sheets Reference#image-prop}{image} property may be used to draw an image over the border-image. The image specified does not tile or stretch and when its size does not match the size of the widget, its alignment is specified using the - \l{Qt Style Sheets Reference#image-position-prop}{image-position} + \l{Qt Style Sheets Reference#image-position-prop}{image-position} property. Unlike background-image and border-image, one may specify a SVG in the image property, in which case the image is scaled automatically according to the widget size. @@ -672,7 +672,7 @@ {subcontrol-position} and \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin} properties. - + Once positioned, sub-controls can be styled using the \l{box model}. \note With complex widgets such as QComboBox and QScrollBar, if one @@ -710,7 +710,7 @@ All derivatives of QAbstractScrollArea, including QTextEdit, and QAbstractItemView (all item view classes), support - scrollable backgrounds using + scrollable backgrounds using \l{Qt Style Sheets Reference#background-attachment-prop} {background-attachment}. Setting the background-attachment to \c{fixed} provides a background-image that does not scroll with the @@ -737,22 +737,22 @@ \row \o QColumnView \target qcolumnview-widget \o The grip can be styled be using the \l{image-prop}{image} property. - The arrow indicators can by styled using the - \l{left-arrow-sub}{::left-arrow} subcontrol and the + The arrow indicators can by styled using the + \l{left-arrow-sub}{::left-arrow} subcontrol and the \l{right-arrow-sub}{::right-arrow} subcontrol. \row \o QComboBox \target qcombobox-widget - \o The frame around the combobox can be styled using the + \o The frame around the combobox can be styled using the \l{box model}. The drop-down button can be styled using the \l{#drop-down-sub}{::drop-down} subcontrol. By default, the drop-down button is placed in the top right corner of the padding - rectangle of the widget. The arrow mark inside the drop-down button - can be styled using the \l{#down-arrow-sub}{::down-arrow} - subcontrol. By default, the arrow is placed in the center of the + rectangle of the widget. The arrow mark inside the drop-down button + can be styled using the \l{#down-arrow-sub}{::down-arrow} + subcontrol. By default, the arrow is placed in the center of the contents rectangle of the drop-down subcontrol. - See \l{Qt Style Sheets Examples#Customizing QComboBox}{Customizing QComboBox} + See \l{Qt Style Sheets Examples#Customizing QComboBox}{Customizing QComboBox} for an example. \row @@ -784,11 +784,11 @@ The dock widget border can be styled using the \l{#border-prop}{border} property. The \l{#title-sub}{::title} subcontrol can be used to customize the title bar. The close and float buttons are positioned with respect - to the \l{title-sub}{::title} subcontrol using the + to the \l{title-sub}{::title} subcontrol using the \l{#close-button-sub}{::close-button} and \l{#float-button-sub}{::float-button} respectively. - When the title bar is vertical, the \l{#vertical-ps}{:vertical} pseudo + When the title bar is vertical, the \l{#vertical-ps}{:vertical} pseudo class is set. In addition, depending on QDockWidget::DockWidgetFeature, the \l{#closable-ps}{:closable}, \l{#floatable-ps}{:floatable} and \l{#movable-ps}{:movable} pseudo states are set. @@ -822,8 +822,8 @@ depending on QGroupBox::textAlignment. In the case of a checkable QGroupBox, the title includes the - check indicator. The indicator is styled using the - the \l{#indicator-sub}{::indicator} subcontrol. The + check indicator. The indicator is styled using the + the \l{#indicator-sub}{::indicator} subcontrol. The \l{#spacing-prop}{spacing} property can be used to control the spacing between the text and indicator. @@ -835,13 +835,13 @@ \o Supports the \l{box model}. The sections of the header view are styled using the \l{#section-sub}{::section} sub control. The \c{section} Sub-control supports the \l{#middle-ps}{:middle}, - \l{#first-ps}{:first}, \l{#last-ps}{:last}, + \l{#first-ps}{:first}, \l{#last-ps}{:last}, \l{#only-one-ps}{:only-one}, \l{#next-selected-ps}{:next-selected}, - \l{#previous-selected-ps}{:previous-selected}, + \l{#previous-selected-ps}{:previous-selected}, \l{#selected-ps}{:selected} pseudo states. - Sort indicator in can be styled using the - \l{#up-arrow-sub}{::up-arrow} and the + Sort indicator in can be styled using the + \l{#up-arrow-sub}{::up-arrow} and the \l{#down-arrow-sub}{::down-arrow} Sub-control. See \l{Qt Style Sheets Examples#Customizing QHeaderView}{Customizing QHeaderView} @@ -850,7 +850,7 @@ \row \o QLabel \target qlabel-widget \o Supports the \l{box model}. Does not support the - \l{#hover-ps}{:hover} pseudo-state. + \l{#hover-ps}{:hover} pseudo-state. Since 4.3, setting a stylesheet on a QLabel automatically sets the QFrame::frameStyle property to QFrame::StyledPanel. @@ -876,9 +876,9 @@ \row \o QListView \target qlistview-widget - \o Supports the \l{box model}. When - \l{QAbstractItemView::alternatingRowColors}{alternating row colors} - is enabled, the alternating colors can be styled using the + \o Supports the \l{box model}. When + \l{QAbstractItemView::alternatingRowColors}{alternating row colors} + is enabled, the alternating colors can be styled using the \l{#alternate-background-color-prop}{alternate-background-color} property. @@ -915,14 +915,14 @@ \row \o QMenu \target qmenu-widget - \o Supports the \l{box model}. + \o Supports the \l{box model}. - Individual items are styled using the \l{#item-sub}{::item} + Individual items are styled using the \l{#item-sub}{::item} subcontrol. In addition to the usually supported pseudo states, - \c{item} subcontrol supports the + \c{item} subcontrol supports the \l{#selected-ps}{:selected}, \l{#default-ps}{:default}, - \l{#exclusive-ps}{:exclusive} and the - \l{#non-exclusive-ps}{non-exclusive} pseudo states. + \l{#exclusive-ps}{:exclusive} and the + \l{#non-exclusive-ps}{non-exclusive} pseudo states. The indicator of checkable menu items is styled using the \l{#indicator-sub}{::indicator} subcontrol. @@ -931,7 +931,7 @@ subcontrol. For items with a sub menu, the arrow marks are styled using the - \l{::right-arrow-sub}{right-arrow} and + \l{::right-arrow-sub}{right-arrow} and \l{::left-arrow-sub}{left-arrow}. The scroller is styled using the \l{#scroller-sub}{::scroller}. @@ -969,7 +969,7 @@ If the progress bar displays text, use the \l{text-align-prop}{text-align} property to position the text. - Indeterminate progress bars have the + Indeterminate progress bars have the \l{#indeterminate-ps}{:indeterminate} pseudo state set. See \l{Qt Style Sheets Examples#Customizing QProgressBar}{Customizing QProgressBar} @@ -983,7 +983,7 @@ For QPushButton with a menu, the menu indicator is styled using the \l{#menu-indicator-sub}{::menu-indicator} subcontrol. Appearance of checkable push buttons can be - customized using the \l{#open-ps}{:open} and + customized using the \l{#open-ps}{:open} and \l{#closed-ps}{:closed} pseudo-states. \warning If you only set a background-color on a QPushButton, the background @@ -1016,7 +1016,7 @@ is considered to be the groove over which the slider moves. The extent of the QScrollBar (i.e the width or the height depending on the orientation) is set using the \l{#width-prop}{width} or \l{#height-prop}{height} property - respectively. To determine the orientation, use the + respectively. To determine the orientation, use the \l{#horizontal-ps}{:horizontal} and the \l{vertical-ps}{:vertical} pseudo states. @@ -1025,24 +1025,24 @@ provides size contraints for the slider depending on the orientation. The \l{add-line-sub}{::add-line} subcontrol can be used to style the - button to add a line. By default, the add-line subcontrol is placed in + button to add a line. By default, the add-line subcontrol is placed in top right corner of the Border rectangle of the widget. Depending on the - orientation the \l{#right-arrow-sub}{::right-arrow} or - \l{#down-arrow-sub}{::down-arrow}. By default, the arrows are placed in - the center of the Contents rectangle of the add-line subcontrol. + orientation the \l{#right-arrow-sub}{::right-arrow} or + \l{#down-arrow-sub}{::down-arrow}. By default, the arrows are placed in + the center of the Contents rectangle of the add-line subcontrol. The \l{sub-line-sub}{::sub-line} subcontrol can be used to style the - button to subtract a line. By default, the sub-line subcontrol is placed in + button to subtract a line. By default, the sub-line subcontrol is placed in bottom right corner of the Border rectangle of the widget. Depending on the - orientation the \l{#left-arrow-sub}{::left-arrow} or - \l{#up-arrow-sub}{::up-arrow}. By default, the arrows are placed in - the center of the Contents rectangle of the sub-line subcontrol. + orientation the \l{#left-arrow-sub}{::left-arrow} or + \l{#up-arrow-sub}{::up-arrow}. By default, the arrows are placed in + the center of the Contents rectangle of the sub-line subcontrol. The \l{sub-page-sub}{::sub-page} subcontrol can be used to style the region of the slider that subtracts a page. The \l{add-page-sub}{::add-page} subcontrol can be used to style the region of the slider that adds a page. - See \l{Qt Style Sheets Examples#Customizing QScrollBar}{Customizing QScrollBar} + See \l{Qt Style Sheets Examples#Customizing QScrollBar}{Customizing QScrollBar} for an example. \row @@ -1056,15 +1056,15 @@ \row \o QSlider \target qslider-widget - \o Supports the \l{box model}. For horizontal slides, the + \o Supports the \l{box model}. For horizontal slides, the \l{min-width-prop}{min-width} and \l{height-prop}{height} - properties must be provided. For vertical sliders, the + properties must be provided. For vertical sliders, the \l{min-height-prop}{min-height} and \l{width-prop}{width} properties must be provided. - The groove of the slider is styled - using the \l{#groove-sub}{::groove}. The groove is - positioned by default in the Contents rectangle of the widget. + The groove of the slider is styled + using the \l{#groove-sub}{::groove}. The groove is + positioned by default in the Contents rectangle of the widget. The thumb of the slider is styled using \l{#handle-sub}{::handle} subcontrol. The subcontrol moves in the Contents rectangle of the groove subcontrol. @@ -1075,21 +1075,21 @@ \row \o QSpinBox \target qspinbox-widget \o The frame of the spin box can be styled using the \l{box - model}. + model}. - The up button and arrow can be styled using the + The up button and arrow can be styled using the \l{#up-button-sub}{::up-button} and \l{#up-arrow-sub}{::up-arrow} subcontrols. By default, - the up-button is placed in the top right corner in the + the up-button is placed in the top right corner in the Padding rectangle of the widget. Without an explicit size, it occupies half the height of its reference rectangle. The up-arrow is placed in the center of the Contents rectangle of the up-button. - The down button and arrow can be styled using the + The down button and arrow can be styled using the \l{#down-button-sub}{::down-button} and \l{#down-arrow-sub}{::down-arrow} subcontrols. By default, - the down-button is placed in the bottom right corner in the + the down-button is placed in the bottom right corner in the Padding rectangle of the widget. Without an explicit size, it occupies half the height of its reference rectangle. The bottom-arrow is placed in the center of the Contents @@ -1100,7 +1100,7 @@ \row \o QSplitter \target qsplitter-widget - \o Supports the \l{box model}. The handle of the splitter + \o Supports the \l{box model}. The handle of the splitter is styled using the \l{#handle-sub}{::handle} subcontrol. See \l{Qt Style Sheets Examples#Customizing QSplitter}{Customizing QSplitter} @@ -1118,8 +1118,9 @@ \row \o QTabBar \target qtabbar-widget - \o Individual tabs may be styled using the \l{#tab-sub}{::tab} - subcontrol. The tabs support the + \o Individual tabs may be styled using the \l{#tab-sub}{::tab} subcontrol. + Close buttons using the \l{#close-button-sub}{::close-button} + The tabs support the \l{#only-one-ps}{:only-one}, \l{#first-ps}{:first}, \l{#last-ps}{:last}, \l{#middle-ps}{:middle}, \l{#previous-selected-ps}{:previous--selected}, @@ -1133,16 +1134,16 @@ Overlapping tabs for the selected state are created by using negative margins or using the \c{absolute} position scheme. - The tear indicator of the QTabBar is styled using the + The tear indicator of the QTabBar is styled using the \l{#tear-sub}{::tear} subcontrol. QTabBar used two QToolButtons for its scrollers that can be styled using the \c{QTabBar QToolButton} selector. To specify the width - of the scroll button use the \l{#scroller-sub}{::scroller} + of the scroll button use the \l{#scroller-sub}{::scroller} subcontrol. The alignment of the tabs within the QTabBar is styled - using the \l{#Alignment}{alignment} property. \warning + using the \l{#Alignment}{alignment} property. \warning To change the position of the QTabBar within a QTabWidget, use the \l{#tab-bar-sub}{tab-bar} subcontrol (and set subcontrol-position). @@ -1152,14 +1153,14 @@ \row \o QTabWidget \target qtabwidget-widget - \o The frame of the tab widget is styled using the + \o The frame of the tab widget is styled using the \l{#pane-sub}{::pane} subcontrol. The left and right corners are styled using the \l{#left-corner-sub}{::left-corner} and \l{#right-corner-sub}{::right-corner} respectively. The position of the tab bar is controlled using the \l{#tab-bar-sub}{::tab-bar} subcontrol. - By default, the subcontrols have positions of a QTabWidget in + By default, the subcontrols have positions of a QTabWidget in the QWindowsStyle. To place the QTabBar in the center, set the subcontrol-position of the tab-bar subcontrol. @@ -1173,8 +1174,8 @@ \row \o QTableView \target qtableview-widget \o Supports the \l{box model}. When - \l{QAbstractItemView::alternatingRowColors}{alternating row colors} - is enabled, the alternating colors can be styled using the + \l{QAbstractItemView::alternatingRowColors}{alternating row colors} + is enabled, the alternating colors can be styled using the \l{#alternate-background-color-prop}{alternate-background-color} property. @@ -1187,10 +1188,10 @@ and can be styled using the "QTableView QTableCornerButton::section" selector. - \warning If you only set a background-color on a QTableCornerButton, - the background may not appear unless you set the border property to - some value. This is because, by default, the QTableCornerButton draws a - native border which completely overlaps the background-color. + \warning If you only set a background-color on a QTableCornerButton, + the background may not appear unless you set the border property to + some value. This is because, by default, the QTableCornerButton draws a + native border which completely overlaps the background-color. The color of the grid can be specified using the \l{#gridline-color-prop}{gridline-color} property. @@ -1223,7 +1224,7 @@ \row \o QToolBar \target qtoolbar-widget - \o Supports the \l{box model}. + \o Supports the \l{box model}. The \l{#top-ps}{:top}, \l{#left-ps}{:left}, \l{#right-ps}{:right}, \l{#bottom-ps}{:bottom} pseudo states depending on the area in @@ -1231,23 +1232,23 @@ The \l{#first-ps}{:first}, \l{#last-ps}{:last}, \l{#middle-ps}{:middle}, \l{#only-one-ps}{:only-one} pseudo states indicator the position - of the tool bar within a line group (See + of the tool bar within a line group (See QStyleOptionToolBar::positionWithinLine). - The separator of a QToolBar is styled using the + The separator of a QToolBar is styled using the \l{#separator-sub}{::separator} subcontrol. The handle (to move the toolbar) is styled using the \l{#handle-sub}{::handle} subcontrol. - See \l{Qt Style Sheets Examples#Customizing QToolBar}{Customizing QToolBar} + See \l{Qt Style Sheets Examples#Customizing QToolBar}{Customizing QToolBar} for an example. \row \o QToolButton \target qtoolbutton-widget \o Supports the \l{box model}. - If the QToolButton has a menu, is + If the QToolButton has a menu, is \l{#menu-indicator-sub}{::menu-indicator} subcontrol can be used to style the indicator. By default, the menu-indicator is positioned at the bottom right of the Padding rectangle of the widget. @@ -1275,9 +1276,9 @@ \row \o QToolBox \target qtoolbox-widget - \o Supports the \l{box model}. + \o Supports the \l{box model}. - The individual tabs can by styled using the + The individual tabs can by styled using the \l{#tab-sub}{::tab} subcontrol. The tabs support the \l{#only-one-ps}{:only-one}, \l{#first-ps}{:first}, \l{#last-ps}{:last}, \l{#middle-ps}{:middle}, @@ -1295,9 +1296,9 @@ \row \o QTreeView \target qtreeview-widget - \o Supports the \l{box model}. When - \l{QAbstractItemView::alternatingRowColors}{alternating row colors} - is enabled, the alternating colors can be styled using the + \o Supports the \l{box model}. When + \l{QAbstractItemView::alternatingRowColors}{alternating row colors} + is enabled, the alternating colors can be styled using the \l{#alternate-background-color-prop}{alternate-background-color} property. @@ -1309,11 +1310,11 @@ The selection behavior is controlled by the \l{#show-decoration-selected-prop}{show-decoration-selected} property. - The branches of the tree view can be styled using the + The branches of the tree view can be styled using the \l{#branch-sub}{::branch} subcontrol. The ::branch Sub-control supports the \l{open-ps}{:open}, \l{closed-ps}{:closed}, \l{has-siblings-ps}{:has-sibling} and - \l{has-children-ps}{:has-children} pseudo states. + \l{has-children-ps}{:has-children} pseudo states. Use the \l{#item-sub}{::item} subcontrol for more fine grained control over the items in the QTreeView. @@ -1340,7 +1341,7 @@ The above code is a no-operation if there is no stylesheet set. - \warning Make sure you define the Q_OBJECT macro for your custom + \warning Make sure you define the Q_OBJECT macro for your custom widget. \endtable @@ -1398,7 +1399,7 @@ Often, it is required to set a fill pattern similar to the styles in Qt::BrushStyle. You can use the background-color property for Qt::SolidPattern, Qt::RadialGradientPattern, Qt::LinearGradientPattern - and Qt::ConicalGradientPattern. The other patterns are easily achieved + and Qt::ConicalGradientPattern. The other patterns are easily achieved by creating a background image that contains the pattern. Example: @@ -1491,7 +1492,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 41 - See also \l{Qt Style Sheets Reference#background-prop}{background}, + See also \l{Qt Style Sheets Reference#background-prop}{background}, \l{#background-origin-prop}{background-origin} and \l{The Box Model}. \row @@ -1633,7 +1634,7 @@ border-top-right-radius, \c border-bottom-right-radius, and \c border-bottom-left-radius. - The border-radius clips the element's + The border-radius clips the element's \l{Qt Style Sheets Reference#background-prop}{background}. This property is supported by QAbstractItemView @@ -1799,7 +1800,7 @@ \row \o \bold{\c color} \target color-prop - \o \l{#Brush}{Brush} \BR + \o \l{#Brush}{Brush} \BR \o The color used to render text. This property is supported by all widgets that respect @@ -1877,7 +1878,7 @@ \row \o \c font-size \o \l{#Font Size}{Font Size} - \o The font size. In this version of Qt, only pt and px metrics are + \o The font size. In this version of Qt, only pt and px metrics are supported. Example: @@ -1919,9 +1920,9 @@ If this property is not specified, it defaults to a value that depends on the subcontrol/widget and on the current style. - \warning Unless otherwise specified, this property has no effect + \warning Unless otherwise specified, this property has no effect when set on widgets. If you want a widget with a fixed height, set - the \l{#min-width-prop}{min-height} and + the \l{#min-width-prop}{min-height} and \l{#max-width-prop}{max-height} to the same value. Example: @@ -1935,7 +1936,7 @@ \o \l{#Length}{Length} \o The width and height of the icon in a widget. - The icon size of the following widgets can be set using this + The icon size of the following widgets can be set using this property. \list \i QCheckBox @@ -1951,20 +1952,20 @@ \row \o \bold{\c image}* \target image-prop \o \l{#Url}{Url}+ - \o The image that is drawn in the contents rectangle of a - \l{subcontrol}. + \o The image that is drawn in the contents rectangle of a + \l{subcontrol}. - The image property accepts a list of \l{#Url}{Url}s or + The image property accepts a list of \l{#Url}{Url}s or an \c{svg}. The actual image that is drawn is determined using the same algorithm as QIcon (i.e) the image is never scaled up but always scaled down if necessary. If a \c{svg} is specified, the image is scaled to the size of the contents rectangle. - Setting the image property on sub controls implicitly sets the + Setting the image property on sub controls implicitly sets the width and height of the sub-control (unless the image in a SVG). In Qt 4.3 and later, the alignment of the - image within the rectangle can be specified using + image within the rectangle can be specified using \l{image-position-prop}{image-position}. \warning The QIcon SVG plugin is needed to render SVG images. @@ -2204,10 +2205,10 @@ \o The widget's left padding. \row - \o \bold{\c paint-alternating-row-colors-for-empty-area} + \o \bold{\c paint-alternating-row-colors-for-empty-area} \target paint-alternating-row-colors-for-empty-area-prop \o \c bool - \o Whether the QTreeView paints alternating row colors for the empty + \o Whether the QTreeView paints alternating row colors for the empty area (i.e the area where there are no items) \row @@ -2360,10 +2361,10 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 77 - This property is currently supported only by QPushButton + This property is currently supported only by QPushButton and QProgressBar. - \row + \row \o \bold{\c text-decoration} \o \c none \BR \c underline \BR @@ -2400,9 +2401,9 @@ If this property is not specified, it defaults to a value that depends on the subcontrol/widget and on the current style. - \warning Unless otherwise specified, this property has no effect + \warning Unless otherwise specified, this property has no effect when set on widgets. If you want a widget with a fixed width, set - the \l{#min-width-prop}{min-width} and + the \l{#min-width-prop}{min-width} and \l{#max-width-prop}{max-width} to the same value. Example: @@ -2735,7 +2736,7 @@ {CSS3 Draft Specification} for details. \row - \o \bold{Box \target Box Colors + \o \bold{Box \target Box Colors Colors} \o \l{#Brush}{Brush}\{1,4\} \o One to four occurrences of \l{#Brush}{Brush}, specifying the top, @@ -2782,10 +2783,10 @@ | \tt{#\e{rrggbb}} \BR | \l{QColor::setNamedColor()}{Color Name} \BR \o Specifies a color as RGB (red, green, blue) or RGBA - (red, green, blue, alpha) or HSV (hue, saturation, value) or HSVA + (red, green, blue, alpha) or HSV (hue, saturation, value) or HSVA (hue, saturation, value, alpha) or a named color. The \c rgb() or \c rgba() syntax can be used with integer values between 0 and 255, or with - percentages. The value of s, v, and a in \c hsv() or \c hsva() must all + percentages. The value of s, v, and a in \c hsv() or \c hsva() must all be in the range 0-255; the value of h must be in the range 0-359. Examples: @@ -2794,7 +2795,7 @@ \note The RGB colors allowed are the same as those allowed with CSS 2.1, as listed - \l{http://www.w3.org/TR/CSS21/syndata.html#color-units}{here}. + \l{http://www.w3.org/TR/CSS21/syndata.html#color-units}{here}. \row \o \bold Font \target Font @@ -2842,10 +2843,10 @@ point. \endlist - Gradients are specified in Object Bounding Mode. Imagine the box + Gradients are specified in Object Bounding Mode. Imagine the box in which the gradient is rendered, to have its top left corner at (0, 0) and its bottom right corner at (1, 1). Gradient parameters are - then specified as percentages from 0 to 1. These values are + then specified as percentages from 0 to 1. These values are extrapolated to actual box coordinates at runtime. It is possible specify values that lie outside the bounding box (-0.6 or 1.8, for instance). @@ -2869,11 +2870,11 @@ \o \bold Length \target Length \o \l{#Number}{Number} (\c px | \c pt | \c em | \c ex)? \o A number followed by a measurement unit. The CSS standard recommends - that user agents must + that user agents must \l{http://www.w3.org/TR/CSS21/syndata.html#illegalvalues}{ignore} - a declaration with an illegal value. In Qt, it is mandatory to - specify measurement units. For compatibility with earlier versions - of Qt, numbers without measurement units are treated as pixels + a declaration with an illegal value. In Qt, it is mandatory to + specify measurement units. For compatibility with earlier versions + of Qt, numbers without measurement units are treated as pixels in most contexts. The supported units are: \list @@ -2928,7 +2929,7 @@ | \c text \BR | \c window \BR | \c window-text \BR - \o These values correspond the \l{QPalette::ColorRole}{Color roles} + \o These values correspond the \l{QPalette::ColorRole}{Color roles} in the widget's QPalette. For example, @@ -2997,7 +2998,7 @@ \row \o \c :checked \target checked-ps - \o The item is checked. For example, the + \o The item is checked. For example, the \l{QAbstractButton::checked}{checked} state of QAbstractButton. \row @@ -3007,12 +3008,12 @@ \row \o \c :closed \target closed-ps - \o The item is in the closed state. For example, an non-expanded + \o The item is in the closed state. For example, an non-expanded item in a QTreeView \row \o \c :default \target default-ps - \o The item is the default. For example, a + \o The item is the default. For example, a \l{QPushButton::default}{default} QPushButton or a default action in a QMenu. @@ -3026,7 +3027,7 @@ \row \o \c :edit-focus \target edit-focus-ps - \o The item has edit focus (See QStyle::State_HasEditFocus). This state + \o The item has edit focus (See QStyle::State_HasEditFocus). This state is available only for Qt Extended applications. \row @@ -3077,7 +3078,7 @@ \row \o \c :indeterminate \target indeterminate-ps - \o The item has indeterminate state. For example, a QCheckBox + \o The item has indeterminate state. For example, a QCheckBox or QRadioButton is \l{Qt::PartiallyChecked}{partially checked}. \row @@ -3126,7 +3127,7 @@ \row \o \c :on \target on-ps \o For items that can be toggled, this applies to widgets - in the "on" state. + in the "on" state. \row \o \c :only-one \target only-one-ps @@ -3135,7 +3136,7 @@ \row \o \c :open \target open-ps - \o The item is in the open state. For example, an expanded + \o The item is in the open state. For example, an expanded item in a QTreeView, or a QComboBox or QPushButton with an open menu. @@ -3163,7 +3164,7 @@ \o The item is positioned at the right. For example, a QTabBar that has its tabs positioned at the right. - \row + \row \o \c :selected \target selected-ps \o The item is selected. For example, the selected tab in a QTabBar or the selected item in a QMenu. @@ -3217,7 +3218,7 @@ \row \o \c ::close-button \target close-button-sub - \o The close button of a QDockWidget. + \o The close button of a QDockWidget or tabs of QTabBar \row \o \c ::corner \target corner-sub @@ -3246,7 +3247,7 @@ \row \o \c ::indicator \target indicator-sub - \o The indicator of a QAbstractItemView, a QCheckBox, a QRadioButton, + \o The indicator of a QAbstractItemView, a QCheckBox, a QRadioButton, a checkable QMenu item or a checkable QGroupBox. \row @@ -3259,7 +3260,7 @@ \row \o \c ::item \target item-sub - \o An item of a QAbstractItemView, a QMenuBar, a QMenu, or + \o An item of a QAbstractItemView, a QMenuBar, a QMenu, or a QStatusBar. \row @@ -3345,7 +3346,7 @@ \row \o \c ::up-arrow \target up-arrow-sub - \o The up arrow of a QHeaderView (sort indicator), QScrollBar + \o The up arrow of a QHeaderView (sort indicator), QScrollBar or a QSpinBox. \row @@ -3534,7 +3535,7 @@ \section2 Customizing QAbstractScrollArea - The background of any QAbstractScrollArea (Item views, QTextEdit + The background of any QAbstractScrollArea (Item views, QTextEdit and QTextBrowser) can be set using the background properties. For example, to set a background-image that scrolls with the scroll bar: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 106 @@ -3556,13 +3557,13 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 109 - The pop-up of the QComboBox is a QAbstractItemView and is styled using + The pop-up of the QComboBox is a QAbstractItemView and is styled using the descendant selector: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 110 \section2 Customizing QDockWidget - The title bar and the buttons of a QDockWidget can be customized as + The title bar and the buttons of a QDockWidget can be customized as follows: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 111 @@ -3582,7 +3583,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 113 \section2 Customizing QGroupBox - + Let us look at an example that moves the QGroupBox's title to the center. @@ -3631,8 +3632,8 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 122 \section2 Customizing QMenu - - Individual items of a QMenu are styled using the 'item' subcontrol as + + Individual items of a QMenu are styled using the 'item' subcontrol as follows: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 123 @@ -3684,8 +3685,8 @@ A QPushButton is styled as follows: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 129 - For a QPushButton with a menu, use the - \l{Qt Style Sheets Reference#menu-indicator-sub}{::menu-indicator} + For a QPushButton with a menu, use the + \l{Qt Style Sheets Reference#menu-indicator-sub}{::menu-indicator} subcontrol. \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 130 @@ -3729,7 +3730,7 @@ (instead of the edges) like on Mac OS X, you can use the following stylesheet: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 136 - + The scroll bar using the above stylesheet looks like this: \image stylesheet-scrollbar2.png @@ -3762,8 +3763,8 @@ \section2 Customizing QSplitter - A QSplitter derives from a QFrame and hence can be styled like a QFrame. - The grip or the handle is customized using the + A QSplitter derives from a QFrame and hence can be styled like a QFrame. + The grip or the handle is customized using the \l{Qt Style Sheets Reference#handle-sub}{::handle} subcontrol. \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 142 @@ -3789,7 +3790,7 @@ Often we require the tabs to overlap to look like below: \image tabWidget-stylesheet2.png - For a tab widget that looks like above, we make use of + For a tab widget that looks like above, we make use of \l{http://www.communitymx.com/content/article.cfm?cid=B0029} {negative margins}. The resulting stylesheet looks like this: @@ -3803,6 +3804,9 @@ The tear indicator and the scroll buttons can be further customized as follows: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 148 + Sine Qt 4.6 the close button can be customized as follow: + \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 159 + \section2 Customizing QTableView Suppose we'd like our selected item in QTableView to have bubblegum pink @@ -3821,7 +3825,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 150 \section2 Customizing QToolBar - + The background and the handle of a QToolBar is customized as below: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 151 @@ -3836,7 +3840,7 @@ There are three types of QToolButtons. \list \i The QToolButton has no menu. In this case, the QToolButton is styled - exactly like QPushButton. See + exactly like QPushButton. See \l{#Customizing QPushButton}{Customizing QPushButton} for an example. @@ -3872,13 +3876,13 @@ \l{item-sub}{::item} subcontrol. For example, \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 156 - The branches of a QTreeView are styled using the + The branches of a QTreeView are styled using the \l{Qt Style Sheets Reference#branch-sub}{::branch} subcontrol. The following stylesheet color codes the various states when drawing a branch. \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 157 - + Colorful, though it is, a more useful example can be made using the following images: diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp index f326aae..a9eebbc 100644 --- a/examples/animation/states/main.cpp +++ b/examples/animation/states/main.cpp @@ -139,12 +139,12 @@ int main(int argc, char *argv[]) state1->assignProperty(p4, "geometry", QRectF(68-150, 48-150, 64, 64)); state1->assignProperty(p5, "geometry", QRectF(168, 48-150, 64, 64)); state1->assignProperty(p6, "geometry", QRectF(268+150, 48-150, 64, 64)); - state1->assignProperty(p1, "zRotation", qreal(0)); - state1->assignProperty(p2, "zRotation", qreal(0)); - state1->assignProperty(p3, "zRotation", qreal(0)); - state1->assignProperty(p4, "zRotation", qreal(-270)); - state1->assignProperty(p5, "zRotation", qreal(-90)); - state1->assignProperty(p6, "zRotation", qreal(270)); + state1->assignProperty(p1, "rotation", qreal(0)); + state1->assignProperty(p2, "rotation", qreal(0)); + state1->assignProperty(p3, "rotation", qreal(0)); + state1->assignProperty(p4, "rotation", qreal(-270)); + state1->assignProperty(p5, "rotation", qreal(-90)); + state1->assignProperty(p6, "rotation", qreal(270)); state1->assignProperty(boxProxy, "opacity", qreal(0)); state1->assignProperty(p1, "opacity", qreal(1)); state1->assignProperty(p2, "opacity", qreal(1)); @@ -163,12 +163,12 @@ int main(int argc, char *argv[]) state2->assignProperty(p4, "geometry", QRectF(64, 48, 64, 64)); state2->assignProperty(p5, "geometry", QRectF(168, 48, 64, 64)); state2->assignProperty(p6, "geometry", QRectF(268, 48, 64, 64)); - state2->assignProperty(p1, "zRotation", qreal(-270)); - state2->assignProperty(p2, "zRotation", qreal(90)); - state2->assignProperty(p3, "zRotation", qreal(270)); - state2->assignProperty(p4, "zRotation", qreal(0)); - state2->assignProperty(p5, "zRotation", qreal(0)); - state2->assignProperty(p6, "zRotation", qreal(0)); + state2->assignProperty(p1, "rotation", qreal(-270)); + state2->assignProperty(p2, "rotation", qreal(90)); + state2->assignProperty(p3, "rotation", qreal(270)); + state2->assignProperty(p4, "rotation", qreal(0)); + state2->assignProperty(p5, "rotation", qreal(0)); + state2->assignProperty(p6, "rotation", qreal(0)); state2->assignProperty(boxProxy, "opacity", qreal(1)); state2->assignProperty(p1, "opacity", qreal(0)); state2->assignProperty(p2, "opacity", qreal(0)); @@ -208,12 +208,12 @@ int main(int argc, char *argv[]) animation1.addAnimation(new QPropertyAnimation(p4, "geometry")); animation1.addAnimation(new QPropertyAnimation(p5, "geometry")); animation1.addAnimation(new QPropertyAnimation(p6, "geometry")); - animation1.addAnimation(new QPropertyAnimation(p1, "zRotation")); - animation1.addAnimation(new QPropertyAnimation(p2, "zRotation")); - animation1.addAnimation(new QPropertyAnimation(p3, "zRotation")); - animation1.addAnimation(new QPropertyAnimation(p4, "zRotation")); - animation1.addAnimation(new QPropertyAnimation(p5, "zRotation")); - animation1.addAnimation(new QPropertyAnimation(p6, "zRotation")); + animation1.addAnimation(new QPropertyAnimation(p1, "rotation")); + animation1.addAnimation(new QPropertyAnimation(p2, "rotation")); + animation1.addAnimation(new QPropertyAnimation(p3, "rotation")); + animation1.addAnimation(new QPropertyAnimation(p4, "rotation")); + animation1.addAnimation(new QPropertyAnimation(p5, "rotation")); + animation1.addAnimation(new QPropertyAnimation(p6, "rotation")); animation1.addAnimation(new QPropertyAnimation(p1, "opacity")); animation1.addAnimation(new QPropertyAnimation(p2, "opacity")); animation1.addAnimation(new QPropertyAnimation(p3, "opacity")); @@ -230,12 +230,12 @@ int main(int argc, char *argv[]) animation2.addAnimation(new QPropertyAnimation(p4, "geometry")); animation2.addAnimation(new QPropertyAnimation(p5, "geometry")); animation2.addAnimation(new QPropertyAnimation(p6, "geometry")); - animation2.addAnimation(new QPropertyAnimation(p1, "zRotation")); - animation2.addAnimation(new QPropertyAnimation(p2, "zRotation")); - animation2.addAnimation(new QPropertyAnimation(p3, "zRotation")); - animation2.addAnimation(new QPropertyAnimation(p4, "zRotation")); - animation2.addAnimation(new QPropertyAnimation(p5, "zRotation")); - animation2.addAnimation(new QPropertyAnimation(p6, "zRotation")); + animation2.addAnimation(new QPropertyAnimation(p1, "rotation")); + animation2.addAnimation(new QPropertyAnimation(p2, "rotation")); + animation2.addAnimation(new QPropertyAnimation(p3, "rotation")); + animation2.addAnimation(new QPropertyAnimation(p4, "rotation")); + animation2.addAnimation(new QPropertyAnimation(p5, "rotation")); + animation2.addAnimation(new QPropertyAnimation(p6, "rotation")); animation2.addAnimation(new QPropertyAnimation(p1, "opacity")); animation2.addAnimation(new QPropertyAnimation(p2, "opacity")); animation2.addAnimation(new QPropertyAnimation(p3, "opacity")); @@ -252,12 +252,12 @@ int main(int argc, char *argv[]) animation3.addAnimation(new QPropertyAnimation(p4, "geometry")); animation3.addAnimation(new QPropertyAnimation(p5, "geometry")); animation3.addAnimation(new QPropertyAnimation(p6, "geometry")); - animation3.addAnimation(new QPropertyAnimation(p1, "zRotation")); - animation3.addAnimation(new QPropertyAnimation(p2, "zRotation")); - animation3.addAnimation(new QPropertyAnimation(p3, "zRotation")); - animation3.addAnimation(new QPropertyAnimation(p4, "zRotation")); - animation3.addAnimation(new QPropertyAnimation(p5, "zRotation")); - animation3.addAnimation(new QPropertyAnimation(p6, "zRotation")); + animation3.addAnimation(new QPropertyAnimation(p1, "rotation")); + animation3.addAnimation(new QPropertyAnimation(p2, "rotation")); + animation3.addAnimation(new QPropertyAnimation(p3, "rotation")); + animation3.addAnimation(new QPropertyAnimation(p4, "rotation")); + animation3.addAnimation(new QPropertyAnimation(p5, "rotation")); + animation3.addAnimation(new QPropertyAnimation(p6, "rotation")); animation3.addAnimation(new QPropertyAnimation(p1, "opacity")); animation3.addAnimation(new QPropertyAnimation(p2, "opacity")); animation3.addAnimation(new QPropertyAnimation(p3, "opacity")); diff --git a/examples/opengl/framebufferobject/glwidget.cpp b/examples/opengl/framebufferobject/glwidget.cpp index 99a8ffd..9e0b6f3 100644 --- a/examples/opengl/framebufferobject/glwidget.cpp +++ b/examples/opengl/framebufferobject/glwidget.cpp @@ -57,6 +57,7 @@ GLWidget::GLWidget(QWidget *parent) if (QGLFramebufferObject::hasOpenGLFramebufferBlit()) { QGLFramebufferObjectFormat format; format.setSamples(4); + format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); render_fbo = new QGLFramebufferObject(512, 512, format); texture_fbo = new QGLFramebufferObject(512, 512); diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm new file mode 100644 index 0000000..96eb189 --- /dev/null +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm @@ -0,0 +1,39 @@ +# /**************************************************************************** +# ** +# ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +# ** Contact: Nokia Corporation (qt-info@nokia.com) +# ** +# ** This file is part of symbian-sbsv2 mkspec. +# ** +# ****************************************************************************/ + +include $(FLMHOME)/metaflm.mk + +STORE_BUILD_TARGET:=$(call sanitise,TSTORE_BUILD_$(PLATFORM_PATH)_$(CFG_PATH)_$(EXTENSION_ROOT)) +CACHE_FILENAME:=$(EXTENSION_ROOT)/.make.cache + +VISUAL_CFG:=RELEASE +ifeq "$(CFG_PATH)" "UDEB" +VISUAL_CFG:=DEBUG +endif + +define qmake_store_build +FINAL:: $(STORE_BUILD_TARGET) + +$(STORE_BUILD_TARGET): + $(call startrule,qmake_store_build) \ + echo "# ==============================================================================" > $(CACHE_FILENAME) && \ + echo "# This file is generated by make and should not be modified by the user" >> $(CACHE_FILENAME) && \ + echo "# Name : .make.cache" >> $(CACHE_FILENAME) && \ + echo "# Part of : " >> $(CACHE_FILENAME) && \ + echo "# Description : This file is used to cache last build target for" >> $(CACHE_FILENAME) && \ + echo "# make sisx target." >> $(CACHE_FILENAME) && \ + echo "# Version : " >> $(CACHE_FILENAME) && \ + echo "# ==============================================================================" >> $(CACHE_FILENAME) && \ + echo QT_SISX_TARGET ?= $(VISUAL_CFG)-$(PLATFORM_PATH) >> $(CACHE_FILENAME) \ + $(call endrule,qmake_store_build) +endef + +$(eval $(qmake_store_build)) +$(eval $(call GenerateStandardCleanTarget,$(CACHE_FILENAME),'')) + diff --git a/mkspecs/symbian-sbsv2/flm/qt/qt.xml b/mkspecs/symbian-sbsv2/flm/qt/qt.xml index 2c46f78..5074e47 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qt.xml +++ b/mkspecs/symbian-sbsv2/flm/qt/qt.xml @@ -39,4 +39,8 @@ flm="qmake_generate_temp_dirs.flm"> <param name='DIRS' /> </interface> + + <interface name="qt.qmake_store_build" extends="Symbian.UserFLM" + flm="qmake_store_build.flm"> + </interface> </build> diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index e903fc1..3bc2391 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -331,7 +331,7 @@ void initProjectDeploySymbian(QMakeProject* project, if (deployBinaries) { // Executables and libraries are deployed to \sys\bin QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\"); - deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName()), + deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true), Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName()))); } if (isPlugin(info, devicePath)) { diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index c20ecf3..48fc8ef 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -72,6 +72,12 @@ #define MMP_TARGETTYPE "TARGETTYPE" #define MMP_SECUREID "SECUREID" +#define SISX_TARGET "sisx" +#define OK_SISX_TARGET "ok_sisx" +#define FAIL_SISX_NOPKG_TARGET "fail_sisx_nopkg" +#define FAIL_SISX_NOCACHE_TARGET "fail_sisx_nocache" +#define RESTORE_BUILD_TARGET "restore_build" + #define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) @@ -194,13 +200,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) } if (generatePkg) { - QStringList platformList = project->values("SYMBIAN_PLATFORMS"); - foreach(QString platform, platformList) { - if (platform.compare("WINSCW", Qt::CaseInsensitive)) { - generatePkgFile(platform.toLower(), "udeb", iconFile); - generatePkgFile(platform.toLower(), "urel", iconFile); - } - } + generatePkgFile(iconFile); } writeBldInfContent(t, generatePkg); @@ -246,9 +246,9 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) if (targetType == TypeExe) { if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - writeRegRssFile(fixedTarget, userRssRules); - writeRssFile(fixedTarget, numberOfIcons, iconFile); - writeLocFile(fixedTarget, symbianLangCodes); + writeRegRssFile(userRssRules); + writeRssFile(numberOfIcons, iconFile); + writeLocFile(symbianLangCodes); } } @@ -258,13 +258,10 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) return true; } -void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) +void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile) { - QString build = (config == "udeb") ? "debug" : "release"; - QString pkgFilename = QString("%1_%2-%3.%4") - .arg(fileInfo(project->projectFile()).completeBaseName()) - .arg(build) - .arg(compiler) + QString pkgFilename = QString("%1_template.%2") + .arg(fixedTarget) .arg("pkg"); QFile pkgFile(pkgFilename); if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -313,8 +310,11 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); if (!containsStartWithItem('#', rawPkgPreRules)) { + QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET"))); + visualTarget = removePathSeparators(visualTarget); + t << "; SIS header: name, uid, version" << endl; - t << QString("#{\"%1\"},(%2),%3").arg(fixedTarget).arg(uid3).arg(applicationVersion) << endl << endl; + t << QString("#{\"%1\"},(%2),%3").arg(visualTarget).arg(uid3).arg(applicationVersion) << endl << endl; } // Localized vendor name @@ -344,10 +344,8 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; // Find location of builds - QString epocReleasePath = QString("%1epoc32/release/%2/%3") - .arg(epocRoot()) - .arg(compiler) - .arg(config); + QString epocReleasePath = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)") + .arg(epocRoot()); if (targetType == TypeExe) { @@ -391,7 +389,7 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QString remoteTestPath; remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); - initProjectDeploySymbian(project, depList, remoteTestPath, true, compiler, config, generatedDirs, generatedFiles); + initProjectDeploySymbian(project, depList, remoteTestPath, true, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles); if (depList.size()) t << "; DEPLOYMENT" << endl; for (int i = 0; i < depList.size(); ++i) { @@ -471,6 +469,7 @@ void SymbianMakefileGenerator::init() MakefileGenerator::init(); fixedTarget = escapeFilePath(fileFixify(project->first("TARGET"))); fixedTarget = removePathSeparators(fixedTarget); + removeSpecialCharacters(fixedTarget); if (0 != project->values("QMAKE_PLATFORM").size()) platform = varGlue("QMAKE_PLATFORM", "", " ", ""); @@ -1187,9 +1186,9 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy } } -void SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) +void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) { - QString filename(appName); + QString filename(fixedTarget); filename.append("_reg.rss"); QFile ft(filename); if (ft.open(QIODevice::WriteOnly)) { @@ -1202,7 +1201,7 @@ void SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us t << "// * user." << endl; t << "// ============================================================================" << endl; t << endl; - t << "#include <" << appName << ".rsg>" << endl; + t << "#include <" << fixedTarget << ".rsg>" << endl; t << "#include <appinfo.rh>" << endl; t << endl; //t << "#include <data_caging_paths.hrh>" << "\n" << endl; @@ -1210,8 +1209,8 @@ void SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us t << "UID3 " << uid3 << endl << endl; t << "RESOURCE APP_REGISTRATION_INFO" << endl; t << "\t{" << endl; - t << "\tapp_file=\"" << appName << "\";" << endl; - t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << appName << "\";" << endl; + t << "\tapp_file=\"" << fixedTarget << "\";" << endl; + t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; t << endl; foreach(QString item, userItems) @@ -1222,9 +1221,9 @@ void SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us } } -void SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) +void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) { - QString filename(appName); + QString filename(fixedTarget); filename.append(".rss"); QFile ft(filename); if (ft.open(QIODevice::WriteOnly)) { @@ -1238,7 +1237,7 @@ void SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI t << "// ============================================================================" << endl; t << endl; t << "#include <appinfo.rh>" << endl; - t << "#include \"" << appName << ".loc\"" << endl; + t << "#include \"" << fixedTarget << ".loc\"" << endl; t << endl; t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; t << "\t{" << endl; @@ -1265,9 +1264,9 @@ void SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI } } -void SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes) { - QString filename(appName); + QString filename(fixedTarget); filename.append(".loc"); QFile ft(filename); if (ft.open(QIODevice::WriteOnly)) { @@ -1281,18 +1280,16 @@ void SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbi t << "// ============================================================================" << endl; t << endl; t << "#ifdef LANGUAGE_SC" << endl; - //t << "#include \"" << appName << ".l01\"" << endl; - t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; - t << "#define STRING_r_caption \"" << appName << "\"" << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; foreach(QString lang, symbianLangCodes) { t << "#elif defined LANGUAGE_" << lang << endl; - //t << "#include \"" << appName << ".l" << lang << "\"" << endl; - t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; - t << "#define STRING_r_caption \"" << appName << "\"" << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; } t << "#else" << endl; - t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; - t << "#define STRING_r_caption \"" << appName << "\"" << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; t << "#endif" << endl; } else { PRINT_FILE_CREATE_ERROR(filename); @@ -1635,6 +1632,44 @@ void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) str.replace(QString(" "), QString("_")); } +void SymbianMakefileGenerator::writeSisxTargets(QTextStream &t) +{ + t << SISX_TARGET ": " RESTORE_BUILD_TARGET << endl; + QString sisxcommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ + "$(MAKE) -s -f $(MAKEFILE) %4,$(MAKE) -s -f $(MAKEFILE) %5)," \ + "$(MAKE) -s -f $(MAKEFILE) %6)") + .arg(fixedTarget) + .arg("pkg") + .arg(MAKE_CACHE_NAME) + .arg(OK_SISX_TARGET) + .arg(FAIL_SISX_NOCACHE_TARGET) + .arg(FAIL_SISX_NOPKG_TARGET); + t << sisxcommand << endl; + t << endl; + + t << OK_SISX_TARGET ":" << endl; + + QString pkgcommand = QString("\tcreatepackage.bat %1_template.%2 $(QT_SISX_TARGET) " \ + "$(QT_SISX_CERTIFICATE) $(QT_SISX_KEY) $(QT_SISX_PASSPHRASE)") + .arg(fixedTarget) + .arg("pkg"); + t << pkgcommand << endl; + t << endl; + + t << FAIL_SISX_NOPKG_TARGET ":" << endl; + t << "\t$(error PKG file does not exist, 'SISX' target is only supported for executables or projects with DEPLOYMENT statement)" << endl; + t << endl; + + t << FAIL_SISX_NOCACHE_TARGET ":" << endl; + t << "\t$(error Project has to be build before calling 'SISX' target)" << endl; + t << endl; + + + t << RESTORE_BUILD_TARGET ":" << endl; + t << "-include " MAKE_CACHE_NAME << endl; + t << endl; +} + void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) { t << "dodistclean:" << endl; @@ -1688,4 +1723,3 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) t << "distclean: clean dodistclean" << endl; t << endl; } - diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 22dc4c9..ce65822 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE #define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" #define QT_EXTRA_INCLUDE_DIR "tmp" +#define MAKE_CACHE_NAME ".make.cache" class SymbianMakefileGenerator : public MakefileGenerator { @@ -84,7 +85,7 @@ protected: QString canonizePath(const QString& origPath); virtual bool writeMakefile(QTextStream &t); - void generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); + void generatePkgFile(const QString &iconFile); bool containsStartWithItem(const QChar &c, const QStringList& src); virtual void init(); @@ -116,9 +117,9 @@ protected: void writeCustomDefFile(); - void writeRegRssFile(QString &appname, QStringList &useritems); - void writeRssFile(QString &appName, QString &numberOfIcons, QString &iconfile); - void writeLocFile(QString &appName, QStringList &symbianLangCodes); + void writeRegRssFile(QStringList &useritems); + void writeRssFile(QString &numberOfIcons, QString &iconfile); + void writeLocFile(QStringList &symbianLangCodes); void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); QStringList symbianLangCodesFromTsFiles(); @@ -136,6 +137,7 @@ protected: const QString& itemPrefix, const QString& itemSuffix); + void writeSisxTargets(QTextStream &t); void generateDistcleanTargets(QTextStream& t); // Subclass implements diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 271d210..49cd7ed 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -58,6 +58,7 @@ #define ALL_SOURCE_DEPS_TARGET "all_source_deps" #define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" #define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean" +#define STORE_BUILD_TARGET "store_build" SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } @@ -87,9 +88,15 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b t << "# ==============================================================================" << "\n" << endl; t << endl << endl; - + t << "MAKE = make" << endl; t << endl; + + t << "VISUAL_CFG = RELEASE" << endl; + t << "ifeq \"$(CFG)\" \"UDEB\"" << endl; + t << "VISUAL_CFG = DEBUG" << endl; + t << "endif" << endl; + t << endl; t << DO_NOTHING_TARGET " :" << endl; t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl; @@ -101,14 +108,16 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b QString finalDepsWinscw; QStringList wrapperTargets; if (deploymentOnly) { - buildDeps.append(DO_NOTHING_TARGET); + buildDeps.append(STORE_BUILD_TARGET); cleanDeps.append(DO_NOTHING_TARGET); cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET); finalDeps.append(DO_NOTHING_TARGET); finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); - wrapperTargets << WINSCW_DEPLOYMENT_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET; + wrapperTargets << WINSCW_DEPLOYMENT_TARGET + << WINSCW_DEPLOYMENT_CLEAN_TARGET + << STORE_BUILD_TARGET; } else { - buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET); + buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); cleanDeps.append(EXTENSION_CLEAN); cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET); finalDeps.append(FINALIZE_TARGET); @@ -118,7 +127,8 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b << EXTENSION_CLEAN << FINALIZE_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET - << WINSCW_DEPLOYMENT_TARGET; + << WINSCW_DEPLOYMENT_TARGET + << STORE_BUILD_TARGET; } t << "MAKMAKE: " << buildDeps << endl << endl; @@ -143,9 +153,9 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath())); foreach(QString target, wrapperTargets) { t << target << " : " << makefile << endl; - t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << endl << endl; - } - + t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SISX_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl; + } + t << endl; } // if(ft.open(QIODevice::WriteOnly)) } @@ -179,10 +189,8 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "#" << endl; t << "# ==============================================================================" << "\n" << endl; t << endl; - QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); - if (ofile.lastIndexOf(Option::dir_sep) != -1) - ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) - 1); - t << "MAKEFILE = " << ofile << endl; + + t << "MAKEFILE = " << wrapperFile.fileName() << endl; t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; @@ -353,6 +361,10 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool writeDeploymentTargets(t); + writeSisxTargets(t); + + writeStoreBuildTarget(t); + generateDistcleanTargets(t); t << "clean: $(ABLD)" << endl; @@ -408,6 +420,25 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) return true; } +void SymbianAbldMakefileGenerator::writeStoreBuildTarget(QTextStream &t) +{ + t << STORE_BUILD_TARGET ":" << endl; + t << "\t@echo # ============================================================================== > " MAKE_CACHE_NAME << endl; + t << "\t@echo # This file is generated by make and should not be modified by the user >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Name : " << MAKE_CACHE_NAME << " >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Part of : " << project->values("TARGET").join(" ") << " >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Description : This file is used to cache last build target for >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # make sisx target. >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Version : >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # ============================================================================== >> " MAKE_CACHE_NAME << endl; + t << "\t@echo. >> " MAKE_CACHE_NAME << endl; + t << "\t@echo QT_SISX_TARGET ?= $(QT_SISX_TARGET) >> " MAKE_CACHE_NAME << endl; + t << endl; + + generatedFiles << MAKE_CACHE_NAME; +} + void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) { // Normally emulator deployment gets done via regular makefile, but since subdirs diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h index 7709d5d..67da43e 100644 --- a/qmake/generators/symbian/symmake_abld.h +++ b/qmake/generators/symbian/symmake_abld.h @@ -56,6 +56,7 @@ protected: virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); + void writeStoreBuildTarget(QTextStream &t); bool writeDeploymentTargets(QTextStream &t); public: diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 2471a2b..9891a2e 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -123,10 +123,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << "#" << endl; t << "# ==============================================================================" << "\n" << endl; t << endl; - QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); - if (ofile.lastIndexOf(Option::dir_sep) != -1) - ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) - 1); - t << "MAKEFILE = " << ofile << endl; + t << "MAKEFILE = " << wrapperFile.fileName() << endl; t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; @@ -219,6 +216,8 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo qDeleteAll(subtargets); } + writeSisxTargets(t); + generateDistcleanTargets(t); t << "clean: " << BLD_INF_FILENAME << endl; @@ -402,6 +401,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << "END" << endl; t << endl; + t << "START EXTENSION qt/qmake_store_build" << endl; + t << "END" << endl; + t << endl; + t << endl; } diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index e4c9d42..621c836 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -1535,9 +1535,10 @@ HRESULT WINAPI QAxClientSite::SetBorderSpace(LPCBORDERWIDTHS pborderwidths) HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName) { AX_DEBUG(QAxClientSite::SetActiveObject); - - if (pszObjName && widget) - widget->setWindowTitle(QString::fromWCharArray(pszObjName)); + + Q_UNUSED(pszObjName); + // we are ignoring the name of the object, as suggested by MSDN documentation + // for IOleInPlaceUIWindow::SetActiveObject(). if (m_spInPlaceActiveObject) { if (!inPlaceModelessEnabled) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index d7ae78f..7a24ecc 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1903,12 +1903,12 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() */ /*! - T *q_check_ptr(T *pointer) + \fn T *q_check_ptr(T *pointer) \relates <QtGlobal> - Users Q_CHECK_PTR on \a pointer, then returns \a pointer. + Users Q_CHECK_PTR on \a pointer, then returns \a pointer. - This can be used as an inline version of Q_CHECK_PTR. + This can be used as an inline version of Q_CHECK_PTR. */ /*! diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 93cc30f..fbefe7a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2382,6 +2382,10 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #endif #if defined(Q_OS_SYMBIAN) + +//Symbian does not support data imports from a DLL +#define Q_NO_DATA_RELOCATION + QT_END_NAMESPACE // forward declare std::exception #ifdef __cplusplus diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 657e367..134cbcc 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2445,7 +2445,7 @@ \value ImhNone No hints. \value ImhHiddenText Characters should be hidden, as is typically used when entering passwords. This is automatically set when setting QLineEdit::echoMode to \c Password. - \value ImhNumbersOnly Only number input is allowed. + \value ImhDigitsOnly Only number input is allowed. \value ImhUppercaseOnly Only upper case letter input is allowed. \value ImhLowercaseOnly Only lower case letter input is allowed. \value ImhNoAutoUppercase The input method should not try to automatically switch to upper case @@ -2456,6 +2456,9 @@ \value ImhNoPredictiveText Do not use predictive text (i.e. dictionary lookup) while typing. \value ImhDialableCharactersOnly Only characters suitable for phone dialling are allowed. + \omitvalue ImhFormattedNumbersOnly + \omitvalue ImhExclusiveInputMask + \note If several flags ending with \c Only are ORed together, the resulting character set will consist of the union of the specified sets. For instance specifying \c ImhNumbersOnly and \c ImhUppercaseOnly would yield a set consisting of numbers and uppercase letters. diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index db0c696..de483ed 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -3199,8 +3199,8 @@ bool QSettings::isWritable() const Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. Example: @@ -3234,8 +3234,8 @@ void QSettings::setValue(const QString &key, const QVariant &value) Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. \sa setValue(), value(), contains() */ @@ -3269,8 +3269,8 @@ void QSettings::remove(const QString &key) Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. \sa value(), setValue() */ @@ -3331,8 +3331,8 @@ bool QSettings::event(QEvent *event) Note that the Windows registry and INI files use case-insensitive keys, whereas the Carbon Preferences API on Mac OS X uses - case-sensitive keys. To avoid portability problems, see the \l{Key - Syntax} rules. + case-sensitive keys. To avoid portability problems, see the + \l{Section and Key Syntax} rules. Example: diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 5e8848b..1ba3000 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2498,25 +2498,32 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star /*! Begins a row move operation. - When reimplementing a subclass, this method simplifies moving entities - in your model. This method is responsible for moving persistent indexes - in the model, which you would otherwise be required to do yourself. + When reimplementing a subclass, this method simplifies moving + entities in your model. This method is responsible for moving + persistent indexes in the model, which you would otherwise be + required to do yourself. Using beginMoveRows and endMoveRows is an alternative to emitting - layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. - layoutAboutToBeChanged is emitted by this method for compatibility reasons. + layoutAboutToBeChanged and layoutChanged directly along with + changePersistentIndexes. layoutAboutToBeChanged is emitted by + this method for compatibility reasons. The \a sourceParent index corresponds to the parent from which the - rows are moved; \a sourceFirst and \a sourceLast are the row numbers of the - rows to be moved. The \a destinationParent index corresponds to the parent into which - the rows are moved. The \a destinationRow is the row to which the rows will be moved. - That is, the index at row \a sourceFirst in \a sourceParent will become row \a destinationRow - in \a destinationParent. Its siblings will be moved correspondingly. - - Note that \a sourceParent and \a destinationParent may be the same, in which case you must - ensure that the \a destinationRow is not within the range of \a sourceFirst and \a sourceLast. - You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. - This method returns false if either condition is true, in which case you should abort your move operation. + rows are moved; \a sourceFirst and \a sourceLast are the row + numbers of the rows to be moved. The \a destinationParent index + corresponds to the parent into which the rows are moved. The \a + destinationChild is the row to which the rows will be moved. That + is, the index at row \a sourceFirst in \a sourceParent will become + row \a destinationChild in \a destinationParent. Its siblings will + be moved correspondingly. + + Note that \a sourceParent and \a destinationParent may be the + same, in which case you must ensure that the \a destinationChild is + not within the range of \a sourceFirst and \a sourceLast. You + must also ensure that you do not attempt to move a row to one of + its own chilren or ancestors. This method returns false if either + condition is true, in which case you should abort your move + operation. \sa endMoveRows() @@ -2694,25 +2701,32 @@ void QAbstractItemModel::endRemoveColumns() /*! Begins a column move operation. - When reimplementing a subclass, this method simplifies moving entities - in your model. This method is responsible for moving persistent indexes - in the model, which you would otherwise be required to do yourself. + When reimplementing a subclass, this method simplifies moving + entities in your model. This method is responsible for moving + persistent indexes in the model, which you would otherwise be + required to do yourself. - Using beginMoveColumns and endMoveColumns is an alternative to emitting - layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. - layoutAboutToBeChanged is emitted by this method for compatibility reasons. + Using beginMoveColumns and endMoveColumns is an alternative to + emitting layoutAboutToBeChanged and layoutChanged directly along + with changePersistentIndexes. layoutAboutToBeChanged is emitted + by this method for compatibility reasons. The \a sourceParent index corresponds to the parent from which the - columns are moved; \a sourceFirst and \a sourceLast are the column numbers of the - columns to be moved. The \a destinationParent index corresponds to the parent into which - the columns are moved. The \a destinationColumn is the column to which the columns will be moved. - That is, the index at column \a sourceFirst in \a sourceParent will become column \a destinationColumn - in \a destinationParent. Its siblings will be moved correspondingly. - - Note that \a sourceParent and \a destinationParent may be the same, in which case you must - ensure that the \a destinationColumn is not within the range of \a sourceFirst and \a sourceLast. - You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. - This method returns false if either condition is true, in which case you should abort your move operation. + columns are moved; \a sourceFirst and \a sourceLast are the column + numbers of the columns to be moved. The \a destinationParent index + corresponds to the parent into which the columns are moved. The \a + destinationChild is the column to which the columns will be + moved. That is, the index at column \a sourceFirst in \a + sourceParent will become column \a destinationChild in \a + destinationParent. Its siblings will be moved correspondingly. + + Note that \a sourceParent and \a destinationParent may be the + same, in which case you must ensure that the \a destinationChild + is not within the range of \a sourceFirst and \a sourceLast. You + must also ensure that you do not attempt to move a row to one of + its own chilren or ancestors. This method returns false if either + condition is true, in which case you should abort your move + operation. \sa endMoveColumns() diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 957b92c..a263cc4 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -175,10 +175,6 @@ Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal) return qt_s60_plugin_resolver()->resolve(ordinal); } -/*! -\internal -Provides global access to a shared RFs. -*/ class QS60RFsSession { public: diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 183809e..854abef 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1029,7 +1029,7 @@ void QCoreApplication::exit(int returnCode) The event is \e not deleted when the event has been sent. The normal approach is to create the event on the stack, for example: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 0 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 0 \sa postEvent(), notify() */ @@ -1552,7 +1552,7 @@ bool QCoreApplication::event(QEvent *e) Example: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 1 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 1 \sa exit(), aboutToQuit(), QApplication::lastWindowClosed() */ @@ -2171,7 +2171,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive)) If you want to iterate over the list, you can use the \l foreach pseudo-keyword: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 2 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 2 \sa setLibraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary, {How to Create Qt Plugins} @@ -2318,7 +2318,7 @@ void QCoreApplication::removeLibraryPath(const QString &path) A function with the following signature that can be used as an event filter: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 3 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 3 \sa setEventFilter() */ @@ -2507,7 +2507,7 @@ int QCoreApplication::loopLevel() } #endif -/*! +/* \fn void QCoreApplication::watchUnixSignal(int signal, bool watch) \internal */ @@ -2531,7 +2531,7 @@ int QCoreApplication::loopLevel() The function specified by \a ptr should take no arguments and should return nothing. For example: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 4 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 4 Note that for an application- or module-wide cleanup, qAddPostRoutine() is often not suitable. For example, if the @@ -2545,7 +2545,7 @@ int QCoreApplication::loopLevel() parent-child mechanism to call a cleanup function at the right time: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 5 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 5 By selecting the right parent object, this can often be made to clean up the module's data at the right moment. @@ -2559,7 +2559,7 @@ int QCoreApplication::loopLevel() translation functions, \c tr() and \c trUtf8(), with these signatures: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 6 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 6 This macro is useful if you want to use QObject::tr() or QObject::trUtf8() in classes that don't inherit from QObject. @@ -2568,7 +2568,7 @@ int QCoreApplication::loopLevel() class definition (before the first \c{public:} or \c{protected:}). For example: - \snippet doc/src/snippets/code/src.corelib.kernel.qcoreapplication.cpp 7 + \snippet doc/src/snippets/code/src_corelib_kernel_qcoreapplication.cpp 7 The \a context parameter is normally the class name, but it can be any string. diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 3d26160..5771feb 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -613,16 +613,26 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co if (strcmp(self->d.stringdata, name) == 0) return self; if (self->d.extradata) { +#ifdef Q_NO_DATA_RELOCATION + const QMetaObjectAccessor *e; + Q_ASSERT(priv(self->d.data)->revision >= 2); +#else const QMetaObject **e; if (priv(self->d.data)->revision < 2) { e = (const QMetaObject**)(self->d.extradata); - } else { + } else +#endif + { const QMetaObjectExtraData *extra = (const QMetaObjectExtraData*)(self->d.extradata); e = extra->objects; } if (e) { while (*e) { +#ifdef Q_NO_DATA_RELOCATION + if (const QMetaObject *m =QMetaObject_findMetaObject(&((*e)()), name)) +#else if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name)) +#endif return m; ++e; } diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 1f35c73..e080bd6 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -240,18 +240,20 @@ static void computeOffsets(const QMetaObject *metaobject, int *signalOffset, int } } -/*! \internal +/* This vector contains the all connections from an object. - Each object may have one vector containing the lists of connections for a given signal. - The index in the vector correspond to the signal index. - The signal index is the one returned by QObjectPrivate::signalIndex (not QMetaObject::indexOfSignal). + Each object may have one vector containing the lists of + connections for a given signal. The index in the vector correspond + to the signal index. The signal index is the one returned by + QObjectPrivate::signalIndex (not QMetaObject::indexOfSignal). Negative index means connections to all signals. This vector is protected by the object mutex (signalSlotMutexes()) - Each Connection is also part of a 'senders' linked list. The mutex of the receiver must be locked when touching - the pointers of this linked list. + Each Connection is also part of a 'senders' linked list. The mutex + of the receiver must be locked when touching the pointers of this + linked list. */ class QObjectConnectionListVector : public QVector<QObjectPrivate::ConnectionList> { @@ -289,7 +291,7 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const QMutexLocker locker(signalSlotLock(q)); if (connectionLists) { if (signal_index < connectionLists->count()) { - const QObjectPrivate::Connection *c = + const QObjectPrivate::Connection *c = connectionLists->at(signal_index).first; while (c) { @@ -358,7 +360,7 @@ void QObjectPrivate::cleanConnectionLists() if (connectionLists->dirty && !connectionLists->inUse) { // remove broken connections for (int signal = -1; signal < connectionLists->count(); ++signal) { - QObjectPrivate::ConnectionList &connectionList = + QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal]; // Set to the last entry in the connection list that was *not* @@ -381,8 +383,8 @@ void QObjectPrivate::cleanConnectionLists() } } - // Correct the connection list's last pointer. As - // conectionList.last could equal last, this could be a noop + // Correct the connection list's last pointer. + // As conectionList.last could equal last, this could be a noop connectionList.last = last; } connectionLists->dirty = false; @@ -904,7 +906,7 @@ QObject::~QObject() if (d->connectionLists) { ++d->connectionLists->inUse; for (int signal = -1; signal < d->connectionLists->count(); ++signal) { - QObjectPrivate::ConnectionList &connectionList = + QObjectPrivate::ConnectionList &connectionList = (*d->connectionLists)[signal]; while (QObjectPrivate::Connection *c = connectionList.first) { @@ -1169,7 +1171,7 @@ static QObject *qChildHelper(const char *objName, const char *inheritsClass, more than one, the first one found is returned. */ QObject* QObject::child(const char *objName, const char *inheritsClass, - bool recursiveSearch) const + bool recursiveSearch) const { Q_D(const QObject); return qChildHelper(objName, inheritsClass, recursiveSearch, d->children); @@ -1388,7 +1390,7 @@ bool QObject::eventFilter(QObject * /* watched */, QEvent * /* event */) /*! If \a block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). - If \a block is false, no such blocking will occur. + If \a block is false, no such blocking will occur. The return value is the previous value of signalsBlocked(). @@ -1680,12 +1682,12 @@ void QObject::killTimer(int id) #ifdef QT3_SUPPORT static void objSearch(QObjectList &result, - const QObjectList &list, - const char *inheritsClass, - bool onlyWidgets, - const char *objName, - QRegExp *rx, - bool recurse) + const QObjectList &list, + const char *inheritsClass, + bool onlyWidgets, + const char *objName, + QRegExp *rx, + bool recurse) { for (int i = 0; i < list.size(); ++i) { QObject *obj = list.at(i); @@ -1755,9 +1757,9 @@ static void objSearch(QObjectList &result, */ QObjectList QObject::queryList(const char *inheritsClass, - const char *objName, - bool regexpMatch, - bool recursiveSearch) const + const char *objName, + bool regexpMatch, + bool recursiveSearch) const { Q_D(const QObject); QObjectList list; @@ -1909,7 +1911,7 @@ QObjectList QObject::queryList(const char *inheritsClass, \internal */ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, - const QMetaObject &mo, QList<void*> *list) + const QMetaObject &mo, QList<void*> *list) { if (!parent || !list) return; @@ -2517,7 +2519,7 @@ int QObject::receivers(const char *signal) const QMutexLocker locker(signalSlotLock(this)); if (d->connectionLists) { if (signal_index < d->connectionLists->count()) { - const QObjectPrivate::Connection *c = + const QObjectPrivate::Connection *c = d->connectionLists->at(signal_index).first; while (c) { receivers += c->receiver ? 1 : 0; @@ -3009,7 +3011,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, if (type & Qt::UniqueConnection) { QObjectConnectionListVector *connectionLists = QObjectPrivate::get(s)->connectionLists; if (connectionLists && connectionLists->count() > signal_index) { - const QObjectPrivate::Connection *c2 = + const QObjectPrivate::Connection *c2 = (*connectionLists)[signal_index].first; while (c2) { @@ -3080,7 +3082,7 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, Same as the QMetaObject::disconnect, but \a signal_index must be the result of QObjectPrivate::signalIndex */ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, - const QObject *receiver, int method_index) + const QObject *receiver, int method_index) { if (!sender) return false; @@ -3103,7 +3105,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, if (signal_index < 0) { // remove from all connection lists for (signal_index = -1; signal_index < connectionLists->count(); ++signal_index) { - QObjectPrivate::Connection *c = + QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; while (c) { if (c->receiver @@ -3132,7 +3134,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index, } } } else if (signal_index < connectionLists->count()) { - QObjectPrivate::Connection *c = + QObjectPrivate::Connection *c = (*connectionLists)[signal_index].first; while (c) { if (c->receiver @@ -3489,7 +3491,8 @@ int QObjectPrivate::signalIndex(const char *signalName) const \a signal_index must be the index returned by QObjectPrivate::signalIndex; */ -bool QObjectPrivate::isSignalConnected(int signal_index) const { +bool QObjectPrivate::isSignalConnected(int signal_index) const +{ if (signal_index < (int)sizeof(connectedSignals) * 8 && !qt_signal_spy_callback_set.signal_begin_callback && !qt_signal_spy_callback_set.signal_end_callback) { @@ -3719,7 +3722,7 @@ void QObject::dumpObjectInfo() qDebug(" signal: %s", signal.signature()); // receivers - const QObjectPrivate::Connection *c = + const QObjectPrivate::Connection *c = d->connectionLists->at(signal_index).first; while (c) { if (!c->receiver) { diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index aa538bc..d85faee 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -381,7 +381,7 @@ inline QList<T> qFindChildren(const QObject *o, const QRegExp &re) #endif // Q_MOC_RUN -template <class T> inline const char * qobject_interface_iid() +template <class T> inline const char * qobject_interface_iid() { return 0; } template <class T> inline T qobject_cast_helper(QObject *object, T) @@ -465,7 +465,7 @@ inline T qobject_cast(const QObject *object) } -template <class T> inline const char * qobject_interface_iid() +template <class T> inline const char * qobject_interface_iid() { return 0; } #ifndef Q_MOC_RUN diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 421617a..3f990a3 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -150,6 +150,7 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} public: \ Q_OBJECT_CHECK \ static const QMetaObject staticMetaObject; \ + static const QMetaObject &getStaticMetaObject(); \ virtual const QMetaObject *metaObject() const; \ virtual void *qt_metacast(const char *); \ QT_TR_FUNCTIONS \ @@ -161,6 +162,7 @@ private: #define Q_GADGET \ public: \ static const QMetaObject staticMetaObject; \ + static const QMetaObject &getStaticMetaObject(); \ private: #else // Q_MOC_RUN #define slots slots @@ -444,9 +446,15 @@ struct Q_CORE_EXPORT QMetaObject }; +typedef const QMetaObject& (*QMetaObjectAccessor)(); + struct QMetaObjectExtraData { +#ifdef Q_NO_DATA_RELOCATION + const QMetaObjectAccessor *objects; +#else const QMetaObject **objects; +#endif int (*static_metacall)(QMetaObject::Call, int, void **); }; diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 3103ba1..2da768b 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -76,8 +76,8 @@ static TPtrC defaultFormatSpec(TExtendedLocale&) return TPtrC(KNullDesC); } -/*! - Definition of struct for mapping Symbian to ISO locale +/* + Definition of struct for mapping Symbian to ISO locale */ struct symbianToISO { int symbian_language; @@ -85,8 +85,8 @@ struct symbianToISO { }; -/*! - Mapping from Symbian to ISO locale +/* + Mapping from Symbian to ISO locale */ static const symbianToISO symbian_to_iso_list[] = { { ELangEnglish, "en_GB" }, diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index ef6cc39..5296bae 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -170,7 +170,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QScopedPointer::operator==(const QScopedPointer<T> &other) const + \fn bool QScopedPointer::operator==(const QScopedPointer<T, Cleanup> &other) const Equality operator. Returns true if the scoped pointer \a other is pointing to the same object as this pointer, otherwise returns false. @@ -178,7 +178,7 @@ QT_BEGIN_NAMESPACE /*! - \fn bool QScopedPointer::operator!=(const QScopedPointer<T> &other) const + \fn bool QScopedPointer::operator!=(const QScopedPointer<T, Cleanup> &other) const Inequality operator. Returns true if the scoped pointer \a other is not pointing to the same object as this pointer, otherwise returns false. diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 90ca34f..e4f7ba9 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -511,7 +511,7 @@ public: QWeakPointer<T> toWeakRef() const; protected: - inline QSharedPointer(Qt::Initialization i) : BaseClass(i) {} + inline explicit QSharedPointer(Qt::Initialization i) : BaseClass(i) {} public: static inline QSharedPointer<T> create() diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 5f64698..50644ff 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -990,6 +990,8 @@ QGraphicsOpacityEffect::~QGraphicsOpacityEffect() fully transparent and 1.0 is fully opaque. By default, the opacity is 0.7. + + \sa setOpacityMask() */ qreal QGraphicsOpacityEffect::opacity() const { @@ -1006,6 +1008,10 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity) return; d->opacity = opacity; + if ((d->isFullyTransparent = qFuzzyIsNull(d->opacity))) + d->isFullyOpaque = 0; + else + d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1); emit opacityChanged(opacity); } @@ -1017,6 +1023,45 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity) */ /*! + \property QGraphicsOpacityEffect::opacityMask + \brief the opacity mask of the effect. + + An opacity mask allows you apply opacity to portions of an element. + + For example: + + \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 2 + + There is no opacity mask by default. + + \sa setOpacity() +*/ +QBrush QGraphicsOpacityEffect::opacityMask() const +{ + Q_D(const QGraphicsOpacityEffect); + return d->opacityMask; +} + +void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask) +{ + Q_D(QGraphicsOpacityEffect); + if (d->opacityMask == mask) + return; + + d->opacityMask = mask; + d->hasOpacityMask = (mask.style() != Qt::NoBrush); + + emit opacityMaskChanged(mask); +} + +/*! + \fn void QGraphicsOpacityEffect::opacityMaskChanged(const QBrush &mask) + + This signal is emitted whenever the effect's opacity mask changes. + The \a mask parameter holds the effect's new opacity mask. +*/ + +/*! \reimp */ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) @@ -1024,11 +1069,11 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour Q_D(QGraphicsOpacityEffect); // Transparent; nothing to draw. - if (qFuzzyIsNull(d->opacity)) + if (d->isFullyTransparent) return; // Opaque; draw directly without going through a pixmap. - if (qFuzzyIsNull(d->opacity - 1)) { + if (d->isFullyOpaque && !d->hasOpacityMask) { source->draw(painter); return; } @@ -1039,13 +1084,55 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour QPoint offset; if (source->isPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); - painter->drawPixmap(offset, pixmap); + if (!d->hasOpacityMask) { + const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); + painter->drawPixmap(offset, pixmap); + } else { + QRectF srcBrect = source->boundingRect(); + QPixmap pixmap(srcBrect.size().toSize()); + pixmap.fill(Qt::transparent); + + QPainter pixmapPainter(&pixmap); + pixmapPainter.setRenderHints(painter->renderHints()); + pixmapPainter.translate(-srcBrect.topLeft()); + source->draw(&pixmapPainter); + pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); + pixmapPainter.fillRect(srcBrect, d->opacityMask); + pixmapPainter.end(); + + painter->drawPixmap(srcBrect.topLeft(), pixmap); + } } else { // Draw pixmap in device coordinates to avoid pixmap scaling; - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); - painter->setWorldTransform(QTransform()); - painter->drawPixmap(offset, pixmap); + if (!d->hasOpacityMask) { + const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + painter->setWorldTransform(QTransform()); + painter->drawPixmap(offset, pixmap); + } else { + QTransform worldTransform = painter->worldTransform(); + + // Calculate source bounding rect in logical and device coordinates. + QRectF srcBrect = source->boundingRect(); + QRect srcDeviceBrect = worldTransform.mapRect(srcBrect).toAlignedRect(); + srcDeviceBrect &= source->deviceRect(); + + offset = srcDeviceBrect.topLeft(); + worldTransform *= QTransform::fromTranslate(-srcDeviceBrect.x(), -srcDeviceBrect.y()); + + QPixmap pixmap(srcDeviceBrect.size()); + pixmap.fill(Qt::transparent); + + QPainter pixmapPainter(&pixmap); + pixmapPainter.setRenderHints(painter->renderHints()); + pixmapPainter.setWorldTransform(worldTransform); + source->draw(&pixmapPainter); + pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); + pixmapPainter.fillRect(srcBrect, d->opacityMask); + pixmapPainter.end(); + + painter->setWorldTransform(QTransform()); + painter->drawPixmap(offset, pixmap); + } } painter->restore(); diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index fef6531..a53357b 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -46,6 +46,7 @@ #include <QtCore/qpoint.h> #include <QtCore/qrect.h> #include <QtGui/qcolor.h> +#include <QtGui/qbrush.h> QT_BEGIN_HEADER @@ -274,17 +275,21 @@ class Q_GUI_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(int opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + Q_PROPERTY(QBrush opacityMask READ opacityMask WRITE setOpacityMask NOTIFY opacityMaskChanged) public: QGraphicsOpacityEffect(QObject *parent = 0); ~QGraphicsOpacityEffect(); qreal opacity() const; + QBrush opacityMask() const; public Q_SLOTS: void setOpacity(qreal opacity); + void setOpacityMask(const QBrush &mask); Q_SIGNALS: void opacityChanged(qreal opacity); + void opacityMaskChanged(const QBrush &mask); protected: void draw(QPainter *painter, QGraphicsEffectSource *source); diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 6ce5cda..c902b67 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -164,10 +164,15 @@ class QGraphicsOpacityEffectPrivate : public QGraphicsEffectPrivate { Q_DECLARE_PUBLIC(QGraphicsOpacityEffect) public: - QGraphicsOpacityEffectPrivate() : opacity(qreal(0.7)) {} + QGraphicsOpacityEffectPrivate() + : opacity(qreal(0.7)), isFullyTransparent(0), isFullyOpaque(0), hasOpacityMask(0) {} ~QGraphicsOpacityEffectPrivate() {} qreal opacity; + QBrush opacityMask; + uint isFullyTransparent : 1; + uint isFullyOpaque : 1; + uint hasOpacityMask : 1; }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 8860677..765f76b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10270,10 +10270,8 @@ void QGraphicsItemEffectSourcePrivate::draw(QPainter *painter) info->widget, info->opacity, info->effectTransform, info->wasDirtySceneTransform, info->drawItem); } else { - QTransform effectTransform = painter->worldTransform(); - effectTransform *= info->painter->worldTransform().inverted(); - if (info->effectTransform) - effectTransform *= *info->effectTransform; + QTransform effectTransform = info->painter->worldTransform().inverted(); + effectTransform *= painter->worldTransform(); scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion, info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform, info->drawItem); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7dbc996..7fd471b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -673,8 +673,8 @@ void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDyin if (focusItem && popupWidgets.isEmpty()) { QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); sendEvent(focusItem, &event); - } else { - ungrabKeyboard((QGraphicsItem *)widget, itemIsDying); + } else if (keyboardGrabberItems.contains(static_cast<QGraphicsItem *>(widget))) { + ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying); } if (!itemIsDying && widget->isVisible()) { widget->hide(); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 658b8e0..155474f 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -322,6 +322,8 @@ QPixmap::QPixmap(const char * const xpm[]) QPixmap::~QPixmap() { + if (data->is_cached && data->ref == 1) + QImagePixmapCleanupHooks::executePixmapHooks(this); } /*! diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 9626193..8d98223 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1080,8 +1080,17 @@ Qt::FocusReason QFocusEvent::reason() const rect() that is the bounding rectangle of that region. Both are provided because many widgets can't make much use of region(), and rect() can be much faster than region().boundingRect(). + + \section1 Automatic Clipping + Painting is clipped to region() during the processing of a paint - event. + event. This clipping is performed by Qt's paint system and is + independent of any clipping that may be applied to a QPainter used to + draw on the paint device. + + As a result, the value returned by QPainter::clipRegion() on + a newly-constructed QPainter will not reflect the clip region that is + used by the paint system. \sa QPainter, QWidget::update(), QWidget::repaint(), QWidget::paintEvent() diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index fb5f934..38b09ee 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11846,10 +11846,9 @@ const QList<QAction*>& QWidget::softKeys() const \preliminary \since 4.6 - Sets the softkey \a softkey to this widget's list of softkeys, + Sets the softkey \a softKey to this widget's list of softkeys. Setting 0 as softkey will clear all the existing softkeys set - to the widget - A QWidget can have 0 or more softkeys + to the widget. A QWidget can have 0 or more softkeys. \sa softKeys(), setSoftKeys() */ @@ -11866,8 +11865,8 @@ void QWidget::setSoftKey(QAction *softKey) } /*! - Sets the list of softkeys \a softkeys to this widget's list of softkeys, - A QWidget can have 0 or more softkeys + Sets the list of softkeys \a softKeys to this widget's list of softkeys. + A QWidget can have 0 or more softkeys. \sa softKeys(), setSoftKey() */ diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 36ffcbe..eb87052 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -1450,7 +1450,7 @@ static const qreal inv_dist_to_plane = 1. / 1024.; value of 1024 corresponds to the projection factor used by QTransform::rotate() for the x and y axes. - If \a distToPlane is zero, then the returned QTransform + If \a distanceToPlane is zero, then the returned QTransform is formed by simply dropping the third row and third column of the QMatrix4x4. This is suitable for implementing orthographic projections where the z co-ordinate should diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b05a1e9..12d4948 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -67,6 +67,7 @@ #include "qtoolbar.h" #include "qtoolbutton.h" #include "qtreeview.h" +#include "qfocusframe.h" #include "private/qtoolbarextension_p.h" #include "private/qcombobox_p.h" @@ -86,6 +87,8 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl static const QByteArray propertyKeyLayouts = "layouts"; static const QByteArray propertyKeyCurrentlayout = "currentlayout"; +static const qreal goldenRatio = 1.618; + const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** {240,320,1,14,true,"QVGA Landscape Mirrored"}, @@ -508,11 +511,6 @@ void QS60StylePrivate::deleteBackground() } } -int QS60StylePrivate::focusRectPenWidth() -{ - return pixelMetric(QS60Style::PM_DefaultFrameWidth); -} - void QS60StylePrivate::setCurrentLayout(int index) { m_pmPointer = data[index]; @@ -950,13 +948,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElements handleElement = horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags); - - if (optionSlider->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*optionSlider); - fropt.rect = subElementRect(SE_SliderFocusRect, optionSlider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } break; #endif // QT_NO_SLIDER @@ -991,17 +982,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom drawPrimitive(PE_IndicatorSpinDown, &buttonOption, painter, widget); painter->restore(); } - - if (cmb->subControls & SC_ComboBoxEditField) { - if (cmb->state & State_HasFocus && !cmb->editable) { - QStyleOptionFocusRect focus; - focus.QStyleOption::operator=(*cmb); - focus.rect = cmbxEditField; - focus.state |= State_FocusAtBorder; - focus.backgroundColor = cmb->palette.highlight().color(); - drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); - } - } } break; #endif // QT_NO_COMBOBOX @@ -1079,13 +1059,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } } } - if (toolBtn->state & State_HasFocus) { - QStyleOptionFocusRect fr; - fr.QStyleOption::operator=(*toolBtn); - const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget); - fr.rect.adjust(frameWidth, frameWidth, -frameWidth, -frameWidth); - drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); - } if (toolBtn->features & QStyleOptionToolButton::Arrow) { QStyle::PrimitiveElement pe; @@ -1209,13 +1182,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom groupBox->palette, groupBox->state & State_Enabled, groupBox->text, textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); painter->restore(); - - if (groupBox->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*groupBox); - fropt.rect = textRect; - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } // Draw checkbox @@ -1249,12 +1215,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); drawControl(CE_PushButtonLabel, &subopt, painter, widget); - if (btn->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*btn); - fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } } break; case CE_PushButtonBevel: @@ -1612,18 +1572,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (verticalTabs) painter->restore(); - if (optionTab.state & State_HasFocus) { - const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - const int leftBorder = optionTab.rect.left(); - const int rightBorder = optionTab.rect.right() - 1; - - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(leftBorder + 1 + OFFSET, optionTab.rect.y() + OFFSET, - rightBorder - leftBorder - 2*OFFSET, optionTab.rect.height() - 2*OFFSET); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - painter->restore(); } break; @@ -1875,11 +1823,48 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else if (qobject_cast<const QFrame *>(widget)) { QCommonStyle::drawControl(element, option, painter, widget); } - if (option->state & State_HasFocus) - drawPrimitive(PE_FrameFocusRect, option, painter, widget); break; case CE_MenuScroller: break; + case CE_FocusFrame: + { + // The pen width should nearly fill the layoutspacings around the widget + const int penWidth = + qMin(pixelMetric(QS60Style::PM_LayoutVerticalSpacing), pixelMetric(QS60Style::PM_LayoutHorizontalSpacing)) + - 2; // But keep 1 pixel distance to the focus widget and 1 pixel to the adjacent widgets + +#ifdef QT_KEYPAD_NAVIGATION + bool editFocus = false; + if (const QFocusFrame *focusFrame = qobject_cast<const QFocusFrame*>(widget)) { + if (focusFrame->widget() && focusFrame->widget()->hasEditFocus()) + editFocus = true; + } + const qreal opacity = editFocus ? 0.65 : 0.45; // Trial and error factors. Feel free to improve. +#else + const qreal opacity = 0.5; +#endif + // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. + const qreal rectAdjustment = (penWidth % 2) ? -.5 : 0; + + // Make sure that the pen stroke is inside the rect + const QRectF adjustedRect = + QRectF(option->rect).adjusted( + rectAdjustment + penWidth, + rectAdjustment + penWidth, + -rectAdjustment - penWidth, + -rectAdjustment - penWidth + ); + + const qreal roundRectRadius = penWidth * goldenRatio; + + painter->save(); + painter->setRenderHint(QPainter::Antialiasing); + painter->setOpacity(opacity); + painter->setPen(QPen(option->palette.color(QPalette::Highlight), penWidth)); + painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); + painter->restore(); + } + break; default: QCommonStyle::drawControl(element, option, painter, widget); } @@ -1901,9 +1886,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, painter, option->rect, flags); - - if (lineEdit->state & State_HasFocus) - drawPrimitive(PE_FrameFocusRect, lineEdit, painter, widget); } break; #endif // QT_NO_LINEEDIT @@ -2030,50 +2012,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_COMBOBOX break; #endif //QT_NO_SPINBOX - case PE_FrameFocusRect: -// Calendar widget and combox both do not use styled itemDelegate - if (widget && !(false -#ifndef QT_NO_CALENDARWIDGET - || qobject_cast<const QCalendarWidget *>(widget->parent()) -#endif //QT_NO_CALENDARWIDGET -#ifndef QT_NO_COMBOBOX - || qobject_cast<const QComboBoxListView *>(widget) -#endif //QT_NO_COMBOBOX - )) { - // no focus selection for touch - if (option->state & State_HasFocus && !QS60StylePrivate::isTouchSupported()) { - painter->save(); - const int penWidth = QS60StylePrivate::focusRectPenWidth(); -#ifdef QT_KEYPAD_NAVIGATION - const Qt::PenStyle penStyle = widget->hasEditFocus() ? Qt::SolidLine :Qt::DashLine; - const qreal opacity = widget->hasEditFocus() ? 0.6 : 0.4; -#else - const Qt::PenStyle penStyle = Qt::SolidLine; - const qreal opacity = 0.5; -#endif - painter->setRenderHint(QPainter::Antialiasing); - painter->setOpacity(opacity); - // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. - const qreal rectAdjustment = penWidth % 2?.5:0; - // Also we try to stay inside the option->rect, with penWidth > 1. Therefore these +1/-1 - const QRectF adjustedRect = QRectF(option->rect).adjusted( - rectAdjustment + penWidth - 1, - rectAdjustment + penWidth - 1, - -rectAdjustment - penWidth + 1, - -rectAdjustment - penWidth + 1); - const qreal roundRectRadius = penWidth * 1.5; -#ifdef QT_KEYPAD_NAVIGATION - if (penStyle != Qt::SolidLine) { - painter->setPen(QPen(option->palette.color(QPalette::HighlightedText), penWidth, Qt::SolidLine)); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); - } -#endif - painter->setPen(QPen((option->palette.color(QPalette::Text), penWidth, penStyle))); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); - painter->restore(); - } - } - break; case PE_Widget: if (QS60StylePrivate::drawsOwnThemeBackground(widget) #ifndef QT_NO_COMBOBOX @@ -2118,8 +2056,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti Q_ASSERT(false); break; case PE_Frame: - if (const QStyleOptionFrameV3 *frame = qstyleoption_cast<const QStyleOptionFrameV3 *>(option)) - drawPrimitive(PE_FrameFocusRect, frame, painter, widget); break; #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewItem: @@ -2668,16 +2604,6 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } ret = visualRect(opt->direction, opt->rect, ret); break; - case SE_FrameContents: - if (QS60StylePrivate::isTouchSupported()) { - return QCommonStyle::subElementRect(element, opt, widget); - } else if (const QStyleOptionFrameV2 *f = qstyleoption_cast<const QStyleOptionFrameV2 *>(opt)) { - // We shrink the frame contents by focusFrameWidth, so that we can draw the frame around it in keypad navigation mode. - const int frameWidth = QS60StylePrivate::focusRectPenWidth(); - ret = opt->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); - ret = visualRect(opt->direction, opt->rect, ret); - } - break; default: ret = QCommonStyle::subElementRect(element, opt, widget); } @@ -2778,6 +2704,38 @@ QVariant QS60Style::styleProperty(const char *name) const return d->styleProperty_specific(name); } +bool QS60Style::event(QEvent *e) +{ +#ifdef QT_KEYPAD_NAVIGATION + if (QS60StylePrivate::isTouchSupported()) + return false; + Q_D(QS60Style); + switch (e->type()) { + case QEvent::FocusIn: + if (QWidget *focusWidget = QApplication::focusWidget()) { + if (!d->m_focusFrame) + d->m_focusFrame = new QFocusFrame(focusWidget); + d->m_focusFrame->setWidget(focusWidget); + } else if (d->m_focusFrame) { + d->m_focusFrame->setWidget(0); + } + break; + case QEvent::FocusOut: + if (d->m_focusFrame) + d->m_focusFrame->setWidget(0); + break; + case QEvent::EnterEditFocus: + case QEvent::LeaveEditFocus: + if (d->m_focusFrame) + d->m_focusFrame->update(); + break; + default: + break; + } +#endif + return false; +} + QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index a03803b..c01c40a 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -80,6 +80,8 @@ public: void setStyleProperty(const char *name, const QVariant &value); QVariant styleProperty(const char *name) const; + bool event(QEvent *e); + #ifndef Q_WS_S60 static QStringList partKeys(); static QStringList colorListKeys(); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 2e661c0..ed0abfa 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -292,6 +292,8 @@ public: }; }; +class QFocusFrame; + // Private class #ifdef Q_OS_SYMBIAN NONSHARABLE_CLASS (QS60StylePrivate) @@ -430,8 +432,6 @@ public: //access to theme palette static QPalette* themePalette(); - static int focusRectPenWidth(); - static const layoutHeader m_layoutHeaders[]; static const short data[][MAX_PIXELMETRICS]; @@ -499,6 +499,8 @@ private: // defined theme palette static QPalette *m_themePalette; QPalette m_originalPalette; + + QPointer<QFocusFrame> m_focusFrame; }; QT_END_NAMESPACE diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index bc218cd..1cf47cc 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1350,9 +1350,6 @@ void QS60StyleModeSpecifics::colorGroupAndIndex( } } -/*! - Constructs a QS60Style object. -*/ QS60Style::QS60Style() : QCommonStyle(*new QS60StylePrivate) { diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 7acb3a6..da71ced 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -214,6 +214,7 @@ enum PseudoElement { PseudoElement_ViewItemText, PseudoElement_ViewItemIndicator, PseudoElement_ScrollAreaCorner, + PseudoElement_TabBarTabCloseButton, NumPseudoElements }; @@ -223,7 +224,7 @@ struct PseudoElementInfo { }; static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = { - { QStyle::SC_None, "", }, + { QStyle::SC_None, "" }, { QStyle::SC_None, "down-arrow" }, { QStyle::SC_None, "up-arrow" }, { QStyle::SC_None, "left-arrow" }, @@ -300,8 +301,9 @@ static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = { { QStyle::SC_None, "item" }, { QStyle::SC_None, "icon" }, { QStyle::SC_None, "text" }, - { QStyle::SC_None, "indicator" } , - { QStyle::SC_None, "corner" } + { QStyle::SC_None, "indicator" }, + { QStyle::SC_None, "corner" }, + { QStyle::SC_None, "close-button" }, }; @@ -4370,6 +4372,12 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op case PE_IndicatorSpinPlus: pseudoElement = PseudoElement_SpinBoxUpArrow; break; +#ifndef QT_NO_TABBAR + case PE_IndicatorTabClose: + if (w) + w = w->parentWidget(); //match on the QTabBar instead of the CloseButton + pseudoElement = PseudoElement_TabBarTabCloseButton; +#endif default: break; @@ -5104,6 +5112,18 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi #endif // QT_NO_TABWIDGET s = QLatin1String("alignment"); break; +#ifndef QT_NO_TABBAR + case SH_TabBar_CloseButtonPosition: + rule = renderRule(w, opt, PseudoElement_TabBarTabCloseButton); + if (rule.hasPosition()) { + Qt::Alignment align = rule.position()->position; + if (align & Qt::AlignLeft || align & Qt::AlignTop) + return QTabBar::LeftSide; + if (align & Qt::AlignRight || align & Qt::AlignBottom) + return QTabBar::RightSide; + } + break; +#endif case SH_TabBar_ElideMode: s = QLatin1String("tabbar-elide-mode"); break; case SH_TabBar_PreferNoArrows: s = QLatin1String("tabbar-prefer-no-arrows"); break; case SH_ComboBox_PopupFrameStyle: diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 058041b..fe90010 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -126,8 +126,13 @@ QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() } QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation() { - qDeleteAll(m_extensions); - // TODO m_store cleanup removed because it was crashing + typedef QHash<QString, const QFontEngineS60Extensions *>::iterator iterator; + for (iterator p = m_extensions.begin(); p != m_extensions.end(); ++p) { + m_store->ReleaseFont((*p)->fontOwner()); + delete *p; + } + + delete m_store; m_heap->Close(); } @@ -140,7 +145,7 @@ const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(c const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, spec); Q_ASSERT(err == KErrNone && font); CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font); - m_extensions.insert(typeface, new QFontEngineS60Extensions(bitmapFont->OpenFont())); + m_extensions.insert(typeface, new QFontEngineS60Extensions(font, bitmapFont->OpenFont())); } return m_extensions.value(typeface); } diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index eba21e8..ed6b1c1 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -54,10 +54,11 @@ QT_BEGIN_NAMESPACE -QFontEngineS60Extensions::QFontEngineS60Extensions(COpenFont *font) +QFontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font) : m_font(font) , m_cmap(0) , m_symbolCMap(false) + , m_fontOwner(fontOwner) { TAny *shapingExtension = NULL; m_font->ExtendedInterface(KUidOpenFontShapingExtension, shapingExtension); @@ -109,6 +110,12 @@ QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const return result; } +CFont *QFontEngineS60Extensions::fontOwner() const +{ + return m_fontOwner; +} + + // duplicated from qfontengine_xyz.cpp static inline unsigned int getChar(const QChar *str, int &i, const int len) { diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index 0c1be8c..bbbc3d6 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -69,11 +69,12 @@ QT_BEGIN_NAMESPACE class QFontEngineS60Extensions { public: - QFontEngineS60Extensions(COpenFont *font); + QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font); QByteArray getSfntTable(uint tag) const; const unsigned char *cmap() const; QPainterPath glyphOutline(glyph_t glyph) const; + CFont *fontOwner() const; private: COpenFont *m_font; @@ -82,6 +83,7 @@ private: mutable const unsigned char *m_cmap; mutable bool m_symbolCMap; mutable QByteArray m_cmapTable; + CFont* m_fontOwner; }; class QFontEngineS60 : public QFontEngine diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index cc9b014..f2aabd2 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -219,6 +219,11 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) pex->transferMode(BrushDrawingMode); +#ifndef QT_OPENGL_ES_2 + if (pex->inRenderText) + glPushAttrib(GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_SCISSOR_BIT); +#endif + glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); @@ -268,6 +273,11 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glViewport(0, 0, pex->width, pex->height); pex->updateDepthScissorTest(); + +#ifndef QT_OPENGL_ES_2 + if (pex->inRenderText) + glPopAttrib(); +#endif } void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) @@ -836,6 +846,11 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) glEnable(GL_STENCIL_TEST); prepareForDraw(currentBrush->isOpaque()); + +#ifndef QT_OPENGL_ES_2 + if (inRenderText) + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); +#endif composite(vertexCoordinateArray.boundingRect()); glDisable(GL_STENCIL_TEST); @@ -873,9 +888,21 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d glDisable(GL_BLEND); +#ifndef QT_OPENGL_ES_2 + if (inRenderText) { + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_DEPTH_TEST); + } +#endif + // Draw the vertecies into the stencil buffer: drawVertexArrays(vertexArray, GL_TRIANGLE_FAN); +#ifndef QT_OPENGL_ES_2 + if (inRenderText) + glPopAttrib(); +#endif + // Enable color writes & disable stencil writes glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } @@ -981,9 +1008,19 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(QGL2PEXVertexArray& vertexArray, glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR); } - - - +float QGL2PaintEngineExPrivate::zValueForRenderText() const +{ +#ifndef QT_OPENGL_ES_2 + // Get the z translation value from the model view matrix and + // transform it using the ortogonal projection with z-near = 0, + // and z-far = 1, which is used in QGLWidget::renderText() + GLdouble model[4][4]; + glGetDoublev(GL_MODELVIEW_MATRIX, &model[0][0]); + return -2 * model[3][2] - 1; +#else + return 0; +#endif +} /////////////////////////////////// Public Methods ////////////////////////////////////////// @@ -1002,8 +1039,8 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) if (brush.style() == Qt::NoBrush) return; - - ensureActive(); + if (!d->inRenderText) + ensureActive(); d->setBrush(&brush); d->fill(path); d->setBrush(&(state()->brush)); // reset back to the state's brush @@ -1104,7 +1141,9 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c QGLContext *ctx = d->ctx; glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); QGLTexture *texture = - ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption + | QGLContext::CanFlipNativePixmapBindOption); GLfloat top = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.top()) : src.top(); GLfloat bottom = texture->options & QGLContext::InvertedYBindOption ? (pixmap.height() - src.bottom()) : src.bottom(); @@ -1154,7 +1193,8 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem { Q_D(QGL2PaintEngineEx); - ensureActive(); + if (!d->inRenderText) + ensureActive(); QOpenGL2PaintEngineState *s = state(); const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); @@ -1203,6 +1243,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte if (cache->width() == 0 || cache->height() == 0) return; + if (inRenderText) + transferMode(BrushDrawingMode); transferMode(TextDrawingMode); if (glyphType == QFontEngineGlyphCache::Raster_A8) @@ -1241,6 +1283,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte prepareForDraw(false); // Text always causes src pixels to be transparent +#ifndef QT_OPENGL_ES_2 + if (inRenderText) + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), zValueForRenderText()); +#endif + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT); if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr) @@ -1286,12 +1333,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) glViewport(0, 0, d->width, d->height); -// glClearColor(0.0, 1.0, 0.0, 1.0); -// glClear(GL_COLOR_BUFFER_BIT); -// d->ctx->swapBuffers(); -// qDebug("You should see green now"); -// sleep(5); - d->brushTextureDirty = true; d->brushUniformsDirty = true; d->matrixDirty = true; @@ -1304,10 +1345,12 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->use_system_clip = !systemClip().isEmpty(); - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDepthFunc(GL_LEQUAL); - glDepthMask(false); + if (!d->inRenderText) { + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDepthFunc(GL_LEQUAL); + glDepthMask(false); + } #if !defined(QT_OPENGL_ES_2) glDisable(GL_MULTISAMPLE); @@ -1612,7 +1655,11 @@ void QGL2PaintEngineExPrivate::regenerateDepthClip() void QGL2PaintEngineExPrivate::systemStateChanged() { Q_Q(QGL2PaintEngineEx); - use_system_clip = !systemClip.isEmpty(); + + if (q->paintDevice()->devType() == QInternal::Widget) + use_system_clip = false; + else + use_system_clip = !systemClip.isEmpty(); glDisable(GL_DEPTH_TEST); q->state()->depthTestEnabled = false; @@ -1728,6 +1775,12 @@ QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const return s; } +void QGL2PaintEngineEx::setRenderTextActive(bool active) +{ + Q_D(QGL2PaintEngineEx); + d->inRenderText = active; +} + QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other) : QPainterState(other) { diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 66e7a51..68447bc 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -141,6 +141,8 @@ public: QPixmapFilter *createPixmapFilter(int type) const; + void setRenderTextActive(bool); + private: Q_DISABLE_COPY(QGL2PaintEngineEx) }; @@ -156,7 +158,8 @@ public: ctx(0), currentBrush(0), inverseScale(1), - shaderManager(0) + shaderManager(0), + inRenderText(false) { } ~QGL2PaintEngineExPrivate(); @@ -191,6 +194,8 @@ public: inline void useSimpleShader(); inline QColor premultiplyColor(QColor c, GLfloat opacity); + float zValueForRenderText() const; + QGL2PaintEngineEx* q; QGLDrawable drawable; int width, height; @@ -240,6 +245,7 @@ public: GLuint lastTexture; bool needsSync; + bool inRenderText; }; QT_END_NAMESPACE diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 02991d9..f3265b4 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1607,7 +1607,13 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() would mirror the image and automatically generate mipmaps. This option helps preserve this default behavior. - \omitvalue MemoryManagedBindOption + \omitvalue CanFlipNativePixmapBindOption Used by x11 from pixmap to choose + wether or not it can bind the pixmap upside down or not. + + \omitvalue MemoryManagedBindOption Used by paint engines to + indicate that the pixmap should be memory managed along side with + the pixmap/image that it stems from, e.g. installing destruction + hooks in them. \omitvalue InternalBindOption */ @@ -1666,7 +1672,6 @@ QGLContext::QGLContext(const QGLFormat &format) QGLContext::~QGLContext() { - Q_D(QGLContext); // remove any textures cached in this context QGLTextureCache::instance()->removeContextTextures(this); QGLTextureCache::deleteIfEmpty(); // ### thread safety @@ -2179,6 +2184,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format) The \a format parameter sets the internal format for the texture. The default format is \c GL_RGBA. + The binding \a options are a set of options used to decide how to + bind the texture to the context. + The texture that is generated is cached, so multiple calls to bindTexture() with the same QImage will return the same texture id. @@ -2229,7 +2237,7 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma \overload Generates and binds a 2D GL texture to the current context, based - on \a image. + on \a pixmap. */ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options) { @@ -4070,6 +4078,10 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, bool auto_swap = autoBufferSwap(); QPaintEngine *engine = paintEngine(); +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(true); +#endif QPainter *p; bool reuse_painter = false; if (engine->isActive()) { @@ -4095,6 +4107,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, setAutoBufferSwap(false); // disable glClear() as a result of QPainter::begin() d->glcx->d_func()->clear_on_painter_begin = false; + if (engine->type() == QPaintEngine::OpenGL2) { + qt_save_gl_state(); +#ifndef QT_OPENGL_ES_2 + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +#endif + } p = new QPainter(this); } @@ -4118,7 +4137,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, delete p; setAutoBufferSwap(auto_swap); d->glcx->d_func()->clear_on_painter_begin = true; + if (engine->type() == QPaintEngine::OpenGL2) + qt_restore_gl_state(); } +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(false); +#endif } /*! \overload @@ -4151,6 +4176,10 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con win_y = height - win_y; // y is inverted QPaintEngine *engine = paintEngine(); +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(true); +#endif QPainter *p; bool reuse_painter = false; #ifndef QT_OPENGL_ES @@ -4169,6 +4198,8 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con setAutoBufferSwap(false); // disable glClear() as a result of QPainter::begin() d->glcx->d_func()->clear_on_painter_begin = false; + if (engine->type() == QPaintEngine::OpenGL2) + qt_save_gl_state(); p = new QPainter(this); } @@ -4207,9 +4238,15 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con } else { p->end(); delete p; + if (engine->type() == QPaintEngine::OpenGL2) + qt_restore_gl_state(); setAutoBufferSwap(auto_swap); d->glcx->d_func()->clear_on_painter_begin = true; } +#ifndef QT_OPENGL_ES + if (engine->type() == QPaintEngine::OpenGL2) + static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(false); +#endif } QGLFormat QGLWidget::format() const @@ -4254,8 +4291,12 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format) return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption); } +/*! + \overload - + The binding \a options are a set of options used to decide how to + bind the texture to the context. + */ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) { Q_D(QGLWidget); @@ -4291,6 +4332,15 @@ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); } +/*! + \overload + + Generates and binds a 2D GL texture to the current context, based + on \a pixmap. The generated texture id is returned and can be used in + + The binding \a options are a set of options used to decide how to + bind the texture to the context. + */ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { @@ -4427,10 +4477,10 @@ QPaintEngine *QGLWidget::paintEngine() const #elif defined(QT_OPENGL_ES_2) return qt_gl_2_engine(); #else - if (!qt_gl_preferGL2Engine()) - return qt_gl_engine(); - else + if (qt_gl_preferGL2Engine()) return qt_gl_2_engine(); + else + return qt_gl_engine(); #endif } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 13ad668..96a8b08 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -289,16 +289,20 @@ public: virtual void swapBuffers() const; enum BindOption { - NoBindOption = 0x0000, - InvertedYBindOption = 0x0001, - MipmapBindOption = 0x0002, - PremultipliedAlphaBindOption = 0x0004, - LinearFilteringBindOption = 0x0008, - - MemoryManagedBindOption = 0x1000, // internal flag - - DefaultBindOption = LinearFilteringBindOption | InvertedYBindOption | MipmapBindOption, - InternalBindOption = MemoryManagedBindOption | PremultipliedAlphaBindOption + NoBindOption = 0x0000, + InvertedYBindOption = 0x0001, + MipmapBindOption = 0x0002, + PremultipliedAlphaBindOption = 0x0004, + LinearFilteringBindOption = 0x0008, + + MemoryManagedBindOption = 0x0010, // internal flag + CanFlipNativePixmapBindOption = 0x0020, // internal flag + + DefaultBindOption = LinearFilteringBindOption + | InvertedYBindOption + | MipmapBindOption, + InternalBindOption = MemoryManagedBindOption + | PremultipliedAlphaBindOption }; Q_DECLARE_FLAGS(BindOptions, BindOption) @@ -407,6 +411,7 @@ private: Q_DISABLE_COPY(QGLContext) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions); class Q_OPENGL_EXPORT QGLWidget : public QWidget { diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index aca60bc..a34ea37 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1633,7 +1633,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, // QGLContext::bindTexture() can't return an inverted texture, but QPainter::drawPixmap() can: - GLX_Y_INVERTED_EXT, options & QGLContext::InvertedYBindOption ? GLX_DONT_CARE : False, + GLX_Y_INVERTED_EXT, options & QGLContext::CanFlipNativePixmapBindOption ? GLX_DONT_CARE : False, XNone }; configList = glXChooseFBConfig(x11Info.display(), x11Info.screen(), configAttribs, &configCount); @@ -1694,8 +1694,9 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con glBindTexture(GL_TEXTURE_2D, textureId); - if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))); + if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))) options &= ~QGLContext::InvertedYBindOption; + QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); if (texture->options & QGLContext::InvertedYBindOption) pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index b982a19..f40cdc9 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -490,12 +490,13 @@ void QGLWidgetPrivate::recreateEglSurface(bool force) } -QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, const qint64 key, bool canInvert) +QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, const qint64 key, + QGLContext::BindOptions options) { Q_Q(QGLContext); // The EGL texture_from_pixmap has no facility to invert the y coordinate - if (!canInvert) + if (!(options & QGLContext::CanFlipNativePixmapBindOption)) return 0; Q_ASSERT(pd->classId() == QPixmapData::X11Class); @@ -623,7 +624,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData* pd, cons return 0; } - QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, canInvert, true); + // Always inverted because the opposite is not supported... + options |= QGLContext::InvertedYBindOption; + + QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 52363cb..2b38e3d 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -516,12 +516,12 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At framebuffer objects more portable. \endlist + When using a QPainter to paint to a QGLFramebufferObject you should take + care that the QGLFramebufferObject is created with the CombinedDepthStencil + attachment for QPainter to be able to render correctly. Note that you need to create a QGLFramebufferObject with more than one sample per pixel for primitives to be antialiased when drawing using a - QPainter, unless if the QPainter::HighQualityAntialiasing render hint is - set. The QPainter::HighQualityAntialiasing render hint will enable - antialiasing as long as the \c{GL_ARB_fragment_program} extension is - present. To create a multisample framebuffer object you should use one of + QPainter. To create a multisample framebuffer object you should use one of the constructors that take a QGLFramebufferObject parameter, and set the QGLFramebufferObject::samples() property to a non-zero value. @@ -896,7 +896,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const return qt_buffer_2_engine(); #else Q_D(const QGLFramebufferObject); - if (d->ctx->d_func()->internal_context || qt_gl_preferGL2Engine()) + if (qt_gl_preferGL2Engine()) return qt_buffer_2_engine(); else return qt_buffer_engine(); diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp index fab1237..e8f4a27 100644 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp @@ -50,6 +50,7 @@ EXPORT_C QString localizedDirectoryName(QString& rawPath) { QString ret; + std::exception dummy; // voodoo fix for "Undefined symbol typeinfo for std::exception" in armv5 build TRAPD(err, QT_TRYCATCH_LEAVING( diff --git a/src/s60installs/qt_libs.pro b/src/s60installs/s60installs.pro index f24a03f..0314958 100644 --- a/src/s60installs/qt_libs.pro +++ b/src/s60installs/s60installs.pro @@ -5,7 +5,8 @@ symbian: { load(data_caging_paths) SUBDIRS= - TARGET = "QtLibs pre-release" + # WARNING: Changing TARGET name will break Symbian SISX upgrade functionality + TARGET = "Qt for S60" TARGET.UID3 = 0x2001E61C VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index e59b773..890ed9d 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -50,6 +50,9 @@ #include <QtCore/qmetaobject.h> #include "CodeBlock.h" #include "JSFunction.h" +#if ENABLE(JIT) +#include "MacroAssemblerCodeRef.h" +#endif QT_BEGIN_NAMESPACE @@ -154,7 +157,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte lineNumber = -1; columnNumber = -1; - const JSC::ExecState *frame = QScriptEnginePrivate::frameForContext(context); + JSC::CallFrame *frame = const_cast<JSC::CallFrame *>(QScriptEnginePrivate::frameForContext(context)); // Get the line number: @@ -171,8 +174,13 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte JSC::Instruction *returnPC = aboveFrame->returnPC(); JSC::CodeBlock *codeBlock = frame->codeBlock(); if (returnPC && codeBlock) { - lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), - returnPC - codeBlock->instructions().begin() -1); +#if ENABLE(JIT) + unsigned bytecodeOffset = codeBlock->getBytecodeIndex(frame, JSC::ReturnAddressPtr(returnPC)); +#else + unsigned bytecodeOffset = returnPC - codeBlock->instructions().begin(); +#endif + bytecodeOffset--; //because returnPC is on the next instruction. We want the current one + lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), bytecodeOffset); } } } else { diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 596fd8f..46c6abb 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2259,8 +2259,11 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV if (calledAsConstructor) flags |= CalledAsConstructorContext; + //build a frame JSC::CallFrame *newCallFrame = exec; - if (callee == 0 || !(exec->callee() == callee && exec->returnPC() != 0)) { + if (callee == 0 //called from public QScriptEngine::pushContext + || exec->returnPC() == 0 || (contextFlags(exec) & NativeContext) //called from native-native call + || (exec->codeBlock() && exec->callee() != callee)) { //the interpreter did not build a frame for us. //We need to check if the Interpreter might have already created a frame for function called from JS. JSC::Interpreter *interp = exec->interpreter(); JSC::Register *oldEnd = interp->registerFile().end(); @@ -2278,6 +2281,9 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV newCallFrame->init(0, /*vPC=*/0, exec->scopeChain(), exec, flags, argc, callee); } else { setContextFlags(newCallFrame, flags); +#if ENABLE(JIT) + exec->registers()[JSC::RegisterFile::Callee] = JSC::JSValue(callee); //JIT let the callee set the 'callee' +#endif if (calledAsConstructor) { //update the new created this JSC::Register* thisRegister = newCallFrame->registers() - JSC::RegisterFile::CallFrameHeaderSize - newCallFrame->argumentCount(); @@ -3783,4 +3789,15 @@ QScriptSyntaxCheckResult &QScriptSyntaxCheckResult::operator=(const QScriptSynta return *this; } +#ifdef QT_BUILD_INTERNAL +Q_AUTOTEST_EXPORT bool qt_script_isJITEnabled() +{ +#if ENABLE(JIT) + return true; +#else + return false; +#endif +} +#endif + QT_END_NAMESPACE diff --git a/src/script/utils/qscriptdate.cpp b/src/script/utils/qscriptdate.cpp index a6abe4a..2445ebf 100644 --- a/src/script/utils/qscriptdate.cpp +++ b/src/script/utils/qscriptdate.cpp @@ -330,7 +330,7 @@ static qsreal getLocalTZA() /*! \internal - Converts the QDateTime \dt to an ECMA Date value (in UTC form). + Converts the QDateTime \a dt to an ECMA Date value (in UTC form). */ qsreal FromDateTime(const QDateTime &dt) { diff --git a/src/src.pro b/src/src.pro index feb6a9c..1801d55 100644 --- a/src/src.pro +++ b/src/src.pro @@ -6,8 +6,7 @@ win32:SRC_SUBDIRS += src_winmain wince*:{ SRC_SUBDIRS += src_corelib src_xml src_gui src_sql src_network src_testlib } else:symbian { - SRC_SUBDIRS += src_s60main src_corelib src_xml src_gui src_network src_sql src_testlib - SRC_SUBDIRS += $$QT_SOURCE_TREE/src/s60installs/qt_libs.pro + SRC_SUBDIRS += src_s60main src_corelib src_xml src_gui src_network src_sql src_testlib src_s60installs } else { SRC_SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_uic src_corelib src_xml src_network src_gui src_sql src_testlib !vxworks:contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support @@ -37,6 +36,8 @@ SRC_SUBDIRS += src_plugins src_s60main.subdir = $$QT_SOURCE_TREE/src/s60main src_s60main.target = sub-s60main +src_s60installs.subdir = $$QT_SOURCE_TREE/src/s60installs +src_s60installs.target = sub-s60installs src_winmain.subdir = $$QT_SOURCE_TREE/src/winmain src_winmain.target = sub-winmain src_tools_bootstrap.subdir = $$QT_SOURCE_TREE/src/tools/bootstrap diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index cc6fa88..95e8386 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -302,13 +302,18 @@ void Generator::generateCode() } } if (!extraList.isEmpty()) { + fprintf(out, "#ifdef Q_NO_DATA_RELOCATION\n"); + fprintf(out, "static const QMetaObjectAccessor qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData()); + for (int i = 0; i < extraList.count(); ++i) { + fprintf(out, " %s::getStaticMetaObject,\n", extraList.at(i).constData()); + } + fprintf(out, "#else\n"); fprintf(out, "static const QMetaObject *qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData()); for (int i = 0; i < extraList.count(); ++i) { - if (i) - fprintf(out, ",\n "); - fprintf(out, " &%s::staticMetaObject", extraList.at(i).constData()); + fprintf(out, " &%s::staticMetaObject,\n", extraList.at(i).constData()); } - fprintf(out, ",0\n};\n\n"); + fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n"); + fprintf(out, " 0\n};\n\n"); } if (isConstructible || !extraList.isEmpty()) { @@ -328,7 +333,6 @@ void Generator::generateCode() // // Finally create and initialize the static meta object // - if (isQt) fprintf(out, "const QMetaObject QObject::staticQtMetaObject = {\n"); else @@ -348,11 +352,22 @@ void Generator::generateCode() fprintf(out, "&qt_meta_extradata2_%s }\n", qualifiedClassNameIdentifier.constData()); fprintf(out, "};\n"); - if (isQt || !cdef->hasQObject) + if(isQt) + return; + +// +// Generate static meta object accessor (needed for symbian, because DLLs do not support data imports. +// + fprintf(out, "\n#ifdef Q_NO_DATA_RELOCATION\n"); + fprintf(out, "const QMetaObject &%s::getStaticMetaObject() { return staticMetaObject; }\n", cdef->qualified.constData()); + fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n"); + + if (!cdef->hasQObject) return; fprintf(out, "\nconst QMetaObject *%s::metaObject() const\n{\n return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;\n}\n", cdef->qualified.constData()); + // // Generate smart cast function // diff --git a/tests/arthur/lance/main.cpp b/tests/arthur/lance/main.cpp index 8bf10eb..534e15d 100644 --- a/tests/arthur/lance/main.cpp +++ b/tests/arthur/lance/main.cpp @@ -380,7 +380,7 @@ int main(int argc, char **argv) QString script = textFile.readAll(); content = script.split("\n", QString::SkipEmptyParts); } else { - printf("failed to read file: '%s'\n", qPrintable(fileName)); + printf("failed to read file: '%s'\n", qPrintable(fileinfo.absoluteFilePath())); continue; } pcmd.setContents(content); diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 8958530..59779b0 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -45,6 +45,7 @@ #include <qcoreapplication.h> #include <qdebug.h> #include <qgl.h> +#include <qglpixelbuffer.h> #include <qglcolormap.h> #include <qpaintengine.h> @@ -70,6 +71,7 @@ private slots: void partialGLWidgetUpdates_data(); void partialGLWidgetUpdates(); void glWidgetRendering(); + void glPBufferRendering(); void glWidgetReparent(); void colormap(); }; @@ -630,6 +632,37 @@ void tst_QGL::partialGLWidgetUpdates() } +// This tests that rendering to a QGLPBuffer using QPainter works. +void tst_QGL::glPBufferRendering() +{ + if (!QGLPixelBuffer::hasOpenGLPbuffers()) + QSKIP("QGLPixelBuffer not supported on this platform", SkipSingle); + + QGLPixelBuffer* pbuf = new QGLPixelBuffer(128, 128); + + QPainter p; + bool begun = p.begin(pbuf); + QVERIFY(begun); + + QPaintEngine::Type engineType = p.paintEngine()->type(); + QVERIFY(engineType == QPaintEngine::OpenGL || engineType == QPaintEngine::OpenGL2); + + p.fillRect(0, 0, 128, 128, Qt::red); + p.fillRect(32, 32, 64, 64, Qt::blue); + p.end(); + + QImage fb = pbuf->toImage(); + delete pbuf; + + QImage reference(128, 128, fb.format()); + p.begin(&reference); + p.fillRect(0, 0, 128, 128, Qt::red); + p.fillRect(32, 32, 64, 64, Qt::blue); + p.end(); + + QCOMPARE(fb, reference); +} + class GLWidget : public QGLWidget { public: @@ -664,7 +697,7 @@ void tst_QGL::glWidgetRendering() QTest::qWait(200); QVERIFY(w.beginOk); - QVERIFY(w.engineType == QPaintEngine::OpenGL); + QVERIFY(w.engineType == QPaintEngine::OpenGL || w.engineType == QPaintEngine::OpenGL2); QImage fb = w.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32); QImage reference(fb.size(), QImage::Format_RGB32); @@ -697,7 +730,7 @@ void tst_QGL::glWidgetReparent() qt_x11_wait_for_window_manager(widget); qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 1); // The layout @@ -707,7 +740,7 @@ void tst_QGL::glWidgetReparent() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 2); // Layout & glwidget QVERIFY(parentWidget.children().contains(widget)); @@ -718,7 +751,7 @@ void tst_QGL::glWidgetReparent() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 1); // The layout @@ -730,7 +763,7 @@ void tst_QGL::glWidgetReparent() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&parentWidget); #endif - QTest::qWait(2000); + QTest::qWait(200); QVERIFY(parentWidget.children().count() == 2); // Layout & glwidget QVERIFY(parentWidget.children().contains(widget)); diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index ef609e0..a09d314 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -50,6 +50,10 @@ Q_DECLARE_METATYPE(QScriptValueList) +QT_BEGIN_NAMESPACE +extern bool qt_script_isJITEnabled(); +QT_END_NAMESPACE + class tst_QScriptContext : public QObject { Q_OBJECT @@ -598,8 +602,10 @@ void tst_QScriptContext::backtrace_data() expected << "<native>('hey') at -1" << "<eval>() at 3" - //### line number should be 2 but the line number information is not kept for eval call - << "foo(arg1 = 'hello', arg2 = 456) at testfile:-1" + << QString::fromLatin1("foo(arg1 = 'hello', arg2 = 456) at testfile:%0") + // interpreter unfortunately doesn't provide line number for eval() + .arg(qt_script_isJITEnabled() ? 2 : -1); + expected << "<global>() at testfile:4"; QTest::newRow("eval") << source << expected; @@ -658,8 +664,10 @@ void tst_QScriptContext::backtrace_data() expected << "<native>('hey') at -1" << "<eval>() at 3" - //### line number should be 3 but the line number information is not kept for eval call - << "plop('hello', 456) at testfile:-1" + << QString::fromLatin1("plop('hello', 456) at testfile:%0") + // interpreter unfortunately doesn't provide line number for eval() + .arg(qt_script_isJITEnabled() ? 3 : -1); + expected << "<global>() at testfile:5"; QTest::newRow("eval in member") << source << expected; @@ -1003,6 +1011,8 @@ void tst_QScriptContext::calledAsConstructor() eng.evaluate("test();"); QVERIFY(!fun3.property("calledAsConstructor").toBool()); eng.evaluate("new test();"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue); QVERIFY(fun3.property("calledAsConstructor").toBool()); } diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 886c70b..f515304 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -49,6 +49,10 @@ //TESTED_CLASS= //TESTED_FILES= +QT_BEGIN_NAMESPACE +extern bool qt_script_isJITEnabled(); +QT_END_NAMESPACE + class tst_QScriptEngineAgent : public QObject { Q_OBJECT @@ -557,6 +561,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall() spy->clear(); QVERIFY(eng.evaluate("(function() { return 123; } )()").toNumber()==123); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -592,6 +598,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCallWithoutReturn() spy->clear(); eng.evaluate("(function() { var a = 123; } )()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -634,6 +642,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition() QVERIFY(spy->at(1).value.isUndefined()); eng.evaluate("foo()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -709,6 +719,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_native2() spy->clear(); eng.evaluate("nativeFunctionCallingArg(function() { return 123; })"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 6); // evaluate() entry @@ -797,6 +809,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_builtin() spy->clear(); eng.evaluate("'ciao'.toString()"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 4); // evaluate() entry @@ -1021,6 +1035,8 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call() spy->clear(); fun.call(); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); // entry @@ -1575,6 +1591,8 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao'); } catch (e) { }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 2); QCOMPARE(spy->at(0).type, ScriptEngineEvent::ExceptionThrow); @@ -1632,6 +1650,8 @@ void tst_QScriptEngineAgent::eventOrder_functionDefinition() QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); eng.evaluate("foo(123)"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 13); // load QCOMPARE(spy->at(3).type, ScriptEngineEvent::ScriptLoad); @@ -1708,6 +1728,8 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch() { spy->clear(); eng.evaluate("try { throw new Error('ciao') } catch (e) { void(e); }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 12); // load QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); @@ -1752,6 +1774,8 @@ void tst_QScriptEngineAgent::eventOrder_functions() QCOMPARE(spy->count(), 6); eng.evaluate("foo(123)"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 21); // load @@ -1876,6 +1900,8 @@ void tst_QScriptEngineAgent::eventOrder_throwCatchFinally() { spy->clear(); eng.evaluate("try { throw 1; } catch(e) { i = e; } finally { i = 2; }"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort); QCOMPARE(spy->count(), 9); // load diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 93f5b6e..d3df376 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -548,6 +548,13 @@ class OtherObject: public QObject void tst_QSharedPointer::qobjectWeakManagement() { { + QWeakPointer<QObject> weak; + weak = QWeakPointer<QObject>(); + QVERIFY(weak.isNull()); + QVERIFY(!weak.data()); + } + + { QObject *obj = new QObject; QWeakPointer<QObject> weak(obj); QVERIFY(!weak.isNull()); @@ -1661,6 +1668,11 @@ void tst_QSharedPointer::invalidConstructs_data() << "QObject *ptr = new QObject;\n" "QWeakPointer<QObject> weak = ptr;\n" // this makes the object unmanaged "QSharedPointer<QObject> shared(ptr);\n"; + + QTest::newRow("shared-pointer-implicit-from-uninitialized") + << &QTest::QExternalTest::tryCompileFail + << "Data *ptr = 0;\n" + "QSharedPointer<Data> weakptr = Qt::Uninitialized;\n"; } void tst_QSharedPointer::invalidConstructs() diff --git a/tests/auto/uiloader/baseline/css_tab_closebutton.ui b/tests/auto/uiloader/baseline/css_tab_closebutton.ui new file mode 100644 index 0000000..82bd2b5 --- /dev/null +++ b/tests/auto/uiloader/baseline/css_tab_closebutton.ui @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <property name="styleSheet"> + <string notr="true">*{} + +#tabWidget QTabBar::close-button +{ + background: blue; + border: 2px dotted red; + subcontrol-position: top; +} + + +#tabWidget_2 QTabBar::close-button +{ + image: url(images/checkbox_checked.png); + subcontrol-position: left; +} + +#tabWidget_2 QTabBar::close-button:hover +{ + image: url(images/checkbox_unchecked_hover.png); +} + + +#tabWidget_3 QTabBar::close-button +{ + border-image: url(images/pushbutton.png) 3px; + border-width:3px; +} + + +</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QTabWidget" name="tabWidget"> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Test the close button in the tabbar</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + <item row="0" column="1" rowspan="2"> + <widget class="QTabWidget" name="tabWidget_3"> + <property name="tabPosition"> + <enum>QTabWidget::East</enum> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + <item row="1" column="0"> + <widget class="QTabWidget" name="tabWidget_2"> + <property name="tabPosition"> + <enum>QTabWidget::South</enum> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="tabsClosable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |