summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill King <bking@trolltech.com>2010-02-10 02:34:50 (GMT)
committerBill King <bking@trolltech.com>2010-02-10 02:34:50 (GMT)
commitdf27c6e5db83e41ace52e2cebca140a956e9e240 (patch)
treec18beeadf18cb1f5dce7a69854631029e72a7fe1
parent3318d412cb78a545790761161f243cb49da4abb7 (diff)
parent4935ec52fc07d4aaa7ae594cfe9986e25ca62dcb (diff)
downloadQt-df27c6e5db83e41ace52e2cebca140a956e9e240.zip
Qt-df27c6e5db83e41ace52e2cebca140a956e9e240.tar.gz
Qt-df27c6e5db83e41ace52e2cebca140a956e9e240.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-sql-team into 4.6
-rwxr-xr-xbin/createpackage.pl16
-rw-r--r--doc/src/deployment/deployment.qdoc17
-rw-r--r--doc/src/getting-started/installation.qdoc2
-rw-r--r--doc/src/platforms/symbian-introduction.qdoc4
-rw-r--r--doc/src/snippets/code/doc_src_deployment.qdoc17
-rw-r--r--qmake/generators/symbian/symmake.cpp35
-rw-r--r--qmake/qmake.pro14
-rw-r--r--src/gui/image/qicon.cpp17
-rw-r--r--src/gui/image/qpixmapfilter.cpp14
-rw-r--r--src/gui/itemviews/qlistview.cpp2
-rw-r--r--src/gui/kernel/qapplication_win.cpp28
-rw-r--r--src/gui/kernel/qkeymapper_x11.cpp14
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/kernel/qwidget_p.h2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
-rw-r--r--src/opengl/qgl_mac.mm2
-rw-r--r--src/opengl/qgl_p.h4
-rw-r--r--src/qt3support/dialogs/q3filedialog.cpp40
-rw-r--r--src/qt3support/itemviews/q3iconview.cpp13
-rw-r--r--src/qt3support/itemviews/q3listview.cpp3
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp37
-rw-r--r--src/xmlpatterns/data/qatomicvalue.cpp2
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp9
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp84
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp28
-rw-r--r--tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp536
-rw-r--r--tools/designer/src/lib/shared/actionrepository.cpp21
-rw-r--r--tools/designer/src/lib/shared/actionrepository_p.h9
-rw-r--r--tools/designer/src/lib/shared/iconloader.cpp3
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menu.cpp11
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menu_p.h2
-rw-r--r--tools/linguist/linguist/messagemodel.cpp48
-rw-r--r--tools/linguist/linguist/messagemodel.h2
-rw-r--r--translations/qt_de.ts8
-rw-r--r--util/qlalr/cppgenerator.cpp2
35 files changed, 497 insertions, 558 deletions
diff --git a/bin/createpackage.pl b/bin/createpackage.pl
index 460df31..6d4614e 100755
--- a/bin/createpackage.pl
+++ b/bin/createpackage.pl
@@ -95,10 +95,10 @@ Example with certfile:
# This is comment line, also the empty lines are ignored
rd.cer;rd-key.pem
.\\cert\\mycert.cer;.\\cert\\mykey.key;yourpassword
- X:\\QtS60\\selfsigned.cer;X:\\QtS60\\selfsigned.key
+ X:\\QtS60\\s60installs\\selfsigned.cer;X:\\QtS60\\s60installs\\selfsigned.key
If no certificate and key files are provided, either a RnD certificate or
-a self-signed certificate from Qt installation root directory is used.
+a self-signed certificate from QtDir\\src\\s60installs directory is used.
==============================================================================================
ENDUSAGESTRING
@@ -149,8 +149,10 @@ $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";
+my $sisoutputbasename = lc($pkgoutputbasename);
+$sisoutputbasename =~ s/_$targetplatform//g;
+my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis";
+my $signed_sis_name = $sisoutputbasename.".sis";
# Store some utility variables
my $scriptpath = dirname(__FILE__);
@@ -263,7 +265,11 @@ system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphra
# Check if creating signed SIS Succeeded
stat($signed_sis_name);
if( -e _ ) {
- print ("\nSuccessfully created $signed_sis_name using certificate: $certtext!\n");
+ my $targetInsert = "";
+ if ($targetplatform ne "-") {
+ $targetInsert = "for $targetplatform ";
+ }
+ print ("\nSuccessfully created $signed_sis_name ${targetInsert}using certificate: $certtext!\n");
# Sign with additional certificates & keys
for my $row ( @certificates ) {
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc
index 575a6dc..41babd9 100644
--- a/doc/src/deployment/deployment.qdoc
+++ b/doc/src/deployment/deployment.qdoc
@@ -1573,28 +1573,17 @@
By default \c .pkg file generated by \c qmake adds support for all
S60 3rd edition FP1, S60 3rd edition FP2 and S60 5th edition devices.
- As a last step we will instruct qmake to generate smart installer \c .pkg file by defining
- the UID of the installation package. The UID needs to be different than the application UID,
- and should be reserved via normal Symbian mechanisms. You can use a random UID starting with
- \c 0xE for testing purposes:
-
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 58
-
Now we are ready to compile the application and create the application
deployment file. Run \c qmake to create Symbian specific makefiles, resources (\.rss)
and deployment packaging files (\c .pkg). And do build to create the
application binaries and resources.
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 59
+ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 58
If everything compiled and linked without any errors, we are now ready to create
- an application package (\c wiggly.sis):
-
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 60
+ an application installation package (\c wiggly_installer.sis):
- Now you can create the smart installer package for the application:
-
- \snippet doc/src/snippets/code/doc_src_deployment.qdoc 61
+ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 59
If all binaries and dependencies were found, you should now have a self signed
\c wiggly_installer.sis ready to be installed on a device. The smart installer
diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc
index b679250..abdfcd2 100644
--- a/doc/src/getting-started/installation.qdoc
+++ b/doc/src/getting-started/installation.qdoc
@@ -677,7 +677,7 @@ If you are using pre-built binaries, follow the instructions given in the
\snippet doc/src/snippets/code/doc_src_installation.qdoc 30
- This will create a self-signed \c fluidlauncher_armv5_urel.sis and
+ This will create a self-signed \c fluidlauncher.sis and
install it to your device.
To run the demos on the emulator simply navigate to the directory of the demo
diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc
index 427f45a..94075f5 100644
--- a/doc/src/platforms/symbian-introduction.qdoc
+++ b/doc/src/platforms/symbian-introduction.qdoc
@@ -127,6 +127,10 @@
\row \o \c run \o Run the application on the emulator.
\row \o \c runonphone \o Run the application on a device.
\row \o \c sis \o Create signed \c .sis file for project.
+ \row \o \c installer_sis \o Create signed smart installer \c .sis file for project.
+ Smart installer will attempt to download
+ missing dependencies in addition to
+ just installing the application.
\endtable
The following lines perform a debug build for the emulator
diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc
index 9c00681..3b0cda1 100644
--- a/doc/src/snippets/code/doc_src_deployment.qdoc
+++ b/doc/src/snippets/code/doc_src_deployment.qdoc
@@ -475,19 +475,10 @@ default_deployment.pkg_prerules += supported_platforms
//! [57]
//! [58]
-DEPLOYMENT.installer_header = 0xE2345678
-//! [58]
-
-//! [59]
qmake
make release-gcce
-//! [59]
-
-//! [60]
-make sis
-ren wiggly_release-gcce.sis wiggly.sis
-//! [60]
+//! [58]
-//! [61]
-createpackage wiggly_installer.pkg
-//! [61] \ No newline at end of file
+//! [59]
+make installer_sis
+//! [59] \ No newline at end of file
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 6c44f0b..3ee3b3a 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -87,7 +87,9 @@
#define MMP_END_RESOURCE "END"
#define SIS_TARGET "sis"
+#define INSTALLER_SIS_TARGET "installer_sis"
#define OK_SIS_TARGET "ok_sis"
+#define OK_INSTALLER_SIS_TARGET "ok_installer_sis"
#define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg"
#define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache"
@@ -295,6 +297,9 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme
QTextStream t(&pkgFile);
QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n");
+ if (installerSisHeader.isEmpty())
+ installerSisHeader = "0xA000D7CE"; // Use default self-signable UID if not defined
+
QString wrapperStreamBuffer;
QTextStream tw(&wrapperStreamBuffer);
@@ -517,7 +522,7 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme
twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\adm\\" << sisName << "\"" << endl;
QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath);
- bootStrapPath.append("/bootstrap.sis");
+ bootStrapPath.append("/smartinstaller.sis");
QFileInfo fi(fileInfo(bootStrapPath));
twf << "@\"" << fi.absoluteFilePath() << "\",(0x2002CCCD)" << endl;
}
@@ -1901,8 +1906,34 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t)
t << pkgcommand << endl;
t << endl;
+ QString sisName = fixedTarget;
+ sisName += ".sis";
+
+ t << sisName << ":" << endl;
+ t << "\t$(MAKE) -s -f $(MAKEFILE) " SIS_TARGET << endl << endl;
+
+ t << INSTALLER_SIS_TARGET ": " << sisName << endl;
+ siscommand = QString("\t$(if $(wildcard %1_installer.%2)," \
+ "$(MAKE) -s -f $(MAKEFILE) %3," \
+ "$(MAKE) -s -f $(MAKEFILE) %4)")
+ .arg(fixedTarget)
+ .arg("pkg")
+ .arg(OK_INSTALLER_SIS_TARGET)
+ .arg(FAIL_SIS_NOPKG_TARGET);
+ t << siscommand << endl;
+ t << endl;
+
+ t << OK_INSTALLER_SIS_TARGET ": " << endl;
+
+ pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \
+ "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)")
+ .arg(fixedTarget)
+ .arg("pkg");
+ t << pkgcommand << endl;
+ t << endl;
+
t << FAIL_SIS_NOPKG_TARGET ":" << endl;
- t << "\t$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)" << endl;
+ t << "\t$(error PKG file does not exist, '" SIS_TARGET "' and '" INSTALLER_SIS_TARGET "' target are only supported for executables or projects with DEPLOYMENT statement)" << endl;
t << endl;
t << FAIL_SIS_NOCACHE_TARGET ":" << endl;
diff --git a/qmake/qmake.pro b/qmake/qmake.pro
index 560aee9..00dcbce 100644
--- a/qmake/qmake.pro
+++ b/qmake/qmake.pro
@@ -17,9 +17,15 @@ VPATH += $$QT_SOURCE_TREE/src/corelib/global \
$$QT_SOURCE_TREE/src/corelib/kernel \
$$QT_SOURCE_TREE/src/corelib/codecs \
$$QT_SOURCE_TREE/src/corelib/plugin \
- $$QT_SOURCE_TREE/src/corelib/xml \
- $$QT_SOURCE_TREE/src/corelib/io
-INCPATH += generators generators/unix generators/win32 generators/mac generators/symbian \
- $$QT_SOURCE_TREE/include $$QT_SOURCE_TREE/include/QtCore
+ $$QT_SOURCE_TREE/src/corelib/xml \
+ $$QT_SOURCE_TREE/src/corelib/io
+INCPATH += generators \
+ generators/unix \
+ generators/win32 \
+ generators/mac \
+ generators/symbian \
+ $$QT_SOURCE_TREE/include \
+ $$QT_SOURCE_TREE/include/QtCore \
+ $$QT_SOURCE_TREE/qmake
include(qmake.pri)
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index ac1d303..bf6eb8d 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -104,6 +104,15 @@ QT_BEGIN_NAMESPACE
static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
+static void qt_cleanup_icon_cache();
+typedef QCache<QString, QIcon> IconCache;
+Q_GLOBAL_STATIC_WITH_INITIALIZER(IconCache, qtIconCache, qAddPostRoutine(qt_cleanup_icon_cache))
+
+static void qt_cleanup_icon_cache()
+{
+ qtIconCache()->clear();
+}
+
QIconPrivate::QIconPrivate()
: engine(0), ref(1),
serialNum(serialNumCounter.fetchAndAddRelaxed(1)),
@@ -963,15 +972,13 @@ QString QIcon::themeName()
*/
QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
{
- static QCache <QString, QIcon> iconCache;
-
QIcon icon;
- if (iconCache.contains(name)) {
- icon = *iconCache.object(name);
+ if (qtIconCache()->contains(name)) {
+ icon = *qtIconCache()->object(name);
} else {
QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name));
- iconCache.insert(name, cachedIcon);
+ qtIconCache()->insert(name, cachedIcon);
icon = *cachedIcon;
}
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 37a6a18..7cf942c 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -422,6 +422,9 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q
if(d->kernelWidth<=0 || d->kernelHeight <= 0)
return;
+ if (src.isNull())
+ return;
+
QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ?
static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0;
QPixmapConvolutionFilter *convolutionFilter = static_cast<QPixmapConvolutionFilter*>(filter);
@@ -902,6 +905,9 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap
if (!painter->isActive())
return;
+ if (src.isNull())
+ return;
+
QRectF srcRect = rect;
if (srcRect.isNull())
srcRect = src.rect();
@@ -1082,6 +1088,10 @@ void QPixmapColorizeFilter::setStrength(qreal strength)
void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const
{
Q_D(const QPixmapColorizeFilter);
+
+ if (src.isNull())
+ return;
+
QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ?
static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0;
QPixmapColorizeFilter *colorizeFilter = static_cast<QPixmapColorizeFilter*>(filter);
@@ -1312,6 +1322,10 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
const QRectF &src) const
{
Q_D(const QPixmapDropShadowFilter);
+
+ if (px.isNull())
+ return;
+
QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ?
static_cast<QPaintEngineEx *>(p->paintEngine())->pixmapFilter(type(), this) : 0;
QPixmapDropShadowFilter *dropShadowFilter = static_cast<QPixmapDropShadowFilter*>(filter);
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 19b1e8c..b2def39 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -2160,7 +2160,7 @@ void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand)
} else {
if (flowPositions.isEmpty())
return;
- const int max = flowPositions.count() - 1;
+ const int max = scrollValueMap.count() - 1;
if (vertical && flow() == QListView::TopToBottom && dy != 0) {
int currentValue = qBound(0, verticalValue, max);
int previousValue = qBound(0, currentValue + dy, max);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 3355272..0a4869b 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -928,7 +928,11 @@ const QString qt_reg_winclass(QWidget *w) // register window class
uint style;
bool icon;
QString cname;
- if (flags & Qt::MSWindowsOwnDC) {
+ if (qt_widget_private(w)->isGLWidget) {
+ cname = QLatin1String("QGLWidget");
+ style = CS_DBLCLKS;
+ icon = true;
+ } else if (flags & Qt::MSWindowsOwnDC) {
cname = QLatin1String("QWidgetOwnDC");
style = CS_DBLCLKS;
#ifndef Q_WS_WINCE
@@ -1021,7 +1025,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class
}
wc.hCursor = 0;
#ifndef Q_WS_WINCE
- wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
+ wc.hbrBackground = qt_widget_private(w)->isGLWidget ? 0 : (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
#else
wc.hbrBackground = 0;
#endif
@@ -3616,13 +3620,19 @@ bool QETWidget::translatePaintEvent(const MSG &msg)
return true;
setAttribute(Qt::WA_PendingUpdate, false);
- const QRegion dirtyInBackingStore(qt_dirtyRegion(this));
- // Make sure the invalidated region contains the region we're about to repaint.
- // BeginPaint will set the clip to the invalidated region and it is impossible
- // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient
- // as it may return an invalid context (especially on Windows Vista).
- if (!dirtyInBackingStore.isEmpty())
- InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false);
+
+ if (d_func()->isGLWidget) {
+ if (d_func()->usesDoubleBufferedGLContext)
+ InvalidateRect(internalWinId(), 0, false);
+ } else {
+ const QRegion dirtyInBackingStore(qt_dirtyRegion(this));
+ // Make sure the invalidated region contains the region we're about to repaint.
+ // BeginPaint will set the clip to the invalidated region and it is impossible
+ // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient
+ // as it may return an invalid context (especially on Windows Vista).
+ if (!dirtyInBackingStore.isEmpty())
+ InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false);
+ }
PAINTSTRUCT ps;
d_func()->hd = BeginPaint(internalWinId(), &ps);
diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp
index 70574e7..4e6c847 100644
--- a/src/gui/kernel/qkeymapper_x11.cpp
+++ b/src/gui/kernel/qkeymapper_x11.cpp
@@ -360,6 +360,13 @@ QList<int> QKeyMapperPrivate::possibleKeysXKB(QKeyEvent *event)
if (code && code < 0xfffe)
code = QChar(code).toUpper().unicode();
+
+ if (code == Qt::Key_Tab && (baseModifiers & Qt::ShiftModifier)) {
+ // map shift+tab to shift+backtab
+ code = Qt::Key_Backtab;
+ text = QString();
+ }
+
if (code == baseCode)
continue;
@@ -448,6 +455,13 @@ QList<int> QKeyMapperPrivate::possibleKeysCore(QKeyEvent *event)
if (code && code < 0xfffe)
code = QChar(code).toUpper().unicode();
+
+ if (code == Qt::Key_Tab && (baseModifiers & Qt::ShiftModifier)) {
+ // map shift+tab to shift+backtab
+ code = Qt::Key_Backtab;
+ text = QString();
+ }
+
if (code == baseCode)
continue;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index c072d9d..2a19d23 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -192,6 +192,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
, inDirtyList(0)
, isScrolled(0)
, isMoved(0)
+ , isGLWidget(0)
, usesDoubleBufferedGLContext(0)
#if defined(Q_WS_X11)
, picture(0)
@@ -200,7 +201,6 @@ QWidgetPrivate::QWidgetPrivate(int version)
, nativeGesturePanEnabled(0)
#elif defined(Q_WS_MAC)
, needWindowChange(0)
- , isGLWidget(0)
, window_event(0)
, qd_hd(0)
#endif
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index b1eb3c3..1e3e6be 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -682,6 +682,7 @@ public:
uint inDirtyList : 1;
uint isScrolled : 1;
uint isMoved : 1;
+ uint isGLWidget : 1;
uint usesDoubleBufferedGLContext : 1;
// *************************** Platform specific ************************************
@@ -713,7 +714,6 @@ public:
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC
// This is new stuff
uint needWindowChange : 1;
- uint isGLWidget : 1;
// Each wiget keeps a list of all its child and grandchild OpenGL widgets.
// This list is used to update the gl context whenever a parent and a granparent
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 70a301d..5bd972c 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -305,9 +305,12 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
while (socket->bytesAvailable()) {
QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState;
switch (state) {
- case QHttpNetworkReplyPrivate::NothingDoneState:
- case QHttpNetworkReplyPrivate::ReadingStatusState: {
+ case QHttpNetworkReplyPrivate::NothingDoneState: {
+ // only eat whitespace on the first call
eatWhitespace();
+ state = reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;
+ }
+ case QHttpNetworkReplyPrivate::ReadingStatusState: {
qint64 statusBytes = reply->d_func()->readStatus(socket);
if (statusBytes == -1 && reconnectAttempts <= 0) {
// too many errors reading/receiving/parsing the status, close the socket and emit error
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm
index c01575b..4d7532e 100644
--- a/src/opengl/qgl_mac.mm
+++ b/src/opengl/qgl_mac.mm
@@ -951,8 +951,6 @@ void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget)
break;
current = current->parentWidget();
}
-
- isGLWidget = 1;
}
bool QGLWidgetPrivate::renderCxPm(QPixmap*)
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 713b067..da0887e 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -179,7 +179,9 @@ public:
#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
, eglSurfaceWindowId(0)
#endif
- {}
+ {
+ isGLWidget = 1;
+ }
~QGLWidgetPrivate() {}
diff --git a/src/qt3support/dialogs/q3filedialog.cpp b/src/qt3support/dialogs/q3filedialog.cpp
index 9b8e4d3..35f7890 100644
--- a/src/qt3support/dialogs/q3filedialog.cpp
+++ b/src/qt3support/dialogs/q3filedialog.cpp
@@ -475,9 +475,17 @@ static int sortFilesBy = (int)QDir::Name;
static bool sortAscending = true;
static bool detailViewMode = false;
-static Q3CleanupHandler<QPixmap> qfd_cleanup_pixmap;
static Q3CleanupHandler<QString> qfd_cleanup_string;
+static void qt_cleanup_fd_pixmaps();
+typedef QList<QPixmap *> FDPixmaps;
+Q_GLOBAL_STATIC_WITH_INITIALIZER(FDPixmaps, qfd_pixmaps, qAddPostRoutine(qt_cleanup_fd_pixmaps))
+
+static void qt_cleanup_fd_pixmaps()
+{
+ qDeleteAll(*qfd_pixmaps());
+}
+
static QString toRootIfNotExists( const QString &path )
{
if ( !path.isEmpty() )
@@ -533,37 +541,37 @@ static void makeVariables() {
qfd_cleanup_string.add(&workingDirectory);
openFolderIcon = new QPixmap((const char **)open_xpm);
- qfd_cleanup_pixmap.add(&openFolderIcon);
+ qfd_pixmaps()->append(openFolderIcon);
symLinkDirIcon = new QPixmap((const char **)link_dir_xpm);
- qfd_cleanup_pixmap.add(&symLinkDirIcon);
+ qfd_pixmaps()->append(symLinkDirIcon);
symLinkFileIcon = new QPixmap((const char **)link_file_xpm);
- qfd_cleanup_pixmap.add(&symLinkFileIcon);
+ qfd_pixmaps()->append(symLinkFileIcon);
fileIcon = new QPixmap((const char **)file_xpm);
- qfd_cleanup_pixmap.add(&fileIcon);
+ qfd_pixmaps()->append(fileIcon);
closedFolderIcon = new QPixmap((const char **)closed_xpm);
- qfd_cleanup_pixmap.add(&closedFolderIcon);
+ qfd_pixmaps()->append(closedFolderIcon);
detailViewIcon = new QPixmap((const char **)detailedview_xpm);
- qfd_cleanup_pixmap.add(&detailViewIcon);
+ qfd_pixmaps()->append(detailViewIcon);
multiColumnListViewIcon = new QPixmap((const char **)mclistview_xpm);
- qfd_cleanup_pixmap.add(&multiColumnListViewIcon);
+ qfd_pixmaps()->append(multiColumnListViewIcon);
cdToParentIcon = new QPixmap((const char **)cdtoparent_xpm);
- qfd_cleanup_pixmap.add(&cdToParentIcon);
+ qfd_pixmaps()->append(cdToParentIcon);
newFolderIcon = new QPixmap((const char **)newfolder_xpm);
- qfd_cleanup_pixmap.add(&newFolderIcon);
+ qfd_pixmaps()->append(newFolderIcon);
previewInfoViewIcon
= new QPixmap((const char **)previewinfoview_xpm);
- qfd_cleanup_pixmap.add(&previewInfoViewIcon);
+ qfd_pixmaps()->append(previewInfoViewIcon);
previewContentsViewIcon
= new QPixmap((const char **)previewcontentsview_xpm);
- qfd_cleanup_pixmap.add(&previewContentsViewIcon);
+ qfd_pixmaps()->append(previewContentsViewIcon);
startCopyIcon = new QPixmap((const char **)start_xpm);
- qfd_cleanup_pixmap.add(&startCopyIcon);
+ qfd_pixmaps()->append(startCopyIcon);
endCopyIcon = new QPixmap((const char **)end_xpm);
- qfd_cleanup_pixmap.add(&endCopyIcon);
+ qfd_pixmaps()->append(endCopyIcon);
goBackIcon = new QPixmap((const char **)back_xpm);
- qfd_cleanup_pixmap.add(&goBackIcon);
+ qfd_pixmaps()->append(goBackIcon);
fifteenTransparentPixels = new QPixmap(closedFolderIcon->width(), 1);
- qfd_cleanup_pixmap.add(&fifteenTransparentPixels);
+ qfd_pixmaps()->append(fifteenTransparentPixels);
QBitmap m(fifteenTransparentPixels->width(), 1);
m.fill(Qt::color0);
fifteenTransparentPixels->setMask(m);
diff --git a/src/qt3support/itemviews/q3iconview.cpp b/src/qt3support/itemviews/q3iconview.cpp
index 67c956e..683e3d6 100644
--- a/src/qt3support/itemviews/q3iconview.cpp
+++ b/src/qt3support/itemviews/q3iconview.cpp
@@ -132,14 +132,21 @@ static QPixmap *qiv_selection = 0;
#endif
static bool optimize_layout = false;
-static Q3CleanupHandler<QPixmap> qiv_cleanup_pixmap;
+static void qt_cleanup_iv_pixmaps();
+typedef QList<QPixmap *> IVPixmaps;
+Q_GLOBAL_STATIC_WITH_INITIALIZER(IVPixmaps, qiv_pixmaps, qAddPostRoutine(qt_cleanup_iv_pixmaps))
+
+static void qt_cleanup_iv_pixmaps()
+{
+ qDeleteAll(*qiv_pixmaps());
+}
static QPixmap *get_qiv_buffer_pixmap(const QSize &s)
{
if (!qiv_buffer_pixmap) {
qiv_buffer_pixmap = new QPixmap(s);
- qiv_cleanup_pixmap.add(&qiv_buffer_pixmap);
+ qiv_pixmaps()->append(qiv_buffer_pixmap);
return qiv_buffer_pixmap;
}
@@ -2580,7 +2587,7 @@ Q3IconView::Q3IconView(QWidget *parent, const char *name, Qt::WindowFlags f)
{
if (!unknown_icon) {
unknown_icon = new QPixmap((const char **)unknown_xpm);
- qiv_cleanup_pixmap.add(&unknown_icon);
+ qiv_pixmaps()->append(unknown_icon);
}
d = new Q3IconViewPrivate;
diff --git a/src/qt3support/itemviews/q3listview.cpp b/src/qt3support/itemviews/q3listview.cpp
index 2c15ad0..12dad84 100644
--- a/src/qt3support/itemviews/q3listview.cpp
+++ b/src/qt3support/itemviews/q3listview.cpp
@@ -70,9 +70,6 @@ QT_BEGIN_NAMESPACE
const int Unsorted = 16383;
-static Q3CleanupHandler<QBitmap> qlv_cleanup_bitmap;
-
-
struct Q3ListViewPrivate
{
// classes that are here to avoid polluting the global name space
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 2049a76..4d3663e 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -144,6 +144,7 @@ public:
QSqlRecord rInf;
QVector<QVariant> fieldCache;
+ QVector<wchar_t *> paramCache;
int fieldCacheIdx;
int disconnectCount;
bool hasSQLFetchScroll;
@@ -202,7 +203,7 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode
*nativeCode = nativeCode_;
QString tmpstore;
#ifdef UNICODE
- tmpstore = QString((const QChar*)description_.data(), msgLen);
+ tmpstore = QString::fromWCharArray((const wchar_t*)description_, msgLen);
#else
tmpstore = QString::fromLocal8Bit((const char*)description_.data(), msgLen);
#endif
@@ -332,7 +333,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
} else {
colSize++; // make sure there is room for more than the 0 termination
if (unicode) {
- colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call
+ colSize *= sizeof(wchar_t); // a tiny bit faster, since it saves a SQLGetData() call
}
}
QVarLengthArray<char> buf(colSize);
@@ -353,9 +354,9 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// contain the number of bytes returned - it contains the
// total number of bytes that CAN be fetched
// colSize-1: remove 0 termination when there is more data to fetch
- int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator;
+ int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-sizeof(wchar_t) : colSize-1) : lengthIndicator;
if (unicode) {
- fieldVal += QString((const QChar*) buf.constData(), rSize / 2);
+ fieldVal += QString::fromWCharArray((wchar_t*)buf.constData(), rSize / sizeof(wchar_t));
} else {
fieldVal += QString::fromAscii(buf.constData(), rSize);
}
@@ -551,7 +552,7 @@ static QSqlField qMakeFieldInfo(const QODBCPrivate* p, int i )
}
#ifdef UNICODE
- QString qColName((const QChar*)colName, colNameLen);
+ QString qColName = QString::fromWCharArray((const wchar_t*)colName, colNameLen);
#else
QString qColName = QString::fromLocal8Bit((const char*)colName);
#endif
@@ -1270,9 +1271,12 @@ bool QODBCResult::exec()
// bind parameters - only positional binding allowed
QVector<QVariant>& values = boundValues();
+ QVector<wchar_t *> wcharstorage;
+
int i;
SQLRETURN r;
for (i = 0; i < values.count(); ++i) {
+ wcharstorage.append(NULL);
if (bindValueType(i) & QSql::Out)
values[i].detach();
const QVariant &val = values.at(i);
@@ -1435,13 +1439,14 @@ bool QODBCResult::exec()
#ifndef Q_ODBC_VERSION_2
if (d->unicode) {
QString str = val.toString();
- str.utf16();
+ int strSize = str.length() * sizeof(wchar_t);
if (*ind != SQL_NULL_DATA)
- *ind = str.length() * sizeof(QChar);
- int strSize = str.length() * sizeof(QChar);
+ *ind = strSize;
if (bindValueType(i) & QSql::Out) {
- QByteArray ba((char*)str.constData(), str.capacity() * sizeof(QChar));
+ wchar_t *temp=new wchar_t[str.capacity()*sizeof(wchar_t)];
+ str.toWCharArray(temp);
+ QByteArray ba((char*)temp, str.capacity() * sizeof(wchar_t));
r = SQLBindParameter(d->hStmt,
i + 1,
qParamType[(QFlag)(bindValueType(i)) & QSql::InOut],
@@ -1453,9 +1458,13 @@ bool QODBCResult::exec()
ba.size(),
ind);
tmpStorage.append(ba);
+ wcharstorage.replace(i,temp);
break;
}
+ wchar_t *temp=new wchar_t[(1+str.length())*sizeof(wchar_t)];
+ str.toWCharArray(temp);
+ temp[str.length()]=0;
r = SQLBindParameter(d->hStmt,
i + 1,
qParamType[(QFlag)(bindValueType(i)) & QSql::InOut],
@@ -1463,9 +1472,10 @@ bool QODBCResult::exec()
strSize > 254 ? SQL_WLONGVARCHAR : SQL_WVARCHAR,
strSize,
0,
- (void *)str.constData(),
+ (void *)temp,
strSize,
ind);
+ wcharstorage.replace(i,temp);
break;
}
else
@@ -1515,6 +1525,13 @@ bool QODBCResult::exec()
}
}
r = SQLExecute(d->hStmt);
+
+ for(int i=0;i<wcharstorage.size();i++)
+ {
+ if(wcharstorage.at(i))
+ delete [](wcharstorage.at(i));
+ }
+
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
qWarning() << "QODBCResult::exec: Unable to execute statement:" << qODBCWarn(d);
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp
index 6858e27..c4f3578 100644
--- a/src/xmlpatterns/data/qatomicvalue.cpp
+++ b/src/xmlpatterns/data/qatomicvalue.cpp
@@ -226,6 +226,8 @@ ItemType::Ptr AtomicValue::qtToXDMType(const QXmlItem &item)
/* Fallthrough. */
case QVariant::Time:
return BuiltinTypes::xsDateTime;
+ case QMetaType::Float:
+ return BuiltinTypes::xsFloat;
case QVariant::Double:
return BuiltinTypes::xsDouble;
default:
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 69e7699..ca84b38 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -3455,10 +3455,8 @@ void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion()
completer.setCompletionMode(QCompleter::InlineCompletion);
lineEdit.setCompleter(&completer);
lineEdit.show();
-#ifdef Q_WS_X11
- // to be safe and avoid failing setFocus with window managers
- qt_x11_wait_for_window_manager(&lineEdit);
-#endif
+ QTest::qWaitForWindowShown(&lineEdit);
+ QApplication::setActiveWindow(&lineEdit);
lineEdit.setFocus();
QTRY_VERIFY(lineEdit.hasFocus());
QTest::keyPress(&lineEdit, 'a');
@@ -3651,10 +3649,11 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
le.addAction(&action);
le.show();
- QApplication::setActiveWindow(&le);
QTest::qWaitForWindowShown(&le);
+ QApplication::setActiveWindow(&le);
le.setFocus();
QTRY_VERIFY(le.hasFocus());
+
QTest::keyClick(0, Qt::Key_P);
QCOMPARE(spy.count(), 1);
}
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 7109213..2c31d8b 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -606,9 +606,8 @@ void tst_QListView::indexAt()
view2.setWrapping(true);
// We really want to make sure it is shown, because the layout won't be known until it is shown
view2.show();
- for (int i = 0; i < 5 && !view2.m_shown; ++i) {
- QTest::qWait(500);
- }
+ QTest::qWaitForWindowShown(&view2);
+ QTRY_VERIFY(view2.m_shown);
QVERIFY(view2.m_index.isValid());
QVERIFY(view2.m_index.row() != 0);
@@ -760,7 +759,8 @@ void tst_QListView::hideFirstRow()
view.setUniformItemSizes(true);
view.setRowHidden(0,true);
view.show();
- QTest::qWait(100);
+ QTest::qWaitForWindowShown(&view);
+ QTest::qWait(10);
}
void tst_QListView::batchedMode()
@@ -778,10 +778,9 @@ void tst_QListView::batchedMode()
view.setBatchSize(2);
view.resize(200,400);
view.show();
+ QTest::qWaitForWindowShown(&view);
-#if !defined(Q_OS_WINCE)
- QTest::qWait(100);
-#else
+#if defined(Q_OS_WINCE)
QTest::qWait(2000);
#endif
QBitArray ba;
@@ -1203,9 +1202,9 @@ void tst_QListView::scrollTo()
//we click the item
QPoint p = lv.visualRect(index).center();
QTest::mouseClick(lv.viewport(), Qt::LeftButton, Qt::NoModifier, p);
- //let's wait 1 second because the scrolling is delayed
- QTest::qWait(1000);
- QCOMPARE(lv.visualRect(index).y(),0);
+ //let's wait because the scrolling is delayed
+ QTest::qWait(QApplication::doubleClickInterval() + 150);
+ QTRY_COMPARE(lv.visualRect(index).y(),0);
//we scroll down. As the item is to tall for the view, it will disappear
QTest::keyClick(lv.viewport(), Qt::Key_Down, Qt::NoModifier);
@@ -1222,9 +1221,9 @@ void tst_QListView::scrollTo()
//we click the item
p = lv.visualRect(index).center();
QTest::mouseClick(lv.viewport(), Qt::LeftButton, Qt::NoModifier, p);
- //let's wait 1 second because the scrolling is delayed
- QTest::qWait(1000);
- QCOMPARE(lv.visualRect(index).x(),0);
+ //let's wait because the scrolling is delayed
+ QTest::qWait(QApplication::doubleClickInterval() + 150);
+ QTRY_COMPARE(lv.visualRect(index).x(),0);
//we scroll right. As the item is too wide for the view, it will disappear
QTest::keyClick(lv.viewport(), Qt::Key_Right, Qt::NoModifier);
@@ -1243,9 +1242,9 @@ void tst_QListView::scrollTo()
//we click the item
p = lv.visualRect(index).center();
QTest::mouseClick(lv.viewport(), Qt::LeftButton, Qt::NoModifier, p);
- //let's wait 1 second because the scrolling is delayed
- QTest::qWait(1000);
- QCOMPARE(lv.visualRect(index).y(),0);
+ //let's wait because the scrolling is delayed
+ QTest::qWait(QApplication::doubleClickInterval() + 150);
+ QTRY_COMPARE(lv.visualRect(index).y(),0);
//we scroll down. As the item is too tall for the view, it will partially disappear
QTest::keyClick(lv.viewport(), Qt::Key_Down, Qt::NoModifier);
@@ -1277,7 +1276,7 @@ void tst_QListView::scrollBarRanges()
for (int h = 30; h <= 210; ++h) {
lv.resize(250, h);
- QTest::qWait(100); // wait for the layout to be done
+ QApplication::processEvents(); // wait for the layout to be done
int visibleRowCount = lv.viewport()->size().height() / rowHeight;
int invisibleRowCount = rowCount - visibleRowCount;
QCOMPARE(lv.verticalScrollBar()->maximum(), invisibleRowCount);
@@ -1366,7 +1365,7 @@ void tst_QListView::scrollBarAsNeeded()
model.setStringList(list);
QApplication::processEvents();
- QTest::qWait(100);
+ QTest::qWait(50);
QStringList replacement;
for (i = 0; i < itemCount; ++i) {
@@ -1375,10 +1374,9 @@ void tst_QListView::scrollBarAsNeeded()
model.setStringList(replacement);
QApplication::processEvents();
- QTest::qWait(100);
- QCOMPARE(lv.horizontalScrollBar()->isVisible(), horizontalScrollBarVisible);
- QCOMPARE(lv.verticalScrollBar()->isVisible(), verticalScrollBarVisible);
+ QTRY_COMPARE(lv.horizontalScrollBar()->isVisible(), horizontalScrollBarVisible);
+ QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), verticalScrollBarVisible);
}
}
@@ -1433,10 +1431,9 @@ void tst_QListView::wordWrap()
lv.setFixedSize(150, 150);
lv.show();
QApplication::processEvents();
- QTest::qWait(100);
- QCOMPARE(lv.horizontalScrollBar()->isVisible(), false);
- QCOMPARE(lv.verticalScrollBar()->isVisible(), true);
+ QTRY_COMPARE(lv.horizontalScrollBar()->isVisible(), false);
+ QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true);
}
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
@@ -1557,7 +1554,8 @@ void tst_QListView::task248430_crashWith0SizedItem()
QStringListModel model(QStringList() << QLatin1String("item1") << QString());
view.setModel(&model);
view.show();
- QTest::qWait(100);
+ QTest::qWaitForWindowShown(&view);
+ QTest::qWait(20);
}
void tst_QListView::task250446_scrollChanged()
@@ -1569,21 +1567,21 @@ void tst_QListView::task250446_scrollChanged()
QVERIFY(index.isValid());
view.setCurrentIndex(index);
view.show();
- QTest::qWait(100);
+ QTest::qWaitForWindowShown(&view);
const int scrollValue = view.verticalScrollBar()->maximum();
view.verticalScrollBar()->setValue(scrollValue);
QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
QCOMPARE(view.currentIndex(), index);
view.showMinimized();
- QTest::qWait(100);
- QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
- QCOMPARE(view.currentIndex(), index);
+ QTest::qWait(50);
+ QTRY_COMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QTRY_COMPARE(view.currentIndex(), index);
view.showNormal();
- QTest::qWait(100);
- QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
- QCOMPARE(view.currentIndex(), index);
+ QTest::qWait(50);
+ QTRY_COMPARE(view.verticalScrollBar()->value(), scrollValue);
+ QTRY_COMPARE(view.currentIndex(), index);
}
void tst_QListView::task196118_visualRegionForSelection()
@@ -1699,7 +1697,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes()
view.setViewMode(QListView::IconMode);
view.setModel(&model);
view.show();
- QTest::qWait(30);
+ QTest::qWaitForWindowShown(&view);
// Verfify that item sizes are non-uniform
QVERIFY(view.sizeHintForIndex(model.index(0, 0)).height() > view.sizeHintForIndex(model.index(1, 0)).height());
@@ -1729,7 +1727,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes()
view.setViewMode(QListView::IconMode);
view.setModel(&model);
view.show();
- QTest::qWait(30);
+ QTest::qWaitForWindowShown(&view);
// Verfify that item sizes are non-uniform
QVERIFY(view.sizeHintForIndex(model.index(0, 0)).width() > view.sizeHintForIndex(model.index(1, 0)).width());
@@ -1789,7 +1787,6 @@ void tst_QListView::task262152_setModelColumnNavigate()
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
- QTest::qWait(30);
QTRY_COMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
QTest::keyClick(&view, Qt::Key_Down);
QTest::qWait(30);
@@ -1834,6 +1831,23 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems()
QVERIFY(index.isValid());
QCOMPARE(index.row(), 2 * i + 1);
}
+
+ //QTBUG-7929 should not crash
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QScrollBar *bar = view.flow() == QListView::TopToBottom
+ ? view.verticalScrollBar() : view.horizontalScrollBar();
+
+ int nbVisibleItem = rowCount / 2 - bar->maximum();
+
+ bar->setValue(bar->maximum());
+ QApplication::processEvents();
+ for (int i = rowCount; i > rowCount / 2; i--) {
+ view.setRowHidden(i, true);
+ }
+ QApplication::processEvents();
+ QCOMPARE(bar->value(), bar->maximum());
+ QCOMPARE(bar->maximum(), rowCount/4 - nbVisibleItem);
}
void tst_QListView::taskQTBUG_633_changeModelData()
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 4cb07db..10e00a6 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -555,7 +555,11 @@ void tst_QGraphicsView::imageRiver()
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
+#if defined(Q_OS_SYMBIAN)
+ for (int i = 0; i < 50; ++i) {
+#else
for (int i = 0; i < 100; ++i) {
+#endif
AnimatedPixmapItem *item;
if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale);
if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale);
@@ -574,7 +578,11 @@ void tst_QGraphicsView::imageRiver()
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
+#if defined(Q_OS_SYMBIAN)
+ for (int i = 0; i < 50; ++i) {
+#else
for (int i = 0; i < 100; ++i) {
+#endif
scene.advance();
while (view.count < (i+1))
qApp->processEvents();
@@ -669,7 +677,11 @@ void tst_QGraphicsView::textRiver()
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
+#if defined(Q_OS_SYMBIAN)
+ for (int i = 0; i < 50; ++i) {
+#else
for (int i = 0; i < 100; ++i) {
+#endif
AnimatedTextItem *item;
if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale);
if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale);
@@ -687,7 +699,11 @@ void tst_QGraphicsView::textRiver()
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
+#if defined(Q_OS_SYMBIAN)
+ for (int i = 0; i < 50; ++i) {
+#else
for (int i = 0; i < 100; ++i) {
+#endif
scene.advance();
while (view.count < (i+1))
qApp->processEvents();
@@ -771,7 +787,11 @@ void tst_QGraphicsView::moveItemCache()
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
+#if defined(Q_OS_SYMBIAN)
+ for (int i = 0; i < 5; ++i) {
+#else
for (int i = 0; i < 50; ++i) {
+#endif
AnimatedPixmapCacheItem *item;
if (direction == 0) item = new AnimatedPixmapCacheItem((i % 4) + 1, 0);
if (direction == 1) item = new AnimatedPixmapCacheItem(0, (i % 4) + 1);
@@ -793,7 +813,11 @@ void tst_QGraphicsView::moveItemCache()
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
+#if defined(Q_OS_SYMBIAN)
+ for (int i = 0; i < 50; ++i) {
+#else
for (int i = 0; i < 100; ++i) {
+#endif
scene.advance();
while (view.count < (i+1))
qApp->processEvents();
@@ -893,7 +917,11 @@ void tst_QGraphicsView::paintItemCache()
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
+#if defined(Q_OS_SYMBIAN)
+ for (int i = 0; i < 5; ++i) {
+#else
for (int i = 0; i < 50; ++i) {
+#endif
scene.advance();
while (view.count < (i+1))
qApp->processEvents();
diff --git a/tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp b/tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp
index 7985028..6ab78b1 100644
--- a/tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp
+++ b/tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp
@@ -46,348 +46,15 @@ Q_DECLARE_METATYPE(QScriptContext*)
Q_DECLARE_METATYPE(QScriptValue)
Q_DECLARE_METATYPE(QScriptValueList)
-//TESTED_FILES=
-
-class TestClass : public QScriptClass
-{
-public:
- struct CustomProperty {
- QueryFlags qflags;
- uint id;
- QScriptValue::PropertyFlags pflags;
- QScriptValue value;
-
- CustomProperty(QueryFlags qf, uint i, QScriptValue::PropertyFlags pf,
- const QScriptValue &val)
- : qflags(qf), id(i), pflags(pf), value(val) { }
- };
-
- enum CallableMode {
- NotCallable,
- CallableReturnsSum,
- CallableReturnsArgument,
- CallableReturnsInvalidVariant
- };
-
- TestClass(QScriptEngine *engine);
- ~TestClass();
-
- void addCustomProperty(const QScriptString &name, QueryFlags qflags,
- uint id, QScriptValue::PropertyFlags pflags,
- const QScriptValue &value);
- void removeCustomProperty(const QScriptString &name);
-
- QueryFlags queryProperty(const QScriptValue &object,
- const QScriptString &name,
- QueryFlags flags, uint *id);
-
- QScriptValue property(const QScriptValue &object,
- const QScriptString &name, uint id);
-
- void setProperty(QScriptValue &object, const QScriptString &name,
- uint id, const QScriptValue &value);
-
- QScriptValue::PropertyFlags propertyFlags(
- const QScriptValue &object, const QScriptString &name, uint id);
-
- QScriptClassPropertyIterator *newIterator(const QScriptValue &object);
-
- QScriptValue prototype() const;
-
- QString name() const;
-
- bool supportsExtension(Extension extension) const;
- QVariant extension(Extension extension,
- const QVariant &argument = QVariant());
-
- void setIterationEnabled(bool enable);
- bool isIterationEnabled() const;
-
- void setCallableMode(CallableMode mode);
- CallableMode callableMode() const;
-
- void setHasInstance(bool hasInstance);
- bool hasInstance() const;
-
-private:
- inline CustomProperty *findCustomProperty(const QScriptString &name);
-
- QHash<QScriptString, CustomProperty*> customProperties;
-
- QScriptValue m_prototype;
- bool m_iterationEnabled;
- CallableMode m_callableMode;
- bool m_hasInstance;
-};
-
-class TestClassPropertyIterator : public QScriptClassPropertyIterator
-{
-public:
- TestClassPropertyIterator(const QHash<QScriptString, TestClass::CustomProperty*> &props,
- const QScriptValue &object);
- ~TestClassPropertyIterator();
-
- bool hasNext() const;
- void next();
-
- bool hasPrevious() const;
- void previous();
-
- void toFront();
- void toBack();
-
- QScriptString name() const;
- uint id() const;
- QScriptValue::PropertyFlags flags() const;
-
-private:
- int m_index;
- int m_last;
- QHash<QScriptString, TestClass::CustomProperty*> m_props;
-};
-
-TestClass::TestClass(QScriptEngine *engine)
- : QScriptClass(engine), m_iterationEnabled(true),
- m_callableMode(NotCallable), m_hasInstance(false)
-{
- m_prototype = engine->newObject();
-}
-
-TestClass::~TestClass()
-{
- qDeleteAll(customProperties);
-}
-
-TestClass::CustomProperty* TestClass::findCustomProperty(const QScriptString &name)
-{
- QHash<QScriptString, CustomProperty*>::const_iterator it;
- it = customProperties.constFind(name);
- if (it == customProperties.constEnd())
- return 0;
- return it.value();
-
-}
-
-void TestClass::addCustomProperty(const QScriptString &name, QueryFlags qflags,
- uint id, QScriptValue::PropertyFlags pflags,
- const QScriptValue &value)
-{
- customProperties.insert(name, new CustomProperty(qflags, id, pflags, value));
-}
-
-void TestClass::removeCustomProperty(const QScriptString &name)
-{
- CustomProperty *prop = customProperties.take(name);
- if (prop)
- delete prop;
-}
-
-QScriptClass::QueryFlags TestClass::queryProperty(const QScriptValue &/*object*/,
- const QScriptString &name,
- QueryFlags flags, uint *id)
-{
- CustomProperty *prop = findCustomProperty(name);
- if (!prop)
- return 0;
- *id = prop->id;
- return prop->qflags & flags;
-}
-
-QScriptValue TestClass::property(const QScriptValue &/*object*/,
- const QScriptString &name, uint /*id*/)
-{
- CustomProperty *prop = findCustomProperty(name);
- if (!prop)
- return QScriptValue();
- return prop->value;
-}
-
-void TestClass::setProperty(QScriptValue &/*object*/, const QScriptString &name,
- uint /*id*/, const QScriptValue &value)
-{
- CustomProperty *prop = findCustomProperty(name);
- if (!prop)
- return;
- prop->value = value;
-}
-
-QScriptValue::PropertyFlags TestClass::propertyFlags(
- const QScriptValue &/*object*/, const QScriptString &name, uint /*id*/)
-{
- CustomProperty *prop = findCustomProperty(name);
- if (!prop)
- return 0;
- return prop->pflags;
-}
-
-QScriptClassPropertyIterator *TestClass::newIterator(const QScriptValue &object)
-{
- if (!m_iterationEnabled)
- return 0;
- return new TestClassPropertyIterator(customProperties, object);
-}
-
-QScriptValue TestClass::prototype() const
-{
- return m_prototype;
-}
-
-QString TestClass::name() const
-{
- return QLatin1String("TestClass");
-}
-
-bool TestClass::supportsExtension(Extension extension) const
-{
- if (extension == Callable)
- return (m_callableMode != NotCallable);
- if (extension == HasInstance)
- return m_hasInstance;
- return false;
-}
-
-QVariant TestClass::extension(Extension extension,
- const QVariant &argument)
-{
- if (extension == Callable) {
- Q_ASSERT(m_callableMode != NotCallable);
- QScriptContext *ctx = qvariant_cast<QScriptContext*>(argument);
- if (m_callableMode == CallableReturnsSum) {
- qsreal sum = 0;
- for (int i = 0; i < ctx->argumentCount(); ++i)
- sum += ctx->argument(i).toNumber();
- QScriptValueIterator it(ctx->thisObject());
- while (it.hasNext()) {
- it.next();
- sum += it.value().toNumber();
- }
- return sum;
- } else if (m_callableMode == CallableReturnsArgument) {
- return qVariantFromValue(ctx->argument(0));
- } else if (m_callableMode == CallableReturnsInvalidVariant) {
- return QVariant();
- }
- } else if (extension == HasInstance) {
- Q_ASSERT(m_hasInstance);
- QScriptValueList args = qvariant_cast<QScriptValueList>(argument);
- QScriptValue obj = args.at(0);
- QScriptValue value = args.at(1);
- return value.property("foo").equals(obj.property("foo"));
- }
- return QVariant();
-}
-
-void TestClass::setIterationEnabled(bool enable)
-{
- m_iterationEnabled = enable;
-}
-
-bool TestClass::isIterationEnabled() const
-{
- return m_iterationEnabled;
-}
-
-void TestClass::setCallableMode(CallableMode mode)
-{
- m_callableMode = mode;
-}
-
-TestClass::CallableMode TestClass::callableMode() const
-{
- return m_callableMode;
-}
-
-void TestClass::setHasInstance(bool hasInstance)
-{
- m_hasInstance = hasInstance;
-}
-
-bool TestClass::hasInstance() const
-{
- return m_hasInstance;
-}
-
-TestClassPropertyIterator::TestClassPropertyIterator(const QHash<QScriptString, TestClass::CustomProperty*> &props,
- const QScriptValue &object)
- : QScriptClassPropertyIterator(object)
-{
- m_props = props;
- toFront();
-}
-
-TestClassPropertyIterator::~TestClassPropertyIterator()
-{
-}
-
-bool TestClassPropertyIterator::hasNext() const
-{
- return m_index < m_props.size();
-}
-
-void TestClassPropertyIterator::next()
-{
- m_last = m_index;
- ++m_index;
-}
-
-bool TestClassPropertyIterator::hasPrevious() const
-{
- return m_index > 0;
-}
-
-void TestClassPropertyIterator::previous()
-{
- --m_index;
- m_last = m_index;
-}
-
-void TestClassPropertyIterator::toFront()
-{
- m_index = 0;
- m_last = -1;
-}
-
-void TestClassPropertyIterator::toBack()
-{
- m_index = m_props.size();
- m_last = -1;
-}
-
-QScriptString TestClassPropertyIterator::name() const
-{
- return m_props.keys().value(m_last);
-}
-
-uint TestClassPropertyIterator::id() const
-{
- QScriptString key = m_props.keys().value(m_last);
- if (!key.isValid())
- return 0;
- TestClass::CustomProperty *prop = m_props.value(key);
- return prop->id;
-}
-
-QScriptValue::PropertyFlags TestClassPropertyIterator::flags() const
-{
- QScriptString key = m_props.keys().value(m_last);
- if (!key.isValid())
- return 0;
- TestClass::CustomProperty *prop = m_props.value(key);
- return prop->pflags;
-}
+// We want reliable numbers so we don't want to rely too much
+// on the number of iterations done by testlib.
+// this also make the results of valgrind more interesting
+const int iterationNumber = 5000;
class tst_QScriptClass : public QObject
{
Q_OBJECT
-public:
- tst_QScriptClass();
- virtual ~tst_QScriptClass();
-
-public slots:
- void init();
- void cleanup();
-
private slots:
void noSuchProperty();
void property();
@@ -398,111 +65,218 @@ private slots:
void iterate();
};
-tst_QScriptClass::tst_QScriptClass()
-{
-}
-
-tst_QScriptClass::~tst_QScriptClass()
-{
-}
-
-void tst_QScriptClass::init()
-{
-}
-
-void tst_QScriptClass::cleanup()
-{
-}
-
+// Test the overhead of checking for an inexisting property of a QScriptClass
void tst_QScriptClass::noSuchProperty()
{
QScriptEngine eng;
- TestClass cls(&eng);
+ QScriptClass cls(&eng);
QScriptValue obj = eng.newObject(&cls);
QString propertyName = QString::fromLatin1("foo");
QBENCHMARK {
- (void)obj.property(propertyName);
+ for (int i = 0; i < iterationNumber; ++i)
+ (void)obj.property(propertyName);
}
+ Q_ASSERT(!obj.property(propertyName).isValid());
}
+
+class FooScriptClass : public QScriptClass
+{
+public:
+ FooScriptClass(QScriptEngine *engine)
+ : QScriptClass(engine)
+ {
+ foo = engine->toStringHandle("foo");
+ }
+
+ QueryFlags queryProperty(const QScriptValue &,
+ const QScriptString &,
+ QueryFlags flags,
+ uint *id)
+ {
+ *id = 1;
+ return flags;
+ }
+
+ QScriptValue property(const QScriptValue &,
+ const QScriptString &,
+ uint)
+ {
+ return QScriptValue(engine(), 35);
+ }
+
+ void setProperty(QScriptValue &, const QScriptString &,
+ uint, const QScriptValue &)
+ {}
+
+ QScriptValue::PropertyFlags propertyFlags(const QScriptValue &, const QScriptString &, uint)
+ {
+ return QScriptValue::Undeletable;
+ }
+private:
+ QScriptString foo;
+};
+
+// Test the overhead of getting a value of QScriptClass accross the Javascript engine
void tst_QScriptClass::property()
{
QScriptEngine eng;
- TestClass cls(&eng);
- QScriptString foo = eng.toStringHandle("foo");
- cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123);
+ FooScriptClass cls(&eng);
QScriptValue obj = eng.newObject(&cls);
+ QScriptString foo = eng.toStringHandle("foo");
QBENCHMARK {
- (void)obj.property(foo);
+ for (int i = 0; i < iterationNumber; ++i)
+ (void)obj.property(foo);
}
}
+// Test the overhead of setting a value on QScriptClass accross the Javascript engine
void tst_QScriptClass::setProperty()
{
QScriptEngine eng;
- TestClass cls(&eng);
- QScriptString foo = eng.toStringHandle("foo");
- cls.addCustomProperty(foo, QScriptClass::HandlesWriteAccess, /*id=*/1, /*attributes=*/0, /*value=*/123);
+ FooScriptClass cls(&eng);
QScriptValue obj = eng.newObject(&cls);
QScriptValue value(456);
+ QScriptString foo = eng.toStringHandle("foo");
QBENCHMARK {
- obj.setProperty(foo, value);
+ for (int i = 0; i < iterationNumber; ++i)
+ obj.setProperty(foo, value);
}
}
+// Test the time taken to get the propeties flags accross the engine
void tst_QScriptClass::propertyFlags()
{
QScriptEngine eng;
- TestClass cls(&eng);
- QScriptString foo = eng.toStringHandle("foo");
- cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, QScriptValue::ReadOnly, /*value=*/123);
+ FooScriptClass cls(&eng);
QScriptValue obj = eng.newObject(&cls);
+ QScriptString foo = eng.toStringHandle("foo");
QBENCHMARK {
- (void)obj.propertyFlags(foo);
+ for (int i = 0; i < iterationNumber; ++i)
+ (void)obj.propertyFlags(foo);
}
}
+
+
+class ExtensionScriptClass : public QScriptClass
+{
+public:
+ ExtensionScriptClass(QScriptEngine *engine)
+ : QScriptClass(engine)
+ {
+ }
+
+ bool supportsExtension(Extension) const
+ {
+ return true;
+ }
+
+ QVariant extension(Extension, const QVariant &argument = QVariant())
+ {
+ Q_UNUSED(argument);
+ return QVariant();
+ }
+};
+
+// Check the overhead of the extension "call"
void tst_QScriptClass::call()
{
QScriptEngine eng;
- TestClass cls(&eng);
- cls.setCallableMode(TestClass::CallableReturnsArgument);
+ ExtensionScriptClass cls(&eng);
QScriptValue obj = eng.newObject(&cls);
QScriptValue thisObject;
QScriptValueList args;
args.append(123);
QBENCHMARK {
- (void)obj.call(thisObject, args);
+ for (int i = 0; i < iterationNumber; ++i)
+ (void)obj.call(thisObject, args);
}
}
+// Check the overhead of the extension "instanceOf"
void tst_QScriptClass::hasInstance()
{
QScriptEngine eng;
- TestClass cls(&eng);
- cls.setHasInstance(true);
+ ExtensionScriptClass cls(&eng);
QScriptValue obj = eng.newObject(&cls);
obj.setProperty("foo", 123);
QScriptValue plain = eng.newObject();
plain.setProperty("foo", obj.property("foo"));
QBENCHMARK {
- (void)plain.instanceOf(obj);
+ for (int i = 0; i < iterationNumber; ++i)
+ (void)plain.instanceOf(obj);
}
}
+
+
+static const int iteratorValuesNumber = 100;
+class TestClassPropertyIterator : public QScriptClassPropertyIterator
+{
+public:
+ TestClassPropertyIterator(const QScriptValue &object, QVector<QScriptString> names)
+ : QScriptClassPropertyIterator(object)
+ , m_index(0)
+ , names(names)
+ {
+ }
+
+ bool hasNext() const
+ {
+ return m_index < iteratorValuesNumber - 1;
+ }
+ void next() { ++m_index; }
+
+ bool hasPrevious() const { return m_index > 0; }
+ void previous() { --m_index; }
+
+ void toFront() { m_index = 0; }
+ void toBack() { m_index = iteratorValuesNumber - 1; }
+
+ QScriptString name() const { return names[m_index]; }
+ uint id() const { return m_index; }
+ QScriptValue::PropertyFlags flags() const { return 0; }
+
+private:
+ int m_index;
+ QVector<QScriptString> names;
+};
+
+
+class IteratorScriptClass : public QScriptClass
+{
+public:
+ IteratorScriptClass(QScriptEngine *engine)
+ : QScriptClass(engine)
+ {
+ for (int i = 0; i < iteratorValuesNumber; ++i)
+ names.append(engine->toStringHandle(QString("property%1").arg(i)));
+ }
+
+ QScriptClassPropertyIterator *newIterator(const QScriptValue &object)
+ {
+ return new TestClassPropertyIterator(object, names);
+ }
+private:
+ QVector<QScriptString> names;
+ friend class TestClassPropertyIterator;
+};
+
+// Measure the performance of the interface to iterate over QScriptClassPropertyIterator
void tst_QScriptClass::iterate()
{
QScriptEngine eng;
- TestClass cls(&eng);
- cls.setIterationEnabled(true);
- cls.addCustomProperty(eng.toStringHandle("foo"), QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123);
- cls.addCustomProperty(eng.toStringHandle("bar"), QScriptClass::HandlesReadAccess, /*id=*/2, /*attributes=*/0, /*value=*/456);
+ IteratorScriptClass cls(&eng);
QScriptValue obj = eng.newObject(&cls);
+ int iterationNumberIterate = iterationNumber / iteratorValuesNumber;
QBENCHMARK {
- QScriptValueIterator it(obj);
- while (it.hasNext()) {
- it.next();
- (void)it.scriptName();
+ for (int i = 0; i < iterationNumberIterate; ++i) {
+ QScriptValueIterator it(obj);
+ while (it.hasNext()) {
+ it.next();
+ (void)it.scriptName();
+ }
}
}
}
diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp
index e3ff2c1..1076ff4 100644
--- a/tools/designer/src/lib/shared/actionrepository.cpp
+++ b/tools/designer/src/lib/shared/actionrepository.cpp
@@ -77,18 +77,12 @@ static inline QAction *actionOfItem(const QStandardItem* item)
return qvariant_cast<QAction*>(item->data(qdesigner_internal::ActionModel::ActionRole));
}
-static QIcon fixActionIcon(const QIcon &icon)
-{
- if (icon.isNull())
- return qdesigner_internal::emptyIcon();
- return icon;
-}
-
namespace qdesigner_internal {
// ----------- ActionModel
ActionModel::ActionModel(QWidget *parent ) :
QStandardItemModel(parent),
+ m_emptyIcon(emptyIcon()),
m_core(0)
{
QStringList headers;
@@ -127,7 +121,7 @@ void ActionModel::update(int row)
for (int i = 0; i < NumColumns; i++)
list += item(row, i);
- setItems(m_core, actionOfItem(list.front()), list);
+ setItems(m_core, actionOfItem(list.front()), m_emptyIcon, list);
}
void ActionModel::remove(int row)
@@ -150,7 +144,7 @@ QModelIndex ActionModel::addAction(QAction *action)
item->setFlags(flags);
items.push_back(item);
}
- setItems(m_core, action, items);
+ setItems(m_core, action, m_emptyIcon, items);
appendRow(items);
return indexFromItem(items.front());
}
@@ -185,7 +179,9 @@ PropertySheetKeySequenceValue ActionModel::actionShortCut(const QDesignerPropert
return qvariant_cast<PropertySheetKeySequenceValue>(sheet->property(index));
}
-void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, QStandardItemList &sl)
+void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
+ const QIcon &defaultIcon,
+ QStandardItemList &sl)
{
// Tooltip, mostly for icon view mode
@@ -200,7 +196,10 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
QStandardItem *item = sl[NameColumn];
item->setText(action->objectName());
- item->setIcon(fixActionIcon(action->icon()));
+ QIcon icon = action->icon();
+ if (icon.isNull())
+ icon = defaultIcon;
+ item->setIcon(icon);
item->setToolTip(firstTooltip);
item->setWhatsThis(firstTooltip);
// Used
diff --git a/tools/designer/src/lib/shared/actionrepository_p.h b/tools/designer/src/lib/shared/actionrepository_p.h
index 65adc5d..6e17e7b 100644
--- a/tools/designer/src/lib/shared/actionrepository_p.h
+++ b/tools/designer/src/lib/shared/actionrepository_p.h
@@ -59,6 +59,7 @@
#include <QtGui/QTreeView>
#include <QtGui/QListView>
#include <QtGui/QStackedWidget>
+#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
@@ -110,10 +111,14 @@ signals:
void resourceImageDropped(const QString &path, QAction *action);
private:
+ typedef QList<QStandardItem *> QStandardItemList;
+
void initializeHeaders();
+ static void setItems(QDesignerFormEditorInterface *core, QAction *a,
+ const QIcon &defaultIcon,
+ QStandardItemList &sl);
- typedef QList<QStandardItem *> QStandardItemList;
- static void setItems(QDesignerFormEditorInterface *core, QAction *a, QStandardItemList &sl);
+ const QIcon m_emptyIcon;
QDesignerFormEditorInterface *m_core;
};
diff --git a/tools/designer/src/lib/shared/iconloader.cpp b/tools/designer/src/lib/shared/iconloader.cpp
index df0bb7e..ed312b8 100644
--- a/tools/designer/src/lib/shared/iconloader.cpp
+++ b/tools/designer/src/lib/shared/iconloader.cpp
@@ -70,8 +70,7 @@ QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name)
QDESIGNER_SHARED_EXPORT QIcon emptyIcon()
{
- static const QIcon empty_icon(QLatin1String(":/trolltech/formeditor/images/emptyicon.png"));
- return empty_icon;
+ return QIcon(QLatin1String(":/trolltech/formeditor/images/emptyicon.png"));
}
} // namespace qdesigner_internal
diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp
index c83abad..ba512e4 100644
--- a/tools/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp
@@ -88,6 +88,7 @@ static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection d
QDesignerMenu::QDesignerMenu(QWidget *parent) :
QMenu(parent),
+ m_subMenuPixmap(QPixmap(QLatin1String(":/trolltech/formeditor/images/submenu.png"))),
m_currentIndex(0),
m_addItem(new SpecialMenuAction(this)),
m_addSeparator(new SpecialMenuAction(this)),
@@ -550,11 +551,10 @@ void QDesignerMenu::deleteAction(QAction *a)
QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const
{
- static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png"));
const QRect g = actionGeometry(action);
- const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - pm.width() - 2) : 2;
- const int y = g.top() + (g.height() - pm.height())/2 + 1;
- return QRect(x, y, pm.width(), pm.height());
+ const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - m_subMenuPixmap.width() - 2) : 2;
+ const int y = g.top() + (g.height() - m_subMenuPixmap.height())/2 + 1;
+ return QRect(x, y, m_subMenuPixmap.width(), m_subMenuPixmap.height());
}
bool QDesignerMenu::hasSubMenuPixmap(QAction *action) const
@@ -591,8 +591,7 @@ void QDesignerMenu::paintEvent(QPaintEvent *event)
p.fillRect(g, lg);
} else if (hasSubMenuPixmap(a)) {
- static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png"));
- p.drawPixmap(subMenuPixmapRect(a).topLeft(), pm);
+ p.drawPixmap(subMenuPixmapRect(a).topLeft(), m_subMenuPixmap);
}
}
diff --git a/tools/designer/src/lib/shared/qdesigner_menu_p.h b/tools/designer/src/lib/shared/qdesigner_menu_p.h
index 9c9a311..ae1e0e7 100644
--- a/tools/designer/src/lib/shared/qdesigner_menu_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_menu_p.h
@@ -57,6 +57,7 @@
#include <QtGui/QAction>
#include <QtGui/QMenu>
+#include <QtGui/QPixmap>
#include <QtCore/QHash>
QT_BEGIN_NAMESPACE
@@ -183,6 +184,7 @@ protected:
private:
bool hideSubMenuOnCursorKey();
bool showSubMenuOnCursorKey();
+ const QPixmap m_subMenuPixmap;
QPoint m_startPosition;
int m_currentIndex;
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp
index 6572059..4e2b473 100644
--- a/tools/linguist/linguist/messagemodel.cpp
+++ b/tools/linguist/linguist/messagemodel.cpp
@@ -584,12 +584,16 @@ void MultiContextItem::putMessageItem(int pos, MessageItem *m)
m_messageLists.last()[pos] = m;
}
-void MultiContextItem::appendMessageItem(MessageItem *m)
+void MultiContextItem::appendMessageItems(const QList<MessageItem *> &m)
{
+ QList<MessageItem *> nullItems = m; // Basically, just a reservation
+ for (int i = 0; i < nullItems.count(); ++i)
+ nullItems[i] = 0;
for (int i = 0; i < m_messageLists.count() - 1; ++i)
- m_messageLists[i].append(0);
- m_messageLists.last().append(m);
- m_multiMessageList.append(MultiMessageItem(m));
+ m_messageLists[i] += nullItems;
+ m_messageLists.last() += m;
+ foreach (MessageItem *mi, m)
+ m_multiMessageList.append(MultiMessageItem(mi));
}
void MultiContextItem::removeMultiMessageItem(int pos)
@@ -710,33 +714,43 @@ void MultiDataModel::append(DataModel *dm, bool readWrite)
m_msgModel->endInsertColumns();
}
m_msgModel->endInsertColumns();
+ int appendedContexts = 0;
for (int i = 0; i < dm->contextCount(); ++i) {
ContextItem *c = dm->contextItem(i);
int mcx = findContextIndex(c->context());
if (mcx >= 0) {
MultiContextItem *mc = multiContextItem(mcx);
mc->assignLastModel(c, readWrite);
+ QList<MessageItem *> appendItems;
for (int j = 0; j < c->messageCount(); ++j) {
MessageItem *m = c->messageItem(j);
int msgIdx = mc->findMessage(m->text(), m->comment());
- if (msgIdx >= 0) {
+ if (msgIdx >= 0)
mc->putMessageItem(msgIdx, m);
- } else {
- int msgCnt = mc->messageCount();
- m_msgModel->beginInsertRows(m_msgModel->createIndex(mcx, 0, 0), msgCnt, msgCnt);
- mc->appendMessageItem(m);
- m_msgModel->endInsertRows();
- ++m_numMessages;
- }
+ else
+ appendItems << m;
+ }
+ if (!appendItems.isEmpty()) {
+ int msgCnt = mc->messageCount();
+ m_msgModel->beginInsertRows(m_msgModel->createIndex(mcx, 0, 0),
+ msgCnt, msgCnt + appendItems.size() - 1);
+ mc->appendMessageItems(appendItems);
+ m_msgModel->endInsertRows();
+ m_numMessages += appendItems.size();
}
} else {
- MultiContextItem item(modelCount() - 1, c, readWrite);
- m_msgModel->beginInsertRows(QModelIndex(), contextCount(), contextCount());
- m_multiContextList.append(item);
- m_msgModel->endInsertRows();
- m_numMessages += item.messageCount();
+ m_multiContextList << MultiContextItem(modelCount() - 1, c, readWrite);
+ m_numMessages += c->messageCount();
+ ++appendedContexts;
}
}
+ if (appendedContexts) {
+ // Do that en block to avoid itemview inefficiency. It doesn't hurt that we
+ // announce the availability of the data "long" after it was actually added.
+ m_msgModel->beginInsertRows(QModelIndex(),
+ contextCount() - appendedContexts, contextCount() - 1);
+ m_msgModel->endInsertRows();
+ }
dm->setWritable(readWrite);
updateCountsOnAdd(modelCount() - 1, readWrite);
connect(dm, SIGNAL(modifiedChanged()), SLOT(onModifiedChanged()));
diff --git a/tools/linguist/linguist/messagemodel.h b/tools/linguist/linguist/messagemodel.h
index 3e0107e..7d98873 100644
--- a/tools/linguist/linguist/messagemodel.h
+++ b/tools/linguist/linguist/messagemodel.h
@@ -332,7 +332,7 @@ private:
void removeModel(int pos);
void moveModel(int oldPos, int newPos); // newPos is *before* removing at oldPos
void putMessageItem(int pos, MessageItem *m);
- void appendMessageItem(MessageItem *m);
+ void appendMessageItems(const QList<MessageItem *> &m);
void removeMultiMessageItem(int pos);
void incrementFinishedCount() { ++m_finishedCount; }
void decrementFinishedCount() { --m_finishedCount; }
diff --git a/translations/qt_de.ts b/translations/qt_de.ts
index 8cbf402..6447451 100644
--- a/translations/qt_de.ts
+++ b/translations/qt_de.ts
@@ -7572,7 +7572,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation>
<location line="+2"/>
<source>Play movie in full-screen mode</source>
<comment>Media controller element</comment>
- <translation>FIlm im Vollbildmodus abspielen</translation>
+ <translation>Film im Vollbildmodus abspielen</translation>
</message>
<message>
<location line="+2"/>
@@ -8245,7 +8245,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation>
<message>
<location filename="../src/xmlpatterns/api/qcoloringmessagehandler.cpp" line="+87"/>
<source>Warning in %1, at line %2, column %3: %4</source>
- <translation>Fehler in %1, bei Zeile %2, Spalte %3: %4</translation>
+ <translation>Warnung in %1, bei Zeile %2, Spalte %3: %4</translation>
</message>
<message>
<location line="+7"/>
@@ -9466,7 +9466,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation>
<location line="-470"/>
<location line="+451"/>
<source>%1 is not allowed to derive from %2 by list as the latter defines it as final.</source>
- <translation>%1 darf nicht durch Listen von %2 abgeleitet werden, da sie letzterer sie als final deklariert.</translation>
+ <translation>%1 darf nicht durch Listen von %2 abgeleitet werden, da letzterer sie als final deklariert.</translation>
</message>
<message>
<location line="-431"/>
@@ -9917,7 +9917,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation>
<message>
<location line="+6"/>
<source>Complex type %1 cannot be derived by extension from %2 as the latter contains %3 element in its content model.</source>
- <translation>Der komplexe Typ % kann nicht durch Erweiterung von %2 abgeleitet werden, da letzterer ein &apos;%3&apos;-Element in seinem Inhaltsmodell hat.</translation>
+ <translation>Der komplexe Typ %1 kann nicht durch Erweiterung von %2 abgeleitet werden, da letzterer ein &apos;%3&apos;-Element in seinem Inhaltsmodell hat.</translation>
</message>
<message>
<location line="+101"/>
diff --git a/util/qlalr/cppgenerator.cpp b/util/qlalr/cppgenerator.cpp
index a95f5e4..f52a86f 100644
--- a/util/qlalr/cppgenerator.cpp
+++ b/util/qlalr/cppgenerator.cpp
@@ -457,7 +457,7 @@ void CppGenerator::generateDecl (QTextStream &out)
out << "class " << grammar.table_name << endl
<< "{" << endl
<< "public:" << endl
- << " enum {" << endl;
+ << " enum VariousConstants {" << endl;
foreach (Name t, grammar.terminals)
{