From 9d88ff485e93e9701719263ce0a46cb86b0398ca Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 2 Sep 2010 13:03:50 +0100 Subject: Prevent null pointer dereference Task-number: QTBUG-13204 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 4ed4ba3..21f930e 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -129,7 +129,7 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo statusPaneVisibilityChanged = (s->IsVisible() != statusPaneVisible); s->MakeVisible(statusPaneVisible); } - if (buttonGroupVisibilityChanged && !statusPaneVisibilityChanged) + if (buttonGroupVisibilityChanged && !statusPaneVisibilityChanged && QApplication::activeWindow()) // Ensure that control rectangle is updated static_cast(QApplication::activeWindow()->winId())->handleClientAreaChange(); } -- cgit v0.12 From 55b067d14d8c12bd29b03c17e0281a11a49f95ca Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 2 Sep 2010 13:07:59 +0100 Subject: Update QDesktopWidget geometry when S60 furniture visibility changes Task-number: QTBUG-13204 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 6 ++++++ src/gui/kernel/qwidget_s60.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 21f930e..e937918 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -129,6 +129,12 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo statusPaneVisibilityChanged = (s->IsVisible() != statusPaneVisible); s->MakeVisible(statusPaneVisible); } + if (buttonGroupVisibilityChanged || statusPaneVisibilityChanged) { + const QSize size = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()).size(); + const QSize oldSize; // note that QDesktopWidget::resizeEvent ignores the QResizeEvent contents + QResizeEvent event(size, oldSize); + QApplication::instance()->sendEvent(QApplication::desktop(), &event); + } if (buttonGroupVisibilityChanged && !statusPaneVisibilityChanged && QApplication::activeWindow()) // Ensure that control rectangle is updated static_cast(QApplication::activeWindow()->winId())->handleClientAreaChange(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index fc13c93..c98c05a 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -503,8 +503,10 @@ void QWidgetPrivate::show_sys() // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver. QSymbianControl *desktopControl = static_cast(QApplication::desktop()->winId()); S60->statusPane()->SetObserver(desktopControl); - if (isFullscreen) - S60->statusPane()->MakeVisible(false); + if (isFullscreen) { + const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible(); + S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible); + } } } } -- cgit v0.12 From f8c789a70ee3061dd81307ead82c47bb0f8041d5 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Thu, 2 Sep 2010 15:30:37 +0300 Subject: Document known limitations in UI performance on S60 5.0 based devices. Task-number: QTBUG-11333 Reviewed-by: axis --- doc/src/images/symbian-draw-pixmap-sequence.png | Bin 0 -> 5724 bytes doc/src/images/symbian-qt-draw-pixmap-sequence.png | Bin 0 -> 9141 bytes .../symbian-qt-rendering-stack-non-screenplay.png | Bin 0 -> 52802 bytes .../symbian-rendering-stack-non-screenplay.png | Bin 0 -> 44655 bytes doc/src/platforms/platform-notes.qdoc | 50 +++++++++++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 doc/src/images/symbian-draw-pixmap-sequence.png create mode 100644 doc/src/images/symbian-qt-draw-pixmap-sequence.png create mode 100644 doc/src/images/symbian-qt-rendering-stack-non-screenplay.png create mode 100644 doc/src/images/symbian-rendering-stack-non-screenplay.png diff --git a/doc/src/images/symbian-draw-pixmap-sequence.png b/doc/src/images/symbian-draw-pixmap-sequence.png new file mode 100644 index 0000000..05e3739 Binary files /dev/null and b/doc/src/images/symbian-draw-pixmap-sequence.png differ diff --git a/doc/src/images/symbian-qt-draw-pixmap-sequence.png b/doc/src/images/symbian-qt-draw-pixmap-sequence.png new file mode 100644 index 0000000..f7546f4 Binary files /dev/null and b/doc/src/images/symbian-qt-draw-pixmap-sequence.png differ diff --git a/doc/src/images/symbian-qt-rendering-stack-non-screenplay.png b/doc/src/images/symbian-qt-rendering-stack-non-screenplay.png new file mode 100644 index 0000000..9e1997d Binary files /dev/null and b/doc/src/images/symbian-qt-rendering-stack-non-screenplay.png differ diff --git a/doc/src/images/symbian-rendering-stack-non-screenplay.png b/doc/src/images/symbian-rendering-stack-non-screenplay.png new file mode 100644 index 0000000..80cb078 Binary files /dev/null and b/doc/src/images/symbian-rendering-stack-non-screenplay.png differ diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 94b9856..6f533ae 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -526,6 +526,56 @@ platform in use. If available, it is loaded in preference over the MMF plugin. If the Helix plugin fails to load, the MMF plugin, if present on the device, will be loaded instead. + + \section1 UI Performance in devices prior to Symbian^3 + + Qt uses the QPainter class to perform low-level painting on widgets and + other paint devices. QPainter provides functions to draw complex shapes, + aligned text and pixmaps. It can also do vector path clipping, coordinate + transformations and Porter-Duff composition. If the underlying graphics + architecture does not support all of these operations then Qt uses the + raster graphics system for rendering. + + Most of the Symbian devices prior to Symbian^3 use a non-ScreenPlay + graphics architecture which does not have native support for all functions + provided by QPainter. In non-ScreenPlay devices Qt uses the raster + graphics system by default which has a performance penalty when compared + to native Symbian rendering. + + In order to be able to perform all functions provided by QPainter, the + raster graphics system needs to have pixel level framebuffer access. To + make this possible in non-ScreenPlay devices Qt has to create an + additional offscreen buffer that is the target for all Qt rendering + operations. Qt renders the widget tree to the offscreen buffer and the + offscreen buffer is blitted to the framebuffer via Symbian Window Server. + + The following table shows the rendering stacks of native Symbian and Qt in + non-ScreenPlay devices. + + \table + \header \o Symbian + \o Qt + \row \o \image symbian-rendering-stack-non-screenplay.png + \o \image symbian-qt-rendering-stack-non-screenplay.png + \endtable + + The following diagrams show a simplified sequence of drawing a pixmap in + a non-ScreenPlay device. + + \table + \header \o Symbian + \row \o \image symbian-draw-pixmap-sequence.png + \endtable + + \table + \header \o Qt + \row \o \image symbian-qt-draw-pixmap-sequence.png + \endtable + + When compared to a native Symbian application, Qt does an additional blit + to the offscreen buffer before drawing to the framebuffer. That is the + performance penalty which needs to be paid to get all functionality + provided by QPainter in non-ScreenPlay architecture. */ /*! -- cgit v0.12 From efe67ac8c1c59fd4cf8c793b549169f4e2926ac8 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 2 Sep 2010 15:40:38 +0200 Subject: Fixed a bug where passwords would not be committed when confirming. The bug happened when you were typing a password and pressing "Done" softkey very quickly. Because of the temporarily visible character, the widget would not contain the full string at the time of softkey triggering, only the *** part. Fixed by having the input context listen for softkey (command) events and commit the temporary character before the softkey action is triggered. AutoTest: Included Task: QTBUG-12949 RevBy: Miikka Heikkinen --- src/gui/inputmethod/qcoefepinputcontext_p.h | 1 + src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 13 +++ tests/auto/qinputcontext/tst_qinputcontext.cpp | 124 ++++++++++++++++++++++++ 3 files changed, 138 insertions(+) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 2fd6d16..ac40bba 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -84,6 +84,7 @@ public: void update(); bool filterEvent(const QEvent *event); + bool symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event); void mouseHandler( int x, QMouseEvent *event); bool isComposing() const { return !m_preeditString.isEmpty(); } diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index add3d17..abcec32 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -287,6 +288,18 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) return false; } +bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event) +{ + Q_UNUSED(keyWidget); + if (event->type() == QSymbianEvent::CommandEvent) + // A command basically means the same as a button being pushed. With Qt buttons + // that would normally result in a reset of the input method due to the focus change. + // This should also happen for commands. + reset(); + + return false; +} + void QCoeFepInputContext::timerEvent(QTimerEvent *timerEvent) { if (timerEvent->timerId() == m_tempPreeditStringTimeout.timerId()) diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 93813f9..52e655b 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef Q_OS_SYMBIAN #include @@ -80,6 +81,8 @@ private slots: void focusProxy(); void symbianTestCoeFepInputContext_data(); void symbianTestCoeFepInputContext(); + void symbianTestCoeFepAutoCommit_data(); + void symbianTestCoeFepAutoCommit(); private: bool m_phoneIsQwerty; @@ -936,5 +939,126 @@ void tst_QInputContext::symbianTestCoeFepInputContext() #endif } +void tst_QInputContext::symbianTestCoeFepAutoCommit_data() +{ +#ifdef Q_OS_SYMBIAN + QTest::addColumn ("inputMethodHints"); + QTest::addColumn ("echoMode"); + QTest::addColumn > ("keyEvents"); + QTest::addColumn ("finalString"); + + QList events; + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('0', '0', 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + QTest::newRow("Numbers") + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << QLineEdit::Normal + << events + << QString("440968"); + QTest::newRow("Numbers and password") + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << QLineEdit::Password + << events + << QString("440968"); + QTest::newRow("Multitap") + << Qt::InputMethodHints(Qt::ImhPreferLowercase | Qt::ImhNoPredictiveText) + << QLineEdit::Normal + << events + << QString("h wmt"); + QTest::newRow("T9") + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << QLineEdit::Normal + << events + << QString("hi you"); + QTest::newRow("Multitap with password") + << Qt::InputMethodHints(Qt::ImhPreferLowercase | Qt::ImhNoPredictiveText) + << QLineEdit::Password + << events + << QString("h wmt"); + QTest::newRow("T9 with password") + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << QLineEdit::Password + << events + << QString("h wmt"); +#endif +} + +void tst_QInputContext::symbianTestCoeFepAutoCommit() +{ +#ifndef Q_OS_SYMBIAN + QSKIP("This is a Symbian-only test", SkipAll); +#else + QCoeFepInputContext *ic = qobject_cast(qApp->inputContext()); + if (!ic) { + QSKIP("coefep is not the active input context; skipping test", SkipAll); + } + + QFETCH(Qt::InputMethodHints, inputMethodHints); + QFETCH(QLineEdit::EchoMode, echoMode); + QFETCH(QList, keyEvents); + QFETCH(QString, finalString); + + if (m_phoneIsQwerty) { + QSKIP("Skipping advanced input method tests on QWERTY phones", SkipSingle); + } + + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *lineedit = new QLineEdit; + layout->addWidget(lineedit); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + QPushButton *pushButton = new QPushButton("Done"); + layout->addWidget(pushButton); + QAction softkey("Done", &w); + softkey.setSoftKeyRole(QAction::PositiveSoftKey); + w.addAction(&softkey); + w.show(); + + lineedit->setInputMethodHints(inputMethodHints); + lineedit->setEchoMode(echoMode); + + QTest::qWait(200); + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + QApplication::processEvents(); + + QTest::mouseClick(pushButton, Qt::LeftButton); + + QCOMPARE(lineedit->text(), finalString); + QVERIFY(ic->m_preeditString.isEmpty()); + +#ifdef Q_WS_S60 + lineedit->inputContext()->reset(); + lineedit->clear(); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + + QTest::qWait(200); + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + QApplication::processEvents(); + + FepReplayEvent(EStdKeyDevice0, EKeyDevice0, 0, 0).replay(lineedit); // Left softkey + + QCOMPARE(lineedit->text(), finalString); + QVERIFY(ic->m_preeditString.isEmpty()); + +#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN +} + QTEST_MAIN(tst_QInputContext) #include "tst_qinputcontext.moc" -- cgit v0.12 From 5afd02d13fca42d556e03579a5ed4eb53d2eb172 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 2 Sep 2010 16:09:17 +0200 Subject: Fixed a few warnings. --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index abcec32..b08b9a9 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -664,7 +664,7 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText, QInputMethodEvent event(newPreeditString, attributes); if (newPreeditString.isEmpty() && m_preeditString.isEmpty()) { // In Symbian world this means "erase last character". - event.setCommitString("", -1, 1); + event.setCommitString(QLatin1String(""), -1, 1); } m_preeditString = newPreeditString; sendEvent(event); @@ -836,8 +836,6 @@ void QCoeFepInputContext::DoCommitFepInlineEditL() void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction) { - int longPress = 0; - QList attributes; QInputMethodEvent event(QLatin1String(""), attributes); event.setCommitString(m_preeditString, 0, 0); -- cgit v0.12 From c229d4c1cb4c5aa0be22dddd5e8d8436a29cf103 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 2 Sep 2010 17:37:07 +0200 Subject: Removing a left over #if 1..#endif construct --- src/gui/text/qfont_s60.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index ccd17a2..f303419 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE -#if 1 #ifdef QT_NO_FREETYPE Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex); #endif // QT_NO_FREETYPE @@ -70,7 +69,7 @@ QString QFont::lastResortFamily() const lock.relock(); } return family; -#else +#else // QT_NO_FREETYPE // For the FreeType case we just hard code the face name, since otherwise on // East Asian systems we may get a name for a stroke based (non-ttf) font. @@ -82,12 +81,6 @@ QString QFont::lastResortFamily() const return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":"Series 60 Sans"); #endif // QT_NO_FREETYPE } -#else // 0 -QString QFont::lastResortFamily() const -{ - return QLatin1String("Series 60 Sans"); -} -#endif // 0 QString QFont::defaultFamily() const { -- cgit v0.12 From aece97b08ce8ae0752d4f7628fd80db48736d5ab Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 2 Sep 2010 16:12:10 +0200 Subject: qdrawhelper: Remove blend_transformed_bilinear_argb With the recent optimisation in fetchTransformedBilinear, the generic path is faster than the 'optimized' path Reviewed-by: Samuel --- src/gui/painting/qdrawhelper.cpp | 183 +-------------------------------------- 1 file changed, 4 insertions(+), 179 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5e1509d..46c94e0 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5335,181 +5335,6 @@ static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData) blend_tiled_generic(count, spans, userData); } - -template /* blendType must be either BlendTransformedBilinear or BlendTransformedBilinearTiled */ -Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const QSpan *spans, void *userData) -{ - QSpanData *data = reinterpret_cast(userData); - if (data->texture.format != QImage::Format_ARGB32_Premultiplied - && data->texture.format != QImage::Format_RGB32) { - blend_src_generic(count, spans, userData); - return; - } - - CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; - uint buffer[buffer_size]; - - const int image_x1 = data->texture.x1; - const int image_y1 = data->texture.y1; - const int image_x2 = data->texture.x2; - const int image_y2 = data->texture.y2; - const int image_width = data->texture.width; - const int image_height = data->texture.height; - const int scanline_offset = data->texture.bytesPerLine / 4; - - if (data->fast_matrix) { - // The increment pr x in the scanline - int fdx = (int)(data->m11 * fixed_scale); - int fdy = (int)(data->m12 * fixed_scale); - - while (count--) { - void *t = data->rasterBuffer->scanLine(spans->y); - - uint *target = ((uint *)t) + spans->x; - uint *image_bits = (uint *)data->texture.imageData; - - const qreal cx = spans->x + 0.5; - const qreal cy = spans->y + 0.5; - - int x = int((data->m21 * cy - + data->m11 * cx + data->dx) * fixed_scale) - half_point; - int y = int((data->m22 * cy - + data->m12 * cx + data->dy) * fixed_scale) - half_point; - - int length = spans->len; - const int coverage = (data->texture.const_alpha * spans->coverage) >> 8; - while (length) { - int l = qMin(length, buffer_size); - const uint *end = buffer + l; - uint *b = buffer; - while (b < end) { - int x1 = (x >> 16); - int x2; - int y1 = (y >> 16); - int y2; - - fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); - fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); - - int y1_offset = y1 * scanline_offset; - int y2_offset = y2 * scanline_offset; - -#if defined(Q_IRIX_GCC3_3_WORKAROUND) - uint tl = gccBug(image_bits[y1_offset + x1]); - uint tr = gccBug(image_bits[y1_offset + x2]); - uint bl = gccBug(image_bits[y2_offset + x1]); - uint br = gccBug(image_bits[y2_offset + x2]); -#else - uint tl = image_bits[y1_offset + x1]; - uint tr = image_bits[y1_offset + x2]; - uint bl = image_bits[y2_offset + x1]; - uint br = image_bits[y2_offset + x2]; -#endif - - int distx = (x & 0x0000ffff) >> 8; - int disty = (y & 0x0000ffff) >> 8; - int idistx = 256 - distx; - int idisty = 256 - disty; - - uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); - uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); - *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); - ++b; - - x += fdx; - y += fdy; - } - if (spanMethod == RegularSpans) - func(target, buffer, l, coverage); - else - drawBufferSpan(data, buffer, buffer_size, - spans->x + spans->len - length, - spans->y, l, coverage); - target += l; - length -= l; - } - ++spans; - } - } else { - const qreal fdx = data->m11; - const qreal fdy = data->m12; - const qreal fdw = data->m13; - - while (count--) { - void *t = data->rasterBuffer->scanLine(spans->y); - - uint *target = ((uint *)t) + spans->x; - uint *image_bits = (uint *)data->texture.imageData; - - const qreal cx = spans->x + 0.5; - const qreal cy = spans->y + 0.5; - - qreal x = data->m21 * cy + data->m11 * cx + data->dx; - qreal y = data->m22 * cy + data->m12 * cx + data->dy; - qreal w = data->m23 * cy + data->m13 * cx + data->m33; - - int length = spans->len; - const int coverage = (data->texture.const_alpha * spans->coverage) >> 8; - while (length) { - int l = qMin(length, buffer_size); - const uint *end = buffer + l; - uint *b = buffer; - while (b < end) { - const qreal iw = w == 0 ? 1 : 1 / w; - const qreal px = x * iw - 0.5; - const qreal py = y * iw - 0.5; - - int x1 = int(px) - (px < 0); - int x2; - int y1 = int(py) - (py < 0); - int y2; - - int distx = int((px - x1) * 256); - int disty = int((py - y1) * 256); - int idistx = 256 - distx; - int idisty = 256 - disty; - - fetchTransformedBilinear_pixelBounds(image_width, image_x1, image_x2, x1, x2); - fetchTransformedBilinear_pixelBounds(image_height, image_y1, image_y2, y1, y2); - - int y1_offset = y1 * scanline_offset; - int y2_offset = y2 * scanline_offset; - -#if defined(Q_IRIX_GCC3_3_WORKAROUND) - uint tl = gccBug(image_bits[y1_offset + x1]); - uint tr = gccBug(image_bits[y1_offset + x2]); - uint bl = gccBug(image_bits[y2_offset + x1]); - uint br = gccBug(image_bits[y2_offset + x2]); -#else - uint tl = image_bits[y1_offset + x1]; - uint tr = image_bits[y1_offset + x2]; - uint bl = image_bits[y2_offset + x1]; - uint br = image_bits[y2_offset + x2]; -#endif - - uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); - uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); - *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); - ++b; - - x += fdx; - y += fdy; - w += fdw; - } - if (spanMethod == RegularSpans) - func(target, buffer, l, coverage); - else - drawBufferSpan(data, buffer, buffer_size, - spans->x + spans->len - length, - spans->y, l, coverage); - target += l; - length -= l; - } - ++spans; - } - } -} - template Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan *spans, void *userData) @@ -6760,7 +6585,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32 - blend_transformed_bilinear_argb, // ARGB32_Premultiplied + SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32_Premultiplied blend_transformed_bilinear_rgb565, blend_transformed_bilinear_argb8565, blend_transformed_bilinear_rgb666, @@ -6779,7 +6604,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32 - blend_transformed_bilinear_argb, // ARGB32_Premultiplied + SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32_Premultiplied SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB16 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB8565_Premultiplied SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB666 @@ -6878,7 +6703,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag blend_src_generic, // Indexed8 blend_src_generic, // RGB32 blend_src_generic, // ARGB32 - blend_transformed_bilinear_argb, // ARGB32_Premultiplied + blend_src_generic, // ARGB32_Premultiplied blend_src_generic, // RGB16 blend_src_generic, // ARGB8565_Premultiplied blend_src_generic, // RGB666 @@ -6897,7 +6722,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag blend_src_generic, // Indexed8 blend_src_generic, // RGB32 blend_src_generic, // ARGB32 - blend_transformed_bilinear_argb, // ARGB32_Premultiplied + blend_src_generic, // ARGB32_Premultiplied blend_src_generic, // RGB16 blend_src_generic, // ARGB8565_Premultiplied blend_src_generic, // RGB666 -- cgit v0.12 From 41a8c2280a3f454c457f811fc6428826b11b4754 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 2 Sep 2010 21:33:06 +0200 Subject: Symbian: return better default font for SansSerif style hint The latest QtWebkit will use QFont::defaultFamily() with style hints to ask for the appropriate default fonts on a system. This patch makes sure thath "Nokia Sans S60" and "Series 60 Sans" are prioritized for QFont::SansSerif, if they are present. Task-Number: QTBUG-12611 --- src/gui/text/qfont_s60.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index f303419..2d547a9 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qfont.h" +#include "qfont_p.h" #include #include #include "qmutex.h" @@ -48,6 +49,17 @@ QT_BEGIN_NAMESPACE #ifdef QT_NO_FREETYPE Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex); +Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, { + QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); + const int numTypeFaces = S60->screenDevice()->NumTypefaces(); + for (int i = 0; i < numTypeFaces; i++) { + TTypefaceSupport typefaceSupport; + S60->screenDevice()->TypefaceSupport(typefaceSupport, i); + const QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length()); + x->append(familyName); + } + lock.relock(); +}); #endif // QT_NO_FREETYPE QString QFont::lastResortFamily() const @@ -84,6 +96,21 @@ QString QFont::lastResortFamily() const QString QFont::defaultFamily() const { +#ifdef QT_NO_FREETYPE + switch(d->request.styleHint) { + case QFont::SansSerif: { + static const char* const preferredSansSerif[] = {"Nokia Sans S60", "Series 60 Sans"}; + for (int i = 0; i < sizeof preferredSansSerif / sizeof preferredSansSerif[0]; ++i) { + const QString sansSerif = QLatin1String(preferredSansSerif[i]); + if (fontFamiliesOnFontServer()->contains(sansSerif)) + return sansSerif; + } + } + // No break. Intentional fall through. + default: + return lastResortFamily(); + } +#endif // QT_NO_FREETYPE return lastResortFamily(); } -- cgit v0.12 From 1bd2eb8ecd6b2377132beaa789c8b3b8a6f544d9 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 3 Sep 2010 11:34:48 +1000 Subject: Support passing QObject derived types to QML methods QTBUG-13047 --- src/declarative/qml/qdeclarativeengine.cpp | 2 +- .../qml/qdeclarativeobjectscriptclass.cpp | 16 +++++++++++-- .../data/invokableObjectArg.qml | 9 ++++++++ .../data/invokableObjectRet.qml | 11 +++++++++ .../declarative/qdeclarativeecmascript/testtypes.h | 6 ++++- .../tst_qdeclarativeecmascript.cpp | 27 ++++++++++++++++++++++ 6 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8461368..e77a53e 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2113,7 +2113,7 @@ bool QDeclarativeEnginePrivate::isQObject(int t) QObject *QDeclarativeEnginePrivate::toQObject(const QVariant &v, bool *ok) const { int t = v.userType(); - if (m_compositeTypes.contains(t)) { + if (t == QMetaType::QObjectStar || m_compositeTypes.contains(t)) { if (ok) *ok = true; return *(QObject **)(v.constData()); } else { diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index f439151..9d74238 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -625,11 +625,12 @@ private: char data[4 * sizeof(void *)]; int type; + bool isObjectType; }; } MetaCallArgument::MetaCallArgument() -: type(QVariant::Invalid) +: type(QVariant::Invalid), isObjectType(false) { } @@ -744,12 +745,23 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, new (&data) QVariant(); type = -1; - QVariant v = QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value); + QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(engine); + QVariant v = priv->scriptValueToVariant(value); if (v.userType() == callType) { *((QVariant *)&data) = v; } else if (v.canConvert((QVariant::Type)callType)) { *((QVariant *)&data) = v; ((QVariant *)&data)->convert((QVariant::Type)callType); + } else if (const QMetaObject *mo = priv->rawMetaObjectForType(callType)) { + QObject *obj = priv->toQObject(v); + + if (obj) { + const QMetaObject *objMo = obj->metaObject(); + while (objMo && objMo != mo) objMo = objMo->superClass(); + if (!objMo) obj = 0; + } + + *((QVariant *)&data) = QVariant(callType, &obj); } else { *((QVariant *)&data) = QVariant(callType, (void *)0); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml new file mode 100644 index 0000000..d5d3329 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml @@ -0,0 +1,9 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + Component.onCompleted: { + root.myinvokable(root); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml new file mode 100644 index 0000000..29d7d01 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml @@ -0,0 +1,11 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + property bool test: false + Component.onCompleted: { + test = (root.returnme() == root) + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 7d7e3d9..220318d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -95,7 +95,7 @@ class MyQmlObject : public QObject Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false); public: - MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} + MyQmlObject(): myinvokableObject(0), m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 }; enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3 }; @@ -149,6 +149,9 @@ public: int nonscriptable() const { return 0; } void setNonscriptable(int) {} + MyQmlObject *myinvokableObject; + Q_INVOKABLE MyQmlObject *returnme() { return this; } + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); @@ -162,6 +165,7 @@ public slots: void methodNoArgs() { m_methodCalled = true; } void method(int a) { if(a == 163) m_methodIntCalled = true; } void setString(const QString &s) { m_string = s; } + void myinvokable(MyQmlObject *o) { myinvokableObject = o; } private: friend class tst_qdeclarativeecmascript; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 76ca964..33bf7ea 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -164,6 +164,8 @@ private slots: void include(); void callQtInvokables(); + void invokableObjectArg(); + void invokableObjectRet(); private: QDeclarativeEngine engine; }; @@ -1733,6 +1735,31 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().at(0), QVariant(9)); } +// QTBUG-13047 (check that you can pass registered object types as args) +void tst_qdeclarativeecmascript::invokableObjectArg() +{ + QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectArg.qml")); + + QObject *o = component.create(); + QVERIFY(o); + MyQmlObject *qmlobject = qobject_cast(o); + QVERIFY(qmlobject); + QCOMPARE(qmlobject->myinvokableObject, qmlobject); + + delete o; +} + +// QTBUG-13047 (check that you can return registered object types from methods) +void tst_qdeclarativeecmascript::invokableObjectRet() +{ + QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectRet.qml")); + + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + // QTBUG-5675 void tst_qdeclarativeecmascript::listToVariant() { -- cgit v0.12 From e0d41e566c49532dba6ed7eeb6a826f80e11c119 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 3 Sep 2010 11:41:12 +1000 Subject: Doc QTBUG-12665 --- doc/src/declarative/extending.qdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 6388764..0cc989d 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -674,6 +674,16 @@ declaring a new property, and the corresponding C++ type. \row \o variant \o QVariant \endtable +From QML you can also declare object and list properties using any element name +like this: + +\code + property QtObject objectProperty + property Item itemProperty + property MyCustomType customProperty + property list listOfItemsProperty +\endcode + QML supports two methods for adding a new property to a type: a new property definition, and a property alias. -- cgit v0.12 From d758910f3d8d5eb64f7c7d94e5c9ef9ae259230b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 3 Sep 2010 11:56:42 +1000 Subject: Don't modify the signal order on the second dynamic meta object pass QTBUG-13374 --- src/declarative/qml/qdeclarativecompiler.cpp | 12 ++++++++---- .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 12 ++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 7847303..61ea9c8 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2416,13 +2416,17 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn propBuilder.setWritable(!readonly); } - if (mode == ResolveAliases) { - for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) { - const Object::DynamicProperty &p = obj->dynamicProperties.at(ii); + for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) { + const Object::DynamicProperty &p = obj->dynamicProperties.at(ii); - if (p.type == Object::DynamicProperty::Alias) { + if (p.type == Object::DynamicProperty::Alias) { + if (mode == ResolveAliases) { ((QDeclarativeVMEMetaData *)dynamicData.data())->aliasCount++; compileAlias(builder, dynamicData, obj, p); + } else { + // Need a fake signal so that the metaobject remains consistent across + // the resolve and non-resolve alias runs + builder.addSignal(p.name + "Changed()"); } } } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index dc00e16..1825991 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -118,6 +118,7 @@ private slots: void valueTypes(); void cppnamespace(); void aliasProperties(); + void aliasPropertiesAndSignals(); void componentCompositeType(); void i18n(); void i18n_data(); @@ -1051,6 +1052,17 @@ void tst_qdeclarativelanguage::aliasProperties() } } +// QTBUG-13374 Test that alias properties and signals can coexist +void tst_qdeclarativelanguage::aliasPropertiesAndSignals() +{ + QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertiesAndSignals.qml")); + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + // Test that the root element in a composite type can be a Component void tst_qdeclarativelanguage::componentCompositeType() { -- cgit v0.12 From 348e8471b7df101fb71d1c651eb92dcc0f45f6ff Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 3 Sep 2010 16:26:07 +1000 Subject: qreal == float fixes QTBUG-11853 --- src/declarative/qml/qdeclarativevaluetypescriptclass.cpp | 2 +- tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp index f06d6ae..60f2cb3 100644 --- a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp +++ b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp @@ -168,7 +168,7 @@ void QDeclarativeValueTypeScriptClass::setProperty(Object *obj, const Identifier ref->type->read(ref->object, ref->property); QMetaProperty p = ref->type->metaObject()->property(m_lastIndex); - if (p.isEnumType() && (QMetaType::Type)v.type() == QMetaType::QReal) + if (p.isEnumType() && (QMetaType::Type)v.type() == QMetaType::Double) v = v.toInt(); p.write(ref->type, v); ref->type->write(ref->object, ref->property, 0); diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 5028ba1..dca5205 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -480,7 +480,7 @@ void tst_qdeclarativedom::loadDynamicProperty() DP_TEST(0, a, QVariant::Int, 25, 14, "int"); DP_TEST(1, b, QVariant::Bool, 44, 15, "bool"); - DP_TEST(2, c, QVariant::Double, 64, 17, "double"); + DP_TEST(2, c, QMetaType::QReal, 64, 17, "double"); DP_TEST(3, d, QMetaType::QReal, 86, 15, "real"); DP_TEST(4, e, QVariant::String, 106, 17, "string"); DP_TEST(5, f, QVariant::Url, 128, 14, "url"); -- cgit v0.12 From 982d7f659750f0864e2d874ce41289125f40a36b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 3 Sep 2010 17:10:45 +1000 Subject: Keep ListView position sensible when all visible items are removed. Previously it would always jump back to 0. Now it stays at the nearest remaining index. Task-number: QTBUG-12664 --- src/declarative/graphicsitems/qdeclarativelistview.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index ef28ab2..1c634d2 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2916,14 +2916,18 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count) } if (removedVisible && d->visibleItems.isEmpty()) { - d->visibleIndex = 0; - d->visiblePos = d->header ? d->header->size() : 0; d->timeline.clear(); - d->setPosition(0); if (d->itemCount == 0) { + d->visibleIndex = 0; + d->visiblePos = d->header ? d->header->size() : 0; + d->setPosition(0); d->updateHeader(); d->updateFooter(); update(); + } else { + if (modelIndex < d->visibleIndex) + d->visibleIndex = modelIndex+1; + d->visibleIndex = qMax(qMin(d->visibleIndex, d->itemCount-1), 0); } } -- cgit v0.12 From 9be190b01a0a74d133958b030f52656282f31175 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 3 Sep 2010 17:13:45 +1000 Subject: Fix the same bug that was in the demo samegame, in the tutorial version --- examples/declarative/tutorials/samegame/samegame4/content/samegame.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index b1f427c..79ff0c1 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -127,7 +127,7 @@ function shuffleDown() { } else { if (fallDist > 0) { var obj = board[index(column, row)]; - obj.y += fallDist * gameCanvas.blockSize; + obj.y = (row + fallDist) * gameCanvas.blockSize; board[index(column, row + fallDist)] = obj; board[index(column, row)] = null; } @@ -145,7 +145,7 @@ function shuffleDown() { obj = board[index(column, row)]; if (obj == null) continue; - obj.x -= fallDist * gameCanvas.blockSize; + obj.x = (fallDist - column) * gameCanvas.blockSize; board[index(column - fallDist, row)] = obj; board[index(column, row)] = null; } -- cgit v0.12 From 9311f0554b885f6b3ab1ab77f9c65b9f89865675 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 3 Sep 2010 17:18:46 +1000 Subject: Missing file --- .../data/aliasPropertiesAndSignals.qml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml new file mode 100644 index 0000000..59afe58 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +QtObject { + id: root + + property bool test: false + property alias myalias: root.objectName + signal go + onGo: test = true + + Component.onCompleted: { + root.go(); + } +} -- cgit v0.12 From 250545f7996927fa151097857179b5895010506b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 3 Sep 2010 17:50:43 +1000 Subject: Complete Component::createObject() creation after setting the parent. Task-number: QTBUG-13170 Reviewed-by: Alan Alpert --- src/declarative/qml/qdeclarativecomponent.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 75bb5db..74de738 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -607,10 +607,11 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) ctxt = d->engine->rootContext(); if (!ctxt) return QScriptValue(QScriptValue::NullValue); - QObject* ret = create(ctxt); - if (!ret) + QObject* ret = beginCreate(ctxt); + if (!ret) { + completeCreate(); return QScriptValue(QScriptValue::NullValue); - + } if (parent) { ret->setParent(parent); @@ -631,6 +632,7 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) if (needParent) qWarning("QDeclarativeComponent: Created graphical object was not placed in the graphics scene."); } + completeCreate(); QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(d->engine); QDeclarativeData::get(ret, true)->setImplicitDestructible(); -- cgit v0.12 From adcb5f115ff768fe68883f392c00e6d2945a377c Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 3 Sep 2010 18:12:09 +1000 Subject: Cleanup visible item checking in positioners Especially in Grid, where it wasn't being done right. Task-number: QTBUG-12610 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativepositioners.cpp | 48 +++++++++++----------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index b776b8e..77b26b9 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -247,13 +247,13 @@ void QDeclarativeBasePositioner::prePositioning() positionedItems.append(posItem); item = &positionedItems[positionedItems.count()-1]; item->isNew = true; - if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden) + if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden || !childPrivate->width() || !childPrivate->height()) item->isVisible = false; } else { item = &oldItems[wIdx]; // Items are only omitted from positioning if they are explicitly hidden // i.e. their positioning is not affected if an ancestor is hidden. - if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden) { + if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden || !childPrivate->width() || !childPrivate->height()) { item->isVisible = false; } else if (!item->isVisible) { item->isVisible = true; @@ -321,12 +321,6 @@ void QDeclarativeBasePositioner::finishApplyTransitions() d->moveActions.clear(); } -static inline bool isInvisible(QGraphicsObject *child) -{ - QGraphicsItemPrivate *childPrivate = static_cast(QGraphicsItemPrivate::get(child)); - return child->opacity() == 0.0 || childPrivate->explicitlyHidden || !childPrivate->width() || !childPrivate->height(); -} - /*! \qmlclass Column QDeclarativeColumn \ingroup qml-positioning-elements @@ -449,7 +443,7 @@ void QDeclarativeColumn::doPositioning(QSizeF *contentSize) for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (!child.item || isInvisible(child.item)) + if (!child.item || !child.isVisible) continue; if(child.item->y() != voffset) @@ -584,7 +578,7 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (!child.item || isInvisible(child.item)) + if (!child.item || !child.isVisible) continue; if(child.item->x() != hoffset) @@ -793,9 +787,17 @@ void QDeclarativeGrid::setFlow(Flow flow) void QDeclarativeGrid::doPositioning(QSizeF *contentSize) { + int c = m_columns; int r = m_rows; - int numVisible = positionedItems.count(); + //Is allocating the extra QPODVector too much overhead? + QPODVector visibleItems;//we aren't concerned with invisible items + visibleItems.reserve(positionedItems.count()); + for(int i=0; iwidth() > maxColWidth[j]) maxColWidth[j] = childPrivate->width(); @@ -837,10 +838,9 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) maxColWidth << 0; if (childIndex == positionedItems.count()) - continue; - const PositionedItem &child = positionedItems.at(childIndex++); - if (!child.item || isInvisible(child.item)) - continue; + break; + + const PositionedItem &child = visibleItems.at(childIndex++); QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item); if (childPrivate->width() > maxColWidth[j]) maxColWidth[j] = childPrivate->width(); @@ -854,10 +854,8 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) int yoffset=0; int curRow =0; int curCol =0; - for (int i = 0; i < positionedItems.count(); ++i) { - const PositionedItem &child = positionedItems.at(i); - if (!child.item || isInvisible(child.item)) - continue; + for (int i = 0; i < visibleItems.count(); ++i) { + const PositionedItem &child = visibleItems.at(i); if((child.item->x()!=xoffset)||(child.item->y()!=yoffset)){ positionX(xoffset, child); positionY(yoffset, child); @@ -1033,7 +1031,7 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) for (int i = 0; i < positionedItems.count(); ++i) { const PositionedItem &child = positionedItems.at(i); - if (!child.item || isInvisible(child.item)) + if (!child.item || !child.isVisible) continue; QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item); -- cgit v0.12 From 200d1743dcdacf1036384f746046e55d91ccd918 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 3 Sep 2010 12:48:01 +0200 Subject: Fix QStaticText copy constructor to also copy text option property The text option property of QStaticText was not copied in the copy constructor, so when the text was detached, the property would be reset to the default. Task-number: QTBUG-13368 Reviewed-by: Gunnar --- src/gui/text/qstatictext.cpp | 6 +++--- tests/auto/qstatictext/tst_qstatictext.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 21c2e02..b950b13 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -400,9 +400,9 @@ QStaticTextPrivate::QStaticTextPrivate() QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other) : text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix), - items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), needsRelayout(true), - useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat), - untransformedCoordinates(other.untransformedCoordinates) + items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), textOption(other.textOption), + needsRelayout(true), useBackendOptimizations(other.useBackendOptimizations), + textFormat(other.textFormat), untransformedCoordinates(other.untransformedCoordinates) { } diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 0ae5320..2a60e9e 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -73,6 +73,8 @@ private slots: void prepareToCorrectData(); void prepareToWrongData(); + void copyConstructor(); + void translatedPainter(); void rotatedPainter(); void scaledPainter(); @@ -104,6 +106,31 @@ void tst_QStaticText::constructionAndDestruction() QStaticText text("My text"); } +void tst_QStaticText::copyConstructor() +{ + QStaticText text(QLatin1String("My text")); + + QTextOption textOption(Qt::AlignRight); + text.setTextOption(textOption); + + text.setPerformanceHint(QStaticText::AggressiveCaching); + text.setTextWidth(123.456); + text.setTextFormat(Qt::PlainText); + + QStaticText copiedText(text); + copiedText.setText(QLatin1String("Other text")); + + QCOMPARE(copiedText.textOption().alignment(), Qt::AlignRight); + QCOMPARE(copiedText.performanceHint(), QStaticText::AggressiveCaching); + QCOMPARE(copiedText.textWidth(), 123.456); + QCOMPARE(copiedText.textFormat(), Qt::PlainText); + + QStaticText otherCopiedText(copiedText); + otherCopiedText.setTextWidth(789); + + QCOMPARE(otherCopiedText.text(), QString::fromLatin1("Other text")); +} + Q_DECLARE_METATYPE(QStaticText::PerformanceHint) void tst_QStaticText::drawToPoint_data() { -- cgit v0.12 From d5373433d2a6d632e06d3873003069d49e17e2cd Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 3 Sep 2010 14:22:58 +0300 Subject: Added missing code to bring web browser foreground in Symbian. Task-number: QTBUG-8336 Reviewed-by: Miikka Heikkinen --- src/gui/util/qdesktopservices_s60.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 24f6ccf..cd023cb 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -223,6 +223,7 @@ static void handleOtherSchemesL(const TDesC& aUrl) TApaTask task = taskList.FindApp(KUidBrowser); if (task.Exists()){ // Switch to existing browser instance + task.BringToForeground(); HBufC8* param8 = HBufC8::NewLC(buf16->Length()); param8->Des().Append(buf16->Des()); task.SendMessage(TUid::Uid( 0 ), *param8); // Uid is not used -- cgit v0.12 From 344ae27327b3fd36b0288636f41d73d91694eb02 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 2 Sep 2010 22:14:30 +0200 Subject: qdrawhelper: micro optimisation in fetchTransformBilinear move the -1 out of the loop Reviewed-by: Benjamin Poulain --- src/gui/painting/qdrawhelper.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 46c94e0..cf487b5 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -684,8 +684,8 @@ Q_STATIC_TEMPLATE_FUNCTION inline void fetchTransformedBilinear_pixelBounds(int } else { if (v1 < l1) { v2 = v1 = l1; - } else if (v1 >= l2 - 1) { - v2 = v1 = l2 - 1; + } else if (v1 >= l2) { + v2 = v1 = l2; } else { v2 = v1 + 1; } @@ -715,8 +715,8 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * int image_x1 = data->texture.x1; int image_y1 = data->texture.y1; - int image_x2 = data->texture.x2; - int image_y2 = data->texture.y2; + int image_x2 = data->texture.x2 - 1; + int image_y2 = data->texture.y2 - 1; const qreal cx = x + 0.5; const qreal cy = y + 0.5; @@ -763,9 +763,9 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * x %= image_width; if (x < 0) x += image_width; } else { - lim = qMin(count, image_x2-x); + lim = qMin(count, image_x2-x+1); if (x < image_x1) { - Q_ASSERT(x < image_x2); + Q_ASSERT(x <= image_x2); uint t = fetch(s1, image_x1, data->texture.colorTable); uint b = fetch(s2, image_x1, data->texture.colorTable); quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; @@ -818,7 +818,7 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * if (blendType == BlendTransformedBilinearTiled) { if (x >= image_width) x -= image_width; } else { - x = qMin(x, image_x2 - 1); + x = qMin(x, image_x2); } uint t = fetch(s1, x, data->texture.colorTable); -- cgit v0.12 From 5c978d026d378f7deaa14a87cf103ed43f14c413 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 3 Sep 2010 11:33:38 +0300 Subject: Fix Symbian handling of projects with special characters in TARGET Plenty of filenames got generated with spaces which didn't work as that was not taken into account. Harmonized TARGET fixing across prf files and qmake Symbian generator code. Task-number: QTBUG-13363 Reviewed-by: Thomas Zander --- mkspecs/common/symbian/symbian.conf | 18 ++++++++ mkspecs/features/sis_targets.prf | 24 +++++----- mkspecs/features/symbian/application_icon.prf | 15 +----- mkspecs/features/symbian/run_on_phone.prf | 10 ++-- mkspecs/features/symbian/symbian_building.prf | 66 +++++++++++++-------------- qmake/generators/symbian/symbiancommon.cpp | 19 +++----- 6 files changed, 77 insertions(+), 75 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 61cc7d9..beef193 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -175,3 +175,21 @@ pkg_platform_dependencies = \ DEPLOYMENT += default_deployment +defineReplace(symbianRemoveSpecialCharacters) { + # Produce identical string to what SymbianCommonGenerator::removeSpecialCharacters and + # SymbianCommonGenerator::removeEpocSpecialCharacters produce + + fixedStr = $$1 + + fixedStr = $$replace(fixedStr, /,_) + fixedStr = $$replace(fixedStr, \\\\,_) + fixedStr = $$replace(fixedStr, " ",_) + symbian-abld|symbian-sbsv2 { + fixedStr = $$replace(fixedStr, -,_) + fixedStr = $$replace(fixedStr, \\.,_) + fixedStr = $$replace(fixedStr, :,_) + } + + return ($$fixedStr) +} + diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf index e069ee1..800a04c 100644 --- a/mkspecs/features/sis_targets.prf +++ b/mkspecs/features/sis_targets.prf @@ -10,6 +10,9 @@ else:!equals(DEPLOYMENT, default_deployment) { } equals(GENERATE_SIS_TARGETS, true) { + + baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) + symbian-abld|symbian-sbsv2 { symbian-sbsv2 { CONVERT_GCCE_PARAM = -g @@ -19,7 +22,7 @@ equals(GENERATE_SIS_TARGETS, true) { make_cache_name = .make.cache sis_target.target = sis - sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \ + sis_target.commands = $(if $(wildcard $${baseTarget}_template.pkg), \ $(if $(wildcard $$make_cache_name), \ $(MAKE) -f $(MAKEFILE) ok_sis MAKEFILES=$$make_cache_name \ , \ @@ -34,11 +37,11 @@ equals(GENERATE_SIS_TARGETS, true) { ) ok_sis_target.target = ok_sis - ok_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) $$basename(TARGET)_template.pkg \ + ok_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) $${baseTarget}_template.pkg \ $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) unsigned_sis_target.target = unsigned_sis - unsigned_sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \ + unsigned_sis_target.commands = $(if $(wildcard $${baseTarget}_template.pkg), \ $(if $(wildcard $$make_cache_name), \ $(MAKE) -f $(MAKEFILE) ok_unsigned_sis MAKEFILES=$$make_cache_name \ , \ @@ -53,21 +56,21 @@ equals(GENERATE_SIS_TARGETS, true) { ) ok_unsigned_sis_target.target = ok_unsigned_sis - ok_unsigned_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) -o $$basename(TARGET)_template.pkg $(QT_SIS_TARGET) + ok_unsigned_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) -o $${baseTarget}_template.pkg $(QT_SIS_TARGET) - target_sis_target.target = $$basename(TARGET).sis + target_sis_target.target = $${baseTarget}.sis target_sis_target.commands = $(MAKE) -f $(MAKEFILE) sis installer_sis_target.target = installer_sis - installer_sis_target.commands = $(if $(wildcard $$basename(TARGET)_installer.pkg), \ + installer_sis_target.commands = $(if $(wildcard $${baseTarget}_installer.pkg), \ $(MAKE) -f $(MAKEFILE) ok_installer_sis \ , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) - installer_sis_target.depends = $$basename(TARGET).sis + installer_sis_target.depends = $${baseTarget}.sis ok_installer_sis_target.target = ok_installer_sis - ok_installer_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $$basename(TARGET)_installer.pkg - \ + ok_installer_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) fail_sis_nopkg_target.target = fail_sis_nopkg @@ -77,7 +80,7 @@ equals(GENERATE_SIS_TARGETS, true) { fail_sis_nocache_target.commands = "$(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target)" stub_sis_target.target = stub_sis - stub_sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \ + stub_sis_target.commands = $(if $(wildcard $${baseTarget}_template.pkg), \ $(if $(wildcard $$make_cache_name), \ $(MAKE) -f $(MAKEFILE) ok_stub_sis MAKEFILES=$$make_cache_name \ , \ @@ -92,7 +95,7 @@ equals(GENERATE_SIS_TARGETS, true) { ) ok_stub_sis_target.target = ok_stub_sis - ok_stub_sis_target.commands = createpackage.bat -s $(QT_SIS_OPTIONS) $$basename(TARGET)_stub.pkg \ + ok_stub_sis_target.commands = createpackage.bat -s $(QT_SIS_OPTIONS) $${baseTarget}_stub.pkg \ $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) QMAKE_EXTRA_TARGETS += sis_target \ @@ -134,7 +137,6 @@ equals(GENERATE_SIS_TARGETS, true) { sis_destdir = $$DESTDIR isEmpty(sis_destdir):sis_destdir = . - baseTarget = $$basename(TARGET) !equals(TARGET, "$$baseTarget"):sis_destdir = $$sis_destdir/$$dirname(TARGET) sis_target.target = sis diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index c5654d9..9a9395a 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -14,20 +14,7 @@ contains( CONFIG, no_icon ) { warning("Only first icon specified in ICON variable is used: $$ICON") } - # Try to produce indentical string to fixedTarget in SymbianMakefileGenerator, replaced chars taken - # from SymbianCommonGenerator::removeSpecialCharacters. - # - # Note: it is not a major problem even baseTarget is not 100% identical to fixedTarget since qmake - # only uses filename from RSS_RULES.icon_file when referring to icon file name. - baseTarget = $$basename(TARGET) - baseTarget = $$replace(baseTarget, /,_) - baseTarget = $$replace(baseTarget, \\\\,_) - baseTarget = $$replace(baseTarget, " ",_) - symbian-abld|symbian-sbsv2 { - baseTarget = $$replace(baseTarget, -,_) - baseTarget = $$replace(baseTarget, \\.,_) - baseTarget = $$replace(baseTarget, :,_) - } + baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code !symbian-sbsv2 { diff --git a/mkspecs/features/symbian/run_on_phone.prf b/mkspecs/features/symbian/run_on_phone.prf index f77369c..d845277 100644 --- a/mkspecs/features/symbian/run_on_phone.prf +++ b/mkspecs/features/symbian/run_on_phone.prf @@ -11,19 +11,21 @@ else:!equals(DEPLOYMENT, default_deployment) { } equals(GENERATE_RUN_TARGETS, true) { + baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) + sis_file = $${baseTarget}.sis symbian-abld|symbian-sbsv2 { sis_destdir = - sis_file = $$basename(TARGET).sis } else { sis_destdir = $$DESTDIR - sis_file = $${TARGET}.sis + isEmpty(sis_destdir):sis_destdir = . + !equals(TARGET, "$$baseTarget"):sis_destdir = $$sis_destdir/$$dirname(TARGET) !isEmpty(sis_destdir):!contains(sis_destdir, "[/\\\\]$"):sis_destdir = $${sis_destdir}/ contains(QMAKE_HOST.os, "Windows"):sis_destdir = $$replace(sis_destdir, "/", "\\") } contains(SYMBIAN_PLATFORMS, "WINSCW"):contains(TEMPLATE, "app") { run_target.target = run - run_target.commands = call "$${EPOCROOT}epoc32/release/winscw/udeb/$$basename(TARGET).exe" $(QT_RUN_OPTIONS) + run_target.commands = call "$${EPOCROOT}epoc32/release/winscw/udeb/$${baseTarget}.exe" $(QT_RUN_OPTIONS) QMAKE_EXTRA_TARGETS += run_target } @@ -31,7 +33,7 @@ equals(GENERATE_RUN_TARGETS, true) { runonphone_target.target = runonphone runonphone_target.depends = sis runonphone_target.commands = runonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis "$${sis_destdir}$${sis_file}" - contains(TEMPLATE, "app"):runonphone_target.commands += "$$basename(TARGET).exe" $(QT_RUN_OPTIONS) + contains(TEMPLATE, "app"):runonphone_target.commands += "$${baseTarget}.exe" $(QT_RUN_OPTIONS) QMAKE_EXTRA_TARGETS += runonphone_target } diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 414b081..0b621a3 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -35,7 +35,7 @@ symbianDestdir=$$DESTDIR isEmpty(symbianDestdir) { symbianDestdir = . } -baseTarget = $$basename(TARGET) +baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) !equals(TARGET, "$$baseTarget"):symbianDestdir = $$symbianDestdir/$$dirname(TARGET) contains(QMAKE_CFLAGS, "--thumb")|contains(QMAKE_CXXFLAGS, "--thumb")|contains(QMAKE_CFLAGS, "-mthumb")|contains(QMAKE_CXXFLAGS, "-mthumb") { @@ -253,49 +253,45 @@ symbianresources.CONFIG = no_link target_predeps QMAKE_EXTRA_COMPILERS += symbianresources contains(TEMPLATE, "app"):!contains(CONFIG, "no_icon") { - baseResourceTarget = $$basename(TARGET) - # If you change this, also see application_icon.prf - baseResourceTarget = $$replace(baseResourceTarget, " ",_) - # Make our own extra target in order to get dependencies for generated # files right. This also avoids the warning about files not found. - symbianGenResource.target = $${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rsg + symbianGenResource.target = $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg symbianGenResource.commands = cpp -nostdinc -undef \ $$symbian_resources_INCLUDES \ $$symbian_resources_DEFINES \ - $${baseResourceTarget}.rss \ - -o $${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rpp \ + $${baseTarget}.rss \ + -o $${symbian_resources_RCC_DIR}/$${baseTarget}.rpp \ && rcomp -u -m045,046,047 \ - -s$${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rpp \ - -o$${symbianDestdir}/$${baseResourceTarget}.rsc \ - -h$${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rsg \ - -i$${baseResourceTarget}.rss - silent:symbianGenResource.commands = @echo rcomp $${baseResourceTarget}.rss && $$symbianGenResource.commands - symbianGenResource.depends = $${baseResourceTarget}.rss - PRE_TARGETDEPS += $${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rpp - QMAKE_DISTCLEAN += $${baseResourceTarget}.rss - QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseResourceTarget}.rsc - - symbianGenRegResource.target = $${symbian_resources_RCC_DIR}/$${baseResourceTarget}_reg.rsg + -s$${symbian_resources_RCC_DIR}/$${baseTarget}.rpp \ + -o$${symbianDestdir}/$${baseTarget}.rsc \ + -h$${symbian_resources_RCC_DIR}/$${baseTarget}.rsg \ + -i$${baseTarget}.rss + silent:symbianGenResource.commands = @echo rcomp $${baseTarget}.rss && $$symbianGenResource.commands + symbianGenResource.depends = $${baseTarget}.rss + PRE_TARGETDEPS += $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg + QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg + QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}.rpp + QMAKE_DISTCLEAN += $${baseTarget}.rss + QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseTarget}.rsc + + symbianGenRegResource.target = $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg symbianGenRegResource.commands = cpp -nostdinc -undef \ $$symbian_resources_INCLUDES \ $$symbian_resources_DEFINES \ - $${baseResourceTarget}_reg.rss \ - -o $${symbian_resources_RCC_DIR}/$${baseResourceTarget}_reg.rpp \ + $${baseTarget}_reg.rss \ + -o $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp \ && rcomp -u -m045,046,047 \ - -s$${symbian_resources_RCC_DIR}/$${baseResourceTarget}_reg.rpp \ - -o$${symbianDestdir}/$${baseResourceTarget}_reg.rsc \ - -h$${symbian_resources_RCC_DIR}/$${baseResourceTarget}_reg.rsg \ - -i$${baseResourceTarget}_reg.rss - silent:symbianGenRegResource.commands = @echo rcomp $${baseResourceTarget}_reg.rss && $$symbianGenRegResource.commands - symbianGenRegResource.depends = $${baseResourceTarget}_reg.rss $${symbian_resources_RCC_DIR}/$${baseResourceTarget}.rsg - PRE_TARGETDEPS += $${symbian_resources_RCC_DIR}/$${baseResourceTarget}_reg.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseResourceTarget}_reg.rsg - QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseResourceTarget}_reg.rpp - QMAKE_DISTCLEAN += $${baseResourceTarget}_reg.rss - QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseResourceTarget}_reg.rsc + -s$${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp \ + -o$${symbianDestdir}/$${baseTarget}_reg.rsc \ + -h$${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg \ + -i$${baseTarget}_reg.rss + silent:symbianGenRegResource.commands = @echo rcomp $${baseTarget}_reg.rss && $$symbianGenRegResource.commands + symbianGenRegResource.depends = $${baseTarget}_reg.rss $${symbian_resources_RCC_DIR}/$${baseTarget}.rsg + PRE_TARGETDEPS += $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg + QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rsg + QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp + QMAKE_DISTCLEAN += $${baseTarget}_reg.rss + QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseTarget}_reg.rsc # Trick to get qmake to create the RCC_DIR for us. symbianRccDirCreation.input = SOURCES @@ -312,3 +308,5 @@ contains(TEMPLATE, "app"):!contains(CONFIG, "no_icon") { # Generated pkg files QMAKE_DISTCLEAN += $${baseTarget}_template.pkg +QMAKE_DISTCLEAN += $${baseTarget}_installer.pkg +QMAKE_DISTCLEAN += $${baseTarget}_stub.pkg diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 155dbc9..a60ae07 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -129,7 +129,7 @@ bool SymbianCommonGenerator::containsStartWithItem(const QChar &c, const QString void SymbianCommonGenerator::removeSpecialCharacters(QString& str) { - // When modifying this method check also application_icon.prf + // When modifying this method check also symbianRemoveSpecialCharacters in symbian.conf str.replace(QString("/"), QString("_")); str.replace(QString("\\"), QString("_")); str.replace(QString(" "), QString("_")); @@ -137,7 +137,7 @@ void SymbianCommonGenerator::removeSpecialCharacters(QString& str) void SymbianCommonGenerator::removeEpocSpecialCharacters(QString& str) { - // When modifying this method check also application_icon.prf + // When modifying this method check also symbianRemoveSpecialCharacters in symbian.conf str.replace(QString("-"), QString("_")); str.replace(QString(":"), QString("_")); str.replace(QString("."), QString("_")); @@ -154,13 +154,8 @@ QString romPath(const QString& path) void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocBuild) { QMakeProject *project = generator->project; - QString pkgTarget = project->first("QMAKE_ORIG_TARGET"); - if (pkgTarget.isEmpty()) - pkgTarget = project->first("TARGET"); - pkgTarget = generator->unescapeFilePath(pkgTarget); - pkgTarget = removePathSeparators(pkgTarget); QString pkgFilename = Option::output_dir + QLatin1Char('/') + - QString("%1_template.pkg").arg(pkgTarget); + QString("%1_template.pkg").arg(fixedTarget); QFile pkgFile(pkgFilename); if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -169,7 +164,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB } QString stubPkgFileName = Option::output_dir + QLatin1Char('/') + - QString("%1_stub.pkg").arg(pkgTarget); + QString("%1_stub.pkg").arg(fixedTarget); QFile stubPkgFile(stubPkgFileName); if (!stubPkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -193,7 +188,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Header info QString wrapperPkgFilename = Option::output_dir + QLatin1Char('/') + QString("%1_installer.%2") - .arg(pkgTarget).arg("pkg"); + .arg(fixedTarget).arg("pkg"); QString headerComment = "; %1 generated by qmake at %2\n" "; This file is generated by qmake and should not be modified by the user\n" @@ -535,7 +530,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Wrapped files deployment QString currentPath = qmake_getpwd(); - QString sisName = QString("%1.sis").arg(pkgTarget); + QString sisName = QString("%1.sis").arg(fixedTarget); twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); @@ -552,7 +547,7 @@ QString SymbianCommonGenerator::removePathSeparators(QString &file) if (QDir::separator().unicode() != '/') ret.replace(QDir::separator(), QLatin1Char('/')); - if (ret.indexOf(QLatin1Char('/')) > 0) + if (ret.indexOf(QLatin1Char('/')) >= 0) ret.remove(0, ret.lastIndexOf(QLatin1Char('/')) + 1); return ret; -- cgit v0.12 From 8d42b6ac40ee57857b8b57934c9c6bbe05809720 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 3 Sep 2010 15:11:13 +0300 Subject: Plug memory leak from QS60Style Currently style leaks an animation object (QS60StyleAnimation) when style is destroyed. To avoid this, animation object array is deleted in the style's destructor. Task-number: QTBUG-13145 Reviewed-by: mread --- src/gui/styles/qs60style.cpp | 3 +++ src/gui/styles/qs60style_p.h | 1 + src/gui/styles/qs60style_s60.cpp | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 0ba1bc6..36210b8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -154,6 +154,9 @@ QS60StylePrivate::~QS60StylePrivate() { clearCaches(); //deletes also background image deleteThemePalette(); +#ifdef Q_WS_S60 + removeAnimations(); +#endif } void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 836969a..51ced96 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -571,6 +571,7 @@ public: void startAnimation(QS60StyleEnums::SkinParts animation); void stopAnimation(QS60StyleEnums::SkinParts animation); static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part); + static void removeAnimations(); #endif diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index f44b85e..5dda42e 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1152,6 +1152,12 @@ QS60StylePrivate::QS60StylePrivate() setActiveLayout(); } +void QS60StylePrivate::removeAnimations() +{ + //currently only one animation in the list. + m_animations()->removeFirst(); +} + QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { -- cgit v0.12 From fcc4d041849ec4ea4f5c9e213a59926a57427aca Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 3 Sep 2010 16:43:16 +0300 Subject: QS60Style: QToolbar button and checked state is not shown QS60Style ignores Style_On state for QToolButton drawing. This has been fixed, so that when toolbutton is "on", button is drawn with pressed down graphics. Task-number: QTBUG-13099 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 36210b8..358c6aa 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1100,8 +1100,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } State mflags = bflags; if (toolBtn->state & State_Sunken) { - if (toolBtn->activeSubControls & SC_ToolButton) - bflags |= State_Sunken; + bflags |= State_Sunken; mflags |= State_Sunken; } @@ -1117,11 +1116,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (bflags & (State_Sunken | State_On | State_Raised | State_Enabled)) { tool.rect = button.unite(menuRect); tool.state = bflags; - const QToolButton *toolButtonWidget = qobject_cast(widget); - const QS60StylePrivate::SkinElements element = - ((toolButtonWidget && toolButtonWidget->isDown()) || (option->state & State_Sunken)) ? - QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton; - QS60StylePrivate::drawSkinElement(element, painter, tool.rect, flags); drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); } if (toolBtn->subControls & SC_ToolButtonMenu) { @@ -2177,9 +2171,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_PanelButtonBevel: case PE_FrameButtonBevel: if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) { - const bool isPressed = option->state & State_Sunken; - const QS60StylePrivate::SkinElements skinElement = - isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; + const bool isPressed = (option->state & State_Sunken) || (option->state & State_On); + QS60StylePrivate::SkinElements skinElement; + if (element == PE_PanelButtonTool) + skinElement = isPressed ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton; + else + skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal; QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); } else { commonStyleDraws = true; -- cgit v0.12 From 67bdfe3360c3319f2cda7197f34272dd5e3439c9 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 3 Sep 2010 16:55:27 +0200 Subject: Fixed compilation of the modelview tutorial on Windows. Reviewed-by: Trond --- examples/tutorials/modelview/2_formatting/mymodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp index 3e13ff4..2d2556c 100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -89,7 +89,7 @@ QVariant MyModel::data(const QModelIndex &index, int role) const if (row == 1 && col == 2) //change background only for cell(1,2) { - QBrush redBackground(QColor(Qt::red)); + QBrush redBackground(Qt::red); return redBackground; } break; -- cgit v0.12 From 0b5fa23dd25c78b71dfb0932008d226639a43445 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 6 Sep 2010 09:53:19 +1000 Subject: Add test for ListView positioning when all visible items are removed. Task-number: QTBUG-12664 --- .../tst_qdeclarativelistview.cpp | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 377a9e5..e4b59a7 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -224,6 +224,13 @@ public: emit itemsRemoved(index, 1); } + void removeItems(int index, int count) { + int c = count; + while (c--) + list.removeAt(index); + emit itemsRemoved(index, count); + } + void moveItem(int from, int to) { list.move(from, to); emit itemsMoved(from, to, 1); @@ -290,6 +297,13 @@ public: emit endRemoveRows(); } + void removeItems(int index, int count) { + emit beginRemoveRows(QModelIndex(), index, index+count-1); + while (count--) + list.removeAt(index); + emit endRemoveRows(); + } + void moveItem(int from, int to) { emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); list.move(from, to); @@ -520,7 +534,7 @@ void tst_QDeclarativeListView::removed(bool animated) QDeclarativeView *canvas = createView(); T model; - for (int i = 0; i < 30; i++) + for (int i = 0; i < 50; i++) model.addItem("Item" + QString::number(i), ""); QDeclarativeContext *ctxt = canvas->rootContext(); @@ -643,6 +657,21 @@ void tst_QDeclarativeListView::removed(bool animated) QTRY_COMPARE(listview->currentIndex(), 7); QTRY_VERIFY(listview->currentItem() == oldCurrent); + listview->setContentY(80); + QTest::qWait(300); + + model.removeItems(1, 17); + QTest::qWait(300); + + // Confirm items positioned correctly + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i+2); + if (!item) qWarning() << "Item" << i+2 << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),80+i*20.0); + } + delete canvas; } -- cgit v0.12 From 6892d7adf00d0481103a48a1ff89ad0be2a1143b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 6 Sep 2010 09:07:00 +0200 Subject: Designer: Fix action editor scrolling. In overwritten virtual QAbstractItemView::currentChanged, invoke base implementation. Reviewed-by: Olivier Goffart Task-number: QTCREATORBUG-2249 --- tools/designer/src/lib/shared/actionrepository.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp index 1076ff4..a54c1e7 100644 --- a/tools/designer/src/lib/shared/actionrepository.cpp +++ b/tools/designer/src/lib/shared/actionrepository.cpp @@ -397,9 +397,10 @@ void ActionTreeView::contextMenuEvent(QContextMenuEvent *event) emit contextMenuRequested(event, m_model->actionAt(indexAt(event->pos()))); } -void ActionTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &/*previous*/) +void ActionTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { emit currentChanged(m_model->actionAt(current)); + QTreeView::currentChanged(current, previous); } void ActionTreeView::slotActivated(const QModelIndex &index) @@ -478,9 +479,10 @@ void ActionListView::contextMenuEvent(QContextMenuEvent *event) emit contextMenuRequested(event, m_model->actionAt(indexAt(event->pos()))); } -void ActionListView::currentChanged(const QModelIndex ¤t, const QModelIndex & /*previous*/) +void ActionListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { emit currentChanged(m_model->actionAt(current)); + QListView::currentChanged(current, previous); } void ActionListView::slotActivated(const QModelIndex &index) -- cgit v0.12