From f4f28a0d32758476a3f5733054a50b9b36392288 Mon Sep 17 00:00:00 2001 From: Mikkel Krautz Date: Mon, 7 Dec 2009 12:43:20 +0100 Subject: Don't forget to append current $MAC_CONFIG_TEST_COMMANDLINE when setting the SDK to use. Merge-request: 2254 Reviewed-by: Oswald Buddenhagen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 6dc3898..ee5bbb9 100755 --- a/configure +++ b/configure @@ -2894,7 +2894,7 @@ fi # pass on $CFG_SDK to the configure tests. if [ '!' -z "$CFG_SDK" ]; then - MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK" + MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK" fi # find the default framework value -- cgit v0.12 From 322db8410bf7609f072837d554e7256dc385265b Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 8 Dec 2009 08:04:20 +1000 Subject: Qt fails to build on RHEL 4 and other older Linux versions because of old ALSA Added alsa version checking in config test, must have >= 1.0.10 to enable. Task-number:QTBUG-6493 Reviewed-by:Justin McPherson --- config.tests/unix/alsa/alsatest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config.tests/unix/alsa/alsatest.cpp b/config.tests/unix/alsa/alsatest.cpp index 1307c4e..f1092f8 100644 --- a/config.tests/unix/alsa/alsatest.cpp +++ b/config.tests/unix/alsa/alsatest.cpp @@ -40,8 +40,11 @@ ****************************************************************************/ #include +#if(!(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 10)) +#error "Alsa version found too old, require >= 1.0.10" +#endif + int main(int argc,char **argv) { - return 0; } -- cgit v0.12 From b70f9d3969fdf7789ba1c5f4d942b2625b1bf689 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 8 Dec 2009 08:07:13 +1000 Subject: audioinput and audiooutput examples not using isFormatSupported function. The examples failed to easy, added check to test and get if required a format to use from the backend. Increases the chance of examples working on various platforms like n900. Reviewed-by:Justin McPherson --- examples/multimedia/audioinput/audioinput.cpp | 12 +++++++++++- examples/multimedia/audiooutput/audiooutput.cpp | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp index 62afd73..75bddd6 100644 --- a/examples/multimedia/audioinput/audioinput.cpp +++ b/examples/multimedia/audioinput/audioinput.cpp @@ -195,7 +195,6 @@ InputTest::InputTest() pullMode = true; - // AudioInfo class only supports mono S16LE samples! format.setFrequency(8000); format.setChannels(1); format.setSampleSize(16); @@ -203,6 +202,17 @@ InputTest::InputTest() format.setByteOrder(QAudioFormat::LittleEndian); format.setCodec("audio/pcm"); + QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice()); + if (!info.isFormatSupported(format)) { + qWarning()<<"default format not supported try to use nearest"; + format = info.nearestFormat(format); + } + + if(format.sampleSize() != 16) { + qWarning()<<"audio device doesn't support 16 bit samples, example cannot run"; + return; + } + audioInput = new QAudioInput(format,this); connect(audioInput,SIGNAL(notify()),SLOT(status())); connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp index 244840d..b6047db 100644 --- a/examples/multimedia/audiooutput/audiooutput.cpp +++ b/examples/multimedia/audiooutput/audiooutput.cpp @@ -170,6 +170,18 @@ AudioTest::AudioTest() settings.setCodec("audio/pcm"); settings.setByteOrder(QAudioFormat::LittleEndian); settings.setSampleType(QAudioFormat::SignedInt); + + QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); + if (!info.isFormatSupported(settings)) { + qWarning()<<"default format not supported try to use nearest"; + settings = info.nearestFormat(settings); + } + + if(settings.sampleSize() != 16) { + qWarning()<<"audio device doesn't support 16 bit samples, example cannot run"; + return; + } + audioOutput = new QAudioOutput(settings,this); connect(audioOutput,SIGNAL(notify()),SLOT(status())); connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); -- cgit v0.12 From adef8ffa48c908dda1e2f048469c1e08eec088e3 Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 8 Dec 2009 12:03:47 +0100 Subject: Assistant: Fix race condition in index creation. Reviewed-by: kh1 --- tools/assistant/lib/qhelpindexwidget.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/assistant/lib/qhelpindexwidget.cpp b/tools/assistant/lib/qhelpindexwidget.cpp index 475a1fe..6cf1a72 100644 --- a/tools/assistant/lib/qhelpindexwidget.cpp +++ b/tools/assistant/lib/qhelpindexwidget.cpp @@ -130,6 +130,7 @@ void QHelpIndexProvider::stopCollecting() m_abort = true; m_mutex.unlock(); wait(); + m_abort = false; } QStringList QHelpIndexProvider::indices() const @@ -164,7 +165,6 @@ void QHelpIndexProvider::run() foreach (QString dbFileName, m_helpEngine->fileNameReaderMap.keys()) { m_mutex.lock(); if (m_abort) { - m_abort = false; m_mutex.unlock(); return; } @@ -181,7 +181,6 @@ void QHelpIndexProvider::run() foreach (QString s, lst) indicesSet.insert(s); if (m_abort) { - m_abort = false; m_mutex.unlock(); return; } @@ -194,7 +193,6 @@ void QHelpIndexProvider::run() m_mutex.lock(); m_indices = indicesSet.values(); qSort(m_indices.begin(), m_indices.end(), caseInsensitiveLessThan); - m_abort = false; m_mutex.unlock(); } -- cgit v0.12 From f906c0388ebb88b97e40618d448b0df72ebfebc5 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 8 Dec 2009 14:12:28 +0100 Subject: Fix broken delete key, some cleanup. Reviewed-by: ck --- .../assistant/tools/assistant/bookmarkmanager.cpp | 116 ++++++++++++--------- 1 file changed, 68 insertions(+), 48 deletions(-) diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index 70f3157..523525e 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -69,9 +69,12 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title, , m_title(title) , bookmarkManager(manager) { + ui.setupUi(this); + installEventFilter(this); + ui.treeView->installEventFilter(this); + ui.treeView->viewport()->installEventFilter(this); - ui.setupUi(this); ui.bookmarkEdit->setText(title); ui.newFolderButton->setVisible(false); ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); @@ -264,12 +267,14 @@ void BookmarkDialog::currentChanged(const QModelIndex ¤t) bool BookmarkDialog::eventFilter(QObject *object, QEvent *e) { - if (object == this && e->type() == QEvent::KeyPress) { - QKeyEvent *ke = static_cast(e); + if (object != ui.treeView && object != ui.treeView->viewport()) + return QWidget::eventFilter(object, e); - QModelIndex index = ui.treeView->currentIndex(); + if (e->type() == QEvent::KeyPress) { + QKeyEvent *ke = static_cast(e); switch (ke->key()) { case Qt::Key_F2: { + const QModelIndex &index = ui.treeView->currentIndex(); const QModelIndex &source = proxyModel->mapToSource(index); QStandardItem *item = bookmarkManager->treeBookmarkModel()->itemFromIndex(source); @@ -281,13 +286,13 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e) } break; case Qt::Key_Delete: { + const QModelIndex &index = ui.treeView->currentIndex(); bookmarkManager->removeBookmarkItem(ui.treeView, proxyModel->mapToSource(index)); ui.bookmarkFolders->clear(); ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders()); QString name = tr("Bookmarks"); - index = ui.treeView->currentIndex(); if (index.isValid()) name = index.data().toString(); ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name)); @@ -297,6 +302,7 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e) break; } } + return QObject::eventFilter(object, e); } @@ -312,7 +318,10 @@ BookmarkWidget::BookmarkWidget(BookmarkManager *manager, QWidget *parent, , bookmarkManager(manager) { setup(showButtons); + installEventFilter(this); + treeView->installEventFilter(this); + treeView->viewport()->installEventFilter(this); } BookmarkWidget::~BookmarkWidget() @@ -484,7 +493,6 @@ void BookmarkWidget::setup(bool showButtons) treeView->setAutoExpandDelay(1000); treeView->setDropIndicatorShown(true); treeView->header()->setVisible(false); - treeView->viewport()->installEventFilter(this); treeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(treeView, SIGNAL(expanded(QModelIndex)), this, @@ -530,59 +538,71 @@ void BookmarkWidget::focusInEvent(QFocusEvent *e) bool BookmarkWidget::eventFilter(QObject *object, QEvent *e) { - if ((object == this) || (object == treeView->viewport())) { - QModelIndex index = treeView->currentIndex(); - if (e->type() == QEvent::KeyPress) { - QKeyEvent *ke = static_cast(e); - if (index.isValid() && searchField->text().isEmpty()) { + if (object != this && object != treeView + && object != treeView->viewport()) { + return QWidget::eventFilter(object, e); + } + + if (e->type() == QEvent::KeyPress) { + QKeyEvent *ke = static_cast(e); + const bool tree = object == treeView || object == treeView->viewport(); + switch (ke->key()) { + case Qt::Key_F2: { + const QModelIndex &index = treeView->currentIndex(); const QModelIndex &src = filterBookmarkModel->mapToSource(index); - if (ke->key() == Qt::Key_F2) { - QStandardItem *item = - bookmarkManager->treeBookmarkModel()->itemFromIndex(src); - if (item) { + if (tree && searchField->text().isEmpty()) { + if (QStandardItem *item = bookmarkManager->treeBookmarkModel() + ->itemFromIndex(src)) { item->setEditable(true); treeView->edit(index); item->setEditable(false); } - } else if (ke->key() == Qt::Key_Delete) { - bookmarkManager->removeBookmarkItem(treeView, src); } - } + } break; + + case Qt::Key_Enter: { + case Qt::Key_Return: + if (tree) { + const QString &data = treeView->selectionModel()->currentIndex() + .data(Qt::UserRole + 10).toString(); + if (!data.isEmpty() && data != QLatin1String("Folder")) + emit requestShowLink(data); + } + } break; - switch (ke->key()) { - default: break; - case Qt::Key_Up: { - case Qt::Key_Down: + case Qt::Key_Delete: { + const QModelIndex &index = treeView->currentIndex(); + const QModelIndex &src = filterBookmarkModel->mapToSource(index); + if (tree && searchField->text().isEmpty()) + bookmarkManager->removeBookmarkItem(treeView, src); + } break; + + case Qt::Key_Up: { + case Qt::Key_Down: + if (!tree) treeView->subclassKeyPressEvent(ke); - } break; - - case Qt::Key_Enter: { - case Qt::Key_Return: - index = treeView->selectionModel()->currentIndex(); - if (index.isValid()) { - QString data = index.data(Qt::UserRole + 10).toString(); - if (!data.isEmpty() && data != QLatin1String("Folder")) - emit requestShowLink(data); - } - } break; + } break; - case Qt::Key_Escape: { - emit escapePressed(); - } break; - } - } else if (e->type() == QEvent::MouseButtonRelease) { - if (index.isValid()) { - QMouseEvent *me = static_cast(e); - bool controlPressed = me->modifiers() & Qt::ControlModifier; - if(((me->button() == Qt::LeftButton) && controlPressed) - || (me->button() == Qt::MidButton)) { - QString data = index.data(Qt::UserRole + 10).toString(); - if (!data.isEmpty() && data != QLatin1String("Folder")) - CentralWidget::instance()->setSourceInNewTab(data); - } - } + case Qt::Key_Escape: { + emit escapePressed(); + } break; + + default: break; } } + + if (e->type() == QEvent::MouseButtonRelease) { + QMouseEvent *me = static_cast(e); + bool controlPressed = me->modifiers() & Qt::ControlModifier; + if(((me->button() == Qt::LeftButton) && controlPressed) + || (me->button() == Qt::MidButton)) { + const QModelIndex &index = treeView->currentIndex(); + const QString &data = index.data(Qt::UserRole + 10).toString(); + if (!data.isEmpty() && data != QLatin1String("Folder")) + CentralWidget::instance()->setSourceInNewTab(data); + } + } + return QWidget::eventFilter(object, e); } -- cgit v0.12 From c361d1bb2855b43f5b50adbad321e53848e16b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Tue, 8 Dec 2009 15:25:39 +0200 Subject: Crash: when opening the File Dialog in Media Player (armv5) This is due to NGA API changes in Tb9.2. Because of API changes, S60Style needs to have a lot of internal changes. First, the changed style no longer itself tries to uncompress and handle CFbsBitmaps, but instead uses the QPixmap backend for it. Second, all references to CFbsBitmap::DataAddress() have been removed. Third, the lookup table for theme parts has been cleaned up. Task-number: QTBUG-4644 Reviewed-by: Janne Koskinen --- src/gui/styles/qs60style.cpp | 3 - src/gui/styles/qs60style_p.h | 2 +- src/gui/styles/qs60style_s60.cpp | 759 +++++++++++++++------------------------ src/gui/styles/styles.pri | 2 +- 4 files changed, 296 insertions(+), 470 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index be4f15a..93b517f 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -84,9 +84,6 @@ extern Q_GUI_EXPORT int qt_defaultDpiY(); const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFlags = SkinElementFlags(SF_PointNorth | SF_StateEnabled); -static const QByteArray propertyKeyLayouts = "layouts"; -static const QByteArray propertyKeyCurrentlayout = "currentlayout"; - static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 5ab2308..eed66dc 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -443,7 +443,7 @@ public: static QSize naviPaneSize(); //Checks that the current brush is transparent or has BrushStyle NoBrush, - //so that theme graphic background can be drawn. + //so that theme graphic background can be drawn. static bool canDrawThemeBackground(const QBrush &backgroundBrush); private: diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 48b8fad..fbea644 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) @@ -69,6 +70,7 @@ QT_BEGIN_NAMESPACE enum TDrawType { EDrawIcon, + EDrawGulIcon, EDrawBackground, ENoDraw }; @@ -80,8 +82,11 @@ enum TSupportRelease { ES60_5_0 = 0x0004, ES60_5_1 = 0x0008, ES60_5_2 = 0x0010, + ES60_3_X = ES60_3_1 | ES60_3_2, + // Releases before Symbian Foundation + ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0, // Add all new releases here - ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 + ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 }; typedef struct { @@ -101,11 +106,12 @@ public: static QPixmap colorSkinnedGraphics(const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags); static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex); - static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format); + static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize& targetSize); static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part); static bool disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame); static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags); static QSize naviPaneSize(); + static TAknsItemID partSpecificThemeId(int part); private: static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part, @@ -115,209 +121,205 @@ private: const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags); static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID ¢erId); static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect); - static void checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap); - static void checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap); - static void unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap); - static void fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex); + static void fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex); static bool checkSupport(const int supportedRelease); - static TAknsItemID checkAndUpdateReleaseSpecificGraphics(int part); // Array to match the skin ID, fallback graphics and Qt widget graphics. static const partMapEntry m_partMap[]; }; const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { - /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1}, // Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2. // In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI. - /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */}, - /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */}, - /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */}, - /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */}, - /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */}, - /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_AllReleases, -1,-1}, + /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */}, + /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */}, + /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */}, + /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */}, + /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */}, + /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1}, // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead. - /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/ - /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/ - /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/ - - /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_AllReleases, -1,-1}, - - /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_AllReleases, -1,-1}, - /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, //todo: use "normal button" from 5.0 onwards - /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_AllReleases, -1,-1}, - - /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/ + /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/ + /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/ + + /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_All, -1,-1}, + + /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_All, -1,-1}, + /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_All, -1,-1}, + /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_All, -1,-1}, + + /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_All, -1,-1}, + /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_All, -1,-1}, + /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_All, -1,-1}, + + /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_All, -1, -1}, + /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_All, -1, -1}, + + /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_All, -1,-1}, + + /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_All, -1,-1}, + + /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_All, -1,-1}, + + /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_All, -1,-1}, + + /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_All, -1,-1}, + + /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_All, -1,-1}, // ToolTip graphics different in 3.1 vs. 3.2+. - /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */ - /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6}, - /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3}, - /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4}, - /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca}, - /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7}, - /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8}, - /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9}, - /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2}, - - /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_AllReleases, -1,-1}, - /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_AllReleases, -1,-1}, + /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */ + /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6}, + /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3}, + /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4}, + /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca}, + /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7}, + /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8}, + /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9}, + /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2}, + + /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_All, -1,-1}, // No toolbar frame for 5.0+ releases. - /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, - /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1}, + /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_X, -1,-1}, + /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_X, -1,-1}, // Toolbar graphics is different in 3.1/3.2 vs. 5.0 - /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/ - /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2302}, - /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2303}, - /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2304}, - /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2305}, - /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2306}, - /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2307}, - /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2308}, - /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/ + /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/ + /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302}, + /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303}, + /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304}, + /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305}, + /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306}, + /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307}, + /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308}, + /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/ // No pressed state for toolbar button in 3.1/3.2. - /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/ - /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2622}, - /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2623}, - /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2624}, - /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2625}, - /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2626}, - /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2627}, - /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2628}, - /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2629}, + /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/ + /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622}, + /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623}, + /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624}, + /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625}, + /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626}, + /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627}, + /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628}, + /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629}, // No inactive button graphics in 3.1/3.2 - /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/ - /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b2}, - /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b3}, - /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b4}, - /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b5}, - /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6}, - /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7}, - /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8}, - /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9}, + /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/ + /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b2}, + /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b3}, + /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b4}, + /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b5}, + /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b6}, + /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b7}, + /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8}, + /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9}, }; @@ -349,7 +351,7 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics( } QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics( - const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter, + const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags) { QPixmap colorGraphics; @@ -357,155 +359,118 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics( return error ? QPixmap() : colorGraphics; } -void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex) +void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex) { - switch(stylepart) { + switch(stylePart) { case QS60StyleEnums::SP_QgnGrafBarWait: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_bar_wait_1; break; case QS60StyleEnums::SP_QgnGrafBarFrameCenter: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_bar_frame_center; break; case QS60StyleEnums::SP_QgnGrafBarFrameSideL: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_l; break; case QS60StyleEnums::SP_QgnGrafBarFrameSideR: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_r; break; case QS60StyleEnums::SP_QgnGrafBarProgress: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_bar_progress; break; case QS60StyleEnums::SP_QgnGrafTabActiveL: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_tab_active_l; break; case QS60StyleEnums::SP_QgnGrafTabActiveM: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_tab_active_m; break; case QS60StyleEnums::SP_QgnGrafTabActiveR: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_tab_active_r; break; case QS60StyleEnums::SP_QgnGrafTabPassiveL: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_tab_passive_l; break; case QS60StyleEnums::SP_QgnGrafTabPassiveM: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_tab_passive_m; break; case QS60StyleEnums::SP_QgnGrafTabPassiveR: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_graf_tab_passive_r; break; case QS60StyleEnums::SP_QgnIndiCheckboxOff: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_checkbox_off; break; case QS60StyleEnums::SP_QgnIndiCheckboxOn: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_checkbox_on; break; case QS60StyleEnums::SP_QgnIndiHlColSuper: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = 0x4456; /* EMbmAvkonQgn_indi_hl_col_super */ break; case QS60StyleEnums::SP_QgnIndiHlExpSuper: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = 0x4458; /* EMbmAvkonQgn_indi_hl_exp_super */ break; case QS60StyleEnums::SP_QgnIndiHlLineBranch: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = 0x445A; /* EMbmAvkonQgn_indi_hl_line_branch */ break; case QS60StyleEnums::SP_QgnIndiHlLineEnd: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = 0x445C; /* EMbmAvkonQgn_indi_hl_line_end */ break; case QS60StyleEnums::SP_QgnIndiHlLineStraight: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = 0x445E; /* EMbmAvkonQgn_indi_hl_line_straight */ break; case QS60StyleEnums::SP_QgnIndiMarkedAdd: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_marked_add; break; case QS60StyleEnums::SP_QgnIndiNaviArrowLeft: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_left; break; case QS60StyleEnums::SP_QgnIndiNaviArrowRight: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_right; break; case QS60StyleEnums::SP_QgnIndiRadiobuttOff: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_radiobutt_off; break; case QS60StyleEnums::SP_QgnIndiRadiobuttOn: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on; break; case QS60StyleEnums::SP_QgnIndiSliderEdit: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_slider_edit; break; case QS60StyleEnums::SP_QgnIndiSubMenu: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_indi_submenu; break; case QS60StyleEnums::SP_QgnNoteErased: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_note_erased; break; case QS60StyleEnums::SP_QgnNoteError: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_note_error; break; case QS60StyleEnums::SP_QgnNoteInfo: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_note_info; break; case QS60StyleEnums::SP_QgnNoteOk: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_note_ok; break; case QS60StyleEnums::SP_QgnNoteQuery: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_note_query; break; case QS60StyleEnums::SP_QgnNoteWarning: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_note_warning; break; case QS60StyleEnums::SP_QgnPropFileSmall: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_prop_file_small; break; case QS60StyleEnums::SP_QgnPropFolderCurrent: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_prop_folder_current; break; case QS60StyleEnums::SP_QgnPropFolderSmall: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_prop_folder_small; break; case QS60StyleEnums::SP_QgnPropFolderSmallNew: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_prop_folder_small_new; break; case QS60StyleEnums::SP_QgnPropPhoneMemcLarge: - fallbackFileName = KAvkonBitmapFile(); fallbackIndex = EMbmAvkonQgn_prop_phone_memc_large; break; default: - fallbackFileName = KNullDesC(); fallbackIndex = -1; break; } @@ -521,8 +486,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( TInt fallbackGraphicID = -1; HBufC* iconFile = HBufC::NewLC( KMaxFileName ); - TPtr fileNamePtr = iconFile->Des(); - fallbackInfo(stylepart, fileNamePtr, fallbackGraphicID); + fallbackInfo(stylepart, fallbackGraphicID); TAknsItemID colorGroup = KAknsIIDQsnIconColors; TRgb defaultColor = KRgbBlack; @@ -543,10 +507,18 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); AknsUtils::CreateColorIconLC( - skinInstance, skinId, colorGroup, colorIndex, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID, defaultColor); - User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved)); - User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved)); - QPixmap result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode())); + skinInstance, + skinId, + colorGroup, + colorIndex, + icon, + iconMask, + AknIconUtils::AvkonIconFileName(), + fallbackGraphicID, + fallbackGraphicsMaskID, + defaultColor); + + QPixmap result = fromFbsBitmap(icon, iconMask, flags, targetSize); CleanupStack::PopAndDestroy(3); //icon, iconMask, iconFile return result; } @@ -566,55 +538,43 @@ struct QAutoFbsBitmapHeapLock CFbsBitmap* mBmp; }; -QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format) +QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize &targetSize) { Q_ASSERT(icon); - const TSize iconSize = icon->SizeInPixels(); - const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, icon->DisplayMode()); - const int iconBytesCount = iconBytesPerLine * iconSize.iHeight; - QImage iconImage(qt_TSize2QSize(iconSize), format); - if (iconImage.isNull()) - return QPixmap(); + AknIconUtils::DisableCompression(icon); + TInt error = AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved); - checkAndUnCompressBitmap(icon); - if (!icon) //checkAndUnCompressBitmap might set icon to NULL + if (mask && !error) { + AknIconUtils::DisableCompression(mask); + error = AknIconUtils::SetSize(mask, targetSize, EAspectRatioNotPreserved); + } + if (error) return QPixmap(); - icon->LockHeap(); - const uchar *const iconBytes = (uchar*)icon->DataAddress(); - // The icon data needs to be copied, since the color format will be - // automatically converted to Format_ARGB32 when setAlphaChannel is called. - memcpy(iconImage.bits(), iconBytes, iconBytesCount); - icon->UnlockHeap(); - if (mask) { - checkAndUnCompressBitmap(mask); - if (mask) { //checkAndUnCompressBitmap might set mask to NULL - const TSize maskSize = icon->SizeInPixels(); - const int maskBytesPerLine = CFbsBitmap::ScanLineLength(maskSize.iWidth, mask->DisplayMode()); - // heap lock object required because QImage ctor might throw - QAutoFbsBitmapHeapLock maskHeapLock(mask); - const uchar *const maskBytes = (uchar *)mask->DataAddress(); - // Since no other bitmap should be locked, we can just "borrow" the mask data for setAlphaChannel - const QImage maskImage(maskBytes, maskSize.iWidth, maskSize.iHeight, maskBytesPerLine, QImage::Format_Indexed8); - if (!maskImage.isNull()) - iconImage.setAlphaChannel(maskImage); + QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(icon); + if (mask) + pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask)); + + if ((flags & QS60StylePrivate::SF_PointEast) || + (flags & QS60StylePrivate::SF_PointSouth) || + (flags & QS60StylePrivate::SF_PointWest)) { + QImage iconImage = pixmap.toImage(); + QTransform imageTransform; + if (flags & QS60StylePrivate::SF_PointEast) { + imageTransform.rotate(90); + } else if (flags & QS60StylePrivate::SF_PointSouth) { + imageTransform.rotate(180); + iconImage = iconImage.transformed(imageTransform); + } else if (flags & QS60StylePrivate::SF_PointWest) { + imageTransform.rotate(270); } - } + if (imageTransform.isRotating()) + iconImage = iconImage.transformed(imageTransform); - QTransform imageTransform; - if (flags & QS60StylePrivate::SF_PointEast) { - imageTransform.rotate(90); - } else if (flags & QS60StylePrivate::SF_PointSouth) { - imageTransform.rotate(180); - iconImage = iconImage.transformed(imageTransform); - } else if (flags & QS60StylePrivate::SF_PointWest) { - imageTransform.rotate(270); + pixmap = QPixmap::fromImage(iconImage); } - if (imageTransform.isRotating()) - iconImage = iconImage.transformed(imageTransform); - - return QPixmap::fromImage(iconImage); + return pixmap; } bool QS60StylePrivate::isTouchSupported() @@ -645,7 +605,7 @@ QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) } QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( - QS60StyleEnums::SkinParts part, const QSize &size, + QS60StyleEnums::SkinParts part, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. @@ -653,7 +613,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( return QPixmap(); // Check release support and change part, if necessary. - const TAknsItemID skinId = checkAndUpdateReleaseSpecificGraphics((int)part); + const TAknsItemID skinId = partSpecificThemeId((int)part); const int stylepartIndex = (int)part; const TDrawType drawType = m_partMap[stylepartIndex].drawType; Q_ASSERT(drawType != ENoDraw); @@ -667,24 +627,34 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( QPixmap result; switch (drawType) { + case EDrawGulIcon: { + CGulIcon* icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), skinId, EFalse ); + if (icon) + result = fromFbsBitmap(icon->Bitmap(), icon->Mask(), flags, targetSize); + delete icon; + break; + } case EDrawIcon: { TInt fallbackGraphicID = -1; - HBufC* iconFile = HBufC::NewLC( KMaxFileName ); - TPtr fileNamePtr = iconFile->Des(); - fallbackInfo(part, fileNamePtr, fallbackGraphicID); - // todo: could we instead use AknIconUtils::AvkonIconFileName(); to avoid allocating each time? + fallbackInfo(part, fallbackGraphicID); CFbsBitmap *icon = 0; CFbsBitmap *iconMask = 0; const TInt fallbackGraphicsMaskID = fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files - // QS60WindowSurface::unlockBitmapHeap(); - AknsUtils::CreateIconLC(skinInstance, skinId, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID); - User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved)); - User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved)); - result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode())); - CleanupStack::PopAndDestroy(3); // iconMask, icon, iconFile - // QS60WindowSurface::lockBitmapHeap(); + + AknsUtils::CreateIconL( + skinInstance, + skinId, + icon, + iconMask, + AknIconUtils::AvkonIconFileName(), + fallbackGraphicID , + fallbackGraphicsMaskID); + + result = fromFbsBitmap(icon, iconMask, flags, targetSize); + delete icon; + delete iconMask; break; } case EDrawBackground: { @@ -715,13 +685,16 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( KAknsDrawParamDefault | KAknsDrawParamRGBOnly); if (drawn) - result = fromFbsBitmap(background, NULL, flags, QImage::Format_RGB32); + result = fromFbsBitmap(background, NULL, flags, targetSize); + // if drawing fails in skin server, just ignore the background (probably OOM occured) CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext // QS60WindowSurface::lockBitmapHeap(); break; } } + if (!result) + result = QPixmap(); return result; } @@ -755,24 +728,46 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr User::LeaveIfError(bitmapDev->CreateContext(bitmapGc)); CleanupStack::PushL(bitmapGc); +#ifndef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE frame->LockHeap(); memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes frame->UnlockHeap(); +#endif const TRect outerRect(TPoint(0, 0), targetSize); const TRect innerRect = innerRectFromElement(frameElement, outerRect); TAknsItemID frameSkinID, centerSkinID; - frameSkinID = centerSkinID = checkAndUpdateReleaseSpecificGraphics(QS60StylePrivate::m_frameElementsData[frameElement].center); + frameSkinID = centerSkinID = partSpecificThemeId(QS60StylePrivate::m_frameElementsData[frameElement].center); frameIdAndCenterId(frameElement, frameSkinID, centerSkinID); - const TBool drawn = AknsDrawUtils::DrawFrame( skinInstance, - *bitmapGc, outerRect, innerRect, - frameSkinID, centerSkinID, - drawParam ); + + TBool drawn = AknsDrawUtils::DrawFrame( + skinInstance, + *bitmapGc, + outerRect, + innerRect, + frameSkinID, + centerSkinID, + drawParam ); if (S60->supportsPremultipliedAlpha) { - if (drawn) - result = fromFbsBitmap(frame, NULL, flags, QImage::Format_ARGB32_Premultiplied); + if (drawn) { + result = fromFbsBitmap(frame, NULL, flags, targetSize); + } else { + // Drawing might fail due to OOM (we can do nothing about that), + // or due to skin item not being available. + // If the latter occurs, lets try switch to non-release specific items (if available) + // and re-try the drawing. + frameSkinID = centerSkinID = m_partMap[(int)QS60StylePrivate::m_frameElementsData[frameElement].center].skinID; + frameIdAndCenterId(frameElement, frameSkinID, centerSkinID); + drawn = AknsDrawUtils::DrawFrame( skinInstance, + *bitmapGc, outerRect, innerRect, + frameSkinID, centerSkinID, + drawParam ); + // in case drawing fails, even after using default graphics, ignore the error + if (drawn) + result = fromFbsBitmap(frame, NULL, flags, targetSize); + } } else { TDisplayMode maskDepth = EGray2; // Query the skin item for possible frame graphics mask details. @@ -802,11 +797,12 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr maskBitGc->Clear(); maskBitGc->SetBrushStyle(CGraphicsContext::ENullBrush); - AknsDrawUtils::DrawFrame(skinInstance, + drawn = AknsDrawUtils::DrawFrame(skinInstance, *maskBitGc, outerRect, innerRect, frameSkinID, centerSkinID, KAknsSDMAlphaOnly |KAknsDrawParamNoClearUnderImage); - result = fromFbsBitmap(frame, frameMask, flags, QImage::Format_ARGB32); + if (drawn) + result = fromFbsBitmap(frame, frameMask, flags, targetSize); } CleanupStack::PopAndDestroy(3, frameMask); } @@ -880,10 +876,12 @@ bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease) const QSysInfo::S60Version currentRelease = QSysInfo::s60Version(); return ( (currentRelease == QSysInfo::SV_S60_3_1 && supportedRelease & ES60_3_1) || (currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) || - (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0)); + (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) || + (currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) || + (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2)); } -TAknsItemID QS60StyleModeSpecifics::checkAndUpdateReleaseSpecificGraphics(int part) +TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part) { TAknsItemID newSkinId; if (!checkSupport(m_partMap[(int)part].supportInfo)) @@ -893,33 +891,6 @@ TAknsItemID QS60StyleModeSpecifics::checkAndUpdateReleaseSpecificGraphics(int pa return newSkinId; } -void QS60StyleModeSpecifics::checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap) -{ - TRAPD(error, checkAndUnCompressBitmapL(aOriginalBitmap)); - if (error) - aOriginalBitmap = NULL; -} - -void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap) -{ - const TSize iconSize = aOriginalBitmap->SizeInPixels(); - const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode()); - const int iconBytesCount = iconBytesPerLine * iconSize.iHeight; - if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->Header().iBitmapSize < iconBytesCount) { - const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth, - aOriginalBitmap->SizeInPixels().iHeight); - CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap(); - CleanupStack::PushL(uncompressedBitmap); - User::LeaveIfError(uncompressedBitmap->Create(iconSize, - aOriginalBitmap->DisplayMode())); - unCompressBitmapL(iconSize, uncompressedBitmap, aOriginalBitmap); - CleanupStack::Pop(uncompressedBitmap); - User::LeaveIfError(aOriginalBitmap->Duplicate( - uncompressedBitmap->Handle())); - delete uncompressedBitmap; - } -} - QFont QS60StylePrivate::s60Font_specific( QS60StyleEnums::FontCategories fontCategory, int pointSize) { @@ -1167,148 +1138,6 @@ QPixmap QS60StylePrivate::backgroundTexture() return *m_background; } -// If the public SDK returns compressed images, please let us also uncompress those! -void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap) -{ - if (!aSrcBitmap) - User::Leave(KErrArgument); - if (!aTrgBitmap) - User::Leave(KErrArgument); - - // Note! aSrcBitmap->IsCompressedInRAM() is always ETrue, since this method is called only if that applies! - // Extra note! this function is also being used when bitmaps appear to be compressed (because DataSize is too small) - // even when they pretend they are not. Assert removed. -// ASSERT(aSrcBitmap->IsCompressedInRAM()); - - TDisplayMode displayMode = aSrcBitmap->DisplayMode(); - - if (displayMode != aTrgBitmap->DisplayMode()) - User::Leave(KErrArgument); - - const TSize trgSize = aTrgBitmap->SizeInPixels(); - const TSize srcSize = aSrcBitmap->SizeInPixels(); - - // calculate the valid drawing area - TRect drawRect = aTrgRect; - drawRect.Intersection(TRect(TPoint(0, 0), trgSize)); - - if (drawRect.IsEmpty()) - return; - - CFbsBitmap* realSource = new (ELeave) CFbsBitmap(); - CleanupStack::PushL(realSource); - User::LeaveIfError(realSource->Create(srcSize, displayMode)); - CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(realSource); - CleanupStack::PushL(dev); - CFbsBitGc* gc = NULL; - User::LeaveIfError(dev->CreateContext(gc)); - CleanupStack::PushL(gc); - gc->BitBlt(TPoint(0, 0), aSrcBitmap); - CleanupStack::PopAndDestroy(2); // dev, gc - - // Heap lock for FBServ large chunk is only needed with large bitmaps. - if (realSource->IsLargeBitmap() || aTrgBitmap->IsLargeBitmap()) { - aTrgBitmap->LockHeapLC(ETrue); // fbsheaplock - } else { - CleanupStack::PushL((TAny*) NULL); - } - - TUint32* srcAddress = realSource->DataAddress(); - TUint32* trgAddress = aTrgBitmap->DataAddress(); - - const TInt xSkip = (srcSize.iWidth << 8) / aTrgRect.Width(); - const TInt ySkip = (srcSize.iHeight << 8) / aTrgRect.Height(); - - const TInt drawWidth = drawRect.Width(); - const TInt drawHeight = drawRect.Height(); - - const TRect offsetRect(aTrgRect.iTl, drawRect.iTl); - const TInt yPosOffset = ySkip * offsetRect.Height(); - const TInt xPosOffset = xSkip * offsetRect.Width(); - - if ((displayMode == EGray256) || (displayMode == EColor256)) { - const TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth, - displayMode); - const TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth, - displayMode); - - TUint8* trgAddress8 = reinterpret_cast (trgAddress); - - TInt yPos = yPosOffset; - // skip left and top margins in the beginning - trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX; - - for (TInt y = 0; y < drawHeight; y++) { - const TUint8* srcAddress8 = reinterpret_cast (srcAddress) - + (srcScanLen8 * (yPos >> 8)); - - TInt xPos = xPosOffset; - for (TInt x = 0; x < drawWidth; x++) { - *(trgAddress8++) = srcAddress8[xPos >> 8]; - xPos += xSkip; - } - - yPos += ySkip; - - trgAddress8 += trgScanLen8 - drawWidth; - } - } else if (displayMode == EColor4K || displayMode == EColor64K) { - const TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth, - displayMode) >>1; - const TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth, - displayMode) >>1; - - TUint16* trgAddress16 = reinterpret_cast (trgAddress); - - TInt yPos = yPosOffset; - // skip left and top margins in the beginning - trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX; - - for (TInt y = 0; y < drawHeight; y++) { - const TUint16* srcAddress16 = reinterpret_cast (srcAddress) - + (srcScanLen16 * (yPos >> 8)); - - TInt xPos = xPosOffset; - for (TInt x = 0; x < drawWidth; x++) { - *(trgAddress16++) = srcAddress16[xPos >> 8]; - xPos += xSkip; - } - - yPos += ySkip; - - trgAddress16 += trgScanLen16 - drawWidth; - } - } else if (displayMode == EColor16MU || displayMode == EColor16MA) { - const TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth, - displayMode) >>2; - const TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth, - displayMode) >>2; - - TUint32* trgAddress32 = reinterpret_cast (trgAddress); - - TInt yPos = yPosOffset; - // skip left and top margins in the beginning - trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX; - - for (TInt y = 0; y < drawHeight; y++) { - const TUint32* srcAddress32 = reinterpret_cast (srcAddress) - + (srcScanLen32 * (yPos >> 8)); - - TInt xPos = xPosOffset; - for (TInt x = 0; x < drawWidth; x++) { - *(trgAddress32++) = srcAddress32[xPos >> 8]; - xPos += xSkip; - } - - yPos += ySkip; - - trgAddress32 += trgScanLen32 - drawWidth; - } - } else { User::Leave(KErrUnknown);} - - CleanupStack::PopAndDestroy(2); // fbsheaplock, realSource -} - QSize QS60StylePrivate::screenSize() { const TSize screenSize = QS60Data::screenDevice()->SizeInPixels(); diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 88a2cce..7e5c55a 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -168,7 +168,7 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) { SOURCES += styles/qs60style.cpp symbian { SOURCES += styles/qs60style_s60.cpp - LIBS += -laknicon -laknskins -laknskinsrv -lfontutils + LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul } else { SOURCES += styles/qs60style_simulated.cpp RESOURCES += styles/qstyle_s60_simulated.qrc -- cgit v0.12 From 9ddbc21e76564d2d8cba5a7ea831971c4e628130 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 8 Dec 2009 14:10:34 +0000 Subject: Implement qsrand() for Symbian OS After checking the source code of OpenC stdlib, rand and srand are thread safe (they use Symbian's TLS internally) so the Symbian implementation mostly follows the Windows one (where this is also true) Task-number: QTBUG-6372 Reviewed-by: Janne Koskinen --- src/corelib/global/qglobal.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 62b5409..0c94482 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -77,6 +77,7 @@ #include #include #include +#include # include "private/qcore_symbian_p.h" _LIT(qt_S60Filter, "Series60v?.*.sis"); @@ -2493,7 +2494,7 @@ bool qputenv(const char *varName, const QByteArray& value) #endif } -#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) +#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) # if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500) // older versions of INTEGRITY used a long instead of a uint for the seed. @@ -2516,8 +2517,6 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value Sets the argument \a seed to be used to generate a new random number sequence of pseudo random integers to be returned by qrand(). - If no seed value is provided, qrand() is automatically seeded with a value of 1. - The sequence of random numbers generated is deterministic per thread. For example, if two threads call qsrand(1) and subsequently calls qrand(), the threads will get the same random number sequence. @@ -2541,8 +2540,9 @@ void qsrand(uint seed) srand(seed); } #else - // On Windows srand() and rand() already use Thread-Local-Storage + // On Windows and Symbian srand() and rand() already use Thread-Local-Storage // to store the seed between calls + // this is also valid for QT_NO_THREAD srand(seed); #endif } @@ -2558,7 +2558,7 @@ void qsrand(uint seed) */ void qsrand() { -#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) +#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) SeedStorage *seedStorage = randTLS(); if (seedStorage) { SeedStorageType *pseed = seedStorage->localData(); @@ -2572,24 +2572,28 @@ void qsrand() *pseed = QDateTime::currentDateTime().toTime_t() + quintptr(&pseed) + serial.fetchAndAddRelaxed(1); -#if defined(Q_OS_WIN) - // for Windows the srand function must still be called. +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + // for Windows and Symbian the srand function must still be called. srand(*pseed); #endif } -#elif defined(Q_OS_WIN) +//QT_NO_THREAD implementations +#else static unsigned int seed = 0; if (seed) return; +#if defined(Q_OS_SYMBIAN) + seed = Math::Random(); +#elif defined(Q_OS_WIN) seed = GetTickCount(); - srand(seed); #else - // Symbian? - -#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) + seed = quintptr(&seed) + QDateTime::currentDateTime().toTime_t(); +#endif + srand(seed); +#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) } /*! @@ -2626,8 +2630,9 @@ int qrand() return rand(); } #else - // On Windows srand() and rand() already use Thread-Local-Storage + // On Windows and Symbian srand() and rand() already use Thread-Local-Storage // to store the seed between calls + // this is also valid for QT_NO_THREAD return rand(); #endif } -- cgit v0.12 From 23334d3272834408adeaab604727284846ecdab9 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 8 Dec 2009 15:21:08 +0100 Subject: Def file updates Reviewed-by: TrustMe --- src/s60installs/bwins/QtGuiu.def | 25 +++++++++++++++---------- src/s60installs/eabi/QtGuiu.def | 18 +++++++++++------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 166b6fe..d50e85f 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -271,7 +271,7 @@ EXPORTS ??0QImageIOHandler@@IAE@AAVQImageIOHandlerPrivate@@@Z @ 270 NONAME ; QImageIOHandler::QImageIOHandler(class QImageIOHandlerPrivate &) ??0QImageIOHandler@@QAE@XZ @ 271 NONAME ; QImageIOHandler::QImageIOHandler(void) ??0QImageIOPlugin@@QAE@PAVQObject@@@Z @ 272 NONAME ; QImageIOPlugin::QImageIOPlugin(class QObject *) - ??0QImagePixmapCleanupHooks@@QAE@XZ @ 273 NONAME ; QImagePixmapCleanupHooks::QImagePixmapCleanupHooks(void) + ??0QImagePixmapCleanupHooks@@QAE@XZ @ 273 NONAME ABSENT ; QImagePixmapCleanupHooks::QImagePixmapCleanupHooks(void) ??0QImageReader@@QAE@ABVQString@@ABVQByteArray@@@Z @ 274 NONAME ; QImageReader::QImageReader(class QString const &, class QByteArray const &) ??0QImageReader@@QAE@PAVQIODevice@@ABVQByteArray@@@Z @ 275 NONAME ; QImageReader::QImageReader(class QIODevice *, class QByteArray const &) ??0QImageReader@@QAE@XZ @ 276 NONAME ; QImageReader::QImageReader(void) @@ -2021,7 +2021,7 @@ EXPORTS ?addButton@QMessageBox@@QAEPAVQPushButton@@ABVQString@@W4ButtonRole@1@@Z @ 2020 NONAME ; class QPushButton * QMessageBox::addButton(class QString const &, enum QMessageBox::ButtonRole) ?addButton@QMessageBox@@QAEPAVQPushButton@@W4StandardButton@1@@Z @ 2021 NONAME ; class QPushButton * QMessageBox::addButton(enum QMessageBox::StandardButton) ?addButton@QMessageBox@@QAEXPAVQAbstractButton@@W4ButtonRole@1@@Z @ 2022 NONAME ; void QMessageBox::addButton(class QAbstractButton *, enum QMessageBox::ButtonRole) - ?addCacheData@QVectorPath@@QAEPAUCacheEntry@1@PAVQPaintEngineEx@@PAXP6AX1@Z@Z @ 2023 NONAME ; struct QVectorPath::CacheEntry * QVectorPath::addCacheData(class QPaintEngineEx *, void *, void (*)(void *)) + ?addCacheData@QVectorPath@@QAEPAUCacheEntry@1@PAVQPaintEngineEx@@PAXP6AX1@Z@Z @ 2023 NONAME ABSENT ; struct QVectorPath::CacheEntry * QVectorPath::addCacheData(class QPaintEngineEx *, void *, void (*)(void *)) ?addChild@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 2024 NONAME ; void QGraphicsItemPrivate::addChild(class QGraphicsItem *) ?addChild@QTreeWidgetItem@@QAEXPAV1@@Z @ 2025 NONAME ; void QTreeWidgetItem::addChild(class QTreeWidgetItem *) ?addChildLayout@QLayout@@IAEXPAV1@@Z @ 2026 NONAME ; void QLayout::addChildLayout(class QLayout *) @@ -3724,7 +3724,7 @@ EXPORTS ?directory@QFileDialog@@QBE?AVQDir@@XZ @ 3723 NONAME ; class QDir QFileDialog::directory(void) const ?directoryEntered@QFileDialog@@IAEXABVQString@@@Z @ 3724 NONAME ; void QFileDialog::directoryEntered(class QString const &) ?dirtyRegionOffset@QAbstractItemView@@IBE?AVQPoint@@XZ @ 3725 NONAME ; class QPoint QAbstractItemView::dirtyRegionOffset(void) const - ?discardUpdateRequest@QGraphicsItemPrivate@@QBE_N_N000@Z @ 3726 NONAME ; bool QGraphicsItemPrivate::discardUpdateRequest(bool, bool, bool, bool) const + ?discardUpdateRequest@QGraphicsItemPrivate@@QBE_N_N000@Z @ 3726 NONAME ABSENT ; bool QGraphicsItemPrivate::discardUpdateRequest(bool, bool, bool, bool) const ?disconnectFromModel@QProxyModel@@IBEXPBVQAbstractItemModel@@@Z @ 3727 NONAME ; void QProxyModel::disconnectFromModel(class QAbstractItemModel const *) const ?dispatchEnterLeave@QApplicationPrivate@@SAXPAVQWidget@@0@Z @ 3728 NONAME ; void QApplicationPrivate::dispatchEnterLeave(class QWidget *, class QWidget *) ?display@QLCDNumber@@QAEXABVQString@@@Z @ 3729 NONAME ; void QLCDNumber::display(class QString const &) @@ -5522,8 +5522,8 @@ EXPORTS ?invalidateBuffer@QWidgetPrivate@@QAEXABVQRect@@@Z @ 5521 NONAME ; void QWidgetPrivate::invalidateBuffer(class QRect const &) ?invalidateBuffer@QWidgetPrivate@@QAEXABVQRegion@@@Z @ 5522 NONAME ; void QWidgetPrivate::invalidateBuffer(class QRegion const &) ?invalidateBuffer_resizeHelper@QWidgetPrivate@@QAEXABVQPoint@@ABVQSize@@@Z @ 5523 NONAME ; void QWidgetPrivate::invalidateBuffer_resizeHelper(class QPoint const &, class QSize const &) - ?invalidateCachedClipPath@QGraphicsItemPrivate@@QAEXXZ @ 5524 NONAME ; void QGraphicsItemPrivate::invalidateCachedClipPath(void) - ?invalidateCachedClipPathRecursively@QGraphicsItemPrivate@@QAEX_NABVQRectF@@@Z @ 5525 NONAME ; void QGraphicsItemPrivate::invalidateCachedClipPathRecursively(bool, class QRectF const &) + ?invalidateCachedClipPath@QGraphicsItemPrivate@@QAEXXZ @ 5524 NONAME ABSENT ; void QGraphicsItemPrivate::invalidateCachedClipPath(void) + ?invalidateCachedClipPathRecursively@QGraphicsItemPrivate@@QAEX_NABVQRectF@@@Z @ 5525 NONAME ABSENT ; void QGraphicsItemPrivate::invalidateCachedClipPathRecursively(bool, class QRectF const &) ?invalidateChildrenSceneTransform@QGraphicsItemPrivate@@QAEXXZ @ 5526 NONAME ; void QGraphicsItemPrivate::invalidateChildrenSceneTransform(void) ?invalidateDepthRecursively@QGraphicsItemPrivate@@QAEXXZ @ 5527 NONAME ; void QGraphicsItemPrivate::invalidateDepthRecursively(void) ?invalidateFilter@QSortFilterProxyModel@@IAEXXZ @ 5528 NONAME ; void QSortFilterProxyModel::invalidateFilter(void) @@ -5589,7 +5589,7 @@ EXPORTS ?isClickable@QHeaderView@@QBE_NXZ @ 5588 NONAME ; bool QHeaderView::isClickable(void) const ?isClipEnabled@QPaintEngineState@@QBE_NXZ @ 5589 NONAME ; bool QPaintEngineState::isClipEnabled(void) const ?isClipped@QGraphicsItem@@QBE_NXZ @ 5590 NONAME ; bool QGraphicsItem::isClipped(void) const - ?isClippedAway@QGraphicsItemPrivate@@QBE_NXZ @ 5591 NONAME ; bool QGraphicsItemPrivate::isClippedAway(void) const + ?isClippedAway@QGraphicsItemPrivate@@QBE_NXZ @ 5591 NONAME ABSENT ; bool QGraphicsItemPrivate::isClippedAway(void) const ?isClosed@QPolygonF@@QBE_NXZ @ 5592 NONAME ; bool QPolygonF::isClosed(void) const ?isCollapsible@QSplitter@@QBE_NH@Z @ 5593 NONAME ; bool QSplitter::isCollapsible(int) const ?isColumnHidden@QTableView@@QBE_NH@Z @ 5594 NONAME ; bool QTableView::isColumnHidden(int) const @@ -8586,7 +8586,7 @@ EXPORTS ?setCacheMode@QGraphicsItem@@QAEXW4CacheMode@1@ABVQSize@@@Z @ 8585 NONAME ; void QGraphicsItem::setCacheMode(enum QGraphicsItem::CacheMode, class QSize const &) ?setCacheMode@QGraphicsView@@QAEXV?$QFlags@W4CacheModeFlag@QGraphicsView@@@@@Z @ 8586 NONAME ; void QGraphicsView::setCacheMode(class QFlags) ?setCacheMode@QMovie@@QAEXW4CacheMode@1@@Z @ 8587 NONAME ; void QMovie::setCacheMode(enum QMovie::CacheMode) - ?setCachedClipPath@QGraphicsItemPrivate@@QAEXABVQPainterPath@@@Z @ 8588 NONAME ; void QGraphicsItemPrivate::setCachedClipPath(class QPainterPath const &) + ?setCachedClipPath@QGraphicsItemPrivate@@QAEXABVQPainterPath@@@Z @ 8588 NONAME ABSENT ; void QGraphicsItemPrivate::setCachedClipPath(class QPainterPath const &) ?setCalendarPopup@QDateTimeEdit@@QAEX_N@Z @ 8589 NONAME ; void QDateTimeEdit::setCalendarPopup(bool) ?setCalendarWidget@QDateTimeEdit@@QAEXPAVQCalendarWidget@@@Z @ 8590 NONAME ; void QDateTimeEdit::setCalendarWidget(class QCalendarWidget *) ?setCancelButton@QProgressDialog@@QAEXPAVQPushButton@@@Z @ 8591 NONAME ; void QProgressDialog::setCancelButton(class QPushButton *) @@ -8901,8 +8901,8 @@ EXPORTS ?setElementPositionAt@QPainterPath@@QAEXHMM@Z @ 8900 NONAME ; void QPainterPath::setElementPositionAt(int, float, float) ?setElideMode@QTabBar@@QAEXW4TextElideMode@Qt@@@Z @ 8901 NONAME ; void QTabBar::setElideMode(enum Qt::TextElideMode) ?setElideMode@QTabWidget@@QAEXW4TextElideMode@Qt@@@Z @ 8902 NONAME ; void QTabWidget::setElideMode(enum Qt::TextElideMode) - ?setEmptyCachedClipPath@QGraphicsItemPrivate@@QAEXXZ @ 8903 NONAME ; void QGraphicsItemPrivate::setEmptyCachedClipPath(void) - ?setEmptyCachedClipPathRecursively@QGraphicsItemPrivate@@QAEXABVQRectF@@@Z @ 8904 NONAME ; void QGraphicsItemPrivate::setEmptyCachedClipPathRecursively(class QRectF const &) + ?setEmptyCachedClipPath@QGraphicsItemPrivate@@QAEXXZ @ 8903 NONAME ABSENT ; void QGraphicsItemPrivate::setEmptyCachedClipPath(void) + ?setEmptyCachedClipPathRecursively@QGraphicsItemPrivate@@QAEXABVQRectF@@@Z @ 8904 NONAME ABSENT ; void QGraphicsItemPrivate::setEmptyCachedClipPathRecursively(class QRectF const &) ?setEmptyLabel@QUndoView@@QAEXABVQString@@@Z @ 8905 NONAME ; void QUndoView::setEmptyLabel(class QString const &) ?setEnabled@QAction@@QAEX_N@Z @ 8906 NONAME ; void QAction::setEnabled(bool) ?setEnabled@QActionGroup@@QAEX_N@Z @ 8907 NONAME ; void QActionGroup::setEnabled(bool) @@ -11919,7 +11919,7 @@ EXPORTS ?updateBlock@QAbstractTextDocumentLayout@@IAEXABVQTextBlock@@@Z @ 11918 NONAME ; void QAbstractTextDocumentLayout::updateBlock(class QTextBlock const &) ?updateBoundingRect@QGraphicsEffect@@IAEXXZ @ 11919 NONAME ; void QGraphicsEffect::updateBoundingRect(void) ?updateCacheIfNecessary@QWidgetItemV2@@ABEXXZ @ 11920 NONAME ; void QWidgetItemV2::updateCacheIfNecessary(void) const - ?updateCachedClipPathFromSetPosHelper@QGraphicsItemPrivate@@QAEXABVQPointF@@@Z @ 11921 NONAME ; void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(class QPointF const &) + ?updateCachedClipPathFromSetPosHelper@QGraphicsItemPrivate@@QAEXABVQPointF@@@Z @ 11921 NONAME ABSENT ; void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(class QPointF const &) ?updateCell@QCalendarWidget@@IAEXABVQDate@@@Z @ 11922 NONAME ; void QCalendarWidget::updateCell(class QDate const &) ?updateCells@QCalendarWidget@@IAEXXZ @ 11923 NONAME ; void QCalendarWidget::updateCells(void) ?updateDisplayText@QLineControl@@AAEXXZ @ 11924 NONAME ; void QLineControl::updateDisplayText(void) @@ -12517,4 +12517,9 @@ EXPORTS ?effectiveFocusWidget@QWidgetPrivate@@QAEPAVQWidget@@XZ @ 12516 NONAME ; class QWidget * QWidgetPrivate::effectiveFocusWidget(void) ?ignoreUnusedNavigationEvents@QTextControl@@QBE_NXZ @ 12517 NONAME ; bool QTextControl::ignoreUnusedNavigationEvents(void) const ?setIgnoreUnusedNavigationEvents@QTextControl@@QAEX_N@Z @ 12518 NONAME ; void QTextControl::setIgnoreUnusedNavigationEvents(bool) + ??1QImagePixmapCleanupHooks@@QAE@XZ @ 12519 NONAME ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(void) + ??1QVectorPath@@QAE@XZ @ 12520 NONAME ; QVectorPath::~QVectorPath(void) + ?addCacheData@QVectorPath@@QBEPAUCacheEntry@1@PAVQPaintEngineEx@@PAXP6AX01@Z@Z @ 12521 NONAME ; struct QVectorPath::CacheEntry * QVectorPath::addCacheData(class QPaintEngineEx *, void *, void (*)(class QPaintEngineEx *, void *)) const + ?discardUpdateRequest@QGraphicsItemPrivate@@QBE_N_N00@Z @ 12522 NONAME ; bool QGraphicsItemPrivate::discardUpdateRequest(bool, bool, bool) const + ?makeCacheable@QVectorPath@@QBEXXZ @ 12523 NONAME ; void QVectorPath::makeCacheable(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 6c45a6e..429ca79 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4680,9 +4680,9 @@ EXPORTS _ZN20QGraphicsItemPrivate28ensureSequentialSiblingIndexEv @ 4679 NONAME _ZN20QGraphicsItemPrivate29ensureSceneTransformRecursiveEPP13QGraphicsItem @ 4680 NONAME _ZN20QGraphicsItemPrivate30updateSceneTransformFromParentEv @ 4681 NONAME - _ZN20QGraphicsItemPrivate33setEmptyCachedClipPathRecursivelyERK6QRectF @ 4682 NONAME - _ZN20QGraphicsItemPrivate35invalidateCachedClipPathRecursivelyEbRK6QRectF @ 4683 NONAME - _ZN20QGraphicsItemPrivate36updateCachedClipPathFromSetPosHelperERK7QPointF @ 4684 NONAME + _ZN20QGraphicsItemPrivate33setEmptyCachedClipPathRecursivelyERK6QRectF @ 4682 NONAME ABSENT + _ZN20QGraphicsItemPrivate35invalidateCachedClipPathRecursivelyEbRK6QRectF @ 4683 NONAME ABSENT + _ZN20QGraphicsItemPrivate36updateCachedClipPathFromSetPosHelperERK7QPointF @ 4684 NONAME ABSENT _ZN20QGraphicsItemPrivate8addChildEP13QGraphicsItem @ 4685 NONAME _ZN20QGraphicsPolygonItem10setPolygonERK9QPolygonF @ 4686 NONAME _ZN20QGraphicsPolygonItem11setFillRuleEN2Qt8FillRuleE @ 4687 NONAME @@ -5221,8 +5221,8 @@ EXPORTS _ZN24QImagePixmapCleanupHooks17executeImageHooksEx @ 5220 NONAME _ZN24QImagePixmapCleanupHooks18executePixmapHooksEP7QPixmap @ 5221 NONAME ABSENT _ZN24QImagePixmapCleanupHooks8instanceEv @ 5222 NONAME - _ZN24QImagePixmapCleanupHooksC1Ev @ 5223 NONAME - _ZN24QImagePixmapCleanupHooksC2Ev @ 5224 NONAME + _ZN24QImagePixmapCleanupHooksC1Ev @ 5223 NONAME ABSENT + _ZN24QImagePixmapCleanupHooksC2Ev @ 5224 NONAME ABSENT _ZN24QPixmapConvolutionFilter11qt_metacallEN11QMetaObject4CallEiPPv @ 5225 NONAME _ZN24QPixmapConvolutionFilter11qt_metacastEPKc @ 5226 NONAME _ZN24QPixmapConvolutionFilter16staticMetaObjectE @ 5227 NONAME DATA 16 @@ -9388,7 +9388,7 @@ EXPORTS _ZNK20QGraphicsItemPrivate15initStyleOptionEP24QStyleOptionGraphicsItemRK10QTransformRK7QRegionb @ 9387 NONAME _ZNK20QGraphicsItemPrivate19genericMapFromSceneERK7QPointFPK7QWidget @ 9388 NONAME _ZNK20QGraphicsItemPrivate19maybeExtraItemCacheEv @ 9389 NONAME - _ZNK20QGraphicsItemPrivate20discardUpdateRequestEbbbb @ 9390 NONAME + _ZNK20QGraphicsItemPrivate20discardUpdateRequestEbbbb @ 9390 NONAME ABSENT _ZNK20QGraphicsItemPrivate21effectiveBoundingRectEv @ 9391 NONAME _ZNK20QGraphicsItemPrivate22inputMethodQueryHelperEN2Qt16InputMethodQueryE @ 9392 NONAME _ZNK20QGraphicsItemPrivate24combineTransformToParentEP10QTransformPKS0_ @ 9393 NONAME @@ -11571,7 +11571,7 @@ EXPORTS _ZN11QTapGesture19getStaticMetaObjectEv @ 11570 NONAME _ZN11QTapGestureC1EP7QObject @ 11571 NONAME _ZN11QTapGestureC2EP7QObject @ 11572 NONAME - _ZN11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS2_E @ 11573 NONAME + _ZN11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS2_E @ 11573 NONAME ABSENT _ZN12QApplication18symbianEventFilterEPK13QSymbianEvent @ 11574 NONAME _ZN12QApplication19symbianProcessEventEPK13QSymbianEvent @ 11575 NONAME _ZN13QGestureEvent11setAcceptedEN2Qt11GestureTypeEb @ 11576 NONAME @@ -11737,4 +11737,8 @@ EXPORTS _Zls6QDebugRKN12QStyleOption10OptionTypeE @ 11736 NONAME _ZN12QTextControl31setIgnoreUnusedNavigationEventsEb @ 11737 NONAME _ZNK12QTextControl28ignoreUnusedNavigationEventsEv @ 11738 NONAME + _ZN11QVectorPathD1Ev @ 11739 NONAME + _ZN11QVectorPathD2Ev @ 11740 NONAME + _ZNK11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS1_S2_E @ 11741 NONAME + _ZNK20QGraphicsItemPrivate20discardUpdateRequestEbbb @ 11742 NONAME -- cgit v0.12 From 120a12f5dc13dea327cdbbbc94b58f29d1f3306b Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 8 Dec 2009 17:47:37 +0200 Subject: Speed up rotated/transformed text on OpenGL2 paint engine Reviewed-by: Trond Reviewed-by: Tom --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 95 ++++++++-------------- 1 file changed, 34 insertions(+), 61 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 3fce384..17af9cb 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -589,53 +589,31 @@ void QGL2PaintEngineExPrivate::updateMatrix() // matrix multiplication as most of the components are trivial. const QTransform& transform = q->state()->matrix; - if (mode == TextDrawingMode) { - // Text drawing mode is only used for non-scaling transforms - pmvMatrix[0][0] = 2.0 / width; - pmvMatrix[0][1] = 0.0; - pmvMatrix[0][2] = 0.0; - pmvMatrix[0][3] = 0.0; - pmvMatrix[1][0] = 0.0; - pmvMatrix[1][1] = -2.0 / height; - pmvMatrix[1][2] = 0.0; - pmvMatrix[1][3] = 0.0; - pmvMatrix[2][0] = 0.0; - pmvMatrix[2][1] = 0.0; - pmvMatrix[2][2] = -1.0; - pmvMatrix[2][3] = 0.0; - pmvMatrix[3][0] = pmvMatrix[0][0] * qRound(transform.dx()) - 1.0; - pmvMatrix[3][1] = pmvMatrix[1][1] * qRound(transform.dy()) + 1.0; - pmvMatrix[3][2] = 0.0; - pmvMatrix[3][3] = 1.0; - - inverseScale = 1; - } else { - qreal wfactor = 2.0 / width; - qreal hfactor = -2.0 / height; - - pmvMatrix[0][0] = wfactor * transform.m11() - transform.m13(); - pmvMatrix[0][1] = hfactor * transform.m12() + transform.m13(); - pmvMatrix[0][2] = 0.0; - pmvMatrix[0][3] = transform.m13(); - pmvMatrix[1][0] = wfactor * transform.m21() - transform.m23(); - pmvMatrix[1][1] = hfactor * transform.m22() + transform.m23(); - pmvMatrix[1][2] = 0.0; - pmvMatrix[1][3] = transform.m23(); - pmvMatrix[2][0] = 0.0; - pmvMatrix[2][1] = 0.0; - pmvMatrix[2][2] = -1.0; - pmvMatrix[2][3] = 0.0; - pmvMatrix[3][0] = wfactor * transform.dx() - transform.m33(); - pmvMatrix[3][1] = hfactor * transform.dy() + transform.m33(); - pmvMatrix[3][2] = 0.0; - pmvMatrix[3][3] = transform.m33(); - - // 1/10000 == 0.0001, so we have good enough res to cover curves - // that span the entire widget... - inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())), - qMax(qAbs(transform.m12()), qAbs(transform.m21())) ), - qreal(0.0001)); - } + qreal wfactor = 2.0 / width; + qreal hfactor = -2.0 / height; + + pmvMatrix[0][0] = wfactor * transform.m11() - transform.m13(); + pmvMatrix[0][1] = hfactor * transform.m12() + transform.m13(); + pmvMatrix[0][2] = 0.0; + pmvMatrix[0][3] = transform.m13(); + pmvMatrix[1][0] = wfactor * transform.m21() - transform.m23(); + pmvMatrix[1][1] = hfactor * transform.m22() + transform.m23(); + pmvMatrix[1][2] = 0.0; + pmvMatrix[1][3] = transform.m23(); + pmvMatrix[2][0] = 0.0; + pmvMatrix[2][1] = 0.0; + pmvMatrix[2][2] = -1.0; + pmvMatrix[2][3] = 0.0; + pmvMatrix[3][0] = wfactor * transform.dx() - transform.m33(); + pmvMatrix[3][1] = hfactor * transform.dy() + transform.m33(); + pmvMatrix[3][2] = 0.0; + pmvMatrix[3][3] = transform.m33(); + + // 1/10000 == 0.0001, so we have good enough res to cover curves + // that span the entire widget... + inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())), + qMax(qAbs(transform.m12()), qAbs(transform.m21())) ), + qreal(0.0001)); matrixDirty = false; @@ -817,17 +795,12 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) lastTexture = GLuint(-1); } - if (mode == TextDrawingMode) - matrixDirty = true; - if (newMode == TextDrawingMode) { glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR); glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); - - matrixDirty = true; } if (newMode == ImageDrawingMode) { @@ -930,7 +903,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) int floatSizeInBytes = vertexCount * 2 * sizeof(float); cache->vertexCount = vertexCount; cache->primitiveType = GL_TRIANGLE_FAN; - cache->iscale = inverseScale; + cache->iscale = inverseScale; #ifdef QT_OPENGL_CACHE_AS_VBOS glGenBuffers(1, &cache->vbo); glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); @@ -1545,21 +1518,21 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem const QTextItemInt &ti = static_cast(textItem); - bool drawCached = true; + QTransform::TransformationType txtype = s->matrix.type(); - if (s->matrix.type() > QTransform::TxTranslate) - drawCached = false; + float det = s->matrix.determinant(); + bool drawCached = txtype < QTransform::TxProject; - // don't try to cache huge fonts + // don't try to cache huge fonts or vastly transformed fonts const qreal pixelSize = ti.fontEngine->fontDef.pixelSize; - if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64) + if (pixelSize * pixelSize * qAbs(det) >= 64 * 64 || det < 0.25f || det > 4.f) drawCached = false; QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) : d->glyphCacheType; - if (d->inRenderText) + if (d->inRenderText || txtype > QTransform::TxTranslate) glyphType = QFontEngineGlyphCache::Raster_A8; if (glyphType == QFontEngineGlyphCache::Raster_RGBMask @@ -1589,10 +1562,10 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); QGLTextureGlyphCache *cache = - (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, s->matrix); + (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, QTransform()); if (!cache || cache->cacheType() != glyphType) { - cache = new QGLTextureGlyphCache(ctx, glyphType, s->matrix); + cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); ti.fontEngine->setGlyphCache(ctx, cache); } -- cgit v0.12 From 51297287f1be5c31337203cbf5a0e3eae6047a88 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 9 Dec 2009 08:46:37 +1000 Subject: Make sure a context is current when loading compressed textures. Reviewed-by: trustme --- src/opengl/qpixmapdata_gl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 0299cea..4e1d50d 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -424,6 +424,7 @@ bool QGLPixmapData::fromFile(const QString &filename, const char *format, resize(0, 0); data = file.readAll(); file.close(); + QGLShareContextScope ctx(qt_gl_share_widget()->context()); QSize size = m_texture.bindCompressedTexture (data.constData(), data.size(), format); if (!size.isEmpty()) { @@ -449,6 +450,7 @@ bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format, const char *buf = reinterpret_cast(buffer); if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) { resize(0, 0); + QGLShareContextScope ctx(qt_gl_share_widget()->context()); QSize size = m_texture.bindCompressedTexture(buf, int(len), format); if (!size.isEmpty()) { w = size.width(); -- cgit v0.12 From 62fac41edfff5e42e4c3308376cb08e5d9a10afe Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 9 Dec 2009 09:10:11 +1000 Subject: Fix upside down PVR compressed textures. The "vertical flip" flag in the PVR format is the inverse of the "inverted y" state that we use in Qt. Reviewed-by: trustme --- src/opengl/qgl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 967ba48..8003a29 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5363,11 +5363,12 @@ QSize QGLTexture::bindCompressedTexturePVR(const char *buf, int len) // Restore the default pixel alignment for later texture uploads. glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - // Set the invert flag for the texture. + // Set the invert flag for the texture. The "vertical flip" + // flag in PVR is the opposite sense to our sense of inversion. if ((pvrHeader->flags & PVR_VERTICAL_FLIP) != 0) - options |= QGLContext::InvertedYBindOption; - else options &= ~QGLContext::InvertedYBindOption; + else + options |= QGLContext::InvertedYBindOption; return QSize(pvrHeader->width, pvrHeader->height); } -- cgit v0.12 From f814791b18df3ba0828fefa9f40b2fc955185daf Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Wed, 9 Dec 2009 10:31:53 +1000 Subject: Add -audio-backend and -no-audio-backend configure option. Allow better control over audio backend used. Reviewed-by:Justin McPherson --- configure | 19 +++++++++++++++++-- configure.exe | Bin 1173504 -> 1176576 bytes src/multimedia/audio/audio.pri | 5 +++++ src/multimedia/audio/qaudiodevicefactory.cpp | 14 ++++++++++++++ tools/configure/configureapp.cpp | 11 +++++++++-- 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/configure b/configure index b6ce9e6..41f4991 100755 --- a/configure +++ b/configure @@ -672,6 +672,7 @@ CFG_RELEASE_QMAKE=no CFG_PHONON=auto CFG_PHONON_BACKEND=yes CFG_MULTIMEDIA=yes +CFG_AUDIO_BACKEND=yes CFG_SVG=yes CFG_DECLARATIVE=auto CFG_WEBKIT=auto # (yes|no|auto) @@ -914,7 +915,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -2078,6 +2079,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + audio-backend) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_AUDIO_BACKEND="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; *) UNKNOWN_OPT=yes ;; @@ -3255,7 +3263,7 @@ Usage: $relconf [-h] [-prefix ] [-prefix-install] [-bindir ] [-libdir [-qtnamespace ] [-qtlibinfix ] [-separate-debug-info] [-armfpa] [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns] [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] - [-no-openssl] [-openssl] [-openssl-linked] + [-no-audio-backend] [-audio-backend] [-no-openssl] [-openssl] [-openssl-linked] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit] [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative] @@ -3393,6 +3401,9 @@ fi -no-multimedia ..... Do not build the QtMultimedia module. + -multimedia ........ Build the QtMultimedia module. + -no-audio-backend .. Do not build the platform audio backend into QtMultimedia. + + -audio-backend ..... Build the platform audio backend into QtMultimedia if available. + -no-phonon ......... Do not build the Phonon module. + -phonon ............ Build the Phonon module. Phonon is built if a decent C++ compiler is used. @@ -6440,6 +6451,10 @@ else QT_CONFIG="$QT_CONFIG multimedia" fi +if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then + QT_CONFIG="$QT_CONFIG audio-backend" +fi + if [ "$CFG_SVG" = "yes" ]; then QT_CONFIG="$QT_CONFIG svg" else diff --git a/configure.exe b/configure.exe index 7fe4a93..a410efc 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index c445941..625b871c 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -17,6 +17,8 @@ SOURCES += $$PWD/qaudio.cpp \ $$PWD/qaudioengine.cpp \ $$PWD/qaudiodevicefactory.cpp +contains(QT_CONFIG, audio-backend) { + mac { HEADERS += $$PWD/qaudioinput_mac_p.h \ $$PWD/qaudiooutput_mac_p.h \ @@ -51,3 +53,6 @@ mac { } } } +} else { + DEFINES += QT_NO_AUDIO_BACKEND +} diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 89e4394..bc1656d 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -45,6 +45,7 @@ #include #include "qaudiodevicefactory_p.h" +#ifndef QT_NO_AUDIO_BACKEND #if defined(Q_OS_WIN) #include "qaudiodeviceinfo_win32_p.h" #include "qaudiooutput_win32_p.h" @@ -58,6 +59,7 @@ #include "qaudiooutput_alsa_p.h" #include "qaudioinput_alsa_p.h" #endif +#endif QT_BEGIN_NAMESPACE @@ -125,10 +127,12 @@ public: QList QAudioDeviceFactory::availableDevices(QAudio::Mode mode) { QList devices; +#ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode)) devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif +#endif QFactoryLoader* l = loader(); foreach (QString const& key, l->keys()) { @@ -153,9 +157,11 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); } +#ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); #endif +#endif return QAudioDeviceInfo(); } @@ -168,9 +174,11 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } +#ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); #endif +#endif return QAudioDeviceInfo(); } @@ -178,10 +186,12 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re { QAbstractAudioDeviceInfo *rc = 0; +#ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) if (realm == QLatin1String("builtin")) return new QAudioDeviceInfoInternal(handle, mode); #endif +#endif QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(realm)); @@ -205,10 +215,12 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con { if (deviceInfo.isNull()) return new QNullInputDevice(); +#ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) if (deviceInfo.realm() == QLatin1String("builtin")) return new QAudioInputPrivate(deviceInfo.handle(), format); #endif +#endif QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(deviceInfo.realm())); @@ -222,10 +234,12 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c { if (deviceInfo.isNull()) return new QNullOutputDevice(); +#ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) if (deviceInfo.realm() == QLatin1String("builtin")) return new QAudioOutputPrivate(deviceInfo.handle(), format); #endif +#endif QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(deviceInfo.realm())); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 735e030..9143ca7 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -247,6 +247,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "PHONON" ] = "auto"; dictionary[ "PHONON_BACKEND" ] = "yes"; dictionary[ "MULTIMEDIA" ] = "yes"; + dictionary[ "AUDIO_BACKEND" ] = "yes"; dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; dictionary[ "DECLARATIVE" ] = "auto"; @@ -897,6 +898,10 @@ void Configure::parseCmdLine() dictionary[ "MULTIMEDIA" ] = "no"; } else if( configCmdLine.at(i) == "-multimedia" ) { dictionary[ "MULTIMEDIA" ] = "yes"; + } else if( configCmdLine.at(i) == "-audio-backend" ) { + dictionary[ "AUDIO_BACKEND" ] = "yes"; + } else if( configCmdLine.at(i) == "-no-audio-backend" ) { + dictionary[ "AUDIO_BACKEND" ] = "no"; } else if( configCmdLine.at(i) == "-no-phonon" ) { dictionary[ "PHONON" ] = "no"; } else if( configCmdLine.at(i) == "-phonon" ) { @@ -1567,9 +1572,9 @@ bool Configure::displayHelp() "[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform ]\n" "[-qtnamespace ] [-qtlibinfix ] [-no-phonon]\n" "[-phonon] [-no-phonon-backend] [-phonon-backend]\n" - "[-no-multimedia] [-multimedia] [-no-webkit] [-webkit]\n" + "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n" "[-no-script] [-script] [-no-scripttools] [-scripttools]\n" - "[-graphicssystem raster|opengl|openvg]\n\n", 0, 7); + "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7); desc("Installation options:\n\n"); @@ -1749,6 +1754,8 @@ bool Configure::displayHelp() desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin"); desc("MULTIMEDIA", "no", "-no-multimedia", "Do not compile the multimedia module"); desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module"); + desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia"); + desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia"); desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module"); desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)"); desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module."); -- cgit v0.12 From ad2509f8d7c634364ae7082dcc83b6906d235750 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Wed, 9 Dec 2009 10:34:19 +1000 Subject: Fix up documentation examples for low-level audio. QTBUG-6548 QAudioOutput::start() crashes when the QIODevice is destructed Made documentation clearer. Task-number:QTBUG-6548 Reviewed-by:Justin McPherson --- src/multimedia/audio/qaudioinput.cpp | 15 +++++++++++++-- src/multimedia/audio/qaudiooutput.cpp | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 8b368d5..d81df7a 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -77,8 +77,12 @@ QT_BEGIN_NAMESPACE file, you can: \code + QFile outputFile; // class member. + QAudioInput* audio; // class member. + \endcode + + \code { - QFile outputFile; outputFile.setFileName("/tmp/test.raw"); outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate ); @@ -91,7 +95,13 @@ QT_BEGIN_NAMESPACE format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::UnSignedInt); - QAudioInput *audio = new QAudioInput(format, this); + if (QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice()); + if (!info.isFormatSupported(format)) { + qWarning()<<"default format not supported try to use nearest"; + format = info.nearestFormat(format); + } + + audio = new QAudioInput(format, this); QTimer::singleShot(3000, this, SLOT(stopRecording())); audio->start(outputFile); // Records audio for 3000ms @@ -109,6 +119,7 @@ QT_BEGIN_NAMESPACE { audio->stop(); outputFile->close(); + delete audio; } \endcode diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index f8f2fa1..1c7b617 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -73,7 +73,11 @@ QT_BEGIN_NAMESPACE simple as: \code - QFile inputFile; + QFile inputFile; // class member. + QAudioOutput* audio; // class member. + \endcode + + \code inputFile.setFileName("/tmp/test.raw"); inputFile.open(QIODevice::ReadOnly); @@ -86,7 +90,13 @@ QT_BEGIN_NAMESPACE format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::UnSignedInt); - QAudioOutput *audio = new QAudioOutput(format, this); + QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); + if (!info.isFormatSupported(format)) { + qWarning()<<"raw audio format not supported by backend, cannot play audio."; + return; + } + + audio = new QAudioOutput(format, this); connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State))); audio->start(inputFile); @@ -104,6 +114,7 @@ QT_BEGIN_NAMESPACE if(state == QAudio::IdleState) { audio->stop(); inputFile.close(); + delete audio; } } \endcode -- cgit v0.12 From f59908d4a6edcd333a156d4c94ddbd9b30f7e810 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 9 Dec 2009 11:06:30 +1000 Subject: Export QGLShareRegister because qgl_share_reg() is exported Reviewed-by: trustme --- src/opengl/qgl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 179d69a..615fb60 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -397,7 +397,7 @@ public: Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions) -class Q_AUTOTEST_EXPORT QGLShareRegister +class Q_OPENGL_EXPORT QGLShareRegister { public: QGLShareRegister() {} -- cgit v0.12 From 472c13edc85a6c7efef1e3b904333d0c9a5f9da6 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 3 Dec 2009 08:55:20 -0800 Subject: Set stacking class for stays-on-top windows in DFB For better compatibility with non-QWS DirectFB apps running in the same session we should set the stacking class of Windows that have the StaysOnTop flag set. This corresponds nicely to DWSC_UPPER. Reviewed-by: Jervey Kong --- src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 021d52e..b79418a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -128,7 +128,6 @@ IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const return (dfbWindow ? dfbWindow : (sibling ? sibling->dfbWindow : 0)); } - void QDirectFBWindowSurface::createWindow(const QRect &rect) { IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); @@ -169,6 +168,9 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect) DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result); if (window()) { + if (window()->windowFlags() & Qt::WindowStaysOnTopHint) { + dfbWindow->SetStackingClass(dfbWindow, DWSC_UPPER); + } DFBWindowID winid; result = dfbWindow->GetID(dfbWindow, &winid); if (result != DFB_OK) { -- cgit v0.12 From 941c6637a83f765c028f40973bb7bcca0ecbafb5 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 8 Dec 2009 08:19:58 -0800 Subject: Enable customizing of DirectFB layer to use This patch enables you to use a different layer for Qt apps by specifying: E.g. QWS_DISPLAY=directfb:layerid=2 Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 4cb0184..d3fe183 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1259,11 +1259,14 @@ bool QDirectFBScreen::connect(const QString &displaySpec) setIntOption(displayArgs, QLatin1String("height"), &h); #ifndef QT_NO_DIRECTFB_LAYER - result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY, + int layerId = DLID_PRIMARY; + setIntOption(displayArgs, QLatin1String("layerid"), &layerId); + + result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, static_cast(layerId), &d_ptr->dfbLayer); if (result != DFB_OK) { DirectFBError("QDirectFBScreen::connect: " - "Unable to get primary display layer!", result); + "Unable to get display layer!", result); return false; } result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen); -- cgit v0.12 From 9c32e6f919704a50fbb5f46541b16fb712c24c4c Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 1 Dec 2009 12:09:24 -0800 Subject: Clean up debug message with DirectFB Remove some superfluous spaces. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index d3fe183..4744eb6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -958,47 +958,47 @@ struct FlagDescription { }; static const FlagDescription accelerationDescriptions[] = { - { " DFXL_NONE ", DFXL_NONE }, - { " DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE }, - { " DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE }, - { " DFXL_DRAWLINE", DFXL_DRAWLINE }, - { " DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE }, - { " DFXL_BLIT", DFXL_BLIT }, - { " DFXL_STRETCHBLIT", DFXL_STRETCHBLIT }, - { " DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES }, - { " DFXL_DRAWSTRING", DFXL_DRAWSTRING }, + { "DFXL_NONE", DFXL_NONE }, + { "DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE }, + { "DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE }, + { "DFXL_DRAWLINE", DFXL_DRAWLINE }, + { "DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE }, + { "DFXL_BLIT", DFXL_BLIT }, + { "DFXL_STRETCHBLIT", DFXL_STRETCHBLIT }, + { "DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES }, + { "DFXL_DRAWSTRING", DFXL_DRAWSTRING }, { 0, 0 } }; static const FlagDescription blitDescriptions[] = { - { " DSBLIT_NOFX", DSBLIT_NOFX }, - { " DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL }, - { " DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA }, - { " DSBLIT_COLORIZE", DSBLIT_COLORIZE }, - { " DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY }, - { " DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY }, - { " DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY }, - { " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY }, - { " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY }, - { " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE }, + { "DSBLIT_NOFX", DSBLIT_NOFX }, + { "DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL }, + { "DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA }, + { "DSBLIT_COLORIZE", DSBLIT_COLORIZE }, + { "DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY }, + { "DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY }, + { "DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY }, + { "DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY }, + { "DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY }, + { "DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE }, #if (Q_DIRECTFB_VERSION >= 0x000923) - { " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR }, - { " DSBLIT_XOR", DSBLIT_XOR }, + { "DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR }, + { "DSBLIT_XOR", DSBLIT_XOR }, #endif #if (Q_DIRECTFB_VERSION >= 0x010000) - { " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION }, + { "DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION }, #endif { 0, 0 } }; static const FlagDescription drawDescriptions[] = { - { " DSDRAW_NOFX", DSDRAW_NOFX }, - { " DSDRAW_BLEND", DSDRAW_BLEND }, - { " DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY }, - { " DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY }, - { " DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY }, - { " DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY }, - { " DSDRAW_XOR", DSDRAW_XOR }, + { "DSDRAW_NOFX", DSDRAW_NOFX }, + { "DSDRAW_BLEND", DSDRAW_BLEND }, + { "DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY }, + { "DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY }, + { "DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY }, + { "DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY }, + { "DSDRAW_XOR", DSDRAW_XOR }, { 0, 0 } }; #endif -- cgit v0.12 From d5d39f04c2c473401e9147d57d5a7c62f6111656 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 8 Dec 2009 12:15:19 +0100 Subject: Fix regression in qVariantFromValue when converting from complex type to simple type QVariant v = QColor(Qt::red); v.setValue(1000); Would produce a variant with garbage. the destructor of QColor would not be called, and the 1000 would be in the QVariant::PrivateShared, while most of the QVariant code assume that numbers are dirrectly in the QVariant::Data union Task-number: QTBUG-6602 Reviewed-by: Thierry --- src/corelib/kernel/qvariant.h | 2 +- tests/auto/qvariant/tst_qvariant.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 3c10788..74ff17f 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -458,7 +458,7 @@ inline void qVariantSetValue(QVariant &v, const T &t) //if possible we reuse the current QVariant private const uint type = qMetaTypeId(reinterpret_cast(0)); QVariant::Private &d = v.data_ptr(); - if (v.isDetached() && (type <= uint(QVariant::Char) || type == d.type)) { + if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) { d.type = type; d.is_null = false; T *old = reinterpret_cast(d.is_shared ? d.data.shared->ptr : &d.data.ptr); diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 3d68a73..ae0131c 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -272,6 +272,8 @@ private slots: void numericalConvert(); void moreCustomTypes(); void variantInVariant(); + + void colorInteger(); }; Q_DECLARE_METATYPE(QDate) @@ -3388,5 +3390,20 @@ void tst_QVariant::variantInVariant() QCOMPARE(qvariant_cast(var9), var1); } +void tst_QVariant::colorInteger() +{ + QVariant v = QColor(Qt::red); + QCOMPARE(v.type(), QVariant::Color); + QCOMPARE(v.value(), QColor(Qt::red)); + + v.setValue(1000); + QCOMPARE(v.type(), QVariant::Int); + QCOMPARE(v.toInt(), 1000); + + v.setValue(QColor(Qt::yellow)); + QCOMPARE(v.type(), QVariant::Color); + QCOMPARE(v.value(), QColor(Qt::yellow)); +} + QTEST_MAIN(tst_QVariant) #include "tst_qvariant.moc" -- cgit v0.12 From 934d4b9852060b2870f6774cd854331422147d3e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 8 Dec 2009 10:50:01 +0100 Subject: Use 64bit for the connectedSignals as QML objects may have lots of signals Do not use quint64 as it would produce lots of useless padding on MSVC 32bit Reviewed-by: Brad --- src/corelib/kernel/qobject.cpp | 6 +++--- src/corelib/kernel/qobject_p.h | 11 ++++++----- tests/auto/qobject/tst_qobject.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 30cd011..85915c2 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -145,7 +145,7 @@ QObjectPrivate::QObjectPrivate(int version) receiveChildEvents = true; postedEvents = 0; extraData = 0; - connectedSignals = 0; + connectedSignals[0] = connectedSignals[1] = 0; inEventHandler = false; inThreadChangeEvent = false; deleteWatch = 0; @@ -2924,9 +2924,9 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, QObjectPrivate *const sender_d = QObjectPrivate::get(s); if (signal_index < 0) { - sender_d->connectedSignals = ~ulong(0); + sender_d->connectedSignals[0] = sender_d->connectedSignals[1] = ~0; } else if (signal_index < (int)sizeof(sender_d->connectedSignals) * 8) { - sender_d->connectedSignals |= ulong(1) << signal_index; + sender_d->connectedSignals[signal_index >> 5] |= (1 << (signal_index & 0x1f)); } return true; diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index f899c78..d1841be 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -172,7 +172,7 @@ public: } int signalIndex(const char *signalName) const; - inline bool isSignalConnected(int signalIdx) const; + inline bool isSignalConnected(uint signalIdx) const; public: QString objectName; @@ -183,7 +183,7 @@ public: Connection *senders; // linked list of connections connected to this object Sender *currentSender; // object currently activating the object - mutable ulong connectedSignals; + mutable quint32 connectedSignals[2]; #ifdef QT3_SUPPORT QList pendingChildInsertedEvents; @@ -205,6 +205,7 @@ public: int *deleteWatch; }; + /*! \internal Returns true if the signal with index \a signal_index from object \a sender is connected. @@ -213,12 +214,12 @@ public: \a signal_index must be the index returned by QObjectPrivate::signalIndex; */ -inline bool QObjectPrivate::isSignalConnected(int signal_index) const +inline bool QObjectPrivate::isSignalConnected(uint signal_index) const { - return signal_index >= (int)sizeof(connectedSignals) * 8 + return signal_index >= sizeof(connectedSignals) * 8 || qt_signal_spy_callback_set.signal_begin_callback || qt_signal_spy_callback_set.signal_end_callback - || (connectedSignals & (ulong(1) << signal_index)); + || (connectedSignals[signal_index >> 5] & (1 << (signal_index & 0x1f))); } diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 67a9c46..a2524aa 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -3058,10 +3058,8 @@ void tst_QObject::isSignalConnected() QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig05()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig15()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig29()"))); - if (sizeof(void *) >= 8) { //on 32bit isSignalConnected only works with the first 32 signals - QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()"))); - QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()"))); - } + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()"))); #endif QObject::connect(&o, SIGNAL(sig00()), &o, SIGNAL(sig69())); @@ -3115,6 +3113,8 @@ void tst_QObject::isSignalConnected() QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig04()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig21()"))); QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig25()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig55()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()"))); #endif emit o.sig00(); -- cgit v0.12 From a405437ca9294bf4f0f974739bd1130e165491b8 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 9 Dec 2009 13:46:00 +0200 Subject: Access to image needs to be protected in QS60PixmapData The image can get corrupted if access to it is not properly surrounded with beginDataAccess and endDataAccess calls. Task-number: QTBUG-6050 Reviewed-by: Jani Hautakangas --- src/gui/image/qpixmap_s60.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index dc33ade..610317d 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -820,7 +820,9 @@ void* QS60PixmapData::toNativeType(NativeType type) if(displayMode == EGray2) { //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid //So invert mono bitmaps so that masks work correctly. + beginDataAccess(); image.invertPixels(); + endDataAccess(); needsCopy = true; } @@ -828,7 +830,9 @@ void* QS60PixmapData::toNativeType(NativeType type) QImage source; if (convertToArgb32) { + beginDataAccess(); source = image.convertToFormat(QImage::Format_ARGB32); + endDataAccess(); displayMode = EColor16MA; } else { source = image; @@ -858,7 +862,9 @@ void* QS60PixmapData::toNativeType(NativeType type) if(displayMode == EGray2) { // restore pixels + beginDataAccess(); image.invertPixels(); + endDataAccess(); } return reinterpret_cast(bitmap); -- cgit v0.12 From 6744e241ee41a50b02a76e3e755ec448676589a4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 9 Dec 2009 13:21:23 +0100 Subject: Compile with QT_NO_DEPRECATED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uses of QT_DEPRECATED must be protected by #ifdef Task-number: QTBUG-6649 Reviewed-by: João Abecasis --- src/corelib/tools/qregexp.h | 2 ++ src/gui/embedded/qscreen_qws.h | 2 ++ src/gui/image/qimage.h | 6 ++++++ src/gui/image/qpixmap.h | 2 ++ src/gui/painting/qmatrix.h | 2 ++ src/gui/painting/qpaintdevice.h | 2 ++ src/gui/painting/qregion.h | 2 ++ src/gui/widgets/qlcdnumber.h | 3 ++- src/gui/widgets/qprintpreviewwidget.h | 2 ++ tools/assistant/lib/qhelpsearchengine.h | 2 ++ 10 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h index 2bad40e..8a46b98 100644 --- a/src/corelib/tools/qregexp.h +++ b/src/corelib/tools/qregexp.h @@ -119,7 +119,9 @@ public: #endif int matchedLength() const; #ifndef QT_NO_REGEXP_CAPTURE +#ifdef QT_DEPRECATED QT_DEPRECATED int numCaptures() const; +#endif int captureCount() const; QStringList capturedTexts() const; QStringList capturedTexts(); diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h index b3246f9..7ab49fb 100644 --- a/src/gui/embedded/qscreen_qws.h +++ b/src/gui/embedded/qscreen_qws.h @@ -243,7 +243,9 @@ public: int totalSize() const { return mapsize; } QRgb * clut() { return screenclut; } +#ifdef QT_DEPRECATED QT_DEPRECATED int numCols() { return screencols; } +#endif int colorCount() { return screencols; } virtual QSize mapToDevice(const QSize &) const; diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index d8809ef..ce7f450 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -165,12 +165,16 @@ public: QRect rect() const; int depth() const; +#ifdef QT_DEPRECATED QT_DEPRECATED int numColors() const; +#endif int colorCount() const; QRgb color(int i) const; void setColor(int i, QRgb c); +#ifdef QT_DEPRECATED QT_DEPRECATED void setNumColors(int); +#endif void setColorCount(int); bool allGray() const; @@ -178,7 +182,9 @@ public: uchar *bits(); const uchar *bits() const; +#ifdef QT_DEPRECATED QT_DEPRECATED int numBytes() const; +#endif int byteCount() const; uchar *scanLine(int); diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index d95b4ee..e02b0d6 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -185,7 +185,9 @@ public: const uchar *qwsBits() const; int qwsBytesPerLine() const; QRgb *clut() const; +#ifdef QT_DEPRECATED QT_DEPRECATED int numCols() const; +#endif int colorCount() const; #elif defined(Q_WS_MAC) Qt::HANDLE macQDHandle() const; diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 152b3c9..af48bcb 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -102,7 +102,9 @@ public: bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); } qreal determinant() const { return _m11*_m22 - _m12*_m21; } +#ifdef QT_DEPRECATED QT_DEPRECATED qreal det() const { return _m11*_m22 - _m12*_m21; } +#endif QMatrix inverted(bool *invertible = 0) const; diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index 9148e4b..0f8191e 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -96,7 +96,9 @@ public: int logicalDpiY() const { return metric(PdmDpiY); } int physicalDpiX() const { return metric(PdmPhysicalDpiX); } int physicalDpiY() const { return metric(PdmPhysicalDpiY); } +#ifdef QT_DEPRECATED QT_DEPRECATED int numColors() const { return metric(PdmNumColors); } +#endif int colorCount() const { return metric(PdmNumColors); } int depth() const { return metric(PdmDepth); } diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 2a1be86..f99fbf6 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -116,7 +116,9 @@ public: QRect boundingRect() const; QVector rects() const; void setRects(const QRect *rect, int num); +#ifdef QT_DEPRECATED QT_DEPRECATED int numRects() const; +#endif int rectCount() const; const QRegion operator|(const QRegion &r) const; diff --git a/src/gui/widgets/qlcdnumber.h b/src/gui/widgets/qlcdnumber.h index e65637d..b7162cd 100644 --- a/src/gui/widgets/qlcdnumber.h +++ b/src/gui/widgets/qlcdnumber.h @@ -82,9 +82,10 @@ public: }; bool smallDecimalPoint() const; - +#ifdef QT_DEPRECATED QT_DEPRECATED int numDigits() const; QT_DEPRECATED void setNumDigits(int nDigits); +#endif int digitCount() const; void setDigitCount(int nDigits); diff --git a/src/gui/widgets/qprintpreviewwidget.h b/src/gui/widgets/qprintpreviewwidget.h index 08e596d..d8504de 100644 --- a/src/gui/widgets/qprintpreviewwidget.h +++ b/src/gui/widgets/qprintpreviewwidget.h @@ -82,7 +82,9 @@ public: ViewMode viewMode() const; ZoomMode zoomMode() const; int currentPage() const; +#ifdef QT_DEPRECATED QT_DEPRECATED int numPages() const; +#endif int pageCount() const; void setVisible(bool visible); diff --git a/tools/assistant/lib/qhelpsearchengine.h b/tools/assistant/lib/qhelpsearchengine.h index 21f04c5..632ac0b 100644 --- a/tools/assistant/lib/qhelpsearchengine.h +++ b/tools/assistant/lib/qhelpsearchengine.h @@ -86,7 +86,9 @@ public: QHelpSearchQueryWidget* queryWidget(); QHelpSearchResultWidget* resultWidget(); +#ifdef QT_DEPRECATED QT_DEPRECATED int hitsCount() const; +#endif int hitCount() const; typedef QPair SearchHit; -- cgit v0.12 From ae8a4cfa053b6976933e0d65586ef561d9a209da Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 9 Dec 2009 14:51:42 +0200 Subject: Missing library added to QStringList benchmark for Symbian builds QStringList benchmark uses some std classes which indirectly need pthread library. Task-number: QTBUG-6594 Reviewed-by: Janne Anttila --- tests/benchmarks/qstringlist/qstringlist.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/benchmarks/qstringlist/qstringlist.pro b/tests/benchmarks/qstringlist/qstringlist.pro index f9ebd59..11cceb0 100644 --- a/tests/benchmarks/qstringlist/qstringlist.pro +++ b/tests/benchmarks/qstringlist/qstringlist.pro @@ -2,3 +2,5 @@ load(qttest_p4) TARGET = tst_qstringlist QT -= gui SOURCES += main.cpp + +symbian: LIBS += -llibpthread -- cgit v0.12 From c4d66e27ea69b84bf280209fc72239132924930d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 9 Dec 2009 12:14:58 +0100 Subject: GLES 2 should *not* use a multisampled format by default. This is a platform regression and should never have been there in the first place. Having this as the default format on embedded devices may drop the framerates with as much as 30% on selected HW. Reviewed-by: Tom Cooksey --- src/opengl/qgl.cpp | 3 +-- src/opengl/qgl_p.h | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 25285b5..dcf8c00 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -397,8 +397,7 @@ static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz, \i \link setDirectRendering() Direct rendering:\endlink Enabled. \i \link setOverlay() Overlay:\endlink Disabled. \i \link setPlane() Plane:\endlink 0 (i.e., normal plane). - \i \link setSampleBuffers() Multisample buffers:\endlink Enabled on - OpenGL/ES 2.0, disabled on other platforms. + \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. \endlist */ diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 615fb60..8a0b31f 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -133,9 +133,6 @@ public: : ref(1) { opts = QGL::DoubleBuffer | QGL::DepthBuffer | QGL::Rgba | QGL::DirectRendering | QGL::StencilBuffer; -#if defined(QT_OPENGL_ES_2) - opts |= QGL::SampleBuffers; -#endif pln = 0; depthSize = accumSize = stencilSize = redSize = greenSize = blueSize = alphaSize = -1; numSamples = -1; -- cgit v0.12 From 7fecd890ce50d86120566acc7e71fcac915a671f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 9 Dec 2009 14:19:33 +0100 Subject: Fixed a regression in dock widget resizing It could happen that they grow much more than the movement of the mouse Task-number: QTBUG-6499 Reviewed-by: gabi --- src/gui/widgets/qdockarealayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 0a26a77..cf82da0 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1303,9 +1303,9 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList &path) index = -index - 1; if (index >= item_list.count()) return this; - if (path.count() == 1 || item_list.at(index).subinfo == 0) + if (path.count() == 1 || item_list[index].subinfo == 0) return this; - return item_list.at(index).subinfo->info(path.mid(1)); + return item_list[index].subinfo->info(path.mid(1)); } QRect QDockAreaLayoutInfo::itemRect(int index) const -- cgit v0.12 From 9f3cde38bffb79da82d6248a873a687d37177954 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 9 Dec 2009 14:49:15 +0100 Subject: Don't assert on valid math in qbezier --- src/gui/painting/qbezier_p.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h index 7dbd0c2..c284871 100644 --- a/src/gui/painting/qbezier_p.h +++ b/src/gui/painting/qbezier_p.h @@ -166,8 +166,6 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal & inline QPointF QBezier::pointAt(qreal t) const { - Q_ASSERT(t >= 0); - Q_ASSERT(t <= 1); #if 1 qreal a, b, c, d; coefficients(t, a, b, c, d); -- cgit v0.12 From be927c3978347f95b7eeba53fb6750dbf7e188ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 9 Dec 2009 15:49:47 +0200 Subject: QS60Style: Do not let QCommonStyle draw PE_PanelScrollAreaCorner If QS60Style lets QCommonStyle to draw PE_PanelScrollAreaCorner, common style draws transparent small rect to the end of scrollbar. This is due to our style's palette's Base is Qt::Transparent. Error is only visible when two dialogs/windows are on top of each other and their background is such that a hole in the upper dialog's background will make the hole "visible" (i.e. background is not similar). As a fix, QS60Style should not let QCommonStyle draw the primitive, but instead handle itself (and do nothing with it). Task-number: QTBUG-6657 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 93b517f..98f4aaf 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2238,11 +2238,13 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } break; + case PE_PanelScrollAreaCorner: + break; + // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: case PE_IndicatorDockWidgetResizeHandle: case PE_PanelTipLabel: - case PE_PanelScrollAreaCorner: #ifndef QT_NO_TABBAR case PE_IndicatorTabTear: // No tab tear in S60 -- cgit v0.12 From 4d9ef7c20bedd715f3d8d7c644942d688716f785 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 9 Dec 2009 14:11:30 +0100 Subject: Rewrote most of the regular pointer handling. The old implementation had been hacked on for a while and needed cleanup. The new code is heavily based on looking at the behavior of other platforms. It also reuses more of the cross platform code, which improves the handling of Enter and Leave events. We also switched to letting Symbian grab the pointer automatically when pressing down the mouse button, which improves things considerably compared to doing it ourselves. Popups should also work a lot better after this fix, since they were not really handled at all in the old code. The old code had calls to set the Symbian cursor sprite. This code has been removed since that code is now being called from within dispatchEnterLeaveEvents(). In addition, there was code to check whether the up key event had been left out by the platform. This was solved a bit differently now, instead putting the code in the section that handles virtual mouse, since that is where the problem occurs. Task: QTBUG-4990 RevBy: Shane Kearns AutoTest: N/A, Platform specific code that an autotest cannot catch. Lots of manual testing was done on normal examples as well drag'n'drop examples and it seemed to work fine. --- src/gui/kernel/qapplication_s60.cpp | 170 +++++++++++++++++------------------- src/gui/kernel/qt_s60_p.h | 14 +++ 2 files changed, 94 insertions(+), 90 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index ab57c32..27f2644 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -361,6 +361,8 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) SetFocusing(true); m_longTapDetector = QLongTapTimer::NewL(this); + + DrawableWindow()->SetPointerGrab(ETrue); } } @@ -472,41 +474,6 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent)); } -typedef QPair Event; - -/* - * Helper function called by HandlePointerEvent - separated to keep that function readable - */ -static void generateEnterLeaveEvents(QList &events, QWidget *widgetUnderPointer, - QPoint globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) -{ - //moved to another widget, create enter and leave events - if (S60->lastPointerEventTarget) { - QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal( - S60->lastCursorPos), S60->lastCursorPos, button, QApplicationPrivate::mouse_buttons, - modifiers); - events.append(Event(S60->lastPointerEventTarget, mEventLeave)); - } - if (widgetUnderPointer) { - QMouseEvent mEventEnter(QEvent::Enter, widgetUnderPointer->mapFromGlobal(globalPos), - globalPos, button, QApplicationPrivate::mouse_buttons, modifiers); - - events.append(Event(widgetUnderPointer, mEventEnter)); -#ifndef QT_NO_CURSOR - S60->curWin = widgetUnderPointer->effectiveWinId(); - if (!QApplication::overrideCursor()) { -#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS - if (S60->brokenPointerCursors) - qt_symbian_set_pointer_sprite(widgetUnderPointer->cursor()); - else -#endif - qt_symbian_setWindowCursor(widgetUnderPointer->cursor(), S60->curWin); - } -#endif - } -} - - void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) { QMouseEvent::Type type; @@ -514,85 +481,77 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) mapS60MouseEventTypeToQt(&type, &button, &pEvent); Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); - if (type == QMouseEvent::None) - return; - - // store events for later sending/saving - QList events; - QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY); TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; + S60->lastCursorPos = globalPos; + S60->lastPointerEventPos = widgetPos; - // widgets interested in the event - QWidget *widgetUnderPointer = qwidget->childAt(widgetPos); - if (!widgetUnderPointer) - widgetUnderPointer = qwidget; //i.e. this container widget + QWidget *mouseGrabber = QWidget::mouseGrabber(); - QWidget *widgetWithMouseGrab = QWidget::mouseGrabber(); + QWidget *popupWidget = qApp->activePopupWidget(); + QWidget *popupReceiver = 0; + if (popupWidget) { + QWidget *popupChild = popupWidget->childAt(popupWidget->mapFromGlobal(globalPos)); + popupReceiver = popupChild ? popupChild : popupWidget; + } - // handle auto grab of pointer when pressing / releasing - if (!widgetWithMouseGrab && type == QEvent::MouseButtonPress) { - //if previously auto-grabbed, generate a fake mouse release (platform bug: mouse release event was lost) - if (S60->mousePressTarget) { - QMouseEvent mEvent(QEvent::MouseButtonRelease, S60->mousePressTarget->mapFromGlobal(globalPos), globalPos, - button, QApplicationPrivate::mouse_buttons, modifiers); - events.append(Event(S60->mousePressTarget,mEvent)); + if (mouseGrabber) { + if (popupReceiver) { + sendMouseEvent(popupReceiver, type, globalPos, button, modifiers); + } else { + sendMouseEvent(mouseGrabber, type, globalPos, button, modifiers); } - //auto grab the mouse - widgetWithMouseGrab = S60->mousePressTarget = widgetUnderPointer; - widgetWithMouseGrab->grabMouse(); - } - if (widgetWithMouseGrab && widgetWithMouseGrab == S60->mousePressTarget && type == QEvent::MouseButtonRelease) { - //release the auto grab - note this release event still goes to the autograb widget - S60->mousePressTarget = 0; - widgetWithMouseGrab->releaseMouse(); + // No Enter/Leave events in grabbing mode. + return; } - QWidget *widgetToReceiveMouseEvent; - if (widgetWithMouseGrab) - widgetToReceiveMouseEvent = widgetWithMouseGrab; - else - widgetToReceiveMouseEvent = widgetUnderPointer; - - //queue QEvent::Enter and QEvent::Leave, if the pointer has moved - if (widgetUnderPointer != S60->lastPointerEventTarget && (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove)) - generateEnterLeaveEvents(events, widgetUnderPointer, globalPos, button, modifiers); + QWidget *widgetUnderPointer = qwidget->childAt(widgetPos); + if (!widgetUnderPointer) + widgetUnderPointer = qwidget; - //save global state - S60->lastCursorPos = globalPos; - S60->lastPointerEventPos = widgetPos; + QApplicationPrivate::dispatchEnterLeave(widgetUnderPointer, S60->lastPointerEventTarget); S60->lastPointerEventTarget = widgetUnderPointer; + QWidget *receiver; + if (!popupReceiver && S60->mousePressTarget && type != QEvent::MouseButtonPress) { + receiver = S60->mousePressTarget; + if (type == QEvent::MouseButtonRelease) + S60->mousePressTarget = 0; + } else { + receiver = popupReceiver ? popupReceiver : widgetUnderPointer; + if (type == QEvent::MouseButtonPress) + S60->mousePressTarget = receiver; + } + #if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS) if (S60->brokenPointerCursors) qt_symbian_move_cursor_sprite(); #endif - //queue this event. - Q_ASSERT(widgetToReceiveMouseEvent); - QMouseEvent mEvent(type, widgetToReceiveMouseEvent->mapFromGlobal(globalPos), globalPos, + sendMouseEvent(receiver, type, globalPos, button, modifiers); +} + +void QSymbianControl::sendMouseEvent( + QWidget *receiver, + QEvent::Type type, + const QPoint &globalPos, + Qt::MouseButton button, + Qt::KeyboardModifiers modifiers) +{ + Q_ASSERT(receiver); + QMouseEvent mEvent(type, receiver->mapFromGlobal(globalPos), globalPos, button, QApplicationPrivate::mouse_buttons, modifiers); - events.append(Event(widgetToReceiveMouseEvent,mEvent)); QEventDispatcherS60 *dispatcher; // It is theoretically possible for someone to install a different event dispatcher. - if ((dispatcher = qobject_cast(widgetToReceiveMouseEvent->d_func()->threadData->eventDispatcher)) != 0) { + if ((dispatcher = qobject_cast(receiver->d_func()->threadData->eventDispatcher)) != 0) { if (dispatcher->excludeUserInputEvents()) { - for (int i=0;i < events.count();++i) - { - Event next = events[i]; - dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second)); - } + dispatcher->saveInputEvent(this, receiver, new QMouseEvent(mEvent)); return; } } - //send events in the queue - for (int i=0;i < events.count();++i) - { - Event next = events[i]; - sendMouseEvent(next.first, &(next.second)); - } + sendMouseEvent(receiver, &mEvent); } bool QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent) @@ -672,27 +631,58 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod fakeEvent.iType = TPointerEvent::EButton1Up; S60->virtualMouseAccel = 1; S60->virtualMouseLastKey = 0; + switch (keyCode) { + case Qt::Key_Left: + S60->virtualMousePressedKeys &= ~QS60Data::Left; + break; + case Qt::Key_Right: + S60->virtualMousePressedKeys &= ~QS60Data::Right; + break; + case Qt::Key_Up: + S60->virtualMousePressedKeys &= ~QS60Data::Up; + break; + case Qt::Key_Down: + S60->virtualMousePressedKeys &= ~QS60Data::Down; + break; + case Qt::Key_Select: + S60->virtualMousePressedKeys &= ~QS60Data::Select; + break; + } } else if (type == EEventKey) { switch (keyCode) { case Qt::Key_Left: + S60->virtualMousePressedKeys |= QS60Data::Left; x -= S60->virtualMouseAccel; fakeEvent.iType = TPointerEvent::EMove; break; case Qt::Key_Right: + S60->virtualMousePressedKeys |= QS60Data::Right; x += S60->virtualMouseAccel; fakeEvent.iType = TPointerEvent::EMove; break; case Qt::Key_Up: + S60->virtualMousePressedKeys |= QS60Data::Up; y -= S60->virtualMouseAccel; fakeEvent.iType = TPointerEvent::EMove; break; case Qt::Key_Down: + S60->virtualMousePressedKeys |= QS60Data::Down; y += S60->virtualMouseAccel; fakeEvent.iType = TPointerEvent::EMove; break; case Qt::Key_Select: - fakeEvent.iType = TPointerEvent::EButton1Down; + // Platform bug. If you start pressing several keys simultaneously (for + // example for drag'n'drop), Symbian starts producing spurious up and + // down messages for some keys. Therefore, make sure we have a clean slate + // of pressed keys before starting a new button press. + if (S60->virtualMousePressedKeys != 0) { + S60->virtualMousePressedKeys |= QS60Data::Select; + return EKeyWasConsumed; + } else { + S60->virtualMousePressedKeys |= QS60Data::Select; + fakeEvent.iType = TPointerEvent::EButton1Down; + } break; } } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 08f8bb5..737e9d7 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -103,6 +103,14 @@ public: int defaultDpiY; WId curWin; int virtualMouseLastKey; + enum PressedKeys { + Select = 0x1, + Right = 0x2, + Down = 0x4, + Left = 0x8, + Up = 0x10 + }; + int virtualMousePressedKeys; // of the above type, but avoids casting problems int virtualMouseAccel; int virtualMouseMaxAccel; #ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS @@ -192,6 +200,12 @@ private: TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType); TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent); bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent); + void sendMouseEvent( + QWidget *receiver, + QEvent::Type type, + const QPoint &globalPos, + Qt::MouseButton button, + Qt::KeyboardModifiers modifiers); void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ); #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); -- cgit v0.12 From 0c30418556d978f730c33aa3bb066961981ccc9b Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 9 Dec 2009 15:15:35 +0100 Subject: Fix crash when rotating cleartype text under gl engine. Reviewed-by: Eskil --- src/gui/painting/qtextureglyphcache_p.h | 5 +---- src/gui/text/qfontengine.cpp | 10 ++++++---- src/gui/text/qfontengine_p.h | 4 ++-- src/gui/text/qfontengineglyphcache_p.h | 7 +++++-- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 57473d1..bb0c630 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -76,7 +76,7 @@ class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache { public: QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix) - : QFontEngineGlyphCache(matrix), m_w(0), m_h(0), m_cx(0), m_cy(0), m_type(type) { } + : QFontEngineGlyphCache(matrix, type), m_w(0), m_h(0), m_cx(0), m_cy(0) { } virtual ~QTextureGlyphCache() { } @@ -98,8 +98,6 @@ public: virtual void resizeTextureData(int width, int height) = 0; virtual int glyphMargin() const { return 0; } - QFontEngineGlyphCache::Type cacheType() const { return m_type; } - virtual void fillTexture(const Coord &coord, glyph_t glyph) = 0; inline void createCache(int width, int height) { @@ -121,7 +119,6 @@ protected: int m_h; // image height int m_cx; // current x int m_cy; // current y - QFontEngineGlyphCache::Type m_type; }; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 27fc3c1..0eadf04 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -742,14 +742,15 @@ void QFontEngine::expireGlyphCache() } } -void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data) +void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data, QFontEngineGlyphCache::Type type) { Q_ASSERT(data); QList items = m_glyphPointerHash.value(key); for (QList::iterator it = items.begin(), end = items.end(); it != end; ++it) { QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) { + if (qtransform_equals_no_translate(c->m_transform, data->m_transform) + && c->cacheType() == type) { if (c == data) return; items.removeAll(c); @@ -786,13 +787,14 @@ void QFontEngine::setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyp expireGlyphCache(); } -QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform) const +QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform, QFontEngineGlyphCache::Type type) const { QList items = m_glyphPointerHash.value(key); for (QList::iterator it = items.begin(), end = items.end(); it != end; ++it) { QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, transform)) { + if (qtransform_equals_no_translate(c->m_transform, transform) + && type == c->cacheType()) { m_glyphCacheQueue.removeAll(c); // last used, move it up m_glyphCacheQueue.append(c); return c; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 728c344..62bff85 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -218,9 +218,9 @@ public: virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); - void setGlyphCache(void *key, QFontEngineGlyphCache *data); + void setGlyphCache(void *key, QFontEngineGlyphCache *data, QFontEngineGlyphCache::Type type); void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data); - QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const; + QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform, QFontEngineGlyphCache::Type type) const; QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const; static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize); diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h index e04f4ac..c6112ba 100644 --- a/src/gui/text/qfontengineglyphcache_p.h +++ b/src/gui/text/qfontengineglyphcache_p.h @@ -75,17 +75,20 @@ QT_BEGIN_NAMESPACE class QFontEngineGlyphCache { public: - QFontEngineGlyphCache(const QTransform &matrix) : m_transform(matrix) { } - enum Type { Raster_RGBMask, Raster_A8, Raster_Mono }; + QFontEngineGlyphCache(const QTransform &matrix, Type type) : m_transform(matrix), m_type(type) { } + virtual ~QFontEngineGlyphCache() { } + Type cacheType() const { return m_type; } + QTransform m_transform; + QFontEngineGlyphCache::Type m_type; }; typedef QHash > GlyphPointerHash; typedef QHash > GlyphIntHash; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 17af9cb..9f42217 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1562,11 +1562,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); QGLTextureGlyphCache *cache = - (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, QTransform()); + (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, QTransform(), glyphType); if (!cache || cache->cacheType() != glyphType) { cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); - ti.fontEngine->setGlyphCache(ctx, cache); + ti.fontEngine->setGlyphCache(ctx, cache, glyphType); } cache->setPaintEnginePrivate(this); -- cgit v0.12 From 293db01f907ad8644e8242055521e6b8e7c4dfec Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 9 Dec 2009 16:07:13 +0100 Subject: Fix a crash on the focus chain when removing items from the scene. The crash was because of the dangling pointer set on the tabFocusFirst attribute in QGraphicsScene. A child which was the tabFocusFirst was removed from the scene and fixFocusChainBeforeReparenting was setting the new tabFocusFirst pointer to the parent (since in that example it was the focusNext) but later on the parent was removed also from the scene (due to the recursion of removeItem if you call it with the parent : first children, then the parent itself) and fixFocusChainBeforeReparenting was not called again so if you delete the parent then the scene has the dangling pointer set. Task-number:QTBUG-6544 Reviewed-by:janarve --- src/gui/graphicsview/qgraphicsscene.cpp | 11 ++++---- src/gui/graphicsview/qgraphicswidget.cpp | 2 +- src/gui/graphicsview/qgraphicswidget_p.cpp | 4 +-- src/gui/graphicsview/qgraphicswidget_p.h | 2 +- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 32 ++++++++++++++++++++++ 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 27ebb79..2af90b8 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -569,14 +569,10 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) item->d_ptr->clearSubFocus(); - if (!item->d_ptr->inDestructor && item == tabFocusFirst) { - QGraphicsWidget *widget = static_cast(item); - widget->d_func()->fixFocusChainBeforeReparenting(0, 0); - } - if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges) unregisterScenePosItem(item); + QGraphicsScene *oldScene = item->d_func()->scene; item->d_func()->scene = 0; //We need to remove all children first because they might use their parent @@ -587,6 +583,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) q->removeItem(item->d_ptr->children.at(i)); } + if (!item->d_ptr->inDestructor && item == tabFocusFirst) { + QGraphicsWidget *widget = static_cast(item); + widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0); + } + // Unregister focus proxy. item->d_ptr->resetFocusProxy(); diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index fe569f4..8de81c2 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1054,7 +1054,7 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & break; case ItemParentChange: { QGraphicsItem *parent = qVariantValue(value); - d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast(parent) : 0); + d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast(parent) : 0, scene()); // Deliver ParentAboutToChange. QEvent event(QEvent::ParentAboutToChange); diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index b747a30..5b6490f 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -743,7 +743,7 @@ bool QGraphicsWidgetPrivate::hasDecoration() const /** * is called after a reparent has taken place to fix up the focus chain(s) */ -void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene) +void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene) { Q_Q(QGraphicsWidget); @@ -789,7 +789,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new // update tabFocusFirst for oldScene if the item is going to be removed from oldScene if (newParent) newScene = newParent->scene(); - QGraphicsScene *oldScene = q->scene(); + if (oldScene && newScene != oldScene) oldScene->d_func()->tabFocusFirst = firstOld; diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index eb53649..65e6962 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -98,7 +98,7 @@ public: mutable qreal *margins; void ensureMargins() const; - void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene = 0); + void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene = 0); void setLayout_helper(QGraphicsLayout *l); // Layouts diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 3303df5..a835259 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -168,6 +168,7 @@ private slots: void task236127_bspTreeIndexFails(); void task243004_setStyleCrash(); void task250119_shortcutContext(); + void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems(); }; @@ -2855,6 +2856,37 @@ void tst_QGraphicsWidget::polishEvent2() QVERIFY(widget->events.contains(QEvent::Polish)); } +void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() +{ + QGraphicsScene scene; + QGraphicsWidget* parent1 = new QGraphicsWidget; + QGraphicsWidget* child1_0 = new QGraphicsWidget; + QGraphicsWidget* child1_1 = new QGraphicsWidget; + + QGraphicsWidget* parent2 = new QGraphicsWidget; + + // Add the parent and child to the scene. + scene.addItem(parent1); + child1_0->setParentItem(parent1); + child1_1->setParentItem(parent1); + + // Hide and show the child. + child1_0->setParentItem(NULL); + scene.removeItem(child1_0); + + // Remove parent from the scene. + scene.removeItem(parent1); + + delete child1_0; + delete child1_1; + delete parent1; + + // Add an item into the scene. + scene.addItem(parent2); + + //This should not crash +} + QTEST_MAIN(tst_QGraphicsWidget) #include "tst_qgraphicswidget.moc" -- cgit v0.12 From 16de24d638deafb6e985b531fdf0c15691c0b7b4 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 10 Dec 2009 09:28:04 +1000 Subject: Recreate VGImage properly in out of memory case If vgCreateImage() runs out of memory, then the drawPixmap() will fail. But previously, it would also prevent future attempts to call vgImageSubData() to populate the data when memory was present. Task-number: QTBUG-6639 Reviewed-by: Sarah Smith --- src/openvg/qpixmapdata_vg.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 5d5fcbf..af6f0f0 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -250,6 +250,10 @@ VGImage QVGPixmapData::toVGImage() if (vgImage == VG_INVALID_HANDLE) { vgImage = vgCreateImage (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); + + // Bail out if we run out of GPU memory - try again next time. + if (vgImage == VG_INVALID_HANDLE) + return VG_INVALID_HANDLE; } if (!source.isNull() && recreate) { @@ -280,6 +284,10 @@ VGImage QVGPixmapData::toVGImage(qreal opacity) if (vgImageOpacity == VG_INVALID_HANDLE) { vgImageOpacity = vgCreateImage (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); + + // Bail out if we run out of GPU memory - try again next time. + if (vgImageOpacity == VG_INVALID_HANDLE) + return VG_INVALID_HANDLE; } VGfloat matrix[20] = { 1.0f, 0.0f, 0.0f, 0.0f, -- cgit v0.12 From 2705480b5cd740eee3ed684a26508b0497b00477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 10 Dec 2009 09:51:03 +0100 Subject: Doc: Try to explain better when and how the easing curve is applied Maybe not perfect, but it should be *better* at least. Task-number: QTBUG-6623 Reviewed-by: Thierry --- src/corelib/animation/qvariantanimation.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index d529f67..bc0d35e 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -373,6 +373,13 @@ QVariantAnimation::~QVariantAnimation() Another example is QEasingCurve::InOutElastic, which provides an elastic effect on the values of the interpolated variant. + QVariantAnimation will use the QEasingCurve::valueForProgress() to + transform the "normalized progress" (currentTime / totalDuration) + of the animation into the effective progress actually + used by the animation. It is this effective progress that will be + the progress when interpolated() is called. Also, the steps in the + keyValues are referring to this effective progress. + The easing curve is used with the interpolator, the interpolated() virtual function, the animation's duration, and iterationCount, to control how the current value changes as the animation progresses. -- cgit v0.12 From ba9ea2b97bdd2329cb479bb7a6aef1bc7cee82d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 10 Dec 2009 10:26:06 +0100 Subject: Doc: The ctor of of QGraphicsLayout might install the layout. Task-number: QTBUG-6447 --- src/gui/graphicsview/qgraphicslayout.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 2e9a30c..1e426c8 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -148,6 +148,10 @@ QT_BEGIN_NAMESPACE \a parent is passed to QGraphicsLayoutItem's constructor and the QGraphicsLayoutItem's isLayout argument is set to \e true. + + If \a parent is a QGraphicsWidget the layout will be installed + on that widget. (Note that installing a layout will delete the old one + installed.) */ QGraphicsLayout::QGraphicsLayout(QGraphicsLayoutItem *parent) : QGraphicsLayoutItem(*new QGraphicsLayoutPrivate) -- cgit v0.12 From ab5d00edea76d3b1d38d6e7e59159042ec69f2f2 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 10 Dec 2009 10:41:53 +0100 Subject: Clean up the QFontEngine glyphcaching code to not crash and be more tidy Reviewed-by: Eskil --- src/gui/painting/qpaintengine_raster.cpp | 4 +- src/gui/text/qfontengine.cpp | 124 ++++----------------- src/gui/text/qfontengine_p.h | 18 +-- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 5 +- 4 files changed, 32 insertions(+), 119 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4a72434..aa3b89e 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3018,10 +3018,10 @@ void QRasterPaintEngine::drawCachedGlyphs(const QPointF &p, const QTextItemInt & QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) : d->glyphCacheType; QImageTextureGlyphCache *cache = - (QImageTextureGlyphCache *) ti.fontEngine->glyphCache(glyphType, s->matrix); + (QImageTextureGlyphCache *) ti.fontEngine->glyphCache(0, glyphType, s->matrix); if (!cache) { cache = new QImageTextureGlyphCache(glyphType, s->matrix); - ti.fontEngine->setGlyphCache(glyphType, cache); + ti.fontEngine->setGlyphCache(0, cache); } cache->populate(ti, glyphs, positions); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 0eadf04..d364025 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -185,22 +185,11 @@ QFontEngine::QFontEngine() QFontEngine::~QFontEngine() { - for (GlyphPointerHash::const_iterator it = m_glyphPointerHash.constBegin(), - end = m_glyphPointerHash.constEnd(); it != end; ++it) { - for (QList::const_iterator it2 = it.value().constBegin(), - end2 = it.value().constEnd(); it2 != end2; ++it2) { - delete *it2; - } - } - m_glyphPointerHash.clear(); - for (GlyphIntHash::const_iterator it = m_glyphIntHash.constBegin(), - end = m_glyphIntHash.constEnd(); it != end; ++it) { - for (QList::const_iterator it2 = it.value().constBegin(), - end2 = it.value().constEnd(); it2 != end2; ++it2) { - delete *it2; - } + for (QLinkedList::const_iterator it = m_glyphCaches.constBegin(), + end = m_glyphCaches.constEnd(); it != end; ++it) { + delete it->cache; } - m_glyphIntHash.clear(); + m_glyphCaches.clear(); qHBFreeFace(hbFace); } @@ -713,105 +702,30 @@ QByteArray QFontEngine::getSfntTable(uint tag) const return table; } -void QFontEngine::expireGlyphCache() -{ - if (m_glyphCacheQueue.count() > 10) { // hold only 10 caches in memory. - QFontEngineGlyphCache *old = m_glyphCacheQueue.takeFirst(); - // remove the value from either of our hashes - for (GlyphPointerHash::iterator i = m_glyphPointerHash.begin(); i != m_glyphPointerHash.end(); ++i) { - QList list = i.value(); - if (list.removeAll(old)) { - if (list.isEmpty()) - m_glyphPointerHash.remove(i.key()); - else - m_glyphPointerHash.insert(i.key(), list); - break; - } - } - for (GlyphIntHash::iterator i = m_glyphIntHash.begin(); i != m_glyphIntHash.end(); ++i) { - QList list = i.value(); - if (list.removeAll(old)) { - if (list.isEmpty()) - m_glyphIntHash.remove(i.key()); - else - m_glyphIntHash.insert(i.key(), list); - break; - } - } - delete old; - } -} - -void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data, QFontEngineGlyphCache::Type type) +void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data) { Q_ASSERT(data); - QList items = m_glyphPointerHash.value(key); - - for (QList::iterator it = items.begin(), end = items.end(); it != end; ++it) { - QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, data->m_transform) - && c->cacheType() == type) { - if (c == data) - return; - items.removeAll(c); - delete c; - break; - } - } - items.append(data); - m_glyphPointerHash.insert(key, items); - m_glyphCacheQueue.append(data); - expireGlyphCache(); -} + GlyphCacheEntry entry = { key, data }; + if (m_glyphCaches.contains(entry)) + return; -void QFontEngine::setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data) -{ - Q_ASSERT(data); - QList items = m_glyphIntHash.value(key); - - for (QList::iterator it = items.begin(), end = items.end(); it != end; ++it) { - QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) { - if (c == data) - return; - items.removeAll(c); - delete c; - break; - } - } - items.append(data); - m_glyphIntHash.insert(key, items); + // Limit the glyph caches to 4. This covers all 90 degree rotations and limits + // memory use when there is continous or random rotation + if (m_glyphCaches.size() == 4) + delete m_glyphCaches.takeLast().cache; - m_glyphCacheQueue.append(data); - expireGlyphCache(); -} + m_glyphCaches.push_front(entry); -QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform, QFontEngineGlyphCache::Type type) const -{ - QList items = m_glyphPointerHash.value(key); - - for (QList::iterator it = items.begin(), end = items.end(); it != end; ++it) { - QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, transform) - && type == c->cacheType()) { - m_glyphCacheQueue.removeAll(c); // last used, move it up - m_glyphCacheQueue.append(c); - return c; - } - } - return 0; } -QFontEngineGlyphCache *QFontEngine::glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const +QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const { - QList items = m_glyphIntHash.value(key); - - for (QList::iterator it = items.begin(), end = items.end(); it != end; ++it) { - QFontEngineGlyphCache *c = *it; - if (qtransform_equals_no_translate(c->m_transform, transform)) { - m_glyphCacheQueue.removeAll(c); // last used, move it up - m_glyphCacheQueue.append(c); + for (QLinkedList::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) { + QFontEngineGlyphCache *c = it->cache; + if (key == it->context + && type == c->cacheType() + && qtransform_equals_no_translate(c->m_transform, transform)) { return c; } } diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 62bff85..a9883b4 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -56,6 +56,7 @@ #include "QtCore/qglobal.h" #include "QtCore/qatomic.h" #include +#include #include "private/qtextengine_p.h" #include "private/qfont_p.h" @@ -218,10 +219,8 @@ public: virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); - void setGlyphCache(void *key, QFontEngineGlyphCache *data, QFontEngineGlyphCache::Type type); - void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data); - QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform, QFontEngineGlyphCache::Type type) const; - QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const; + void setGlyphCache(void *key, QFontEngineGlyphCache *data); + QFontEngineGlyphCache *glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const; static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize); static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode); @@ -254,12 +253,13 @@ protected: static const QVector &grayPalette(); private: - /// remove old entries from the glyph cache. Helper method for the setGlyphCache ones. - void expireGlyphCache(); + struct GlyphCacheEntry { + void *context; + QFontEngineGlyphCache *cache; + bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; } + }; - GlyphPointerHash m_glyphPointerHash; - GlyphIntHash m_glyphIntHash; - mutable QList m_glyphCacheQueue; + mutable QLinkedList m_glyphCaches; }; inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 9f42217..fb9bcb4 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1554,7 +1554,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly const QTextItemInt &ti) { Q_Q(QGL2PaintEngineEx); - QOpenGL2PaintEngineState *s = q->state(); QVarLengthArray positions; QVarLengthArray glyphs; @@ -1562,11 +1561,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); QGLTextureGlyphCache *cache = - (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, QTransform(), glyphType); + (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, glyphType, QTransform()); if (!cache || cache->cacheType() != glyphType) { cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); - ti.fontEngine->setGlyphCache(ctx, cache, glyphType); + ti.fontEngine->setGlyphCache(ctx, cache); } cache->setPaintEnginePrivate(this); -- cgit v0.12 From 0160b439764726800f9b4c55acee8d554e1b1413 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 10 Dec 2009 11:04:01 +0100 Subject: Update polish translations --- translations/assistant_pl.ts | 56 +- translations/designer_pl.ts | 34 +- translations/linguist_pl.ts | 50 +- translations/qt_help_pl.ts | 45 +- translations/qt_pl.ts | 1316 ++++++++++++++++++++++++++++++------------ translations/qvfb_pl.ts | 11 +- 6 files changed, 1040 insertions(+), 472 deletions(-) diff --git a/translations/assistant_pl.ts b/translations/assistant_pl.ts index 069b5a0..0ef3251 100644 --- a/translations/assistant_pl.ts +++ b/translations/assistant_pl.ts @@ -78,7 +78,7 @@ BookmarkManager - + Bookmarks Zakładki @@ -102,7 +102,7 @@ BookmarkWidget - + Filter: Filtr: @@ -150,7 +150,7 @@ CentralWidget - + Add new page Dodaj nową stronę @@ -165,7 +165,7 @@ Wydrukuj dokument - + unknown nieznany @@ -191,7 +191,7 @@ Dodaj zakładkę dla tej strony... - + Search Wyszukaj @@ -225,7 +225,7 @@ FindWidget - + Previous Poprzedni @@ -281,7 +281,7 @@ HelpViewer - + Help Pomoc @@ -326,7 +326,7 @@ Wy&szukaj: - + Open Link Otwórz odsyłacz @@ -440,19 +440,19 @@ MainWindow - + Index Indeks - - + + Contents Spis treści - - + + Bookmarks Zakładki @@ -462,14 +462,14 @@ Wyszukaj - - - + + + Qt Assistant Qt Assistant - + Unfiltered Nieprzefiltrowany @@ -515,7 +515,12 @@ Znajdź w &tekście... - + + &Find + &Znajdź + + + Find &Next Znajdź &następny @@ -585,7 +590,12 @@ Znajdź bieżącą stronę w spisie treści - + + Sync + + + + Next Page Następna strona @@ -635,7 +645,7 @@ Przefiltrowane przez: - + Address Toolbar Pasek adresu @@ -660,7 +670,7 @@ Uaktualnianie indeksu wyszukiwawczego - + Looking for Qt Documentation... Szukanie dokumentacji Qt... @@ -962,7 +972,7 @@ Qt Assistant - + Could not register documentation file %1 @@ -1024,7 +1034,7 @@ Powód: SearchWidget - + &Copy S&kopiuj diff --git a/translations/designer_pl.ts b/translations/designer_pl.ts index f9c6dd0..005ad5a4 100644 --- a/translations/designer_pl.ts +++ b/translations/designer_pl.ts @@ -517,12 +517,12 @@ - + Move action Przenieś akcję - + Change Title Zmień tytuł @@ -703,7 +703,7 @@ ConnectionDelegate - + <object> <obiekt> @@ -1028,7 +1028,7 @@ FormBuilder - + Invalid stretch value for '%1': '%2' Parsing layout stretch values Niepoprawna wartość rozciągniecia dla '%1': '%2' @@ -1413,7 +1413,7 @@ Niepoprawny plik UI: brak głównego elementu <ui>. - + The creation of a widget of the class '%1' failed. Utworzenie widżetu klasy '%1' nie powiodło się. @@ -2277,7 +2277,7 @@ Strony pojemników powinny być dodawane jedynie poprzez wyspecyfikowanie ich w QFormBuilder - + An empty class name was passed on to %1 (object name: '%2'). Empty class name passed to widget factory method Pusta nazwa klasy została przekazana do %1 (nazwa obiektu: '%2'). @@ -4709,7 +4709,7 @@ Czy chcesz nadpisać szablon? The file "%1" has changed outside Designer. Do you want to reload it? - Plik "%1" zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować? + Plik "%1" zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować? @@ -4834,7 +4834,7 @@ Czy chcesz nadpisać szablon? qdesigner_internal::FormWindowManager - + Cu&t Wy&tnij @@ -5560,18 +5560,15 @@ Wybierz inną nazwę. qdesigner_internal::ObjectInspector - - &Find in Text... - Z&najdź w tekście... - - - - qdesigner_internal::ObjectInspector::ObjectInspectorPrivate - - + Change Current Page Zmień bieżącą stronę + + + &Find in Text... + Z&najdź w tekście... + qdesigner_internal::OrderDialog @@ -5785,9 +5782,6 @@ Wybierz inną nazwę. Browse... Przeglądaj... - - - qdesigner_internal::PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate Load Custom Device Skin diff --git a/translations/linguist_pl.ts b/translations/linguist_pl.ts index cdff54b..963c39b 100644 --- a/translations/linguist_pl.ts +++ b/translations/linguist_pl.ts @@ -4,7 +4,7 @@ AboutDialog - + Qt Linguist Qt Linguist @@ -110,11 +110,17 @@ + <p>[more duplicates omitted] <p>[pominięto resztę powtórzeń] - + + <p>* ID: %1 + <p>* identyfikator: %1 + + + <p>* Context: %1<br>* Source: %2 <p>* Kontekst: %1<br>* Źródło: %2 @@ -124,7 +130,7 @@ <br>* Komentarz: %3 - + Linguist does not know the plural rules for '%1'. Will assume a single universal form. Linguist nie zna reguł liczby mnogiej dla "%1". @@ -312,7 +318,7 @@ Przyjmie on uniwersalną formę liczby pojedynczej. LRelease - + Dropped %n message(s) which had no ID. Opuszczono %n wyrażenie które nie miało identyfikatora. @@ -714,7 +720,7 @@ Przyjmie on uniwersalną formę liczby pojedynczej. Zamienia tłumaczenia we wszystkich pasujących do wzorca wpisach. - + This is the application's main window. @@ -732,27 +738,27 @@ Przyjmie on uniwersalną formę liczby pojedynczej. - + Context Kontekst - + Items Elementy - + This panel lists the source contexts. Ten panel pokazuje listę kontekstów. - + Strings Tłumaczenia - + Phrases and guesses Wyrażenia i podpowiedzi @@ -773,7 +779,7 @@ Przyjmie on uniwersalną formę liczby pojedynczej. MOD - + Loading... Ładowanie... @@ -811,7 +817,7 @@ Czy chcesz pominąć pierwszy plik? - + Related files (%1);; Związane pliki (%1);; @@ -1176,7 +1182,7 @@ Wszystkie pliki (*) Czy chcesz zachować książke wyrażeń '%1'? - + All Wszystko @@ -1242,7 +1248,7 @@ Wszystkie pliki (*) - + Translation Tłumaczenie @@ -1579,7 +1585,7 @@ Wszystkie pliki (*) Tutaj można wprowadzić komentarze na własny użytek. One nie mają wpływu na przetłumaczoną aplikację. - + %1 translation (%2) Tłumaczenie na język %1 (%2) @@ -1609,7 +1615,7 @@ Linia: %2 MessageModel - + Completion status for %1 Stan ukończenia dla %1 @@ -1632,7 +1638,7 @@ Linia: %2 MsgEdit - + This is the right panel of the main window. @@ -1811,8 +1817,8 @@ Linia: %2 Wszystkie pliki (*) - - + + @@ -1847,7 +1853,7 @@ Linia: %2 Pliki XLIFF - + Qt Linguist 'Phrase Book' Qt Linguist "Książka wyrażeń" @@ -1998,12 +2004,12 @@ Linia: %2 TranslationSettingsDialog - + Any Country Dowolny kraj - + Settings for '%1' - Qt Linguist Ustawienia dla '%1' - Qt Linguist diff --git a/translations/qt_help_pl.ts b/translations/qt_help_pl.ts index 220f70c..f2eb6c9 100644 --- a/translations/qt_help_pl.ts +++ b/translations/qt_help_pl.ts @@ -32,13 +32,9 @@ QHelpCollectionHandler - The collection file is not set up yet! - Plik z kolekcją nie jest jeszcze ustawiony! - - The collection file '%1' is not set up yet! - + Plik z kolekcją "%1" nie jest jeszcze ustawiony! @@ -59,31 +55,27 @@ The collection file '%1' already exists! - + Plik z kolekcją "%1" już istnieje! Unknown filter '%1'! - + Nieznany filtr "%1"! Invalid documentation file '%1'! - + Niepoprawny plik z dokumentacją "%1"! Cannot register namespace '%1'! - + Nie można zarejestrować przestrzeni nazw "%1"! Cannot open database '%1' to optimize! - - - - The specified collection file already exists! - Podany plik z kolekcją już istnieje! + Nie można otworzyć bazy danych "%1" do zoptymalizowania! @@ -96,10 +88,6 @@ Nie można skopiować pliku z kolekcją: %1 - Unknown filter! - Nieznany filtr! - - Cannot register filter %1! Nie można zarejestrować pliku %1! @@ -110,10 +98,6 @@ Nie można otworzyć pliku z dokumentacją %1! - Invalid documentation file! - Niepoprawny plik z dokumentacją! - - The namespace %1 was not registered! Przestrzeń nazw %1 nie została zarejestrowana! @@ -123,14 +107,6 @@ Namespace %1 already exists! Przestrzeń nazw %1 już istnieje! - - Cannot register namespace! - Nie można zarejestrować przestrzeni nazw! - - - Cannot open database to optimize! - Nie można otworzyć bazy danych do zoptymalizowania! - QHelpDBReader @@ -144,7 +120,7 @@ QHelpEngineCore - + The specified namespace does not exist! Podana przestrzeń nazw nie istnieje! @@ -152,7 +128,7 @@ QHelpEngineCorePrivate - + Cannot open documentation file %1: %2! Nie można otworzyć pliku z dokumentacją %1: %2! @@ -342,11 +318,6 @@ QObject - - Untitled - Nienazwany - - Unknown token. Nieznany znak. diff --git a/translations/qt_pl.ts b/translations/qt_pl.ts index f79ecb0..6368b8f 100644 --- a/translations/qt_pl.ts +++ b/translations/qt_pl.ts @@ -4,7 +4,7 @@ CloseButton - + Close Tab Zamknij kartę @@ -12,7 +12,7 @@ FakeReply - + Fake error ! @@ -58,7 +58,7 @@ Phonon::AudioOutput - + <html>The audio playback device <b>%1</b> does not work.<br/>Falling back to <b>%2</b>.</html> <html>Urządzenie dźwiękowe <b>%1</b> nie działa.<br/>Przywracanie do <b>%2</b>.</html> @@ -76,7 +76,7 @@ Phonon::Gstreamer::Backend - + Warning: You do not seem to have the package gstreamer0.10-plugins-good installed. Some video features have been disabled. Ostrzeżenie: Wygląda na to, że pakiet gstreamer0.10-plugins-good nie jest zainstalowany w tym systemie. @@ -96,7 +96,7 @@ Obsługa dźwięku i wideo została wyłączona Cannot start playback. -Check your Gstreamer installation and make sure you +Check your GStreamer installation and make sure you have libgstreamer-plugins-base installed. Nie można rozpocząć odtwarzania. @@ -109,10 +109,10 @@ zainstalowałeś libgstreamer-plugins-base. Brak wymaganego kodeka. Aby odtworzyć zawartość musisz zainstalować poniższy kodek: %0 - + - + @@ -121,12 +121,12 @@ zainstalowałeś libgstreamer-plugins-base. Nie można otworzyć źródła mediów. - + Invalid source type. Niepoprawny typ źródła. - + Could not locate media source. Nie można znaleźć źródła mediów. @@ -144,7 +144,7 @@ zainstalowałeś libgstreamer-plugins-base. Phonon::MMF - + Audio Output Wyjście dźwięku @@ -166,12 +166,12 @@ zainstalowałeś libgstreamer-plugins-base. Phonon::MMF::EffectFactory - audio equalizer + Audio Equalizer Korektor graficzny - Bass boost + Bass Boost Wzmocnienie basów @@ -202,6 +202,14 @@ zainstalowałeś libgstreamer-plugins-base. + Phonon::MMF::MediaObject + + + Media type could not be determined + Nie można określić typu mediów + + + Phonon::VolumeSlider @@ -268,7 +276,7 @@ zainstalowałeś libgstreamer-plugins-base. Q3FileDialog - + %1 File not found. Check path and filename. @@ -285,7 +293,7 @@ Sprawdź ścieżkę i nazwę pliku. - + All Files (*) Wszystkie pliki (*) @@ -905,8 +913,8 @@ na QAbstractSocket - - + + Connection refused Połączenie odrzucone @@ -925,8 +933,8 @@ na Przekroczony czas połączenia - - + + Operation on socket is not supported Operacja na gnieździe nieobsługiwana @@ -970,7 +978,7 @@ na Press - Wciśnij + Wciśnij @@ -996,7 +1004,7 @@ na Niekompatybilność biblioteki Qt - + QT_LAYOUT_DIRECTION Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. LTR @@ -1173,7 +1181,7 @@ na QDB2Driver - + Unable to connect Nie można nawiązać połączenia @@ -1196,7 +1204,7 @@ na QDB2Result - + Unable to execute statement Nie można wykonać polecenia @@ -1284,7 +1292,7 @@ na QDialogButtonBox - + Abort Przerwij @@ -1511,7 +1519,7 @@ na Cannot remove source file - Nie można usunąć oryginalnego pilku + Nie można usunąć oryginalnego pliku @@ -1575,7 +1583,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Czy na pewno chcesz skasować '%1'? - + Recent Places Ostatnie miejsca @@ -1586,7 +1594,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Powrót - + Could not delete directory. Nie można skasować katalogu. @@ -1803,9 +1811,8 @@ Proszę o sprawdzenie podanej nazwy pliku. - %1 bytes - %1 b + %1 bajtów @@ -1854,62 +1861,67 @@ Proszę o sprawdzenie podanej nazwy pliku. Computer Komputer + + + %1 byte(s) + %1 bajt(ów) + QFontDatabase - + Normal Normalny - + - + Bold Pogrubiony - - + + Demi Bold Na wpół pogrubiony - + - + Black it's about font weight Bardzo gruby - + Demi Na wpół - + Light it's about font weight Cienki - - + + Italic Kursywa - - + + Oblique Pochyły - + Any Każdy @@ -2073,6 +2085,11 @@ Proszę o sprawdzenie podanej nazwy pliku. Runic Runiczny + + + N'Ko + N'Ko + QFontDialog @@ -2272,7 +2289,7 @@ Proszę o sprawdzenie podanej nazwy pliku. QHostInfo - + Unknown error Nieznany błąd @@ -2326,7 +2343,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Podłączony do hosta %1 - + Connection closed Połączenie zakończone @@ -2633,7 +2650,7 @@ Proszę o sprawdzenie podanej nazwy pliku. QIODevice - + No space left on device Brak wolnego miejsca na urządzeniu @@ -2653,7 +2670,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Zbyt wiele otwartych plików - + Unknown error Nieznany błąd @@ -2717,7 +2734,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Błąd podczas weryfikacji danych we wtyczce '%1' - + The plugin '%1' uses incompatible Qt library. (%2.%3.%4) [%5] Wtyczka '%1' używa niepoprawnej wersji biblioteki QT. (%2.%3.%4) [%5] @@ -2769,37 +2786,37 @@ Proszę o sprawdzenie podanej nazwy pliku. QLineEdit - + &Copy S&kopiuj - + Cu&t W&ytnij - + Delete Skasuj - + &Paste &Wklej - + &Redo &Przywróć - + Select All Zaznacz wszystko - + &Undo &Cofnij @@ -2808,7 +2825,7 @@ Proszę o sprawdzenie podanej nazwy pliku. QLocalServer - + %1: Name error %1: Błąd nazwy @@ -2902,7 +2919,7 @@ Proszę o sprawdzenie podanej nazwy pliku. QMYSQLDriver - + Unable to begin transaction Nie można rozpocząć transakcji @@ -2912,7 +2929,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Nie można potwierdzić transakcji - + Unable to connect Nie można nawiązać połączenia @@ -2922,7 +2939,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Nie można otworzyć bazy danych ' - + Unable to rollback transaction Nie można wycofać transakcji @@ -2930,7 +2947,7 @@ Proszę o sprawdzenie podanej nazwy pliku. QMYSQLResult - + Unable to bind outvalues Nie można powiązać wartości zewnętrznych @@ -2951,12 +2968,13 @@ Proszę o sprawdzenie podanej nazwy pliku. Nie można wykonać polecenia - + + Unable to fetch data Nie można pobrać danych - + Unable to prepare statement Nie można przygotować polecenia @@ -3332,27 +3350,30 @@ Proszę o sprawdzenie podanej nazwy pliku. QNetworkAccessFileBackend + Request for opening non-local file %1 Żądanie otwarcia zdalnego pliku %1 - + + Error opening %1: %2 Błąd otwierania %1: %2 - + Write error writing to %1: %2 Błąd w trakcie zapisywania do %1: %2 - + + Cannot open %1: Path is a directory Nie można otworzyć %1: Ścieżka jest katalogiem - + Read error reading from %1: %2 Błąd w trakcie czytania z %1: %2 @@ -3418,7 +3439,7 @@ Proszę o sprawdzenie podanej nazwy pliku. QOCIDriver - + Unable to initialize QOCIDriver Nie można dokonać inicjalizacji @@ -3447,8 +3468,8 @@ Proszę o sprawdzenie podanej nazwy pliku. QOCIResult - - + + Unable to bind column for batch execute Nie można powiązać kolumny dla wykonania zestawu poleceń @@ -3552,7 +3573,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Nie można przygotować polecenia - + Unable to fetch last @@ -3611,7 +3632,7 @@ Proszę o sprawdzenie podanej nazwy pliku. QPPDOptionsModel - + Name Nazwa @@ -3927,7 +3948,7 @@ Proszę o sprawdzenie podanej nazwy pliku. Wydrukuj zakres - + unknown nieznany @@ -3975,12 +3996,12 @@ Proszę o sprawdzenie podanej nazwy pliku. Wydrukuj - + Print To File ... Wydrukuj do pliku ... - + File %1 is not writable. Please choose a different file name. Plik %1 jest plikiem tylko do odczytu. @@ -4171,7 +4192,7 @@ Proszę wybrać inną nazwę pliku. Niestandardowy - + &Options >> &Opcje >> @@ -4483,7 +4504,7 @@ Proszę wybrać inną nazwę pliku. QProcess - + Could not open input redirection for reading Nie można otworzyć wejściowego przekierowania do odczytu @@ -4500,7 +4521,7 @@ Proszę wybrać inną nazwę pliku. Błąd zasobów (błąd forkowania): %1 - + @@ -4664,7 +4685,7 @@ Proszę wybrać inną nazwę pliku. QSQLiteDriver - + Error closing database Błąd zamykania bazy danych @@ -4707,8 +4728,8 @@ Proszę wybrać inną nazwę pliku. Nie można wykonać polecenia - - + + Unable to fetch row Nie można pobrać wiersza danych @@ -4719,7 +4740,7 @@ Proszę wybrać inną nazwę pliku. Nie można skasować polecenia - + No query Brak zapytania @@ -4744,7 +4765,7 @@ Proszę wybrać inną nazwę pliku. Ignore-count - + Licznik pominięć @@ -4754,7 +4775,7 @@ Proszę wybrać inną nazwę pliku. Hit-count - Ilość trafień + Licznik trafień @@ -5031,7 +5052,7 @@ Proszę wybrać inną nazwę pliku. Debug Output - Wyjscie debuggera + Wyjście debuggera @@ -5167,7 +5188,7 @@ Proszę wybrać inną nazwę pliku. - + %1: permission denied %1: brak dostępu @@ -5262,7 +5283,7 @@ Proszę wybrać inną nazwę pliku. QShortcut - + + + @@ -5273,12 +5294,12 @@ Proszę wybrać inną nazwę pliku. Alt - + Back Back - + Backspace Backspace @@ -5288,7 +5309,7 @@ Proszę wybrać inną nazwę pliku. Backtab - + Bass Boost Wzmocnienie basów @@ -5303,7 +5324,7 @@ Proszę wybrać inną nazwę pliku. Basy w górę - + Call Wywołaj @@ -5313,289 +5334,734 @@ Proszę wybrać inną nazwę pliku. Caps Lock - + CapsLock CapsLock - - Context1 - Kontekst1 + + Monitor Brightness Up + Zwiększ jasność monitora - Context2 - Kontekst2 + Monitor Brightness Down + Zmniejsz jasność monitora - Context3 - Kontekst3 + Keyboard Light On/Off + - Context4 - Kontekst4 + Keyboard Brightness Up + - - - Ctrl - Ctrl + + Keyboard Brightness Down + - - Del - Del + + Power Off + - - Delete - Delete + + Wake Up + - - Down - Dół + + Eject + Wysuń - - End - End + + Screensaver + Wygaszacz ekranu - - Enter - Enter + + WWW + WWW - - Esc - Esc + + Sleep + - - Escape - Escape + + LightBulb + - - F%1 - F%1 + + Shop + Sklep - - Favorites - Ulubione + + History + Historia - - Flip - Odwróć + + Add Favorite + Dodaj do ulubionych - - Forward - Do przodu + + Hot Links + - - Hangup - Zawieś + + Adjust Brightness + - - Help - Pomoc + + Finance + - - Home - Home + + Community + Społeczność - - Home Page - Strona startowa + + Audio Rewind + - - Ins - Ins + + Back Forward + - - Insert - Insert + + Application Left + - - Launch (0) - Uruchom (0) + + Application Right + - Launch (1) - Uruchom (1) + Book + Książka - Launch (2) - Uruchom (2) + CD + CD - Launch (3) - Uruchom (3) + Calculator + Kalkulator - Launch (4) - Uruchom (4) + Clear + Wyczyść - Launch (5) - Uruchom (5) + Clear Grab + - Launch (6) - Uruchom (6) + Close + Zamknij - Launch (7) - Uruchom (7) + Copy + Skopiuj - Launch (8) - Uruchom (8) + Cut + Wytnij - Launch (9) - Uruchom (9) + Display + - Launch (A) - Uruchom (A) + DOS + DOS - Launch (B) - Uruchom (B) + Documents + Dokumenty - Launch (C) - Uruchom (C) + Spreadsheet + - Launch (D) - Uruchom (D) + Browser + Przeglądarka - Launch (E) - Uruchom (E) + Game + - Launch (F) - Uruchom (F) + Go + Przejdź - - Launch Mail - Uruchom program pocztowy + + iTouch + iTouch - Launch Media - Uruchom przeglądarkę mediów + Logoff + - - Left - Lewo + + Market + Rynek - - Media Next - Następna ścieżka + + Meeting + Spotkanie - - Media Play - Odtwarzaj + + Keyboard Menu + - - Media Previous - Poprzednia ścieżka + + Menu PB + - - Media Record - Nagrywaj + + My Sites + Moje strony - - Media Stop - Zatrzymaj + + News + Wiadomości - - Menu - Menu + + Home Office + - - - Meta - Meta + + Option + Opcje - - No - Nie + + Paste + Wklej - - Num Lock - Num Lock + + Phone + Telefon - Number Lock - Number Lock + Reply + Odpowiedz - - NumLock - NumLock + + Reload + Przeładuj - - Open URL - Otwórz adres + + Rotate Windows + Obróć okna - - Page Down - Strona do góry + + Rotation PB + - - Page Up - Strona w dół - + + Rotation KB + + + + + Save + Zachowaj + + + + Send + Wyślij + + + + Spellchecker + + + + + Split Screen + Podziel ekran + + + + Support + Pomoc techniczna + + + + Task Panel + + + + + Terminal + Terminal + + + + Tools + Narzędzia + + + + Travel + Podróże + + + + Video + Wideo + + + + Word Processor + + + + + XFer + + + + + Zoom In + Powiększ + + + + Zoom Out + Pomniejsz + + + + Away + + + + + Messenger + + + + + WebCam + WebCam + + + + Mail Forward + + + + + Pictures + Zdjęcia + + + + Music + Muzyka + + + + Battery + Bateria + + + + Bluetooth + Bluetooth + + + + Wireless + Bezprzewodowy + + + + Ultra Wide Band + + + + + Audio Forward + + + + + Audio Repeat + + + + + Audio Random Play + + + + + Subtitle + Napisy + + + + Audio Cycle Track + + + + + Time + Czas + + + + View + Widok + + + + Top Menu + Menu główne + + + + Suspend + + + + + Hibernate + + + + + Context1 + Kontekst1 + + + + Context2 + Kontekst2 + + + + Context3 + Kontekst3 + + + + Context4 + Kontekst4 + + + + + Ctrl + Ctrl + + + + Del + Del + + + + Delete + Delete + + + + Down + Dół + + + + End + End + + + + Enter + Enter + + + + Esc + Esc + + + + Escape + Escape + + + + F%1 + F%1 + + + + Favorites + Ulubione + + + + Flip + Odwróć + + + + Forward + Do przodu + + + + Hangup + Zawieś + + + + Help + Pomoc + + + + Home + Home + + + + Home Page + Strona startowa + + + + Ins + Ins + + + + Insert + Insert + + + + Launch (0) + Uruchom (0) + + + + Launch (1) + Uruchom (1) + + + + Launch (2) + Uruchom (2) + + + + Launch (3) + Uruchom (3) + + + + Launch (4) + Uruchom (4) + + + + Launch (5) + Uruchom (5) + + + + Launch (6) + Uruchom (6) + + + + Launch (7) + Uruchom (7) + + + + Launch (8) + Uruchom (8) + + + + Launch (9) + Uruchom (9) + + + + Launch (A) + Uruchom (A) + + + + Launch (B) + Uruchom (B) + + + + Launch (C) + Uruchom (C) + + + + Launch (D) + Uruchom (D) + + + + Launch (E) + Uruchom (E) + + + + Launch (F) + Uruchom (F) + - + + Launch Mail + Uruchom program pocztowy + + + + Launch Media + Uruchom przeglądarkę mediów + + + + Left + Lewo + + + + Media Next + Następna ścieżka + + + + Media Play + Odtwarzaj + + + + Media Previous + Poprzednia ścieżka + + + + Media Record + Nagrywaj + + + + Media Stop + Zatrzymaj + + + + Menu + Menu + + + + + Meta + Meta + + + + No + Nie + + + + Num Lock + Num Lock + + + + Number Lock + Number Lock + + + + NumLock + NumLock + + + + Open URL + Otwórz adres + + + + Page Down + Strona do góry + + + + Page Up + Strona w dół + + + Pause Pauza @@ -5615,17 +6081,17 @@ Proszę wybrać inną nazwę pliku. Print - + Print Screen Wydrukuj zawartość ekranu - + Refresh Odśwież - + Return Powrót @@ -5635,38 +6101,39 @@ Proszę wybrać inną nazwę pliku. Prawo - + Scroll Lock Scroll Lock - + ScrollLock ScrollLock - + Search Szukaj - + + Select Wybierz - + Shift Shift - + Space Spacja - + Standby Tryb oczekiwania @@ -5676,22 +6143,22 @@ Proszę wybrać inną nazwę pliku. Zatrzymaj - + SysReq SysReq - + System Request Żądanie systemu - + Tab Tabulator - + Treble Down Soprany w dół @@ -5701,12 +6168,12 @@ Proszę wybrać inną nazwę pliku. Soprany w górę - + Up Góra - + Volume Down Przycisz @@ -5721,7 +6188,7 @@ Proszę wybrać inną nazwę pliku. Zrób głośniej - + Yes Tak @@ -5822,7 +6289,7 @@ Proszę wybrać inną nazwę pliku. Nieznany kod błędu (0x%1) pośrednika SOCKS wersji 5 - + Network operation timed out Przekroczony czas operacji sieciowej @@ -5830,7 +6297,7 @@ Proszę wybrać inną nazwę pliku. QSoftKeyManager - + Ok OK @@ -5855,7 +6322,7 @@ Proszę wybrać inną nazwę pliku. Anuluj - + Exit Wyjście @@ -5958,7 +6425,12 @@ Proszę wybrać inną nazwę pliku. Niepoprawna lub pusta lista szyfrów (%1) - + + Private key does not certify public key, %1 + Prywatny klucz nie uwiarygodnia publicznego, %1 + + + Error creating SSL session, %1 Błąd tworzenia sesji SSL, %1 @@ -5983,15 +6455,125 @@ Proszę wybrać inną nazwę pliku. Błąd ładowania prywatnego klucza, %1 - - Private key does not certificate public key, %1 - Prywatny klucz nie uwiarygodnia publicznego, %1 + + No error + Brak błędu + + + + The issuer certificate could not be found + Nie można odnaleźć wydawcy certyfikatu + + + + The certificate signature could not be decrypted + Nie można odszyfrować podpisu certyfikatu + + + + The public key in the certificate could not be read + Nie można odczytać publicznego klucza w certyfikacie + + + + The signature of the certificate is invalid + Niepoprawny podpis certyfikatu + + + + The certificate is not yet valid + Certyfikat nie jest jeszcze ważny + + + + The certificate has expired + Certyfikat utracił ważność + + + + The certificate's notBefore field contains an invalid time + Pole "notBefore" certyfikatu zawiera niepoprawną datę + + + + The certificate's notAfter field contains an invalid time + Pole "notAfter" certyfikatu zawiera niepoprawną datę + + + + The certificate is self-signed, and untrusted + + + + + The root certificate of the certificate chain is self-signed, and untrusted + + + + + The issuer certificate of a locally looked up certificate could not be found + + + + + No certificates could be verified + + + + + One of the CA certificates is invalid + + + + + The basicConstraints path length parameter has been exceeded + + + + + The supplied certificate is unsuitable for this purpose + + + + + The root CA certificate is not trusted for this purpose + + + + + The root CA certificate is marked to reject the specified purpose + + + + + The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate + + + + + The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate + + + + + The peer did not present any certificate + + + + + The host name did not match any of the valid hosts for this certificate + + + + + Unknown error + Nieznany błąd QStateMachine - + Missing initial state in compound state '%1' Brak stanu początkowego w stanie złożonym '%1' @@ -6045,7 +6627,7 @@ Proszę wybrać inną nazwę pliku. QTDSDriver - + Unable to open connection Nie można otworzyć połączenia @@ -6079,7 +6661,7 @@ Proszę wybrać inną nazwę pliku. QTextControl - + &Copy S&kopiuj @@ -6179,7 +6761,7 @@ Proszę wybrać inną nazwę pliku. QUnicodeControlCharacterMenu - + Insert Unicode control character Wstaw znak kontroli Unicode @@ -6237,7 +6819,7 @@ Proszę wybrać inną nazwę pliku. QWebFrame - + Request cancelled Prośba anulowana @@ -6657,13 +7239,13 @@ Proszę wybrać inną nazwę pliku. Movie time scrubber Media controller element - + Suwak czasu Movie time scrubber thumb Media controller element - + Uchwyt suwaka czasu @@ -6779,7 +7361,7 @@ Proszę wybrać inną nazwę pliku. Wizytator sieciowy - %2 - + Bad HTTP request Niepoprawna komenda HTTP @@ -6883,7 +7465,7 @@ Proszę wybrać inną nazwę pliku. - + JavaScript Alert - %1 Ostrzeżenie JavaScript - %1 @@ -6908,9 +7490,9 @@ Proszę wybrać inną nazwę pliku. Skrypt na tej stronie nie działa poprawnie. Czy chcesz przerwać ten skrypt? - + Move the cursor to the next character - Przesuń kursor do nastepnego znaku + Przesuń kursor do następnego znaku @@ -6920,7 +7502,7 @@ Proszę wybrać inną nazwę pliku. Move the cursor to the next word - Przesuń kursor do nastepnego słowa + Przesuń kursor do następnego słowa @@ -6930,7 +7512,7 @@ Proszę wybrać inną nazwę pliku. Move the cursor to the next line - Przesuń kursor do nastepnej linii + Przesuń kursor do następnej linii @@ -7080,7 +7662,7 @@ Proszę wybrać inną nazwę pliku. Insert Bulleted List - Wstaw listę wypunktową + Wstaw listę wypunktowaną @@ -7129,7 +7711,7 @@ Proszę wybrać inną nazwę pliku. QWidget - + * * @@ -7557,7 +8139,7 @@ Proszę wybrać inną nazwę pliku. The standalone pseudo attribute must appear after the encoding. - Pseudo atrybut "standalone" musi pojawić sie po "encoding". + Pseudo atrybut "standalone" musi pojawić się po "encoding". @@ -7752,17 +8334,22 @@ Proszę wybrać inną nazwę pliku. A positional predicate must evaluate to a single numeric value. - Wynikiem predykatu pozycyjnego musi być pojedyńcza wartość liczbowa. + Wynikiem predykatu pozycyjnego musi być pojedyncza wartość liczbowa. + + + + The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, %2 is invalid. + Docelowa nazwa w instrukcji przetwarzania nie może być %1 w żadnej kombinacji wielkich i małych liter. Dlatego nazwa %2 jest niepoprawna. - + %1 is not a valid target name in a processing instruction. It must be a %2 value, e.g. %3. %1 nie jest poprawną nazwą docelową w instrukcji przetwarzania. Nazwa musi być wartością %2, np. %3. The last step in a path must contain either nodes or atomic values. It cannot be a mixture between the two. - Ostatni krok w ścieżce musi zawierać albo wezły albo wartości atomowe. Nie może zawierać obu jednocześnie. + Ostatni krok w ścieżce musi zawierać albo węzły albo wartości atomowe. Nie może zawierać obu jednocześnie. @@ -7818,7 +8405,7 @@ Proszę wybrać inną nazwę pliku. %1 must be followed by %2 or %3, not at the end of the replacement string. - Po %1 musi następowac %2 lub %3, lecz nie na końcu zastępczego ciągu. + Po %1 musi następować %2 lub %3, lecz nie na końcu zastępczego ciągu. @@ -7907,7 +8494,12 @@ Proszę wybrać inną nazwę pliku. %1 jest nieznanym typem schematu. - + + A template with name %1 has already been declared. + Szablon o nazwie %1 został już zadeklarowany. + + + Only one %1 declaration can occur in the query prolog. Tylko jedna deklaracja %1 może się pojawić w prologu zapytania. @@ -7962,12 +8554,7 @@ Proszę wybrać inną nazwę pliku. Cecha "Import modułu" nie jest obsługiwana - - No value is available for the external variable by name %1. - Brak wartości dla zewnętrznej zmiennej o nazwie %1. - - - + The namespace %1 is reserved; therefore user defined functions may not use it. Try the predefined prefix %2, which exists for these cases. Przestrzeń nazw %1 jest zarezerwowana, dlatego funkcje zdefiniowane przez użytkownika nie mogą jej użyć. Spróbuj predefiniowany przedrostek %2, który istnieje w takich przypadkach. @@ -7987,12 +8574,7 @@ Proszę wybrać inną nazwę pliku. Zewnętrzne funkcje nie są obsługiwane. Wszystkie obsługiwane funkcje mogą być używane bezpośrednio, bez ich uprzedniego deklarowania jako zewnętrzne - - An argument by name %1 has already been declared. Every argument name must be unique. - Argument o nazwie %1 został już zadeklarowany. Każda nazwa argumentu musi być unikatowa. - - - + The name of a variable bound in a for-expression must be different from the positional variable. Hence, the two variables named %1 collide. Nazwa zmiennej powiązanej w wyrażeniu "for" musi być inna od zmiennej pozycjonującej. W związku z tym dwie zmienne o nazwie %1 kolidują ze sobą. @@ -8019,12 +8601,12 @@ Proszę wybrać inną nazwę pliku. W3C XML Schema identity constraint selector - Selektor ograniczenia jednostki W3C XML Schema + Selektor narzucenia niepowtarzalności W3C XML Schema W3C XML Schema identity constraint field - Pole ograniczenia jednostki W3C XML Schema + Pole narzucenia niepowtarzalności W3C XML Schema @@ -8032,37 +8614,37 @@ Proszę wybrać inną nazwę pliku. Wystąpiła konstrukcja która jest niedozwolona w bieżącym języku (%1). - - No variable by name %1 exists - Zmienna o nazwie %1 nie istnieje - - - - A template by name %1 has already been declared. - Szablon o nazwie %1 został już zadeklarowany. + + The keyword %1 cannot occur with any other mode name. + Słowo kluczowe %1 nie może wystąpić z inną nazwą trybu. - - The keyword %1 cannot occur with any other mode name. - Słowo kluczowe %1 nie może wystapić z inną nazwą trybu. + + No variable with name %1 exists + Zmienna o nazwie %1 nie istnieje - - The value of attribute %1 must of type %2, which %3 isn't. + + The value of attribute %1 must be of type %2, which %3 isn't. Wartość atrybutu %1 musi być typu %2, którym nie jest %3. - The prefix %1 can not be bound. By default, it is already bound to the namespace %2. + The prefix %1 cannot be bound. By default, it is already bound to the namespace %2. Przedrostek %1 nie może być powiązany. Jest on domyślnie powiązany z przestrzenią nazw %2. - A variable by name %1 has already been declared. + A variable with name %1 has already been declared. Zmienna o nazwie %1 została już zadeklarowana. - + + No value is available for the external variable with name %1. + Brak wartości dla zewnętrznej zmiennej o nazwie %1. + + + A stylesheet function must have a prefixed name. Funkcja arkusza stylu musi zawierać nazwę z przedrostkiem. @@ -8072,7 +8654,12 @@ Proszę wybrać inną nazwę pliku. Przestrzeń nazw dla funkcji zdefiniowanej przez użytkownika nie może być pusta (spróbuj predefiniowany przedrostek %1, który stworzono specjalnie do takich sytuacji) - + + An argument with name %1 has already been declared. Every argument name must be unique. + Argument o nazwie %1 został już zadeklarowany. Każda nazwa argumentu musi być unikatowa. + + + When function %1 is used for matching inside a pattern, the argument must be a variable reference or a string literal. Gdy funkcja %1 jest wykorzystana do dopasowania wewnątrz wzorca, jej argument musi być referencją do zmiennej lub napisem. @@ -8113,11 +8700,16 @@ Proszę wybrać inną nazwę pliku. - No function by name %1 is available. + No function with name %1 is available. Żadna funkcja o nazwie %1 nie jest dostępna. - + + An attribute with name %1 has already appeared on this element. + Atrybut o nazwie %1 już się pojawił w tym elemencie. + + + The namespace URI cannot be the empty string when binding to a prefix, %1. Przestrzeń nazw URI nie może być pustym ciągiem w powiązaniu z przedrostkiem, %1. @@ -8152,12 +8744,7 @@ Proszę wybrać inną nazwę pliku. Przestrzeń nazw URI nie może być stałą i nie może używać zawartych w niej wyrażeń. - - An attribute by name %1 has already appeared on this element. - Atrybut o nazwie %1 już się pojawił w tym elemencie. - - - + A direct element constructor is not well-formed. %1 is ended with %2. Konstruktor elementu bezpośredniego nie jest dobrze sformatowany. %1 jest zakończony %2. @@ -8262,11 +8849,6 @@ Proszę wybrać inną nazwę pliku. Modulus division (%1) by zero (%2) is undefined. Dzielenie modulo (%1) przez zero (%2) jest niezdefiniowane. - - - The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, is %2 invalid. - Docelowa nazwa w instrukcji przetwarzania nie może być %1 w żadnej kombinacji wielkich i małych liter. Dlatego nazwa %2 jest niepoprawna. - %1 takes at most %n argument(s). %2 is therefore invalid. @@ -8409,7 +8991,7 @@ Proszę wybrać inną nazwę pliku. In a simplified stylesheet module, attribute %1 must be present. - W uproszczonym module arkuszu stylu musi wystapić atrybut %1. + W uproszczonym module arkuszu stylu musi wystąpić atrybut %1. @@ -8419,7 +9001,7 @@ Proszę wybrać inną nazwę pliku. Element %1 must have at least one of the attributes %2 or %3. - Element %1 musi posiadać przynajmiej jeden z atrybutów: %2 lub %3. + Element %1 musi posiadać przynajmniej jeden z atrybutów: %2 lub %3. @@ -8531,12 +9113,12 @@ Proszę wybrać inną nazwę pliku. %1 is not allowed to derive from %2 by restriction as the latter defines it as final. - Nie można wywieść %1 z %2 ograniczając go ponieważ jest on zdefiniowany jako ostateczny. + Nie można wywieść %1 z %2 ograniczając go ponieważ jest on zdefiniowany jako końcowy. %1 is not allowed to derive from %2 by extension as the latter defines it as final. - Nie można wywieść %1 z %2 rozszerzając go ponieważ jest on zdefiniowany jako ostateczny. + Nie można wywieść %1 z %2 rozszerzając go ponieważ jest on zdefiniowany jako końcowy. @@ -8562,13 +9144,13 @@ Proszę wybrać inną nazwę pliku. Simple type %1 cannot derive from %2 as the latter defines restriction as final. - Typ prosty %1 nie może wywodzić się z %2 ponieważ ten ostatni jest zdefiniowany jako ostateczny. + Typ prosty %1 nie może wywodzić się z %2 ponieważ ten ostatni jest zdefiniowany jako końcowy. Variety of item type of %1 must be either atomic or union. - Typem elementu %1 musi być albo typ atomowy albo unia. + Typem elementów listy %1 musi być albo typ atomowy albo unia. @@ -8595,12 +9177,12 @@ Proszę wybrać inną nazwę pliku. Base type of simple type %1 has defined derivation by restriction as final. - Typ podstawowy dla typu prostego %1 ma zdefiniowane wywodzenie poprzez ograniczenie jako ostateczne. + Typ podstawowy dla typu prostego %1 ma zdefiniowane wywodzenie poprzez ograniczenie jako końcowe. Item type of base type does not match item type of %1. - Typ elementu w podstawowym typie nie pasuje do typu %1. + Typ elementów listy typu podstawowego nie pasuje do typu elementów listy %1. @@ -8657,7 +9239,7 @@ Proszę wybrać inną nazwę pliku. Content model of complex type %1 is not a valid extension of content model of %2. - Model zawartości typu złożonego %1 nie jest poprawnym rozszerzenien modelu zawartości %2. + Model zawartości typu złożonego %1 nie jest poprawnym rozszerzeniem modelu zawartości %2. @@ -8687,7 +9269,7 @@ Proszę wybrać inną nazwę pliku. Item type of simple type %1 cannot be a complex type. - Typ elementu w prostym typie %1 nie może być typem złożonym. + Typ elementów listy w prostym typie %1 nie może być typem złożonym. @@ -8731,7 +9313,7 @@ Proszę wybrać inną nazwę pliku. %1 facet contains invalid regular expression - Aspekt %1 zawiera niepoprawe wyrażenie regularne + Aspekt %1 zawiera niepoprawne wyrażenie regularne @@ -8902,7 +9484,7 @@ Proszę wybrać inną nazwę pliku. processContent of base wildcard must be weaker than derived wildcard. - "processContent" podstawowego znacznika musi być słabszy od wywiedzionego znacznika. + "processContent" podstawowego dżokera musi być słabszy od wywiedzionego dżokera. @@ -8913,7 +9495,7 @@ Proszę wybrać inną nazwę pliku. Particle contains non-deterministic wildcards. - Element zawiera nieokreślone znaczniki. + Element zawiera nieokreślone dżokery. @@ -8933,13 +9515,13 @@ Proszę wybrać inną nazwę pliku. - Derived attribute %1 does not exists in the base definition. - Wywyiedziony atrybut %1 nie istnieje w podstawowej definicji. + Derived attribute %1 does not exist in the base definition. + Wywiedziony atrybut %1 nie istnieje w podstawowej definicji. Derived attribute %1 does not match the wildcard in the base definition. - Wywiedziony atrybut %1 nie pasuje do znacznika w podstawowej definicji. + Wywiedziony atrybut %1 nie pasuje do dżokera w podstawowej definicji. @@ -8954,12 +9536,12 @@ Proszę wybrać inną nazwę pliku. Derived wildcard is not a subset of the base wildcard. - Wywiedziony znacznik nie jest podzbiorem podstawowego znacznika. + Wywiedziony dżoker nie jest podzbiorem podstawowego dżokera. %1 of derived wildcard is not a valid restriction of %2 of base wildcard - %1 wywiedzionego znacznika nie jest poprawnym ograniczeniem %2 podstawowego znacznika + %1 wywiedzionego dżokera nie jest poprawnym ograniczeniem %2 podstawowego dżokera @@ -8984,12 +9566,12 @@ Proszę wybrać inną nazwę pliku. %1 references identity constraint %2 that is no %3 or %4 element. - %1 odwołuje się do ograniczenia jednostki %2 które nie jest elementem %3 ani %4. + %1 odwołuje się do narzucenia niepowtarzalności %2 które nie jest elementem %3 ani %4. %1 has a different number of fields from the identity constraint %2 that it references. - %1 posiada inna liczbę pól od ograniczenia jednostki %2 które się do niego odwołuje. + %1 posiada inna liczbę pól od narzucenia niepowtarzalności %2 które się do niego odwołuje. @@ -8999,7 +9581,7 @@ Proszę wybrać inną nazwę pliku. Item type %1 of %2 element cannot be resolved. - Nie można rozwiązać typu elementu %1 w elemencie %2. + Nie można rozwiązać typu elementów listy %1 w elemencie %2. @@ -9100,17 +9682,17 @@ Proszę wybrać inną nazwę pliku. Attribute wildcard of %1 is not a valid restriction of attribute wildcard of base type %2. - Znacznik atrybutu %1 nie jest poprawnym ograniczeniem znacznika atrybutu typu podstawowego %2. + Atrybut dżokera %1 nie jest poprawnym ograniczeniem atrybutu dżokera typu podstawowego %2. %1 has attribute wildcard but its base type %2 has not. - %1 posiada znacznik atrybutu lecz jego typ podstawowy %2 go nie posiada. + %1 posiada atrybut dżokera lecz jego typ podstawowy %2 go nie posiada. Union of attribute wildcard of type %1 and attribute wildcard of its base type %2 is not expressible. - Nie można wyrazić unii znacznika atrybutu typu %1 i znacznika atrybutu jego typu podstawowego %2. + Nie można wyrazić unii atrybutu dżokera typu %1 i atrybutu dżokera jego typu podstawowego %2. @@ -9181,17 +9763,17 @@ Proszę wybrać inną nazwę pliku. Element %1 does not match namespace constraint of wildcard in base particle. - Element %1 nie pasuje do znacznika w ograniczeniu przestrzeni nazw w elemencie podstawowym. + Element %1 nie pasuje do ograniczenia przestrzeni nazw dżokera w elemencie podstawowym. Wildcard in derived particle is not a valid subset of wildcard in base particle. - Znacznik w wywiedzionym elemencie nie jest poprawnym podzbiorem znacznika w elemencie podstawowym. + Dżoker w wywiedzionym elemencie nie jest poprawnym podzbiorem dżokera w elemencie podstawowym. processContent of wildcard in derived particle is weaker than wildcard in base particle. - "processContent" znacznika w wywiedzionym elemencie jest słabszy od znacznika w podstawowym elemencie. + "processContent" dżokera w wywiedzionym elemencie jest słabszy od dżokera w podstawowym elemencie. @@ -9385,7 +9967,7 @@ Proszę wybrać inną nazwę pliku. - Component with id %1 has been defined previously. + Component with ID %1 has been defined previously. Komponent o identyfikatorze %1 został uprzednio zdefiniowany. @@ -9421,7 +10003,7 @@ Proszę wybrać inną nazwę pliku. Identity constraint %1 already defined. - Ograniczenie jednostki %1 jest już zdefiniowane. + Narzucenie niepowtarzalności %1 jest już zdefiniowane. @@ -9800,11 +10382,16 @@ Proszę wybrać inną nazwę pliku. - Fixed value constrained not allowed if element is nillable. + Fixed value constraint not allowed if element is nillable. Ograniczenie stałej wartości jest niedozwolone gdy element jest zerowalny. - + + Element %1 cannot contain other elements, as it has a fixed content. + Element %1 nie może zawierać innych elementów ponieważ posiada on stałą zawartość. + + + Specified type %1 is not validly substitutable with element type %2. Podany typ %1 nie jest poprawnie zastępowalny typem elementu %2. @@ -9848,19 +10435,14 @@ Proszę wybrać inną nazwę pliku. Element %1 zawiera niedozwolony text. - - Element %1 can not contain other elements, as it has a fixed content. - Element %1 nie może zawierać innych elementów ponieważ posiada on stałą zawartość. - - - + Element %1 is missing required attribute %2. Brak wymaganego atrybutu %2 w elemencie %1. Attribute %1 does not match the attribute wildcard. - Atrybut %1 nie pasuje do znacznika atrybutu. + Atrybut %1 nie pasuje do atrybutu dżokera. @@ -9912,7 +10494,7 @@ Proszę wybrać inną nazwę pliku. No referenced value found for key reference %1. - Brak wartości do której odwołuje sie klucz %1. + Brak wartości do której odwołuje się klucz %1. diff --git a/translations/qvfb_pl.ts b/translations/qvfb_pl.ts index bc3313e..9b85ad9 100644 --- a/translations/qvfb_pl.ts +++ b/translations/qvfb_pl.ts @@ -4,7 +4,7 @@ AnimationSaveWidget - + Record Nagraj @@ -260,6 +260,11 @@ BGR format format BGR + + + 800x480 + 800x480 + DeviceSkin @@ -322,12 +327,12 @@ QVFb - + Browse... Przeglądaj... - + Load Custom Skin... Załaduj skórki użytkownika... -- cgit v0.12 From 6db765ddb88ab8d64560902b75724fc1fca42551 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 10 Dec 2009 12:14:31 +0200 Subject: Fixed "make run" target for targets with special characters in them. Some misc whitespace got fixed, too. Reviewed-by: Janne Anttila --- qmake/generators/symbian/symmake_abld.cpp | 24 ++++++++++++------------ qmake/generators/symbian/symmake_sbsv2.cpp | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 6225720..f2baf46 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -88,15 +88,15 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b t << "# ==============================================================================" << "\n" << endl; t << endl << endl; - + t << "MAKE = make" << endl; t << endl; - + t << "VISUAL_CFG = RELEASE" << endl; - t << "ifeq \"$(CFG)\" \"UDEB\"" << endl; - t << "VISUAL_CFG = DEBUG" << endl; - t << "endif" << endl; - t << endl; + t << "ifeq \"$(CFG)\" \"UDEB\"" << endl; + t << "VISUAL_CFG = DEBUG" << endl; + t << "endif" << endl; + t << endl; t << DO_NOTHING_TARGET " :" << endl; t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl; @@ -113,8 +113,8 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET); finalDeps.append(DO_NOTHING_TARGET); finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); - wrapperTargets << WINSCW_DEPLOYMENT_TARGET - << WINSCW_DEPLOYMENT_CLEAN_TARGET + wrapperTargets << WINSCW_DEPLOYMENT_TARGET + << WINSCW_DEPLOYMENT_CLEAN_TARGET << STORE_BUILD_TARGET; } else { buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); @@ -153,9 +153,9 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath())); foreach(QString target, wrapperTargets) { t << target << " : " << makefile << endl; - t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl; - } - + t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl; + } + t << endl; } // if(ft.open(QIODevice::WriteOnly)) } @@ -375,7 +375,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool // Create execution target if (debugPlatforms.contains("winscw") && targetType == TypeExe) { t << "run:" << endl; - t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; + t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << fixedTarget << ".exe" << endl << endl; } } diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index c7eae64..ad22cfd 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -234,7 +234,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo // create execution target if (debugPlatforms.contains("winscw") && targetType == TypeExe) { t << "run:" << endl; - t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; + t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << fixedTarget << ".exe" << endl << endl; } } -- cgit v0.12 From 8d790367928765c861bd437583d12849517839ba Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 10 Dec 2009 12:15:26 +0200 Subject: Fixed containers-sequential benchmark for Symbian - RVCT 2.2. couldn't compile static templated function f(), so changed it to non-static, as it should make no difference for this test. - Limited insert_Large tests to fit to typical Symbian device memory. - Some whitespace fixed, too. Task-number: QTBUG-6592 Reviewed-by: Janne Anttila --- tests/benchmarks/containers-sequential/main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/benchmarks/containers-sequential/main.cpp b/tests/benchmarks/containers-sequential/main.cpp index 76643ca..885db3e 100644 --- a/tests/benchmarks/containers-sequential/main.cpp +++ b/tests/benchmarks/containers-sequential/main.cpp @@ -59,7 +59,7 @@ public: }; template -static T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler +T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler { return ts; } @@ -81,7 +81,7 @@ class UseCases_QVector : public UseCases void lookup(int size) { QVector v; - + T t; for (int i = 0; i < size; ++i) v.append(t); @@ -113,7 +113,7 @@ class UseCases_stdvector : public UseCases void lookup(int size) { std::vector v; - + T t; for (int i = 0; i < size; ++i) v.push_back(t); @@ -132,6 +132,13 @@ struct Large { // A "large" item type int x[1000]; }; +// Symbian devices typically have limited memory +#ifdef Q_OS_SYMBIAN +# define LARGE_MAX_SIZE 2000 +#else +# define LARGE_MAX_SIZE 20000 +#endif + class tst_vector_vs_std : public QObject { Q_OBJECT @@ -190,7 +197,7 @@ void tst_vector_vs_std::insert_Large_data() QTest::addColumn("useStd"); QTest::addColumn("size"); - for (int size = 10; size < 20000; size += 100) { + for (int size = 10; size < LARGE_MAX_SIZE; size += 100) { const QByteArray sizeString = QByteArray::number(size); QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size; QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size; @@ -236,7 +243,7 @@ void tst_vector_vs_std::lookup_Large_data() QTest::addColumn("useStd"); QTest::addColumn("size"); - for (int size = 10; size < 20000; size += 100) { + for (int size = 10; size < LARGE_MAX_SIZE; size += 100) { const QByteArray sizeString = QByteArray::number(size); QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size; QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size; -- cgit v0.12 From bb0ab1d8cf57dd4a7b69c8478c2a40c1cd1782e9 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 10 Dec 2009 11:27:51 +0100 Subject: Fix spinbox input when seecting the prefix If you were selcting the prefix and entering a digit the cursor position would not be updated correctly Task-number: QTBUG-6670 Reviewed-by: ogoffart --- src/gui/widgets/qabstractspinbox.cpp | 4 +++- tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index a18af4f..c015589 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -1856,8 +1856,10 @@ QValidator::State QSpinBoxValidator::validate(QString &input, int &pos) const if (dptr->specialValueText.size() > 0 && input == dptr->specialValueText) return QValidator::Acceptable; - if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix)) + if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix)) { input.prepend(dptr->prefix); + pos += dptr->prefix.length(); + } if (!dptr->suffix.isEmpty() && !input.endsWith(dptr->suffix)) input.append(dptr->suffix); diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index 7f03153..a3f0915 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -148,6 +148,7 @@ private slots: void task255471_decimalsValidation(); void taskQTBUG_5008_textFromValueAndValidate(); + void taskQTBUG_6670_selectAllWithPrefix(); public slots: void valueChangedHelper(const QString &); @@ -1084,5 +1085,16 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate() QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); } +void tst_QDoubleSpinBox::taskQTBUG_6670_selectAllWithPrefix() +{ + DoubleSpinBox spin; + spin.setPrefix("$ "); + spin.lineEdit()->selectAll(); + QTest::keyClick(spin.lineEdit(), Qt::Key_1); + QCOMPARE(spin.value(), 1.); + QTest::keyClick(spin.lineEdit(), Qt::Key_2); + QCOMPARE(spin.value(), 12.); +} + QTEST_MAIN(tst_QDoubleSpinBox) #include "tst_qdoublespinbox.moc" -- cgit v0.12 From a2ccf692cdc4113cc90ef12c27ba8c4aa552d81f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 10 Dec 2009 11:35:53 +0100 Subject: Fixes internal drag and drop in QListWidget while dropping to the end Task-number: QTBUG-6565 Reviewed-by: Gabriel --- src/gui/itemviews/qlistwidget.cpp | 2 +- tests/auto/qlistwidget/tst_qlistwidget.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 929d688..0ce0e5e 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -173,7 +173,7 @@ void QListModel::move(int srcRow, int dstRow) { if (srcRow == dstRow || srcRow < 0 || srcRow >= items.count() - || dstRow < 0 || dstRow >= items.count()) + || dstRow < 0 || dstRow > items.count()) return; if (!beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow)) diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index 863c308..e165190 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -862,12 +862,18 @@ void tst_QListWidget::moveItemsPriv_data() QTest::newRow("Empty") << 0 << 0 << 0 << false; QTest::newRow("Overflow src") << 5 << 5 << 2 << false; QTest::newRow("Underflow src") << 5 << -1 << 2 << false; - QTest::newRow("Overflow dst") << 5 << 2 << 5 << false; + QTest::newRow("Overflow dst") << 5 << 2 << 6 << false; QTest::newRow("Underflow dst") << 5 << 2 << -1 << false; QTest::newRow("Same place") << 5 << 2 << 2 << false; QTest::newRow("Up") << 5 << 4 << 2 << true; QTest::newRow("Down") << 5 << 2 << 4 << true; QTest::newRow("QTBUG-6532 assert") << 5 << 0 << 1 << false; + QTest::newRow("QTBUG-6565 to the end") << 5 << 3 << 5 << true; + QTest::newRow("Same place 2") << 2 << 0 << 1 << false; + QTest::newRow("swap") << 2 << 0 << 2 << true; + QTest::newRow("swap2") << 4 << 1 << 3 << true; + QTest::newRow("swap3") << 4 << 3 << 2 << true; + QTest::newRow("swap4") << 2 << 1 << 0 << true; } void tst_QListWidget::moveItemsPriv() -- cgit v0.12 From e355ade4712fa63794403dae3fda807a58e8b88d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 10 Dec 2009 12:50:43 +0200 Subject: List item is not highlighted before navigating the list QS60Style does not draw highlight for a list that user has not navigated in yet. Once user makes navigation attempt, highlight is drawn to correct index. This was due to that QS60Style only used State_Selected for deducing where highlight should be drawn to. Task-number: QTBUG-6357 Reviewed-by: Janne Anttila --- src/gui/styles/qs60style.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 98f4aaf..18ad44d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1317,6 +1317,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->setClipRect(voptAdj.rect); const bool isSelected = (vopt->state & QStyle::State_Selected); + const bool hasFocus = (vopt->state & QStyle::State_HasFocus); bool isScrollBarVisible = false; int scrollBarWidth = 0; @@ -1359,7 +1360,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} // draw the focus rect - if (isSelected) { + if (isSelected | hasFocus) { QRect highlightRect = option->rect.adjusted(1,1,-1,-1); QAbstractItemView::SelectionBehavior selectionBehavior = itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; -- cgit v0.12 From c8ac0418fa47316bf4f288a8c0b07611b388c3c6 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 10 Dec 2009 12:30:04 +0100 Subject: Fix .gitignore to not ignore qdoc.pro Remove an old ignore that was introduced before qdoc moved to $QTDIR/bin Reviewed-by: Oswald Buddenhagen --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 33c9b7c..2069ad5 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,6 @@ tests/auto/qprocess/fileWriterProcess.txt .com.apple.timemachine.supported tests/auto/qlibrary/libmylib.so* tests/auto/qresourceengine/runtime_resource.rcc -tools/qdoc3/qdoc3* tools/qtestlib/updater/updater* tools/activeqt/testcon/testcon.tlb translations/*.qm -- cgit v0.12 From 6db96dcd4acccbc13161f85adf3164907b7b5cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Dec 2009 12:52:10 +0100 Subject: Fix redraw bugs when using graphics effects in device coordinate mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QGraphicsEffect::boundingRectFor() needs the source bounding rect in device coordinates. This patch fixes the documentation to reflect this, and fixes some internal usage of boundingRectFor() to ensure it always gets the device rect of the source. Task-number: QTBUG-5918 Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 14 +++++-- src/gui/graphicsview/qgraphicsitem.cpp | 54 +++++++++++++++++++++----- src/gui/graphicsview/qgraphicsitem_p.h | 2 + src/gui/graphicsview/qgraphicsview.cpp | 26 +++++++++++++ src/gui/graphicsview/qgraphicsview.h | 1 + src/gui/graphicsview/qgraphicsview_p.h | 3 ++ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 9 ++++- 7 files changed, 95 insertions(+), 14 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 239e29c..d6cabaa 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -160,6 +160,10 @@ QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const /*! Returns the bounding rectangle of the source mapped to the given \a system. + Calling this function with Qt::DeviceCoordinates outside of + QGraphicsEffect::draw() will give undefined results, as there is no device + context available. + \sa draw() */ QRectF QGraphicsEffect::sourceBoundingRect(Qt::CoordinateSystem system) const @@ -348,6 +352,10 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse The returned pixmap is clipped to the current painter's device rectangle when \a system is Qt::DeviceCoordinates. + Calling this function with Qt::DeviceCoordinates outside of + QGraphicsEffect::draw() will give undefined results, as there is no device + context available. + \sa draw(), boundingRect() */ QPixmap QGraphicsEffect::sourcePixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const @@ -398,8 +406,8 @@ QGraphicsEffect::~QGraphicsEffect() /*! Returns the effective bounding rectangle for this effect, i.e., the - bounding rectangle of the source, adjusted by any margins applied by - the effect itself. + bounding rectangle of the source in device coordinates, adjusted by + any margins applied by the effect itself. \sa boundingRectFor(), updateBoundingRect() */ @@ -413,7 +421,7 @@ QRectF QGraphicsEffect::boundingRect() const /*! Returns the effective bounding rectangle for this effect, given the - provided \a rect in the source's coordinate space. When writing + provided \a rect in the device coordinates. When writing you own custom effect, you must call updateBoundingRect() whenever any parameters are changed that may cause this this function to return a different value. diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 90cc132..8bbe929 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2584,6 +2584,35 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) /*! \internal \since 4.6 + Returns the effective bounding rect of the given item space rect. + If the item has no effect, the rect is returned unmodified. + If the item has an effect, the effective rect can be extend beyond the + item's bounding rect, depending on the effect. + + \sa boundingRect() +*/ +QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const +{ +#ifndef QT_NO_GRAPHICSEFFECT + Q_Q(const QGraphicsItem); + QGraphicsEffect *effect = graphicsEffect; + if (scene && effect && effect->isEnabled()) { + QRectF sceneRect = q->mapRectToScene(rect); + QRectF sceneEffectRect; + foreach (QGraphicsView *view, scene->views()) { + QRectF deviceRect = view->d_func()->mapRectFromScene(sceneRect); + QRect deviceEffectRect = effect->boundingRectFor(deviceRect).toAlignedRect(); + sceneEffectRect |= view->d_func()->mapRectToScene(deviceEffectRect); + } + return q->mapRectFromScene(sceneEffectRect); + } +#endif //QT_NO_GRAPHICSEFFECT + return rect; +} + +/*! + \internal + \since 4.6 Returns the effective bounding rect of the item. If the item has no effect, this is the same as the item's bounding rect. If the item has an effect, the effective rect can be larger than the item's @@ -2594,16 +2623,19 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) QRectF QGraphicsItemPrivate::effectiveBoundingRect() const { #ifndef QT_NO_GRAPHICSEFFECT - QGraphicsEffect *effect = graphicsEffect; - QRectF brect = effect && effect->isEnabled() ? effect->boundingRect() : q_ptr->boundingRect(); + Q_Q(const QGraphicsItem); + QRectF brect = effectiveBoundingRect(q_ptr->boundingRect()); if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) return brect; const QGraphicsItem *effectParent = parent; while (effectParent) { - effect = effectParent->d_ptr->graphicsEffect; - if (effect && effect->isEnabled()) - brect = effect->boundingRectFor(brect); + QGraphicsEffect *effect = effectParent->d_ptr->graphicsEffect; + if (scene && effect && effect->isEnabled()) { + const QRectF brectInParentSpace = q->mapRectToItem(effectParent, brect); + const QRectF effectRectInParentSpace = effectParent->d_ptr->effectiveBoundingRect(brectInParentSpace); + brect = effectParent->mapRectToItem(q, effectRectInParentSpace); + } if (effectParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) return brect; effectParent = effectParent->d_ptr->parent; @@ -10649,17 +10681,21 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); const QRectF sourceRect = boundingRect(system); - QRect effectRect; + QRectF effectRectF; if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { - effectRect = item->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect(); + effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates)); + if (system == Qt::LogicalCoordinates) + effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF); } else if (mode == QGraphicsEffect::PadToTransparentBorder) { // adjust by 1.5 to account for cosmetic pens - effectRect = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5).toAlignedRect(); + effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5); } else { - effectRect = sourceRect.toAlignedRect(); + effectRectF = sourceRect; } + QRect effectRect = effectRectF.toAlignedRect(); + if (offset) *offset = effectRect.topLeft(); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 8f9fe54..2d8de65 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -236,6 +236,8 @@ public: QRectF effectiveBoundingRect() const; QRectF sceneEffectiveBoundingRect() const; + QRectF effectiveBoundingRect(const QRectF &rect) const; + virtual void resolveFont(uint inheritedMask) { for (int i = 0; i < children.size(); ++i) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 3f9f443..ffe64aa 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -545,6 +545,32 @@ qint64 QGraphicsViewPrivate::verticalScroll() const /*! \internal + + Maps the given rectangle to the scene using QTransform::mapRect() +*/ +QRectF QGraphicsViewPrivate::mapRectToScene(const QRect &rect) const +{ + if (dirtyScroll) + const_cast(this)->updateScroll(); + QRectF scrolled = QRectF(rect.translated(scrollX, scrollY)); + return identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled); +} + + +/*! + \internal + + Maps the given rectangle from the scene using QTransform::mapRect() +*/ +QRectF QGraphicsViewPrivate::mapRectFromScene(const QRectF &rect) const +{ + if (dirtyScroll) + const_cast(this)->updateScroll(); + return (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY); +} + +/*! + \internal */ void QGraphicsViewPrivate::updateScroll() { diff --git a/src/gui/graphicsview/qgraphicsview.h b/src/gui/graphicsview/qgraphicsview.h index 2aed0e6..90576e5 100644 --- a/src/gui/graphicsview/qgraphicsview.h +++ b/src/gui/graphicsview/qgraphicsview.h @@ -278,6 +278,7 @@ private: friend class QGraphicsSceneWidget; friend class QGraphicsScene; friend class QGraphicsScenePrivate; + friend class QGraphicsItemPrivate; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsView::CacheMode) diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index cd161ad..d4b718e 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -86,6 +86,9 @@ public: qint64 horizontalScroll() const; qint64 verticalScroll() const; + QRectF mapRectToScene(const QRect &rect) const; + QRectF mapRectFromScene(const QRectF &rect) const; + QPointF mousePressItemPoint; QPointF mousePressScenePoint; QPoint mousePressViewPoint; diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 6266933..3e7a2eb 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -233,6 +233,7 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { hints = painter->renderHints(); + painter->setBrush(brush); painter->drawRect(boundingRect()); ++repaints; } @@ -247,6 +248,7 @@ public: QPainter::RenderHints hints; int repaints; QRectF br; + QBrush brush; }; class tst_QGraphicsItem : public QObject @@ -7646,17 +7648,20 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() EventTester *item1 = new EventTester; item1->br = itemBoundingRect; item1->setPos(-200, -200); + item1->brush = Qt::red; EventTester *item2 = new EventTester; item2->br = itemBoundingRect; item2->setFlag(QGraphicsItem::ItemIgnoresTransformations); item2->setParentItem(item1); item2->setPos(200, 200); + item2->brush = Qt::green; EventTester *item3 = new EventTester; item3->br = itemBoundingRect; item3->setParentItem(item2); item3->setPos(80, 80); + item3->brush = Qt::blue; scene.addItem(item1); QTest::qWait(100); @@ -7671,8 +7676,8 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() item1->setGraphicsEffect(shadow); QTest::qWait(50); - // Make sure all items are repainted. - QCOMPARE(item1->repaints, 1); + // Make sure all visible items are repainted. + QCOMPARE(item1->repaints, 0); QCOMPARE(item2->repaints, 1); QCOMPARE(item3->repaints, 1); -- cgit v0.12 From 2fa94ee5569c91435e68f578f29a712dcfd37e4f Mon Sep 17 00:00:00 2001 From: Tero Saarni Date: Wed, 18 Nov 2009 14:04:08 +0200 Subject: Can't delete selected characters from FEP using backspace touch button. When selection was deleted, the changes where not updated on virtual keyboard. Added new connection to notify when text has changed. Task-number: QTBUG-4847 Reviewed-by: Markku Luukkainen Merge-request: 2149 Signed-off-by: axis --- src/gui/widgets/qlineedit_p.cpp | 5 +++++ src/gui/widgets/qplaintextedit.cpp | 3 +++ src/gui/widgets/qtextedit.cpp | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 4437fef..bdf7993 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -149,6 +149,11 @@ void QLineEditPrivate::init(const QString& txt) #endif QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)), q, SLOT(updateMicroFocus())); + +#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) + QObject::connect(control, SIGNAL(textChanged(const QString &)), + q, SLOT(updateMicroFocus())); +#endif // for now, going completely overboard with updates. QObject::connect(control, SIGNAL(selectionChanged()), diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 89fe7b8..31f8bb4 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -761,6 +761,9 @@ void QPlainTextEditPrivate::init(const QString &txt) QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); +#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) + QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus())); +#endif // set a null page size initially to avoid any relayouting until the textedit // is shown. relayoutDocument() will take care of setting the page size to the diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 1bc0bf1..f79c870 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -158,6 +158,11 @@ void QTextEditPrivate::init(const QString &html) QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); +#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) + QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus())); +#endif + + QTextDocument *doc = control->document(); // set a null page size initially to avoid any relayouting until the textedit // is shown. relayoutDocument() will take care of setting the page size to the -- cgit v0.12 From bfe12d2965130203a27c6d28d06b10a63cd0f2e8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 10 Dec 2009 17:14:21 +0100 Subject: Designer: Handle "visible"-properties of item view headers correctly. Implement the property sheet (isChanged/reset) correctly and do a hack for resetting the visibility. Task-number: QTBUG-6505 Reviewed-by: Jarek Kobus --- .../formeditor/itemview_propertysheet.cpp | 183 +++++++++------------ .../components/formeditor/itemview_propertysheet.h | 10 +- 2 files changed, 88 insertions(+), 105 deletions(-) diff --git a/tools/designer/src/components/formeditor/itemview_propertysheet.cpp b/tools/designer/src/components/formeditor/itemview_propertysheet.cpp index 38f73e7..96d159a 100644 --- a/tools/designer/src/components/formeditor/itemview_propertysheet.cpp +++ b/tools/designer/src/components/formeditor/itemview_propertysheet.cpp @@ -45,6 +45,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -54,41 +55,27 @@ struct Property { Property() : m_sheet(0),m_id(-1) {} Property(QDesignerPropertySheetExtension *sheet, int id) : m_sheet(sheet), m_id(id) {} - bool operator==(const Property &p) { return m_sheet == p.m_sheet && m_id == p.m_id; } - uint qHash() { - return ((int)(m_sheet-(QDesignerPropertySheetExtension*)(0))) & m_id; - } QDesignerPropertySheetExtension *m_sheet; int m_id; }; -class ItemViewPropertySheetPrivate { +typedef QMap FakePropertyMap; -public: - ItemViewPropertySheetPrivate(QHeaderView *horizontalHeader, - QHeaderView *verticalHeader, - QObject *parent); +struct ItemViewPropertySheetPrivate { + ItemViewPropertySheetPrivate(QDesignerFormEditorInterface *core, + QHeaderView *horizontalHeader, + QHeaderView *verticalHeader); - inline void createMapping(int fakeId, QHeaderView *header, const QString &headerName); inline QStringList realPropertyNames(); inline QString fakePropertyName(const QString &prefix, const QString &realName); - QDesignerFormEditorInterface *m_core; - - // Maps index of fake property - // to index of real property in respective sheet - QHash m_propertyIdMap; + // Maps index of fake property to index of real property in respective sheet + FakePropertyMap m_propertyIdMap; - // Maps name of fake property - // to name of real property + // Maps name of fake property to name of real property QHash m_propertyNameMap; -private: - static QDesignerFormEditorInterface *formEditorForObject(QObject *o); - - QHeaderView *m_hHeader; - QHeaderView *m_vHeader; QHash m_propertySheet; QStringList m_realPropertyNames; }; @@ -111,43 +98,18 @@ using namespace qdesigner_internal; /***************** ItemViewPropertySheetPrivate *********************/ -ItemViewPropertySheetPrivate::ItemViewPropertySheetPrivate(QHeaderView *horizontalHeader, - QHeaderView *verticalHeader, - QObject *parent) - : m_core(formEditorForObject(parent)), - m_hHeader(horizontalHeader), - m_vHeader(verticalHeader) +ItemViewPropertySheetPrivate::ItemViewPropertySheetPrivate(QDesignerFormEditorInterface *core, + QHeaderView *horizontalHeader, + QHeaderView *verticalHeader) { if (horizontalHeader) m_propertySheet.insert(horizontalHeader, qt_extension - (m_core->extensionManager(), horizontalHeader)); + (core->extensionManager(), horizontalHeader)); if (verticalHeader) m_propertySheet.insert(verticalHeader, qt_extension - (m_core->extensionManager(), verticalHeader)); -} - -// Find the form editor in the hierarchy. -// We know that the parent of the sheet is the extension manager -// whose parent is the core. -QDesignerFormEditorInterface *ItemViewPropertySheetPrivate::formEditorForObject(QObject *o) -{ - do { - if (QDesignerFormEditorInterface* core = qobject_cast(o)) - return core; - o = o->parent(); - } while(o); - Q_ASSERT(o); - return 0; -} - -void ItemViewPropertySheetPrivate::createMapping(int fakeId, QHeaderView *header, - const QString &headerName) -{ - const int realPropertyId = m_propertySheet.value(header)->indexOf(headerName); - QDesignerPropertySheetExtension *propertySheet = m_propertySheet.value(header); - m_propertyIdMap.insert(fakeId, Property(propertySheet, realPropertyId)); + (core->extensionManager(), verticalHeader)); } QStringList ItemViewPropertySheetPrivate::realPropertyNames() @@ -194,46 +156,19 @@ QString ItemViewPropertySheetPrivate::fakePropertyName(const QString &prefix, ItemViewPropertySheet::ItemViewPropertySheet(QTreeView *treeViewObject, QObject *parent) : QDesignerPropertySheet(treeViewObject, parent), - d(new ItemViewPropertySheetPrivate(treeViewObject->header(), 0, parent)) + d(new ItemViewPropertySheetPrivate(core(), treeViewObject->header(), 0)) { - QHeaderView *hHeader = treeViewObject->header(); - - foreach (const QString &realPropertyName, d->realPropertyNames()) { - const QString fakePropertyName - = d->fakePropertyName(QLatin1String("header"), realPropertyName); - d->createMapping(createFakeProperty(fakePropertyName, 0), hHeader, realPropertyName); - } - - foreach (int id, d->m_propertyIdMap.keys()) { - setAttribute(id, true); - setPropertyGroup(id, QLatin1String(headerGroup)); - } + initHeaderProperties(treeViewObject->header(), QLatin1String("header")); } - ItemViewPropertySheet::ItemViewPropertySheet(QTableView *tableViewObject, QObject *parent) : QDesignerPropertySheet(tableViewObject, parent), - d(new ItemViewPropertySheetPrivate(tableViewObject->horizontalHeader(), - tableViewObject->verticalHeader(), parent)) + d(new ItemViewPropertySheetPrivate(core(), + tableViewObject->horizontalHeader(), + tableViewObject->verticalHeader())) { - QHeaderView *hHeader = tableViewObject->horizontalHeader(); - QHeaderView *vHeader = tableViewObject->verticalHeader(); - - foreach (const QString &realPropertyName, d->realPropertyNames()) { - const QString fakePropertyName - = d->fakePropertyName(QLatin1String("horizontalHeader"), realPropertyName); - d->createMapping(createFakeProperty(fakePropertyName, 0), hHeader, realPropertyName); - } - foreach (const QString &realPropertyName, d->realPropertyNames()) { - const QString fakePropertyName - = d->fakePropertyName(QLatin1String("verticalHeader"), realPropertyName); - d->createMapping(createFakeProperty(fakePropertyName, 0), vHeader, realPropertyName); - } - - foreach (int id, d->m_propertyIdMap.keys()) { - setAttribute(id, true); - setPropertyGroup(id, QLatin1String(headerGroup)); - } + initHeaderProperties(tableViewObject->horizontalHeader(), QLatin1String("horizontalHeader")); + initHeaderProperties(tableViewObject->verticalHeader(), QLatin1String("verticalHeader")); } ItemViewPropertySheet::~ItemViewPropertySheet() @@ -241,6 +176,24 @@ ItemViewPropertySheet::~ItemViewPropertySheet() delete d; } +void ItemViewPropertySheet::initHeaderProperties(QHeaderView *hv, const QString &prefix) +{ + QDesignerPropertySheetExtension *headerSheet = d->m_propertySheet.value(hv); + Q_ASSERT(headerSheet); + const QString headerGroupS = QLatin1String(headerGroup); + foreach (const QString &realPropertyName, d->realPropertyNames()) { + const int headerIndex = headerSheet->indexOf(realPropertyName); + Q_ASSERT(headerIndex != -1); + const QVariant defaultValue = realPropertyName == QLatin1String(visibleProperty) ? + QVariant(true) : headerSheet->property(headerIndex); + const QString fakePropertyName = d->fakePropertyName(prefix, realPropertyName); + const int fakeIndex = createFakeProperty(fakePropertyName, defaultValue); + d->m_propertyIdMap.insert(fakeIndex, Property(headerSheet, headerIndex)); + setAttribute(fakeIndex, true); + setPropertyGroup(fakeIndex, headerGroupS); + } +} + /*! Returns the mapping of fake property names to real property names */ @@ -251,19 +204,17 @@ QHash ItemViewPropertySheet::propertyNameMap() const QVariant ItemViewPropertySheet::property(int index) const { - if (d->m_propertyIdMap.contains(index)) { - Property realProperty = d->m_propertyIdMap.value(index); - return realProperty.m_sheet->property(realProperty.m_id); - } else { - return QDesignerPropertySheet::property(index); - } + const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index); + if (it != d->m_propertyIdMap.constEnd()) + return it.value().m_sheet->property(it.value().m_id); + return QDesignerPropertySheet::property(index); } void ItemViewPropertySheet::setProperty(int index, const QVariant &value) { - if (d->m_propertyIdMap.contains(index)) { - Property realProperty = d->m_propertyIdMap.value(index); - realProperty.m_sheet->setProperty(realProperty.m_id, value); + const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index); + if (it != d->m_propertyIdMap.end()) { + it.value().m_sheet->setProperty(it.value().m_id, value); } else { QDesignerPropertySheet::setProperty(index, value); } @@ -271,18 +222,46 @@ void ItemViewPropertySheet::setProperty(int index, const QVariant &value) void ItemViewPropertySheet::setChanged(int index, bool changed) { - if (d->m_propertyIdMap.contains(index)) { - Property realProperty = d->m_propertyIdMap.value(index); - realProperty.m_sheet->setChanged(realProperty.m_id, changed); + const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index); + if (it != d->m_propertyIdMap.end()) { + it.value().m_sheet->setChanged(it.value().m_id, changed); + } else { + QDesignerPropertySheet::setChanged(index, changed); } - QDesignerPropertySheet::setChanged(index, changed); +} + +bool ItemViewPropertySheet::isChanged(int index) const +{ + const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index); + if (it != d->m_propertyIdMap.constEnd()) + return it.value().m_sheet->isChanged(it.value().m_id); + return QDesignerPropertySheet::isChanged(index); +} + +bool ItemViewPropertySheet::hasReset(int index) const +{ + const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index); + if (it != d->m_propertyIdMap.constEnd()) + return it.value().m_sheet->hasReset(it.value().m_id); + return QDesignerPropertySheet::hasReset(index); } bool ItemViewPropertySheet::reset(int index) { - if (d->m_propertyIdMap.contains(index)) { - Property realProperty = d->m_propertyIdMap.value(index); - return realProperty.m_sheet->reset(realProperty.m_id); + const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index); + if (it != d->m_propertyIdMap.end()) { + QDesignerPropertySheetExtension *headerSheet = it.value().m_sheet; + const int headerIndex = it.value().m_id; + const bool resetRC = headerSheet->reset(headerIndex); + // Resetting for "visible" might fail and the stored default + // of the Widget database is "false" due to the widget not being + // visible at the time it was determined. Reset to "true" manually. + if (!resetRC && headerSheet->propertyName(headerIndex) == QLatin1String(visibleProperty)) { + headerSheet->setProperty(headerIndex, QVariant(true)); + headerSheet->setChanged(headerIndex, false); + return true; + } + return resetRC; } else { return QDesignerPropertySheet::reset(index); } diff --git a/tools/designer/src/components/formeditor/itemview_propertysheet.h b/tools/designer/src/components/formeditor/itemview_propertysheet.h index a926339..dbcd63d 100644 --- a/tools/designer/src/components/formeditor/itemview_propertysheet.h +++ b/tools/designer/src/components/formeditor/itemview_propertysheet.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE namespace qdesigner_internal { -class ItemViewPropertySheetPrivate; +struct ItemViewPropertySheetPrivate; class ItemViewPropertySheet: public QDesignerPropertySheet { @@ -69,11 +69,15 @@ public: QVariant property(int index) const; void setProperty(int index, const QVariant &value); - void setChanged(int index, bool changed); + virtual void setChanged(int index, bool changed); + virtual bool isChanged(int index) const; - bool reset(int index); + virtual bool hasReset(int index) const; + virtual bool reset(int index); private: + void initHeaderProperties(QHeaderView *hv, const QString &prefix); + ItemViewPropertySheetPrivate *d; }; -- cgit v0.12 From bf9456c5a2d8dfe9a35a2175186630cb426858ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 10 Dec 2009 17:38:30 +0100 Subject: Optimize our GL extension checks to avoid mallocs. We want to avoid any unnecessary mallocs when checking GL/GLX extensions. The GL extension string can be quite long and contain several hundred extensions. The old code forced one malloc for each extension + 1 extra malloc for the extension string itself when it was copied into the QByteArray. Reviewed-by: Kim --- src/opengl/qgl.cpp | 47 ++++++++++++++++++++++++----------------------- src/opengl/qgl_p.h | 43 +++++++++++++++++++++++++++++++++++++++++++ src/opengl/qgl_x11.cpp | 24 ++++++++++++------------ 3 files changed, 79 insertions(+), 35 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index dcf8c00..b6f8919 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4822,38 +4822,39 @@ QGLWidget::QGLWidget(QGLContext *context, QWidget *parent, void QGLExtensions::init_extensions() { - QList extensions = QByteArray(reinterpret_cast(glGetString(GL_EXTENSIONS))).split(' '); - if (extensions.contains("GL_ARB_texture_rectangle")) + QGLExtensionMatcher extensions(reinterpret_cast(glGetString(GL_EXTENSIONS))); + + if (extensions.match("GL_ARB_texture_rectangle")) glExtensions |= TextureRectangle; - if (extensions.contains("GL_ARB_multisample")) + if (extensions.match("GL_ARB_multisample")) glExtensions |= SampleBuffers; - if (extensions.contains("GL_SGIS_generate_mipmap")) + if (extensions.match("GL_SGIS_generate_mipmap")) glExtensions |= GenerateMipmap; - if (extensions.contains("GL_ARB_texture_compression")) + if (extensions.match("GL_ARB_texture_compression")) glExtensions |= TextureCompression; - if (extensions.contains("GL_EXT_texture_compression_s3tc")) + if (extensions.match("GL_EXT_texture_compression_s3tc")) glExtensions |= DDSTextureCompression; - if (extensions.contains("GL_OES_compressed_ETC1_RGB8_texture")) + if (extensions.match("GL_OES_compressed_ETC1_RGB8_texture")) glExtensions |= ETC1TextureCompression; - if (extensions.contains("GL_IMG_texture_compression_pvrtc")) + if (extensions.match("GL_IMG_texture_compression_pvrtc")) glExtensions |= PVRTCTextureCompression; - if (extensions.contains("GL_ARB_fragment_program")) + if (extensions.match("GL_ARB_fragment_program")) glExtensions |= FragmentProgram; - if (extensions.contains("GL_ARB_fragment_shader")) + if (extensions.match("GL_ARB_fragment_shader")) glExtensions |= FragmentShader; - if (extensions.contains("GL_ARB_texture_mirrored_repeat")) + if (extensions.match("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; - if (extensions.contains("GL_EXT_framebuffer_object")) + if (extensions.match("GL_EXT_framebuffer_object")) glExtensions |= FramebufferObject; - if (extensions.contains("GL_EXT_stencil_two_side")) + if (extensions.match("GL_EXT_stencil_two_side")) glExtensions |= StencilTwoSide; - if (extensions.contains("GL_EXT_stencil_wrap")) + if (extensions.match("GL_EXT_stencil_wrap")) glExtensions |= StencilWrap; - if (extensions.contains("GL_EXT_packed_depth_stencil")) + if (extensions.match("GL_EXT_packed_depth_stencil")) glExtensions |= PackedDepthStencil; - if (extensions.contains("GL_NV_float_buffer")) + if (extensions.match("GL_NV_float_buffer")) glExtensions |= NVFloatBuffer; - if (extensions.contains("GL_ARB_pixel_buffer_object")) + if (extensions.match("GL_ARB_pixel_buffer_object")) glExtensions |= PixelBufferObject; #if defined(QT_OPENGL_ES_2) glExtensions |= FramebufferObject; @@ -4861,26 +4862,26 @@ void QGLExtensions::init_extensions() glExtensions |= FragmentShader; #endif #if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) - if (extensions.contains("GL_OES_framebuffer_object")) + if (extensions.match("GL_OES_framebuffer_object")) glExtensions |= FramebufferObject; #endif #if defined(QT_OPENGL_ES) - if (extensions.contains("GL_OES_packed_depth_stencil")) + if (extensions.match("GL_OES_packed_depth_stencil")) glExtensions |= PackedDepthStencil; #endif - if (extensions.contains("GL_ARB_framebuffer_object")) { + if (extensions.match("GL_ARB_framebuffer_object")) { // ARB_framebuffer_object also includes EXT_framebuffer_blit. glExtensions |= FramebufferObject; glExtensions |= FramebufferBlit; } - if (extensions.contains("GL_EXT_framebuffer_blit")) + if (extensions.match("GL_EXT_framebuffer_blit")) glExtensions |= FramebufferBlit; - if (extensions.contains("GL_ARB_texture_non_power_of_two")) + if (extensions.match("GL_ARB_texture_non_power_of_two")) glExtensions |= NPOTTextures; - if (extensions.contains("GL_EXT_bgra")) + if (extensions.match("GL_EXT_bgra")) glExtensions |= BGRATextureFormat; } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 8a0b31f..11770d3 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -610,6 +610,49 @@ private: friend class QGLContextGroup; }; + +// This class can be used to match GL extensions with doing any mallocs. The +// class assumes that the GL extension string ends with a space character, +// which it should do on all conformant platforms. Create the object and pass +// in a pointer to the extension string, then call match() on each extension +// that should be matched. The match() function takes the extension name +// *without* the terminating space character as input. + +class QGLExtensionMatcher +{ +public: + QGLExtensionMatcher(const char *str) + : gl_extensions(str), gl_extensions_length(qstrlen(str)) + {} + + bool match(const char *str) { + int str_length = qstrlen(str); + const char *extensions = gl_extensions; + int extensions_length = gl_extensions_length; + + while (1) { + // the total length that needs to be matched is the str_length + + // the space character that terminates the extension name + if (extensions_length < str_length + 1) + return false; + if (qstrncmp(extensions, str, str_length) == 0 && extensions[str_length] == ' ') + return true; + + int split_pos = 0; + while (split_pos < extensions_length && extensions[split_pos] != ' ') + ++split_pos; + ++split_pos; // added for the terminating space character + extensions += split_pos; + extensions_length -= split_pos; + } + return false; + } + +private: + const char *gl_extensions; + int gl_extensions_length; +}; + QT_END_NAMESPACE #endif // QGL_P_H diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index a037282..9c3fc79 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -343,8 +343,8 @@ void* qglx_getProcAddress(const char* procName) static bool triedResolvingGlxGetProcAddress = false; if (!triedResolvingGlxGetProcAddress) { triedResolvingGlxGetProcAddress = true; - QList glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' '); - if (glxExt.contains("GLX_ARB_get_proc_address")) { + QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); + if (extensions.match("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); if (handle) { @@ -523,8 +523,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) if (!d->gpm) return false; } - QList glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' '); - if (glxExt.contains("GLX_SGI_video_sync")) { + QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); + if (extensions.match("GLX_SGI_video_sync")) { if (d->glFormat.swapInterval() == -1) d->glFormat.setSwapInterval(0); } else { @@ -630,8 +630,8 @@ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth) static bool useTranspExt = false; static bool useTranspExtChecked = false; if (f.plane() && !useTranspExtChecked && d->paintDevice) { - QByteArray estr(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); - useTranspExt = estr.contains("GLX_EXT_visual_info"); + QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); + useTranspExt = extensions.match("GLX_EXT_visual_info"); //# (A bit simplistic; that could theoretically be a substring) if (useTranspExt) { QByteArray cstr(glXGetClientString(xinfo->display(), GLX_VENDOR)); @@ -875,8 +875,8 @@ void QGLContext::swapBuffers() const static bool resolved = false; if (!resolved) { const QX11Info *xinfo = qt_x11Info(d->paintDevice); - QList glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' '); - if (glxExt.contains("GLX_SGI_video_sync")) { + QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); + if (extensions.match("GLX_SGI_video_sync")) { glXGetVideoSyncSGI = (qt_glXGetVideoSyncSGI)qglx_getProcAddress("glXGetVideoSyncSGI"); glXWaitVideoSyncSGI = (qt_glXWaitVideoSyncSGI)qglx_getProcAddress("glXWaitVideoSyncSGI"); } @@ -1107,8 +1107,8 @@ void *QGLContext::getProcAddress(const QString &proc) const if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QList glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' '); - if (glxExt.contains("GLX_ARB_get_proc_address")) { + QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); + if (extensions.match("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); if (handle) { @@ -1609,8 +1609,8 @@ static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice) return false; // Can't use TFP without NPOT } const QX11Info *xinfo = qt_x11Info(paintDevice); - QList glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' '); - if (glxExt.contains("GLX_EXT_texture_from_pixmap")) { + QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); + if (extensions.match("GLX_EXT_texture_from_pixmap")) { glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT"); glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT"); } -- cgit v0.12 From 14c1572d3333358682d7e5dc8a6474dbb12ae0e3 Mon Sep 17 00:00:00 2001 From: ck Date: Thu, 10 Dec 2009 18:27:04 +0100 Subject: Assistant: Add documentation for -remove-search-index. Reviewed-by: David Boddie --- doc/src/development/assistant-manual.qdoc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc index 8de500e..5a30e43 100644 --- a/doc/src/development/assistant-manual.qdoc +++ b/doc/src/development/assistant-manual.qdoc @@ -130,7 +130,7 @@ \o -collectionFile \o Uses the specified collection file instead of the default one. \row - \o -showUrl URL + \o -showUrl \o Shows the document referenced by URL. \row \o -enableRemoteControl @@ -156,7 +156,12 @@ \o Unregisters the specified compressed help file from the given collection file. \row - \o -setCurrentFilter filter + \o -remove-search-index + \o Purges the help search engine's index. This option is + useful in case the associated index files get corrupted. + \QA will re-index the documentation at the next start-up. + \row + \o -setCurrentFilter \o Sets the given filter as the active filter. \row \o -quiet -- cgit v0.12 From 3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Dec 2009 17:22:53 +0100 Subject: Prevented leak of keys in QPixmapCache. Removing a pixmap from the pixmap cache using the new QPixmapCache::Key API left the keys dangling in the QCache's internal QHash. The problem is that the Key is invalidated as soon as the QPixmapCacheEntry is destroyed, thus removing it from the hash failed. Reordering the destruction of the object and the removal of the key in QHash fixes the problem. Reviewed-by: Alexis Reviewed-by: Thiago --- src/corelib/tools/qcache.h | 2 +- src/gui/image/qpixmapcache.cpp | 5 +++++ tests/auto/qpixmapcache/tst_qpixmapcache.cpp | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 46e20b1..ee9523f 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -70,8 +70,8 @@ class QCache if (l == &n) l = n.p; if (f == &n) f = n.n; total -= n.c; - delete n.t; hash.remove(*n.keyPtr); + delete n.t; } inline T *relink(const Key &key) { typename QHash::iterator i = hash.find(key); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index b0b7d72..b7b29d7 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -424,6 +424,11 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key) Q_GLOBAL_STATIC(QPMCache, pm_cache) +int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize() +{ + return pm_cache()->size(); +} + QPixmapCacheEntry::~QPixmapCacheEntry() { pm_cache()->releaseKey(key); diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp index 9775d36..c89a182 100644 --- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp @@ -70,6 +70,7 @@ private slots: void remove(); void clear(); void pixmapKey(); + void noLeak(); }; static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key) @@ -482,5 +483,23 @@ void tst_QPixmapCache::pixmapKey() QVERIFY(!getPrivate(key8)); } +extern int q_QPixmapCache_keyHashSize(); + +void tst_QPixmapCache::noLeak() +{ + QPixmapCache::Key key; + + int oldSize = q_QPixmapCache_keyHashSize(); + for (int i = 0; i < 100; ++i) { + QPixmap pm(128, 128); + pm.fill(Qt::transparent); + key = QPixmapCache::insert(pm); + QPixmapCache::remove(key); + } + int newSize = q_QPixmapCache_keyHashSize(); + + QCOMPARE(oldSize, newSize); +} + QTEST_MAIN(tst_QPixmapCache) #include "tst_qpixmapcache.moc" -- cgit v0.12 From 343de9228ae65c36c4a9a45297d45cdeb04a8e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 11 Dec 2009 11:06:03 +0100 Subject: Fixed qgraphicseffectsource autotest. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent crashing when asking for a source pixmap in logical coordinates and PadToEffectiveBoundingRect mode. Also, change the expected values for the test that uses LogicalCoordinates and PadToEffectiveBoundingRect mode to reflect that the boundingRectFor() function applies padding in device coordinates (and in this case there is a scale by 2 when drawing the effect). Reviewed-by: Bjørn Erik Nilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 11 ++++++++--- .../auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 8bbe929..c879c5c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10684,9 +10684,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP QRectF effectRectF; if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { - effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates)); - if (system == Qt::LogicalCoordinates) - effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF); + if (info) { + effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates)); + if (info && system == Qt::LogicalCoordinates) + effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF); + } else { + // no choice but to send a logical coordinate bounding rect to boundingRectFor + effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect); + } } else if (mode == QGraphicsEffect::PadToTransparentBorder) { // adjust by 1.5 to account for cosmetic pens effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5); diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 9991ab4..7a0d40a 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -352,7 +352,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates) << int(QGraphicsEffect::PadToEffectiveBoundingRect) - << QSize(30, 30) << QPoint(-10, -10) + << QSize(20, 20) << QPoint(-5, -5) << 0x00000000u; QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates) -- cgit v0.12 From 664c78144754c499d07a95c3914fd34202bf4b98 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 11 Dec 2009 12:05:00 +0100 Subject: Initial documentation for the performance characteristics of QPainter. Reviewed-by: Tom --- src/gui/painting/qpainter.cpp | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 66bf4f7..13d9a04 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1317,6 +1317,84 @@ void QPainterPrivate::updateState(QPainterState *newState) Another workaround is to convert the paths to polygons first and then draw the polygons instead. + \section1 Performance + + QPainter is a rich framework that allows developers to do a great + variety of graphical operations, such as gradients, composition + modes and vector graphcis. And QPainter can do this across a + variety of different hardware and software stack. Naturally the + underlying combination of hardware and software has some + implications for performance, and ensuring that every single + operation is fast in combination with all the various combinations + of composition modes, brushes, clipping, transformation, etc, is + close to an impossible task because of the number of + permutations. As a compromise we have selected a subset of the + QPainter API and backends, were performance is guaranteed to be as + good as we can sensibly get it for the given combination of + hardware and software. + + The backends we focus on as high-performance engines are: + + \list + + \o Raster - This backend implements all rendering in pure software + and is always used to render into QImages. For optimal performance + only use the format types QImage::Format_ARGB32_Premultiplied, + QImage::Format_RGB32 or QImage::Format_RGB16. Any other format, + including QImage::Format_ARGB32, has significantly worse + performance. This engine is also used by default on Windows and on + QWS. It can be used as default graphics system on any + OS/hardware/software combination by passing \c {-graphcissystem + raster} on the command line + + \o OpenGL 2.0 (ES) - This backend is the primary backend for + hardware accellerated graphics. It can be run on desktop machines + and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0 + spesification. This includes most graphics chips produced in the + last couple of years. The engine can be enabled by using QPainter + onto a QGLWidget or by passing \c {-graphicssystem opengl} on the + command line when the underlying system supports it. + + \endlist + + These operations are: + + \list + + \o Simple transformations, meaning translation and scaling, pluss + 0, 90, 180, 270 degree rotations. + + \o \c drawPixmap() in combination with simple transformations and + opacity with non-smooth transformation mode + (\c QPainter::SmoothPixmapTransform not enabled as a render hint); + + \o Text drawing with regular font sizes with simple + transformations with solid colors using no or 8-bit antialiasing. + + \o Rectangle fills with solid color, two-color linear gradients + and simple transforms. + + \o Rectangular clipping with simple transformations and intersect + clip. + + \o Composition Modes \c QPainter::CompositionMode_Source and + QPainter::CompositionMode_SourceOver + + \o Rounded rectangle filling using solid color and two-color + linear gradients fills. + + \o 3x3 patched pixmaps, via qDrawBorderPixmap. + + \endlist + + This list gives an indication of which features to safely use in + an application where performance is critical. For certain setups, + other operations may be fast too, but before making extensive use + of them, it is recommended to benchmark and verify them on the + system where the software will run in the end. There are also + cases where expensive operations are ok to use, for instance when + the result is cached in a QPixmap. + \sa QPaintDevice, QPaintEngine, {QtSvg Module}, {Basic Drawing Example}, {Drawing Utility Functions} */ -- cgit v0.12 From 8a09d0dfe1010a4b56afa448ff9ee7bb9bdd7427 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 11 Dec 2009 13:03:17 +0200 Subject: Made QFile benchmark compile and run for Symbian - Temporary files need to be deleted after each test, as there is no space to have several 40MB files on typical device. - Read buffer must be allocated dynamically, as Symbian devices have limited stack. - Moved metatype declarations to proper place - Changed _exit() -> exit() - Removed assert from around mkdir - dir creation fails if dir exists, and dir was not created in release builds. - Added QDir::Files to readSmallFiles test directory filter to actually find the files to read. - Fixed filenames to absolute in readSmallFiles test so that it'll find the files even if they are not in current dir. - Write a linefeed to the end of each created file in createSmallFiles, so that the files created have proper size - Only create 1/10th of files in createSmallFiles for Symbian to speed up the test to bearable level. - Added missing ::flose() call to QFileFromPosixBenchmark of open(). - Skipped Windows specific tests on non-Windows platform as just failing them left temporary files to disk Task-number: QTBUG-6593 Reviewed-by: MariusSO --- tests/benchmarks/qfile/main.cpp | 58 +++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/tests/benchmarks/qfile/main.cpp b/tests/benchmarks/qfile/main.cpp index d3f6ab5..4217077 100644 --- a/tests/benchmarks/qfile/main.cpp +++ b/tests/benchmarks/qfile/main.cpp @@ -128,12 +128,18 @@ private: QString tmpDirName; }; +Q_DECLARE_METATYPE(tst_qfile::BenchmarkType) +Q_DECLARE_METATYPE(QIODevice::OpenMode) +Q_DECLARE_METATYPE(QIODevice::OpenModeFlag) + void tst_qfile::createFile() { + removeFile(); // Cleanup in case previous test case aborted before cleaning up + QTemporaryFile tmpFile; tmpFile.setAutoRemove(false); if (!tmpFile.open()) - ::_exit(1); + ::exit(1); filename = tmpFile.fileName(); tmpFile.close(); } @@ -217,7 +223,6 @@ void tst_qfile::readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t, for (int i=0; i fileList; Q_FOREACH(QString file, files) { - QFile *f = new QFile(file); + QFile *f = new QFile(tmpDirName+ "/" + file); f->open(QIODevice::ReadOnly|textMode|bufferedMode); fileList.append(f); } @@ -576,7 +601,7 @@ void tst_qfile::readSmallFiles() case(QFSFileEngineBenchmark): { QList fileList; Q_FOREACH(QString file, files) { - QFSFileEngine *fse = new QFSFileEngine(file); + QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file); fse->open(QIODevice::ReadOnly|textMode|bufferedMode); fileList.append(fse); } @@ -596,7 +621,7 @@ void tst_qfile::readSmallFiles() case(PosixBenchmark): { QList fileList; Q_FOREACH(QString file, files) { - fileList.append(::fopen(QFile::encodeName(file).constData(), "rb")); + fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb")); } QBENCHMARK { @@ -640,11 +665,10 @@ void tst_qfile::readSmallFiles() } break; } -} -Q_DECLARE_METATYPE(tst_qfile::BenchmarkType) -Q_DECLARE_METATYPE(QIODevice::OpenMode) -Q_DECLARE_METATYPE(QIODevice::OpenModeFlag) + removeSmallFiles(); + delete[] buffer; +} QTEST_MAIN(tst_qfile) -- cgit v0.12 From ce9a43bd8b72f8820639fa89d628e303583f4090 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 11 Dec 2009 14:08:34 +0200 Subject: QS60Style: Slider groove is incorrect Style uses just a line as slider groove, when S60 provides themed graphics for it as well. Task-number: QTBUG-6723 Reviewed-by: Janne Koskinen --- src/gui/styles/qs60style.cpp | 35 ++++++++++++++++++++++++----------- src/gui/styles/qs60style_p.h | 5 +++++ src/gui/styles/qs60style_s60.cpp | 38 +++++++++++++++++++++----------------- 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 18ad44d..536b6ad 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -204,6 +204,13 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, break; case SE_SliderHandleVertical: drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointEast); + case SE_SliderGrooveVertical: + drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle, + QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Vertical, painter, rect, flags | SF_PointEast); + break; + case SE_SliderGrooveHorizontal: + drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle, + QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Horizontal, painter, rect, flags | SF_PointNorth); break; case SE_TabBarTabEastActive: drawRow(QS60StyleEnums::SP_QgnGrafTabActiveL, QS60StyleEnums::SP_QgnGrafTabActiveM, @@ -807,7 +814,12 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag //ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones). result.setWidth(result.height()>>1); break; - case QS60StyleEnums::SP_QgnIndiSliderEdit: + + case QS60StyleEnums::SP_QgnGrafNsliderEndLeft: + case QS60StyleEnums::SP_QgnGrafNsliderEndRight: + case QS60StyleEnums::SP_QgnGrafNsliderMiddle: + result.setWidth(result.height()>>1); + break; result.scale(pixelMetric(QStyle::PM_SliderLength), pixelMetric(QStyle::PM_SliderControlThickness), Qt::IgnoreAspectRatio); break; @@ -928,19 +940,20 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom case CC_Slider: if (const QStyleOptionSlider *optionSlider = qstyleoption_cast(option)) { - // The groove is just a centered line. Maybe a qgn_graf_line_* at some point const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget); - const QPoint sliderGrooveCenter = sliderGroove.center(); const bool horizontal = optionSlider->orientation == Qt::Horizontal; - painter->save(); - if (widget) - painter->setPen(widget->palette().windowText().color()); - if (horizontal) - painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y()); - else - painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom()); - painter->restore(); + //Highlight +/* if (optionSlider->state & QStyle::State_HasFocus) + drawPrimitive(PE_FrameFocusRect, optionSlider, painter, widget);*/ + + //Groove graphics + const QS60StylePrivate::SkinElements grooveElement = horizontal ? + QS60StylePrivate::SE_SliderGrooveHorizontal : + QS60StylePrivate::SE_SliderGrooveVertical; + QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags); + + //Handle graphics const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget); const QS60StylePrivate::SkinElements handleElement = horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index eed66dc..b0982e4 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -119,6 +119,9 @@ public: SP_QgnGrafTabPassiveL, SP_QgnGrafTabPassiveM, SP_QgnGrafTabPassiveR, + SP_QgnGrafNsliderEndLeft, + SP_QgnGrafNsliderEndRight, + SP_QgnGrafNsliderMiddle, SP_QgnIndiCheckboxOff, SP_QgnIndiCheckboxOn, SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later. @@ -313,6 +316,8 @@ public: SE_ScrollBarHandleVertical, SE_SliderHandleHorizontal, SE_SliderHandleVertical, + SE_SliderGrooveVertical, + SE_SliderGrooveHorizontal, SE_TabBarTabEastActive, SE_TabBarTabEastInactive, SE_TabBarTabNorthActive, diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index fbea644..f8bc6da 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -128,23 +128,27 @@ private: }; const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { - /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1}, - /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1}, - /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1}, - /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDQgnGrafNsliderEndLeft, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafNsliderEndRight */ {KAknsIIDQgnGrafNsliderEndRight, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafNsliderMiddle */ {KAknsIIDQgnGrafNsliderMiddle, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1}, + // Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2. // In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI. /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */}, -- cgit v0.12 From 57a4d8279a64a7844c2a2bf2b45846563c4c3eb5 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 11 Dec 2009 14:12:16 +0200 Subject: QS60Style: Style does not support pressed state for sliders Currently there is no visual clue that slider is "sunken" (pressed state). There is S60 theme graphic for it, so lets use it. Task-number: QTBUG-6722 Reviewed-by: Janne Koskinen --- src/gui/styles/qs60style.cpp | 23 ++++++++++++++--- src/gui/styles/qs60style_p.h | 5 +++- src/gui/styles/qs60style_s60.cpp | 54 +++++++++++++++++++++------------------- 3 files changed, 52 insertions(+), 30 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 536b6ad..f33ad5d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -200,10 +200,17 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, QS60StyleEnums::SP_QsnCpScrollHandleBottom, Qt::Vertical, painter, rect, flags | SF_PointNorth); break; case SE_SliderHandleHorizontal: - drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointNorth); + drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointNorth); break; case SE_SliderHandleVertical: - drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointEast); + drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointEast); + break; + case SE_SliderHandleSelectedHorizontal: + drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointNorth); + break; + case SE_SliderHandleSelectedVertical: + drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointEast); + break; case SE_SliderGrooveVertical: drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle, QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Vertical, painter, rect, flags | SF_PointEast); @@ -820,6 +827,9 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag case QS60StyleEnums::SP_QgnGrafNsliderMiddle: result.setWidth(result.height()>>1); break; + + case QS60StyleEnums::SP_QgnGrafNsliderMarker: + case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected: result.scale(pixelMetric(QStyle::PM_SliderLength), pixelMetric(QStyle::PM_SliderControlThickness), Qt::IgnoreAspectRatio); break; @@ -955,8 +965,13 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom //Handle graphics const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget); - const QS60StylePrivate::SkinElements handleElement = - horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; + QS60StylePrivate::SkinElements handleElement; + if (optionSlider->state & QStyle::State_Sunken) + handleElement = + horizontal ? QS60StylePrivate::SE_SliderHandleSelectedHorizontal : QS60StylePrivate::SE_SliderHandleSelectedVertical; + else + handleElement = + horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags); } break; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index b0982e4..ab17e2a 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -134,7 +134,8 @@ public: SP_QgnIndiNaviArrowRight, SP_QgnIndiRadiobuttOff, SP_QgnIndiRadiobuttOn, - SP_QgnIndiSliderEdit, + SP_QgnGrafNsliderMarker, + SP_QgnGrafNsliderMarkerSelected, SP_QgnIndiSubMenu, SP_QgnNoteErased, SP_QgnNoteError, @@ -316,6 +317,8 @@ public: SE_ScrollBarHandleVertical, SE_SliderHandleHorizontal, SE_SliderHandleVertical, + SE_SliderHandleSelectedHorizontal, + SE_SliderHandleSelectedVertical, SE_SliderGrooveVertical, SE_SliderGrooveHorizontal, SE_TabBarTabEastActive, diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index f8bc6da..49d8017 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -151,29 +151,30 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { // Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2. // In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI. - /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */}, - /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */}, - /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */}, - /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */}, - /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */}, - /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */}, + /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */}, + /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */}, + /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */}, + /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */}, + /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnGrafNsliderMarker, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnGrafNsliderMarkerSelected, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1}, // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead. /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/ @@ -435,8 +436,11 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style case QS60StyleEnums::SP_QgnIndiRadiobuttOn: fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on; break; - case QS60StyleEnums::SP_QgnIndiSliderEdit: - fallbackIndex = EMbmAvkonQgn_indi_slider_edit; + case QS60StyleEnums::SP_QgnGrafNsliderMarker: + fallbackIndex = EMbmAvkonQgn_graf_nslider_marker; + break; + case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected: + fallbackIndex = EMbmAvkonQgn_graf_nslider_marker_selected; break; case QS60StyleEnums::SP_QgnIndiSubMenu: fallbackIndex = EMbmAvkonQgn_indi_submenu; -- cgit v0.12 From dacbb8b055815f629e2eeccdb7d4ca4cc5a2f839 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 11 Dec 2009 14:10:11 +0100 Subject: Update Polish translations --- translations/designer_pl.ts | 74 ++++++++++++++++++++++----------------------- translations/qt_pl.ts | 24 +++++++-------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/translations/designer_pl.ts b/translations/designer_pl.ts index 005ad5a4..acd1827 100644 --- a/translations/designer_pl.ts +++ b/translations/designer_pl.ts @@ -1050,7 +1050,7 @@ Preview Zoom - Powiększenie podglądu + Powiększanie podglądu @@ -1259,7 +1259,7 @@ Show this Dialog on Startup - Pokaż to okno przy uruchamianiu + Pokazuj to okno przy uruchamianiu @@ -1594,7 +1594,7 @@ Skrypt: %3 Edit Widgets - Edytuj widżety + Modyfikuj widżety @@ -1803,7 +1803,7 @@ Czy chcesz zaktualizować położenie pliku lub wygenerować nowy formularz? &Print... - Wy&drukuj... + &Drukuj... @@ -2669,7 +2669,7 @@ Strony pojemników powinny być dodawane jedynie poprzez wyspecyfikowanie ich w Edit Gradient - Edytuj gradient + Modyfikuj gradient @@ -3042,7 +3042,7 @@ Strony pojemników powinny być dodawane jedynie poprzez wyspecyfikowanie ich w Edit... - Edytuj... + Modyfikuj... @@ -3499,7 +3499,7 @@ jako: Edit Resources... - Edytuj zasoby... + Modyfikuj zasoby... @@ -3961,12 +3961,12 @@ Czy chcesz nadpisać szablon? Edit action - Edytuj akcję + Modyfikuj akcję Edit... - Edytuj... + Modyfikuj... @@ -4126,7 +4126,7 @@ Czy chcesz nadpisać szablon? Edit Buddies - Edytuj skojarzone etykiety + Modyfikuj skojarzone etykiety @@ -4134,7 +4134,7 @@ Czy chcesz nadpisać szablon? Edit Buddies - Edytuj skojarzone etykiety + Modyfikuj skojarzone etykiety @@ -4254,7 +4254,7 @@ Czy chcesz nadpisać szablon? Edit Items... - Edytuj elementy... + Modyfikuj elementy... @@ -4653,7 +4653,7 @@ Czy chcesz nadpisać szablon? Edit the selected profile - Edytuj zaznaczony profil + Modyfikuj zaznaczony profil @@ -4673,7 +4673,7 @@ Czy chcesz nadpisać szablon? Edit Profile - Edytuj profil + Modyfikuj profil @@ -4725,7 +4725,7 @@ Czy chcesz nadpisać szablon? Edit contents - Edytuj zawartość + Modyfikuj zawartość @@ -5290,12 +5290,12 @@ Czy chcesz nadpisać szablon? Edit List Widget - Edytuj listę + Modyfikuj listę Edit Combobox - Edytuj combobox + Modyfikuj combobox @@ -5303,7 +5303,7 @@ Czy chcesz nadpisać szablon? Edit Items... - Edytuj elementy... + Modyfikuj elementy... @@ -5608,7 +5608,7 @@ Wybierz inną nazwę. Edit Palette - Edytuj paletę + Modyfikuj paletę @@ -5716,7 +5716,7 @@ Wybierz inną nazwę. Edit text - Edytuj tekst + Modyfikuj tekst @@ -6196,12 +6196,12 @@ Klasa: %2 Edit ToolTip - Edytuj podpowiedź + Modyfikuj podpowiedź Edit WhatsThis - Edytuj "Co to jest" + Modyfikuj "Co to jest" @@ -6326,7 +6326,7 @@ Klasa: %2 Edit text - Edytuj tekst + Modyfikuj tekst @@ -6427,7 +6427,7 @@ Klasa: %2 Edit script - Edytuj skrypt + Modyfikuj skrypt @@ -6477,7 +6477,7 @@ Klasa: %2 Edit Signals/Slots - Edytuj sygnały/sloty + Modyfikuj sygnały/sloty @@ -6490,7 +6490,7 @@ Klasa: %2 Edit Signals/Slots - Edytuj sygnały/sloty + Modyfikuj sygnały/sloty @@ -6514,7 +6514,7 @@ Klasa: %2 Edit Style Sheet - Edytuj arkusz stylu + Modyfikuj arkusz stylu @@ -6581,7 +6581,7 @@ Klasa: %2 Edit Tab Order - Edytuj kolejność tabulacji + Modyfikuj kolejność tabulacji @@ -6589,7 +6589,7 @@ Klasa: %2 Edit Tab Order - Edytuj kolejność tabulacji + Modyfikuj kolejność tabulacji @@ -6597,7 +6597,7 @@ Klasa: %2 Edit Table Widget - Edytuj tablę + Modyfikuj tablę @@ -6646,7 +6646,7 @@ Klasa: %2 Edit Items... - Edytuj elementy... + Modyfikuj elementy... @@ -6682,12 +6682,12 @@ Klasa: %2 Edit HTML - Edytuj HTML + Modyfikuj HTML Edit Text - Edytuj tekst + Modyfikuj tekst @@ -6751,7 +6751,7 @@ Klasa: %2 Edit Tree Widget - Edytuj drzewo + Modyfikuj drzewo @@ -6877,7 +6877,7 @@ Klasa: %2 Edit Items... - Edytuj elementy... + Modyfikujj elementy... @@ -6928,7 +6928,7 @@ Klasa: %2 Edit name - Edytuj nazwę + Modyfikuj nazwę @@ -6944,7 +6944,7 @@ Klasa: %2 Edit Widgets - Edytuj widżety + Modyfikuj widżety diff --git a/translations/qt_pl.ts b/translations/qt_pl.ts index 6368b8f..fabec70 100644 --- a/translations/qt_pl.ts +++ b/translations/qt_pl.ts @@ -3940,12 +3940,12 @@ Proszę o sprawdzenie podanej nazwy pliku. Print all - Wydrukuj wszystko + Drukuj wszystko Print range - Wydrukuj zakres + Drukuj zakres @@ -3993,12 +3993,12 @@ Proszę o sprawdzenie podanej nazwy pliku. Print - Wydrukuj + Drukowanie Print To File ... - Wydrukuj do pliku ... + Drukuj do pliku ... @@ -4034,7 +4034,7 @@ Proszę wybrać inną nazwę pliku. Print selection - Wydrukuj zaznaczone + Drukuj zaznaczone @@ -4200,7 +4200,7 @@ Proszę wybrać inną nazwę pliku. &Print - &Drukuj + Wy&drukuj @@ -4210,12 +4210,12 @@ Proszę wybrać inną nazwę pliku. Print to File (PDF) - Wydrukuj do pliku (PDF) + Drukuj do pliku (PDF) Print to File (Postscript) - Wydrukuj do pliku (Postscript) + Drukuj do pliku (Postscript) @@ -4243,7 +4243,7 @@ Proszę wybrać inną nazwę pliku. Print Preview - Wydrukuj podgląd + Podgląd wydruku @@ -4370,12 +4370,12 @@ Proszę wybrać inną nazwę pliku. Print range - Wydrukuj zakres + Zakres wydruku Print all - Wydrukuj wszystko + Drukuj wszystko @@ -6078,7 +6078,7 @@ Proszę wybrać inną nazwę pliku. Print - Print + Wydrukuj -- cgit v0.12 From 69e8626652aa85d64d4a3fd9e88cfc71b4e5baed Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 11 Dec 2009 13:59:54 +0100 Subject: Slow spinbox on N95 when using keys Up/Down In the style demo, spinbox widget, we noticed that to go from 0 to 99 , with key Up, takes 35 seconds. This was too slow. It turned out that no acceleration has been implementd when using keyboard, although acceleration works when mouse used. We fixed this by using timer events, as it is the case for mouse events. We also needed to get what is the keyboard repat rate interval from system. This value is used to set timer intervals in more natural way. Task-number: QT-927 Reviewed-by: janarve --- src/gui/widgets/qabstractspinbox.cpp | 67 ++++++++++++++++++++++++++++++------ src/gui/widgets/qabstractspinbox_p.h | 3 +- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index a18af4f..8257a16 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -65,6 +65,11 @@ #include #endif +#if defined(Q_OS_SYMBIAN) +#include +#include +#endif + //#define QABSTRACTSPINBOX_QSBDEBUG #ifdef QABSTRACTSPINBOX_QSBDEBUG # define QASBDEBUG qDebug @@ -939,10 +944,12 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) d->edit->setCursorPosition(d->prefix.size()); int steps = 1; + bool isPgUpOrDown = false; switch (event->key()) { case Qt::Key_PageUp: case Qt::Key_PageDown: steps *= 10; + isPgUpOrDown = true; case Qt::Key_Up: case Qt::Key_Down: { #ifdef QT_KEYPAD_NAVIGATION @@ -964,7 +971,13 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) { d->buttonState = (Keyboard | (up ? Up : Down)); } - stepBy(steps); + if (d->spinClickTimerId == -1) + stepBy(steps); + if(event->isAutoRepeat() && !isPgUpOrDown) { + if(d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) { + d->updateState(up, true); + } + } #ifndef QT_NO_ACCESSIBILITY QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged); #endif @@ -1061,8 +1074,7 @@ void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event) { Q_D(QAbstractSpinBox); - if (d->buttonState & Keyboard && !event->isAutoRepeat() - && style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) { + if (d->buttonState & Keyboard && !event->isAutoRepeat()) { d->reset(); } else { d->edit->event(event); @@ -1148,6 +1160,36 @@ void QAbstractSpinBox::hideEvent(QHideEvent *event) QWidget::hideEvent(event); } + +/*! + \internal + + Used when acceleration is turned on. We need to get the + keyboard auto repeat rate from OS. This value is used as + argument when starting acceleration related timers. + + Every platform should, either, use native calls to obtain + the value or hard code some reasonable rate. + + Remember that time value should be given in msecs. +*/ +static int getKeyboardAutoRepeatRate() { + int ret = 30; +#if defined(Q_OS_SYMBIAN) + TTimeIntervalMicroSeconds32 initialTime; + TTimeIntervalMicroSeconds32 time; + S60->wsSession().GetKeyboardRepeatRate(initialTime, time); + ret = time.Int() / 1000; // msecs +#elif defined(Q_OS_WIN) + DWORD time; + if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &time, 0) != FALSE) + ret = static_cast(1000 / static_cast(time)); // msecs +#else +#pragma message("Using default guesstimated value for keyboard repeat rate") +#endif + return ret; // msecs +} + /*! \reimp */ @@ -1160,14 +1202,17 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event) if (event->timerId() == d->spinClickThresholdTimerId) { killTimer(d->spinClickThresholdTimerId); d->spinClickThresholdTimerId = -1; - d->spinClickTimerId = startTimer(d->spinClickTimerInterval); + d->effectiveSpinRepeatRate = d->buttonState & Keyboard + ? getKeyboardAutoRepeatRate() + : d->spinClickTimerInterval; + d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate); doStep = true; } else if (event->timerId() == d->spinClickTimerId) { if (d->accelerate) { - d->acceleration = d->acceleration + (int)(d->spinClickTimerInterval * 0.05); - if (d->spinClickTimerInterval - d->acceleration >= 10) { + d->acceleration = d->acceleration + (int)(d->effectiveSpinRepeatRate * 0.05); + if (d->effectiveSpinRepeatRate - d->acceleration >= 10) { killTimer(d->spinClickTimerId); - d->spinClickTimerId = startTimer(d->spinClickTimerInterval - d->acceleration); + d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate - d->acceleration); } } doStep = true; @@ -1308,8 +1353,8 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event) QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate() : edit(0), type(QVariant::Invalid), spinClickTimerId(-1), spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1), - buttonState(None), cachedText(QLatin1String("\x01")), cachedState(QValidator::Invalid), - pendingEmit(false), readOnly(false), wrapping(false), + effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")), + cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false), ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true), cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue), acceleration(0), hoverControl(QStyle::SC_None), buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0) @@ -1554,7 +1599,7 @@ void QAbstractSpinBoxPrivate::reset() Updates the state of the spinbox. */ -void QAbstractSpinBoxPrivate::updateState(bool up) +void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false */) { Q_Q(QAbstractSpinBox); if ((up && (buttonState & Up)) || (!up && (buttonState & Down))) @@ -1563,7 +1608,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up) if (q && (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled : QAbstractSpinBox::StepDownEnabled))) { spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); - buttonState = (up ? (Mouse | Up) : (Mouse | Down)); + buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse); q->stepBy(up ? 1 : -1); #ifndef QT_NO_ACCESSIBILITY QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged); diff --git a/src/gui/widgets/qabstractspinbox_p.h b/src/gui/widgets/qabstractspinbox_p.h index 3020cbc..55f94d7 100644 --- a/src/gui/widgets/qabstractspinbox_p.h +++ b/src/gui/widgets/qabstractspinbox_p.h @@ -98,7 +98,7 @@ public: void init(); void reset(); - void updateState(bool up); + void updateState(bool up, bool fromKeyboard = false); QString stripped(const QString &text, int *pos = 0) const; bool specialValue() const; virtual QVariant getZeroVariant() const; @@ -129,6 +129,7 @@ public: QVariant value, minimum, maximum, singleStep; QVariant::Type type; int spinClickTimerId, spinClickTimerInterval, spinClickThresholdTimerId, spinClickThresholdTimerInterval; + int effectiveSpinRepeatRate; uint buttonState; mutable QString cachedText; mutable QVariant cachedValue; -- cgit v0.12 From d8b7b7278987462791488f756edd26842d059074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 11 Dec 2009 14:23:34 +0100 Subject: Fixed invalid read in QCache::unlink after recent change. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to store a pointer to the object in order to delete it later, since the node containing the pointer will be deleted when removing it from the hash. Reviewed-by: Jan-Arve Sæther --- src/corelib/tools/qcache.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index ee9523f..086a52f 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -70,8 +70,9 @@ class QCache if (l == &n) l = n.p; if (f == &n) f = n.n; total -= n.c; + T *object = n.t; hash.remove(*n.keyPtr); - delete n.t; + delete object; } inline T *relink(const Key &key) { typename QHash::iterator i = hash.find(key); -- cgit v0.12 From d1fd7e611651bea5497048c8f16df8de9618f6ba Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 11 Dec 2009 15:35:57 +0200 Subject: QS60Style: Groove changes caused build break of S60 3.1 3.1 does not have theme graphics IDs that we use in style, so it cannot be compiled in 3.1. As a fallback, 3.1 will use the previous method of drawing a slider. Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 22 ++++++++++++++++++---- src/gui/styles/qs60style_p.h | 1 + src/gui/styles/qs60style_s60.cpp | 19 ++++++++++++------- src/gui/styles/qs60style_simulated.cpp | 5 +++++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f33ad5d..17db53d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -958,10 +958,24 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom drawPrimitive(PE_FrameFocusRect, optionSlider, painter, widget);*/ //Groove graphics - const QS60StylePrivate::SkinElements grooveElement = horizontal ? - QS60StylePrivate::SE_SliderGrooveHorizontal : - QS60StylePrivate::SE_SliderGrooveVertical; - QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags); + if (QS60StylePrivate::hasSliderGrooveGraphic()) { + const QS60StylePrivate::SkinElements grooveElement = horizontal ? + QS60StylePrivate::SE_SliderGrooveHorizontal : + QS60StylePrivate::SE_SliderGrooveVertical; + QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags); + } else { + const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget); + const QPoint sliderGrooveCenter = sliderGroove.center(); + const bool horizontal = optionSlider->orientation == Qt::Horizontal; + painter->save(); + if (widget) + painter->setPen(widget->palette().windowText().color()); + if (horizontal) + painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y()); + else + painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom()); + painter->restore(); + } //Handle graphics const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index ab17e2a..65d7574 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -411,6 +411,7 @@ public: static bool isTouchSupported(); static bool isToolBarBackground(); + static bool hasSliderGrooveGraphic(); // calculates average color based on button skin graphics (minus borders). QColor colorFromFrameGraphics(SkinFrameElements frame) const; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 49d8017..48a6801 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -143,9 +143,9 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDQgnGrafNsliderEndLeft, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafNsliderEndRight */ {KAknsIIDQgnGrafNsliderEndRight, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafNsliderMiddle */ {KAknsIIDQgnGrafNsliderMiddle, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19cf /* KAknsIIDQgnGrafNsliderEndLeft */}, + /* SP_QgnGrafNsliderEndRight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d0 /* KAknsIIDQgnGrafNsliderEndRight */}, + /* SP_QgnGrafNsliderMiddle */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d2 /* KAknsIIDQgnGrafNsliderMiddle */}, /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1}, @@ -161,8 +161,8 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnGrafNsliderMarker, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnGrafNsliderMarkerSelected, EDrawIcon, ES60_All, -1,-1}, + /* SP_QgnGrafNsliderMarker */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */}, + /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */}, /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1}, @@ -437,10 +437,10 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on; break; case QS60StyleEnums::SP_QgnGrafNsliderMarker: - fallbackIndex = EMbmAvkonQgn_graf_nslider_marker; + fallbackIndex = 17572; /* EMbmAvkonQgn_graf_nslider_marker */ break; case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected: - fallbackIndex = EMbmAvkonQgn_graf_nslider_marker_selected; + fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */ break; case QS60StyleEnums::SP_QgnIndiSubMenu: fallbackIndex = EMbmAvkonQgn_indi_submenu; @@ -595,6 +595,11 @@ bool QS60StylePrivate::isToolBarBackground() return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); } +bool QS60StylePrivate::hasSliderGrooveGraphic() +{ + return QSysInfo::s60Version() != QSysInfo::SV_S60_3_1; +} + QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) { CCoeControl *control = targetWidget->effectiveWinId(); diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 55d5771..e49854f 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -337,6 +337,11 @@ bool QS60StylePrivate::isToolBarBackground() return true; } +bool QS60StylePrivate::hasSliderGrooveGraphic() +{ + return false; +} + QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) { QFont result; -- cgit v0.12 From bf8e5ae8b05d8e6efeaa36c1c556a4b2f52ffed1 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 11 Dec 2009 15:46:57 +0200 Subject: QS60Style: Theme graphics for QSlider in 3.1 These were missed from previous fix. Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style_s60.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 48a6801..d5b3f73 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -143,6 +143,8 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1}, + + // In 3.1 there is no slider groove. /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19cf /* KAknsIIDQgnGrafNsliderEndLeft */}, /* SP_QgnGrafNsliderEndRight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d0 /* KAknsIIDQgnGrafNsliderEndRight */}, /* SP_QgnGrafNsliderMiddle */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d2 /* KAknsIIDQgnGrafNsliderMiddle */}, @@ -161,8 +163,10 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1}, - /* SP_QgnGrafNsliderMarker */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */}, - /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */}, + + // In 3.1 there different slider graphic and no pressed state. + /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */}, + /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */}, /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1}, -- cgit v0.12 From 8f28b68bcd1e18529ebece8c94133443b925ebab Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 11 Dec 2009 15:03:19 +0100 Subject: qreal-ization In some places we do have direct math related calls. Almost all are calling the double precision functions even if the args and results are float. This leads to unnecessary float->double and double->float transitions. By using wrapper functions we can control which functrion variants are effectively called. Task-number: QTBUG-4894 Reviewed-by: Shane Kearns --- src/corelib/tools/qline.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index d0afb7a..8112757 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -574,7 +574,7 @@ qreal QLineF::angle() const const qreal dx = pt2.x() - pt1.x(); const qreal dy = pt2.y() - pt1.y(); - const qreal theta = atan2(-dy, dx) * 360.0 / M_2PI; + const qreal theta = qAtan2(-dy, dx) * 360.0 / M_2PI; const qreal theta_normalized = theta < 0 ? theta + 360 : theta; @@ -814,7 +814,7 @@ qreal QLineF::angle(const QLineF &l) const qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length()); qreal rad = 0; // only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases) - if (cos_line >= -1.0 && cos_line <= 1.0) rad = acos( cos_line ); + if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line ); return rad * 360 / M_2PI; } -- cgit v0.12 From 5b7e896355f555cc24ee1d181f622aa2856db0fc Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 11 Dec 2009 15:35:40 +0100 Subject: qreal-ization Using math wrapper functions instead direct call. This gives us top-level control to what (single/double) precision we are effectively using. Task-number: QTBUG-4894 Reviewed-by: janarve --- src/3rdparty/easing/easing.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/easing/easing.cpp b/src/3rdparty/easing/easing.cpp index 81af40f..7d70a4d 100644 --- a/src/3rdparty/easing/easing.cpp +++ b/src/3rdparty/easing/easing.cpp @@ -252,7 +252,7 @@ static qreal easeOutInQuint(qreal t) */ static qreal easeInSine(qreal t) { - return (t == 1.0) ? 1.0 : -::cos(t * M_PI_2) + 1.0; + return (t == 1.0) ? 1.0 : -::qCos(t * M_PI_2) + 1.0; } /** @@ -263,7 +263,7 @@ static qreal easeInSine(qreal t) */ static qreal easeOutSine(qreal t) { - return ::sin(t* M_PI_2); + return ::qSin(t* M_PI_2); } /** @@ -274,7 +274,7 @@ static qreal easeOutSine(qreal t) */ static qreal easeInOutSine(qreal t) { - return -0.5 * (::cos(M_PI*t) - 1); + return -0.5 * (::qCos(M_PI*t) - 1); } /** @@ -397,15 +397,15 @@ static qreal easeInElastic_helper(qreal t, qreal b, qreal c, qreal d, qreal a, q if (t_adj==1) return b+c; qreal s; - if(a < ::fabs(c)) { + if(a < ::qFabs(c)) { a = c; s = p / 4.0f; } else { - s = p / (2 * M_PI) * ::asin(c / a); + s = p / (2 * M_PI) * ::qAsin(c / a); } t_adj -= 1.0f; - return -(a*::qPow(2.0f,10*t_adj) * ::sin( (t_adj*d-s)*(2*M_PI)/p )) + b; + return -(a*::qPow(2.0f,10*t_adj) * ::qSin( (t_adj*d-s)*(2*M_PI)/p )) + b; } /** @@ -431,10 +431,10 @@ static qreal easeOutElastic_helper(qreal t, qreal /*b*/, qreal c, qreal /*d*/, q a = c; s = p / 4.0f; } else { - s = p / (2 * M_PI) * ::asin(c / a); + s = p / (2 * M_PI) * ::qAsin(c / a); } - return (a*::qPow(2.0f,-10*t) * ::sin( (t-s)*(2*M_PI)/p ) + c); + return (a*::qPow(2.0f,-10*t) * ::qSin( (t-s)*(2*M_PI)/p ) + c); } /** @@ -469,11 +469,11 @@ static qreal easeInOutElastic(qreal t, qreal a, qreal p) a = 1.0; s = p / 4.0f; } else { - s = p / (2 * M_PI) * ::asin(1.0 / a); + s = p / (2 * M_PI) * ::qAsin(1.0 / a); } - if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p )); - return a*::qPow(2.0f,-10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0; + if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::qSin( (t-1-s)*(2*M_PI)/p )); + return a*::qPow(2.0f,-10*(t-1)) * ::qSin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0; } /** -- cgit v0.12 From 0fecf4184e888b202766210b235fde09a81c5257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 11 Dec 2009 15:36:13 +0100 Subject: Add a simple check for a common wrong usage to avoid infinite recursion Reviewed-by: Alexis --- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 23 ++++++++++++---------- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 7 +++++++ .../tst_qgraphicsanchorlayout.cpp | 20 +++++++++++++++++++ 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 6718a28..f504c54 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -321,14 +321,14 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem, // Horizontal anchor Qt::AnchorPoint firstEdge = (firstCorner & 1 ? Qt::AnchorRight: Qt::AnchorLeft); Qt::AnchorPoint secondEdge = (secondCorner & 1 ? Qt::AnchorRight: Qt::AnchorLeft); - d->addAnchor(firstItem, firstEdge, secondItem, secondEdge); + if (d->addAnchor(firstItem, firstEdge, secondItem, secondEdge)) { + // Vertical anchor + firstEdge = (firstCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop); + secondEdge = (secondCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop); + d->addAnchor(firstItem, firstEdge, secondItem, secondEdge); - // Vertical anchor - firstEdge = (firstCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop); - secondEdge = (secondCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop); - d->addAnchor(firstItem, firstEdge, secondItem, secondEdge); - - invalidate(); + invalidate(); + } } /*! @@ -351,11 +351,14 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem, Qt::Orientations orientations) { + bool ok = true; if (orientations & Qt::Horizontal) { - addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft); - addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight); + // Currently, if the first is ok, then the rest of the calls should be ok + ok = addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft) != 0; + if (ok) + addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight); } - if (orientations & Qt::Vertical) { + if (orientations & Qt::Vertical && ok) { addAnchor(secondItem, Qt::AnchorTop, firstItem, Qt::AnchorTop); addAnchor(firstItem, Qt::AnchorBottom, secondItem, Qt::AnchorBottom); } diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 03ed63d..1dc6873 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1666,6 +1666,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi return 0; } + const QGraphicsLayoutItem *parentWidget = q->parentLayoutItem(); + if (firstItem == parentWidget || secondItem == parentWidget) { + qWarning("QGraphicsAnchorLayout::addAnchor(): " + "You cannot add the parent of the layout to the layout."); + return 0; + } + // In QGraphicsAnchorLayout, items are represented in its internal // graph as four anchors that connect: // - Left -> HCenter diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 6e78522..1cb9f0d 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -90,6 +90,7 @@ private slots: void parallelToHalfLayout(); void globalSpacing(); void graphicsAnchorHandling(); + void invalidHierarchyCheck(); }; class RectWidget : public QGraphicsWidget @@ -2058,5 +2059,24 @@ void tst_QGraphicsAnchorLayout::graphicsAnchorHandling() delete a; } +void tst_QGraphicsAnchorLayout::invalidHierarchyCheck() +{ + QGraphicsWidget window(0, Qt::Window); + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + window.setLayout(l); + + QCOMPARE(l->count(), 0); + QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): " + "You cannot add the parent of the layout to the layout."); + QVERIFY(!l->addAnchor(l, Qt::AnchorLeft, &window, Qt::AnchorLeft)); + QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): " + "You cannot add the parent of the layout to the layout."); + l->addAnchors(l, &window); + QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): " + "You cannot add the parent of the layout to the layout."); + l->addCornerAnchors(l, Qt::TopLeftCorner, &window, Qt::TopLeftCorner); + QCOMPARE(l->count(), 0); +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" -- cgit v0.12 From 6a1cff7c47e1f47161f765ba2f7094b55aaa13c5 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 11 Dec 2009 16:41:00 +0100 Subject: Fixes Graphicsitem transformation problems when grouping/ungrouping. New transformation properties added in 4.6, such as rotation or transformOriginPoint were not taken into account in addTogroup and removeFromGroup. Autotest and manual test included. Task-number: QTBUG-5071 Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 46 ++- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 30 ++ tests/manual/qgraphicsitemgroup/customitem.cpp | 107 +++++++ tests/manual/qgraphicsitemgroup/customitem.h | 77 +++++ tests/manual/qgraphicsitemgroup/main.cpp | 51 ++++ .../qgraphicsitemgroup/qgraphicsitemgroup.pro | 8 + tests/manual/qgraphicsitemgroup/widget.cpp | 260 +++++++++++++++++ tests/manual/qgraphicsitemgroup/widget.h | 93 ++++++ tests/manual/qgraphicsitemgroup/widget.ui | 319 +++++++++++++++++++++ 9 files changed, 989 insertions(+), 2 deletions(-) create mode 100644 tests/manual/qgraphicsitemgroup/customitem.cpp create mode 100644 tests/manual/qgraphicsitemgroup/customitem.h create mode 100644 tests/manual/qgraphicsitemgroup/main.cpp create mode 100644 tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro create mode 100644 tests/manual/qgraphicsitemgroup/widget.cpp create mode 100644 tests/manual/qgraphicsitemgroup/widget.h create mode 100644 tests/manual/qgraphicsitemgroup/widget.ui diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index c879c5c..d955f16 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10537,6 +10537,20 @@ void QGraphicsItemGroup::addToGroup(QGraphicsItem *item) if (!item->pos().isNull()) newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y()); + // removing additional transformations properties applied with itemTransform() + QPointF origin = item->transformOriginPoint(); + QMatrix4x4 m; + QList transformList = item->transformations(); + for (int i = 0; i < transformList.size(); ++i) + transformList.at(i)->applyTo(&m); + newItemTransform *= m.toTransform().inverted(); + newItemTransform.translate(origin.x(), origin.y()); + newItemTransform.rotate(-item->rotation()); + newItemTransform.scale(1/item->scale(), 1/item->scale()); + newItemTransform.translate(-origin.x(), -origin.y()); + + // ### Expensive, we could maybe use dirtySceneTransform bit for optimization + item->setTransform(newItemTransform); item->d_func()->setIsMemberOfGroup(true); prepareGeometryChange(); @@ -10561,11 +10575,39 @@ void QGraphicsItemGroup::removeFromGroup(QGraphicsItem *item) } QGraphicsItem *newParent = d_ptr->parent; + + // COMBINE + bool ok; + QTransform itemTransform; + if (newParent) + itemTransform = item->itemTransform(newParent, &ok); + else + itemTransform = item->sceneTransform(); + QPointF oldPos = item->mapToItem(newParent, 0, 0); item->setParentItem(newParent); - // ### This function should remap the item's matrix to keep the item's - // transformation unchanged relative to the scene. item->setPos(oldPos); + + // removing position from translation component of the new transform + if (!item->pos().isNull()) + itemTransform *= QTransform::fromTranslate(-item->x(), -item->y()); + + // removing additional transformations properties applied + // with itemTransform() or sceneTransform() + QPointF origin = item->transformOriginPoint(); + QMatrix4x4 m; + QList transformList = item->transformations(); + for (int i = 0; i < transformList.size(); ++i) + transformList.at(i)->applyTo(&m); + itemTransform *= m.toTransform().inverted(); + itemTransform.translate(origin.x(), origin.y()); + itemTransform.rotate(-item->rotation()); + itemTransform.scale(1 / item->scale(), 1 / item->scale()); + itemTransform.translate(-origin.x(), -origin.y()); + + // ### Expensive, we could maybe use dirtySceneTransform bit for optimization + + item->setTransform(itemTransform); item->d_func()->setIsMemberOfGroup(item->group() != 0); // ### Quite expensive. But removeFromGroup() isn't called very often. diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 3e7a2eb..a4931ab 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -318,6 +318,7 @@ private slots: void childrenBoundingRect3(); void group(); void setGroup(); + void setGroup2(); void nestedGroups(); void warpChildrenIntoGroup(); void removeFromGroup(); @@ -3345,6 +3346,35 @@ void tst_QGraphicsItem::setGroup() QCOMPARE(rect->parentItem(), (QGraphicsItem *)0); } +void tst_QGraphicsItem::setGroup2() +{ + QGraphicsScene scene; + QGraphicsItemGroup group; + scene.addItem(&group); + + QGraphicsRectItem *rect = scene.addRect(50,50,50,50,Qt::NoPen,Qt::black); + rect->setTransformOriginPoint(50,50); + rect->setRotation(45); + rect->setScale(1.5); + rect->translate(20,20); + group.translate(-30,-40); + group.setRotation(180); + group.setScale(0.5); + + QTransform oldSceneTransform = rect->sceneTransform(); + rect->setGroup(&group); + QCOMPARE(rect->sceneTransform(), oldSceneTransform); + + group.setRotation(20); + group.setScale(2); + rect->setRotation(90); + rect->setScale(0.8); + + oldSceneTransform = rect->sceneTransform(); + rect->setGroup(0); + QCOMPARE(rect->sceneTransform(), oldSceneTransform); +} + void tst_QGraphicsItem::nestedGroups() { QGraphicsItemGroup *group1 = new QGraphicsItemGroup; diff --git a/tests/manual/qgraphicsitemgroup/customitem.cpp b/tests/manual/qgraphicsitemgroup/customitem.cpp new file mode 100644 index 0000000..16da0c5 --- /dev/null +++ b/tests/manual/qgraphicsitemgroup/customitem.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "customitem.h" + +#include +#include +#include + +QList CustomScene::selectedCustomGroups() const +{ + QList all = selectedItems(); + QList groups; + + foreach (QGraphicsItem *item, all) { + CustomGroup* group = dynamic_cast(item); + if (group) + groups.append(group); + } + + return groups; +} + +QList CustomScene::selectedCustomItems() const +{ + QList all = selectedItems(); + QList items; + + foreach (QGraphicsItem *item, all) { + CustomItem* citem = dynamic_cast(item); + if (citem) + items.append(citem); + } + + return items; +} + +CustomGroup::CustomGroup() : + QGraphicsItemGroup() +{ + setFlag(QGraphicsItem::ItemIsMovable); + setFlag(QGraphicsItem::ItemIsSelectable); +} + +void CustomGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + if (option->state & QStyle::State_Selected) + painter->setOpacity(1.); + else + painter->setOpacity(0.2); + + painter->setPen(QPen(QColor(100, 100, 100), 2, Qt::DashLine)); + painter->drawRect(boundingRect().adjusted(-2, -2, 2, 2)); +} + +QRectF CustomGroup::boundingRect() const +{ + return QGraphicsItemGroup::boundingRect().adjusted(-4, -4, 4 ,4); +} + +CustomItem::CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush &brush) : + QGraphicsRectItem(x, y, width, height) +{ + setFlag(QGraphicsItem::ItemIsMovable); + setFlag(QGraphicsItem::ItemIsSelectable); + setBrush(brush); + setPen(Qt::NoPen); + setTransformOriginPoint(boundingRect().center()); +} diff --git a/tests/manual/qgraphicsitemgroup/customitem.h b/tests/manual/qgraphicsitemgroup/customitem.h new file mode 100644 index 0000000..387c8ce --- /dev/null +++ b/tests/manual/qgraphicsitemgroup/customitem.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CUSTOMITEM_H +#define CUSTOMITEM_H + +#include +#include +#include + +class CustomGroup : public QGraphicsItemGroup +{ +public: + CustomGroup(); + virtual ~CustomGroup() { } + +protected: + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + virtual QRectF boundingRect() const; +}; + +class CustomItem : public QGraphicsRectItem +{ +public: + CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush & brush = QBrush()); + virtual ~CustomItem() { } +}; + +class CustomScene : public QGraphicsScene +{ + Q_OBJECT +public: + CustomScene() : QGraphicsScene() { } + + QList selectedCustomItems() const; + QList selectedCustomGroups() const; +}; + +#endif // CUSTOMITEM_H diff --git a/tests/manual/qgraphicsitemgroup/main.cpp b/tests/manual/qgraphicsitemgroup/main.cpp new file mode 100644 index 0000000..e7a6e11 --- /dev/null +++ b/tests/manual/qgraphicsitemgroup/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "widget.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Widget w; + w.show(); + return a.exec(); +} diff --git a/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro new file mode 100644 index 0000000..6676a2e --- /dev/null +++ b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro @@ -0,0 +1,8 @@ +TARGET = qgraphicsitemgroup +TEMPLATE = app +SOURCES += main.cpp \ + widget.cpp \ + customitem.cpp +HEADERS += widget.h \ + customitem.h +FORMS += widget.ui diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp new file mode 100644 index 0000000..23bee3f --- /dev/null +++ b/tests/manual/qgraphicsitemgroup/widget.cpp @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "widget.h" +#include "ui_widget.h" +#include +#include + +Widget::Widget(QWidget *parent) : + QWidget(parent), + ui(new Ui::Widget), + previousSelectionCount(0) +{ + ui->setupUi(this); + + effect = new QGraphicsOpacityEffect; + effect->setOpacity(0.3); + ui->groupBox->setGraphicsEffect(effect); + + fadeIn = new QPropertyAnimation(effect, "opacity"); + fadeIn->setDuration(200); + fadeIn->setStartValue(0.3); + fadeIn->setEndValue(1.); + + fadeOut = new QPropertyAnimation(effect, "opacity"); + fadeOut->setDuration(200); + fadeOut->setStartValue(1.); + fadeOut->setEndValue(0.3); + + scene = new CustomScene; + scene->setSceneRect(-250,-250,500,500); + ui->view->setScene(scene); + scene->setBackgroundBrush(Qt::white); + ui->view->setInteractive(true); + ui->view->setDragMode(QGraphicsView::RubberBandDrag); + ui->view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + ui->view->setRenderHints( QPainter::SmoothPixmapTransform | + QPainter::TextAntialiasing | + QPainter::Antialiasing ); + + rectBlue = new CustomItem(-100, -100, 50, 50, QColor(80, 80, 200)); + scene->addItem(rectBlue); + rectGreen = new CustomItem(100, -100, 50, 50, QColor(80, 200, 80)); + scene->addItem(rectGreen); + rectRed = new CustomItem(-100, 100, 50, 50, QColor(200, 80, 80)); + scene->addItem(rectRed); + rectYellow = new CustomItem(100, 100, 50, 50, QColor(200, 200, 20)); + scene->addItem(rectYellow); + + connect(scene, SIGNAL(selectionChanged()), this, SLOT(onSceneSelectionChanged())); +} + +Widget::~Widget() +{ + delete ui; + delete fadeIn; + delete fadeOut; +} + +void Widget::on_rotate_valueChanged(int value) +{ + if (scene->selectedItems().count() != 1) + return; + + QGraphicsItem *item = scene->selectedItems().at(0); + item->setRotation(value); + ui->rotateItem->setValue(checkedItem()->rotation()); +} + +void Widget::on_scale_valueChanged(int value) +{ + if (scene->selectedItems().count() != 1) + return; + + QGraphicsItem *item = scene->selectedItems().at(0); + item->setScale(value / 10.); + ui->scaleItem->setValue(checkedItem()->scale() * 10); +} + +void Widget::on_rotateItem_valueChanged(int value) +{ + if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem()) + ui->rotate->setValue(value); + else + checkedItem()->setRotation(value); +} + +void Widget::on_scaleItem_valueChanged(int value) +{ + if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem()) + ui->scale->setValue(value); + else + checkedItem()->setScale(value / 10.); +} + +void Widget::on_group_clicked() +{ + QList all = scene->selectedItems(); + if (all.size() < 2) + return; + + QList items = scene->selectedCustomItems(); + QList groups = scene->selectedCustomGroups(); + + if (groups.size() == 1) { + foreach (CustomItem *item, items) { + item->setSelected(false); + groups[0]->addToGroup(item); + } + + return; + } + + CustomGroup* group = new CustomGroup; + scene->addItem(group); + foreach (QGraphicsItem *item, all) { + item->setSelected(false); + group->addToGroup(item); + } + group->setSelected(true); + + updateUngroupButton(); +} + +void Widget::on_dismantle_clicked() +{ + QList groups = scene->selectedCustomGroups(); + + foreach (CustomGroup *group, groups) { + foreach (QGraphicsItem *item, group->childItems()) + group->removeFromGroup(item); + + delete group; + } + + updateUngroupButton(); +} + +void Widget::on_merge_clicked() +{ + QList groups = scene->selectedCustomGroups(); + if (groups.size() < 2) + return; + + CustomGroup *newBigGroup = groups.takeFirst(); + foreach (CustomGroup *group, groups) { + foreach (QGraphicsItem *item, group->childItems()) + item->setGroup(newBigGroup); + + delete group; + } +} + +void Widget::onSceneSelectionChanged() +{ + QList all = scene->selectedItems(); + QList groups = scene->selectedCustomGroups(); + + if (all.empty() && all.count() != previousSelectionCount) { + fadeOut->start(); + } else if (previousSelectionCount == 0) { + fadeIn->start(); + } + + if (all.count() == 1) { + QGraphicsItem *item = all.at(0); + ui->rotate->setValue(item->rotation()); + ui->scale->setValue(item->scale() * 10); + } else { + ui->rotate->setValue(ui->rotate->minimum()); + ui->scale->setValue(ui->scale->minimum()); + } + + ui->rotate->setEnabled(all.size() == 1); + ui->scale->setEnabled(all.size() == 1); + ui->group->setEnabled(all.size() > 1); + ui->dismantle->setEnabled(!groups.empty()); + ui->merge->setEnabled(groups.size() > 1); + + previousSelectionCount = all.size(); + + updateUngroupButton(); +} + +void Widget::on_ungroup_clicked() +{ + QGraphicsItemGroup *oldGroup = checkedItem()->group(); + checkedItem()->setGroup(0); + if (oldGroup && oldGroup->childItems().empty()) + delete oldGroup; + + updateUngroupButton(); +} + +void Widget::updateUngroupButton() +{ + ui->ungroup->setEnabled(checkedItem()->group() != 0); +} + +CustomItem * Widget::checkedItem() const +{ + CustomItem *item; + + if (ui->blue->isChecked()) + item = rectBlue; + else if (ui->red->isChecked()) + item = rectRed; + else if (ui->green->isChecked()) + item = rectGreen; + else if (ui->yellow->isChecked()) + item = rectYellow; + + return item; +} + +void Widget::on_buttonGroup_buttonClicked() +{ + ui->rotateItem->setValue(checkedItem()->rotation()); + ui->scaleItem->setValue(checkedItem()->scale() * 10); + + updateUngroupButton(); +} diff --git a/tests/manual/qgraphicsitemgroup/widget.h b/tests/manual/qgraphicsitemgroup/widget.h new file mode 100644 index 0000000..affc436 --- /dev/null +++ b/tests/manual/qgraphicsitemgroup/widget.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WIDGET_H +#define WIDGET_H + +#include "customitem.h" + +#include +#include +#include + +namespace Ui { + class Widget; +} + +class QGraphicsOpacityEffect; +class QPropertyAnimation; + +class Widget : public QWidget +{ + Q_OBJECT +public: + Widget(QWidget *parent = 0); + ~Widget(); + +protected Q_SLOTS: + void on_rotate_valueChanged(int value); + void on_scale_valueChanged(int value); + void on_rotateItem_valueChanged(int value); + void on_scaleItem_valueChanged(int value); + void on_group_clicked(); + void on_dismantle_clicked(); + void on_merge_clicked(); + void onSceneSelectionChanged(); + void on_ungroup_clicked(); + void on_buttonGroup_buttonClicked(); + +private: + void updateUngroupButton(); + CustomItem * checkedItem() const; + + Ui::Widget *ui; + CustomScene *scene; + CustomItem *rectBlue; + CustomItem *rectRed; + CustomItem *rectGreen; + CustomItem *rectYellow; + QGraphicsOpacityEffect* effect; + QPropertyAnimation *fadeIn; + QPropertyAnimation *fadeOut; + int previousSelectionCount; +}; + +#endif // WIDGET_H diff --git a/tests/manual/qgraphicsitemgroup/widget.ui b/tests/manual/qgraphicsitemgroup/widget.ui new file mode 100644 index 0000000..7e3a4df --- /dev/null +++ b/tests/manual/qgraphicsitemgroup/widget.ui @@ -0,0 +1,319 @@ + + + Widget + + + + 0 + 0 + 782 + 695 + + + + Widget + + + + + + + + Items + + + + + + + + + + Blue + + + true + + + buttonGroup + + + + + + + Red + + + buttonGroup + + + + + + + Green + + + buttonGroup + + + + + + + Yellow + + + buttonGroup + + + + + + + + + + + Rotate + + + + + + + true + + + + 120 + 0 + + + + 360 + + + Qt::Horizontal + + + + + + + Scale + + + + + + + true + + + + 120 + 0 + + + + 5 + + + 30 + + + 10 + + + Qt::Horizontal + + + + + + + + + + + false + + + Ungroup + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 50 + 20 + + + + + + + + true + + + + 300 + 164 + + + + + 300 + 164 + + + + Selection + + + + + + + + false + + + Rotate + + + + + + + false + + + + 120 + 0 + + + + 360 + + + Qt::Horizontal + + + + + + + false + + + Scale + + + + + + + false + + + + 120 + 0 + + + + 5 + + + 30 + + + 10 + + + Qt::Horizontal + + + + + + + + + + + false + + + Group + + + + + + + false + + + Merge Groups + + + + + + + false + + + Dismantle Group + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + -- cgit v0.12 From 4e9063d7a8fc79d1cfee71d2c889877264d44086 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 11 Dec 2009 17:10:18 +0100 Subject: Itemviews: we needed to call ensurePolishedwhen asking for sizehints Reviewed-by: Pierre Rossi --- src/gui/itemviews/qabstractitemview.cpp | 4 ++++ src/gui/itemviews/qtreeview.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index de6e6cb..4a450b7 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2867,6 +2867,8 @@ int QAbstractItemView::sizeHintForRow(int row) const if (row < 0 || row >= d->model->rowCount() || !model()) return -1; + ensurePolished(); + QStyleOptionViewItemV4 option = d->viewOptionsV4(); int height = 0; int colCount = d->model->columnCount(d->root); @@ -2896,6 +2898,8 @@ int QAbstractItemView::sizeHintForColumn(int column) const if (column < 0 || column >= d->model->columnCount() || !model()) return -1; + ensurePolished(); + QStyleOptionViewItemV4 option = d->viewOptionsV4(); int width = 0; int rows = d->model->rowCount(d->root); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 3ad9fbb..bcf9cfb 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2774,6 +2774,7 @@ int QTreeView::sizeHintForColumn(int column) const d->executePostedLayout(); if (d->viewItems.isEmpty()) return -1; + ensurePolished(); int w = 0; QStyleOptionViewItemV4 option = d->viewOptionsV4(); const QVector viewItems = d->viewItems; -- cgit v0.12 From f555e06c3e8eee7cc67218331562c11ad77ec9c4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 10 Dec 2009 15:33:21 +0100 Subject: Add missing benchmark to the benchmarks.pro This does not add the benchmark that runs too slowly. Reviewed-by: jasplin --- tests/benchmarks/benchmarks.pro | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index 9170039..bffa009 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -20,6 +20,24 @@ SUBDIRS = containers-associative \ qregion \ qvariant \ qwidget \ - qtwidgets + qtwidgets \ + qapplication \ + qdir \ + qdiriterator \ + qgraphicsanchorlayout \ + qgraphicsitem \ + qgraphicswidget \ + qmetaobject \ + qpixmapcache \ + qquaternion \ + qscriptclass \ + qscriptengine \ + qscriptvalue \ + qstringbuilder \ + qstylesheetstyle \ + qsvgrenderer \ + qtableview + + contains(QT_CONFIG, opengl): SUBDIRS += opengl -- cgit v0.12 From c15c9cd2356eaeba33a5f8e62a90b0aeb45284e1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 11 Dec 2009 17:18:54 +0100 Subject: Fixes cursor blinking in the QComboBox when it becomes editable while having the focus. The lineedit has the focus because it becomes focusproxy of the QComboBox. But the focusInEvent is not called because the combobox has already the focus when setFocusProxy is called. Workaround that in the show event. Task-number: QTBUG-1949 Reviewed-by: Thierry --- src/gui/widgets/qlineedit.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 2c1acdb..15dcda2 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1445,6 +1445,16 @@ bool QLineEdit::event(QEvent * e) d->control->processEvent(e); } else if (e->type() == QEvent::KeyRelease) { d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); + } else if (e->type() == QEvent::Show) { + //In order to get the cursor blinking if QComboBox::setEditable is called when the combobox has focus + if (hasFocus()) { + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); + QStyleOptionFrameV2 opt; + initStyleOption(&opt); + if ((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) + || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) + d->setCursorVisible(true); + } } #ifdef QT_KEYPAD_NAVIGATION -- cgit v0.12 From 4879551f72a377e0816164ce1762eb646839f4a6 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 14 Dec 2009 14:46:52 +1000 Subject: OpenVG .def file updates. --- src/s60installs/eabi/QtGuiu.def | 41 ++++++++++++++++++++++++++++++++++++++ src/s60installs/eabi/QtOpenVGu.def | 8 ++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 429ca79..bfad2e7 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11741,4 +11741,45 @@ EXPORTS _ZN11QVectorPathD2Ev @ 11740 NONAME _ZNK11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS1_S2_E @ 11741 NONAME _ZNK20QGraphicsItemPrivate20discardUpdateRequestEbbb @ 11742 NONAME + _ZN11QEglContext10extensionsEv @ 11743 NONAME + _ZN11QEglContext10getDisplayEP12QPaintDevice @ 11744 NONAME + _ZN11QEglContext10waitClientEv @ 11745 NONAME + _ZN11QEglContext10waitNativeEv @ 11746 NONAME + _ZN11QEglContext11doneCurrentEv @ 11747 NONAME + _ZN11QEglContext11errorStringEi @ 11748 NONAME + _ZN11QEglContext11makeCurrentEi @ 11749 NONAME + _ZN11QEglContext11openDisplayEP12QPaintDevice @ 11750 NONAME + _ZN11QEglContext11swapBuffersEi @ 11751 NONAME + _ZN11QEglContext12chooseConfigERK14QEglPropertiesN4QEgl16PixelFormatMatchE @ 11752 NONAME + _ZN11QEglContext12hasExtensionEPKc @ 11753 NONAME + _ZN11QEglContext13createContextEPS_PK14QEglProperties @ 11754 NONAME + _ZN11QEglContext13createSurfaceEP12QPaintDevicePK14QEglProperties @ 11755 NONAME + _ZN11QEglContext14currentContextEN4QEgl3APIE @ 11756 NONAME + _ZN11QEglContext14defaultDisplayEP12QPaintDevice @ 11757 NONAME + _ZN11QEglContext14destroySurfaceEi @ 11758 NONAME + _ZN11QEglContext14dumpAllConfigsEv @ 11759 NONAME + _ZN11QEglContext15lazyDoneCurrentEv @ 11760 NONAME + _ZN11QEglContext17setCurrentContextEN4QEgl3APIEPS_ @ 11761 NONAME + _ZN11QEglContext7destroyEv @ 11762 NONAME + _ZN11QEglContextC1Ev @ 11763 NONAME + _ZN11QEglContextC2Ev @ 11764 NONAME + _ZN11QEglContextD1Ev @ 11765 NONAME + _ZN11QEglContextD2Ev @ 11766 NONAME + _ZN14QEglProperties11removeValueEi @ 11767 NONAME + _ZN14QEglProperties14dumpAllConfigsEv @ 11768 NONAME + _ZN14QEglProperties14setPixelFormatEN6QImage6FormatE @ 11769 NONAME + _ZN14QEglProperties17setRenderableTypeEN4QEgl3APIE @ 11770 NONAME + _ZN14QEglProperties19reduceConfigurationEv @ 11771 NONAME + _ZN14QEglProperties20setPaintDeviceFormatEP12QPaintDevice @ 11772 NONAME + _ZN14QEglProperties8setValueEii @ 11773 NONAME + _ZN14QEglPropertiesC1Ei @ 11774 NONAME + _ZN14QEglPropertiesC1Ev @ 11775 NONAME + _ZN14QEglPropertiesC2Ei @ 11776 NONAME + _ZN14QEglPropertiesC2Ev @ 11777 NONAME + _ZNK11QEglContext12configAttribEiPi @ 11778 NONAME + _ZNK11QEglContext16configPropertiesEi @ 11779 NONAME + _ZNK11QEglContext7isValidEv @ 11780 NONAME + _ZNK11QEglContext9isCurrentEv @ 11781 NONAME + _ZNK14QEglProperties5valueEi @ 11782 NONAME + _ZNK14QEglProperties8toStringEv @ 11783 NONAME diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def index 8458983..7526632 100644 --- a/src/s60installs/eabi/QtOpenVGu.def +++ b/src/s60installs/eabi/QtOpenVGu.def @@ -1,8 +1,8 @@ EXPORTS _Z16qPixmapToVGImageRK7QPixmap @ 1 NONAME - _Z20qt_vg_create_contextP12QPaintDevice @ 2 NONAME + _Z20qt_vg_create_contextP12QPaintDevice @ 2 NONAME ABSENT _Z20qt_vg_shared_surfacev @ 3 NONAME - _Z21qt_vg_destroy_contextP11QEglContext @ 4 NONAME + _Z21qt_vg_destroy_contextP11QEglContext @ 4 NONAME ABSENT _Z24qt_vg_image_to_vg_formatN6QImage6FormatE @ 5 NONAME _Z25qt_vg_config_to_vg_formatP11QEglContext @ 6 NONAME _Z25qt_vg_create_paint_enginev @ 7 NONAME @@ -169,4 +169,8 @@ EXPORTS _ZThn8_NK16QVGWindowSurface6metricEN12QPaintDevice17PaintDeviceMetricE @ 168 NONAME _ZN14QVGPaintEngine10fillRegionERK7QRegionRK6QColorRK5QSize @ 169 NONAME _ZN20QVGCompositionHelper10blitWindowEmRK5QSizeRK5QRectRK6QPointi @ 170 NONAME + _Z20qt_vg_create_contextP12QPaintDevicei @ 171 NONAME + _Z21qt_vg_destroy_contextP11QEglContexti @ 172 NONAME + _ZN13QVGPixmapData22destroyImageAndContextEv @ 173 NONAME + _ZN13QVGPixmapData9hibernateEv @ 174 NONAME -- cgit v0.12 From 006b48d5f998d0beba9431a7688c928f0f5f9ad6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 14 Dec 2009 09:11:36 +0100 Subject: Fixed spelling in docs --- src/gui/painting/qpainter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 13d9a04..33496a9 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1321,8 +1321,8 @@ void QPainterPrivate::updateState(QPainterState *newState) QPainter is a rich framework that allows developers to do a great variety of graphical operations, such as gradients, composition - modes and vector graphcis. And QPainter can do this across a - variety of different hardware and software stack. Naturally the + modes and vector graphics. And QPainter can do this across a + variety of different hardware and software stacks. Naturally the underlying combination of hardware and software has some implications for performance, and ensuring that every single operation is fast in combination with all the various combinations @@ -1344,13 +1344,13 @@ void QPainterPrivate::updateState(QPainterState *newState) including QImage::Format_ARGB32, has significantly worse performance. This engine is also used by default on Windows and on QWS. It can be used as default graphics system on any - OS/hardware/software combination by passing \c {-graphcissystem + OS/hardware/software combination by passing \c {-graphicssystem raster} on the command line \o OpenGL 2.0 (ES) - This backend is the primary backend for - hardware accellerated graphics. It can be run on desktop machines + hardware accelerated graphics. It can be run on desktop machines and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0 - spesification. This includes most graphics chips produced in the + specification. This includes most graphics chips produced in the last couple of years. The engine can be enabled by using QPainter onto a QGLWidget or by passing \c {-graphicssystem opengl} on the command line when the underlying system supports it. @@ -1366,7 +1366,7 @@ void QPainterPrivate::updateState(QPainterState *newState) \o \c drawPixmap() in combination with simple transformations and opacity with non-smooth transformation mode - (\c QPainter::SmoothPixmapTransform not enabled as a render hint); + (\c QPainter::SmoothPixmapTransform not enabled as a render hint). \o Text drawing with regular font sizes with simple transformations with solid colors using no or 8-bit antialiasing. -- cgit v0.12 From b2f4c48d5d3096e7c12fd51b8bc6bdabe2c6fd7b Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 14 Dec 2009 10:55:57 +0200 Subject: Skipped the most memory intensive tests in QByteArray benchmark. Symbian devices typically have limited memory, so skipping the cases that require tens of megabytes or more of memory. Task-number: QTBUG-6780 Reviewed-by: Janne Anttila --- tests/benchmarks/qbytearray/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/benchmarks/qbytearray/main.cpp b/tests/benchmarks/qbytearray/main.cpp index 6a481f1..78c5b16 100644 --- a/tests/benchmarks/qbytearray/main.cpp +++ b/tests/benchmarks/qbytearray/main.cpp @@ -73,6 +73,11 @@ void tst_qbytearray::append() { QFETCH(int, size); +#ifdef Q_OS_SYMBIAN + if (size > 1000000) + QSKIP("Skipped due to limited memory in many Symbian devices.", SkipSingle); +#endif + QByteArray ba; QBENCHMARK { QByteArray ba2(size, 'x'); -- cgit v0.12 From 76213ac8028079a9933548625bd917f49862f4c1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 14 Dec 2009 10:31:21 +0100 Subject: Fix warning in public header qcache.h:73: warning: declaration of 'object' shadows a member of this Spotted by compilerwarnings autotest Reviewed-by: Thiago --- src/corelib/tools/qcache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 086a52f..66f9f73 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -70,9 +70,9 @@ class QCache if (l == &n) l = n.p; if (f == &n) f = n.n; total -= n.c; - T *object = n.t; + T *obj = n.t; hash.remove(*n.keyPtr); - delete object; + delete obj; } inline T *relink(const Key &key) { typename QHash::iterator i = hash.find(key); -- cgit v0.12 From 8b46b4cc0e1df56d40535b381986eb455806c589 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 14 Dec 2009 10:51:25 +0100 Subject: Stabilize test --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 1 + tests/auto/qsharedmemory/tst_qsharedmemory.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index a4931ab..03a587a 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -1354,6 +1354,7 @@ void tst_QGraphicsItem::selected() view.setFixedSize(250, 250); view.show(); + QTest::qWaitForWindowShown(&view); qApp->processEvents(); qApp->processEvents(); diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp index f72b6f7..4148594 100644 --- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp @@ -756,12 +756,12 @@ void tst_QSharedMemory::simpleProcessProducerConsumer() ++failedProcesses; } - producer.waitForFinished(5000); + QVERIFY(producer.waitForFinished(5000)); bool consumerFailed = false; while (!consumers.isEmpty()) { - consumers.first()->waitForFinished(2000); + QVERIFY(consumers.first()->waitForFinished(3000)); if (consumers.first()->state() == QProcess::Running || consumers.first()->exitStatus() != QProcess::NormalExit || consumers.first()->exitCode() != 0) { -- cgit v0.12 From dff377e72c1c84aefd81cf92da75d65562bec6b6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 14 Dec 2009 11:10:26 +0100 Subject: Designer: Show actions in action editor in QKeySequence::NativeText format as in Property editor and elsewhere for consistence. Task-number: QTBUG-6760 --- tools/designer/src/lib/shared/actionrepository.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp index 1655d07..83e64e6 100644 --- a/tools/designer/src/lib/shared/actionrepository.cpp +++ b/tools/designer/src/lib/shared/actionrepository.cpp @@ -226,7 +226,7 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, item->setText(action->text()); item->setToolTip(action->text()); // shortcut - const QString shortcut = actionShortCut(core, action).value().toString(); + const QString shortcut = actionShortCut(core, action).value().toString(QKeySequence::NativeText); item = sl[ShortCutColumn]; item->setText(shortcut); item->setToolTip(shortcut); -- cgit v0.12 From 83d333a2b181cbd5c87219599fdc188757261269 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 14 Dec 2009 13:55:36 +0200 Subject: FEP indicator shown in status pane when it should not FEP indicator is shown in few cases in statusbar when it should not be. Case a) Application contains item view. QAbstractItemView is initialized as having WA_InputMethodEnabled on, irregardless of functionality of each separate cell. So we need to check the model for the itemview cell about to receive focus, is it editable. If it isn't then, we'll set the WA_InputMethodEnabled as false. This will fix the FEP indicators in a lot of cases: lists with cells, empty lists, combobox lists, ... Case b) Combobox also initializes itself with WA_InputMethodEnabled active. Even if the fix a) fixed the list inside combobox, the widget itself when receiving focus needs also fixing. If we check the editable flag of combobox when initializing the comment, we can set the flag off. Task-number: QTBUG-5705 Reviewed-by: axis --- src/gui/itemviews/qabstractitemview.cpp | 19 +++++++++++++++++-- src/gui/widgets/qcombobox.cpp | 5 ++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index de6e6cb..d0aac2a 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2065,9 +2065,13 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event) { Q_D(QAbstractItemView); QAbstractScrollArea::focusInEvent(event); - if (selectionModel() + + const QItemSelectionModel* model = selectionModel(); + const bool currentIndexValid = currentIndex().isValid(); + + if (model && !d->currentIndexSet - && !currentIndex().isValid()) { + && !currentIndexValid) { bool autoScroll = d->autoScroll; d->autoScroll = false; QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index @@ -2075,6 +2079,17 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event) selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); d->autoScroll = autoScroll; } + + if (model && currentIndexValid) { + if (currentIndex().flags() != Qt::ItemIsEditable) + setAttribute(Qt::WA_InputMethodEnabled, false); + else + setAttribute(Qt::WA_InputMethodEnabled); + } + + if (!currentIndexValid) + setAttribute(Qt::WA_InputMethodEnabled, false); + d->viewport->update(); } diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index bd1d8ba..b7dd20c 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -931,7 +931,10 @@ void QComboBoxPrivate::init() QSizePolicy::ComboBox)); setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem); q->setModel(new QStandardItemModel(0, 1, q)); - q->setAttribute(Qt::WA_InputMethodEnabled); + if (!q->isEditable()) + q->setAttribute(Qt::WA_InputMethodEnabled, false); + else + q->setAttribute(Qt::WA_InputMethodEnabled); } QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer() -- cgit v0.12 From 08da5b53b6f4564057b99bf9076ec350b4ebeb35 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 14 Dec 2009 13:11:20 +0100 Subject: Added vg to the performance section of the QPainter docs --- src/gui/painting/qpainter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 33496a9..8ed126f 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1355,6 +1355,12 @@ void QPainterPrivate::updateState(QPainterState *newState) onto a QGLWidget or by passing \c {-graphicssystem opengl} on the command line when the underlying system supports it. + \o OpenVG - This backend implements the Khronos standard for 2D + and Vector Graphics. It is primarily for embedded devices with + hardware support for OpenVG. The engine can be enabled by + passing \c {-graphicssystem openvg} on the command line when + the underlying system supports it. + \endlist These operations are: -- cgit v0.12 From 0295f8da10d6c920511d09f9e506b8bed8c444c3 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 6 Oct 2009 21:39:02 +0200 Subject: Determine QPrinterInfo's supportedPaperSizes on demand. The paper size determination requires a cupsGetPPD(), which can be a slow HTTP download. So doing it on demand makes QPrinterInfo::defaultPrinter() much faster, because it doesn't actually need the paper sizes at all. Before this fix, it was requesting the PPD file of every known CUPS printer, every time it was called. My battery of unittests for code that uses QPrinter went from 19 minutes when the cups print server is switched off, to 13 seconds! This fix also removes some code duplication, which is always nice. Task-number: 232664, QTBUG-3033 Reviewed-by: Trond --- src/gui/painting/qprinterinfo_unix.cpp | 50 ++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp index 6684ff7..930785b 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/gui/painting/qprinterinfo_unix.cpp @@ -75,7 +75,9 @@ private: QString m_name; bool m_isNull; bool m_default; - QList m_paperSizes; + mutable bool m_mustGetPaperSizes; + mutable QList m_paperSizes; + int m_cupsPrinterIndex; QPrinterInfo* q_ptr; }; @@ -838,16 +840,7 @@ QList QPrinterInfo::availablePrinters() list.append(QPrinterInfo(printerName)); if (cupsPrinters[i].is_default) list[i].d_ptr->m_default = true; - // Find paper sizes. - cups.setCurrentPrinter(i); - const ppd_option_t* sizes = cups.pageSizes(); - if (sizes) { - for (int j = 0; j < sizes->num_choices; ++j) { - list[i].d_ptr->m_paperSizes.append( - QPrinterInfoPrivate::string2PaperSize( - QLatin1String(sizes->choices[j].choice))); - } - } + list[i].d_ptr->m_cupsPrinterIndex = i; } } else { #endif @@ -909,16 +902,7 @@ QPrinterInfo::QPrinterInfo(const QPrinter& printer) if (printerName == printer.printerName()) { if (cupsPrinters[i].is_default) d->m_default = true; - // Find paper sizes. - cups.setCurrentPrinter(i); - const ppd_option_t* sizes = cups.pageSizes(); - if (sizes) { - for (int j = 0; j < sizes->num_choices; ++j) { - d->m_paperSizes.append( - QPrinterInfoPrivate::string2PaperSize( - QLatin1String(sizes->choices[j].choice))); - } - } + d->m_cupsPrinterIndex = i; return; } } @@ -983,6 +967,26 @@ bool QPrinterInfo::isDefault() const QList< QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const { const Q_D(QPrinterInfo); + if (d->m_mustGetPaperSizes) { + d->m_mustGetPaperSizes = false; + +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + QCUPSSupport cups; + if (QCUPSSupport::isAvailable()) { + // Find paper sizes from CUPS. + cups.setCurrentPrinter(d->m_cupsPrinterIndex); + const ppd_option_t* sizes = cups.pageSizes(); + if (sizes) { + for (int j = 0; j < sizes->num_choices; ++j) { + d->m_paperSizes.append( + QPrinterInfoPrivate::string2PaperSize( + QLatin1String(sizes->choices[j].choice))); + } + } + } +#endif + + } return d->m_paperSizes; } @@ -993,6 +997,8 @@ QPrinterInfoPrivate::QPrinterInfoPrivate() { m_isNull = true; m_default = false; + m_mustGetPaperSizes = true; + m_cupsPrinterIndex = 0; q_ptr = 0; } @@ -1001,6 +1007,8 @@ QPrinterInfoPrivate::QPrinterInfoPrivate(const QString& name) m_name = name; m_isNull = false; m_default = false; + m_mustGetPaperSizes = true; + m_cupsPrinterIndex = 0; q_ptr = 0; } -- cgit v0.12 From 2c6749c38a2538639de86355856414b0d21317cf Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 14 Dec 2009 15:18:37 +0200 Subject: Fixed QGraphicsView benchmark for Symbian. - Added deployment of jpeg plugin - Reduced deep stacking recursion from 1000 -> 200 in order to not run out of stack. - Bunch of whitespace fixes. Task-number: QTBUG-6779 Reviewed-by: Janne Anttila --- tests/benchmarks/qgraphicsview/qgraphicsview.pro | 8 + .../benchmarks/qgraphicsview/tst_qgraphicsview.cpp | 238 +++++++++++---------- 2 files changed, 130 insertions(+), 116 deletions(-) diff --git a/tests/benchmarks/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/qgraphicsview/qgraphicsview.pro index d9db8c9..927d731 100644 --- a/tests/benchmarks/qgraphicsview/qgraphicsview.pro +++ b/tests/benchmarks/qgraphicsview/qgraphicsview.pro @@ -6,3 +6,11 @@ SOURCES += tst_qgraphicsview.cpp RESOURCES += qgraphicsview.qrc include(chiptester/chiptester.pri) + +symbian { + qt_not_deployed { + plugins.sources = qjpeg.dll + plugins.path = imageformats + DEPLOYMENT += plugins + } +} diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp index aadd56c..cf65e5d 100644 --- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp @@ -62,25 +62,25 @@ class QEventWaiter : public QEventLoop { public: QEventWaiter(QObject *receiver, QEvent::Type type) - : waiting(false), t(type) + : waiting(false), t(type) { - receiver->installEventFilter(this); + receiver->installEventFilter(this); } void wait() { - waiting = true; - exec(); + waiting = true; + exec(); } bool eventFilter(QObject *receiver, QEvent *event) { - Q_UNUSED(receiver); - if (waiting && event->type() == t) { - waiting = false; - exit(); - } - return false; + Q_UNUSED(receiver); + if (waiting && event->type() == t) { + waiting = false; + exit(); + } + return false; } private: @@ -166,20 +166,26 @@ void tst_QGraphicsView::paintSingleItem() QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); QPainter painter(&image); QBENCHMARK { - view.viewport()->render(&painter); + view.viewport()->render(&painter); } } +#ifdef Q_OS_SYMBIAN +# define DEEP_STACKING_COUNT 200 +#else +# define DEEP_STACKING_COUNT 1000 +#endif + void tst_QGraphicsView::paintDeepStackingItems() { QGraphicsScene scene(0, 0, 100, 100); QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); QGraphicsRectItem *lastRect = item; - for (int i = 0; i < 1000; ++i) { - QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); - rect->setPos(1, 1); - rect->setParentItem(lastRect); - lastRect = rect; + for (int i = 0; i < DEEP_STACKING_COUNT; ++i) { + QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); + rect->setPos(1, 1); + rect->setParentItem(lastRect); + lastRect = rect; } QGraphicsView view(&scene); @@ -192,7 +198,7 @@ void tst_QGraphicsView::paintDeepStackingItems() QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); QPainter painter(&image); QBENCHMARK { - view.viewport()->render(&painter); + view.viewport()->render(&painter); } } @@ -202,11 +208,11 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped() QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); item->setFlag(QGraphicsItem::ItemClipsChildrenToShape); QGraphicsRectItem *lastRect = item; - for (int i = 0; i < 1000; ++i) { - QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); - rect->setPos(1, 1); - rect->setParentItem(lastRect); - lastRect = rect; + for (int i = 0; i < DEEP_STACKING_COUNT; ++i) { + QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); + rect->setPos(1, 1); + rect->setParentItem(lastRect); + lastRect = rect; } QGraphicsView view(&scene); @@ -219,7 +225,7 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped() QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); QPainter painter(&image); QBENCHMARK { - view.viewport()->render(&painter); + view.viewport()->render(&painter); } } @@ -239,8 +245,8 @@ void tst_QGraphicsView::moveSingleItem() int n = 1; QBENCHMARK { item->setPos(25 * n, 25 * n); - waiter.wait(); - n = n ? 0 : 1; + waiter.wait(); + n = n ? 0 : 1; } } @@ -382,18 +388,18 @@ void tst_QGraphicsView::chipTester() tester.setOpenGL(opengl); tester.setOperation(ChipTester::Operation(operation)); QBENCHMARK { - tester.runBenchmark(); + tester.runBenchmark(); } } static void addChildHelper(QGraphicsItem *parent, int n, bool rotate) { if (!n) - return; + return; QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent); item->setPos(10, 10); if (rotate) - item->rotate(10); + item->rotate(10); addChildHelper(item, n - 1, rotate); } @@ -421,12 +427,12 @@ void tst_QGraphicsView::deepNesting() QGraphicsScene scene; for (int y = 0; y < 15; ++y) { - for (int x = 0; x < 15; ++x) { - QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50)); - if (rotate) item1->rotate(10); - item1->setPos(x * 25, y * 25); - addChildHelper(item1, 30, rotate); - } + for (int x = 0; x < 15; ++x) { + QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50)); + if (rotate) item1->rotate(10); + item1->setPos(x * 25, y * 25); + addChildHelper(item1, 30, rotate); + } } scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex); scene.setSortCacheEnabled(sortCache); @@ -441,11 +447,11 @@ void tst_QGraphicsView::deepNesting() QBENCHMARK { #ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION + CALLGRIND_START_INSTRUMENTATION #endif - view.viewport()->repaint(); + view.viewport()->repaint(); #ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION + CALLGRIND_STOP_INSTRUMENTATION #endif } } @@ -456,36 +462,36 @@ public: AnimatedPixmapItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0) : QGraphicsPixmapItem(parent), rotateFactor(0), scaleFactor(0) { - rotate = rot; - scale = scal; - xspeed = x; - yspeed = y; + rotate = rot; + scale = scal; + xspeed = x; + yspeed = y; } protected: void advance(int i) - { - if (!i) - return; - int x = int(pos().x()) + pixmap().width(); - x += xspeed; - x = (x % (300 + pixmap().width() * 2)) - pixmap().width(); - int y = int(pos().y()) + pixmap().width(); - y += yspeed; - y = (y % (300 + pixmap().width() * 2)) - pixmap().width(); - setPos(x, y); - - int rot = rotateFactor; - int sca = scaleFactor; + { + if (!i) + return; + int x = int(pos().x()) + pixmap().width(); + x += xspeed; + x = (x % (300 + pixmap().width() * 2)) - pixmap().width(); + int y = int(pos().y()) + pixmap().width(); + y += yspeed; + y = (y % (300 + pixmap().width() * 2)) - pixmap().width(); + setPos(x, y); + + int rot = rotateFactor; + int sca = scaleFactor; if (rotate) - rotateFactor = 1 + (rot + xspeed) % 360; + rotateFactor = 1 + (rot + xspeed) % 360; if (scale) - scaleFactor = 1 + (sca + yspeed) % 50; + scaleFactor = 1 + (sca + yspeed) % 50; - if (rotate || scale) { - qreal s = 0.5 + scaleFactor / 50.0; - setTransform(QTransform().rotate(rotateFactor).scale(s, s)); - } + if (rotate || scale) { + qreal s = 0.5 + scaleFactor / 50.0; + setTransform(QTransform().rotate(rotateFactor).scale(s, s)); + } } private: @@ -543,38 +549,38 @@ void tst_QGraphicsView::imageRiver() view.show(); QPixmap pix(":/images/designer.png"); - QVERIFY(!pix.isNull()); + QVERIFY(!pix.isNull()); QList items; QFile file(":/random.data"); QVERIFY(file.open(QIODevice::ReadOnly)); QDataStream str(&file); for (int i = 0; i < 100; ++i) { - 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); - if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale); - item->setPixmap(pix); + 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); + if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale); + item->setPixmap(pix); int rnd1, rnd2; str >> rnd1 >> rnd2; - item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), - -pix.height() + rnd2 % (view.height() + pix.height())); - scene.addItem(item); + item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), + -pix.height() + rnd2 % (view.height() + pix.height())); + scene.addItem(item); } view.count = 0; QBENCHMARK { #ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION + CALLGRIND_START_INSTRUMENTATION #endif - for (int i = 0; i < 100; ++i) { - scene.advance(); - while (view.count < (i+1)) - qApp->processEvents(); - } + for (int i = 0; i < 100; ++i) { + scene.advance(); + while (view.count < (i+1)) + qApp->processEvents(); + } #ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION + CALLGRIND_STOP_INSTRUMENTATION #endif } } @@ -585,38 +591,38 @@ public: AnimatedTextItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0) : QGraphicsSimpleTextItem(parent), rotateFactor(0), scaleFactor(25) { - setText("River of text"); - rotate = rot; - scale = scal; - xspeed = x; - yspeed = y; + setText("River of text"); + rotate = rot; + scale = scal; + xspeed = x; + yspeed = y; } protected: void advance(int i) - { - if (!i) - return; - QRect r = boundingRect().toRect(); - int x = int(pos().x()) + r.width(); - x += xspeed; - x = (x % (300 + r.width() * 2)) - r.width(); - int y = int(pos().y()) + r.width(); - y += yspeed; - y = (y % (300 + r.width() * 2)) - r.width(); - setPos(x, y); - - int rot = rotateFactor; - int sca = scaleFactor; + { + if (!i) + return; + QRect r = boundingRect().toRect(); + int x = int(pos().x()) + r.width(); + x += xspeed; + x = (x % (300 + r.width() * 2)) - r.width(); + int y = int(pos().y()) + r.width(); + y += yspeed; + y = (y % (300 + r.width() * 2)) - r.width(); + setPos(x, y); + + int rot = rotateFactor; + int sca = scaleFactor; if (rotate) - rotateFactor = 1 + (rot + xspeed) % 360; + rotateFactor = 1 + (rot + xspeed) % 360; if (scale) - scaleFactor = 1 + (sca + yspeed) % 50; + scaleFactor = 1 + (sca + yspeed) % 50; - if (rotate || scale) { - qreal s = 0.5 + scaleFactor / 50.0; - setTransform(QTransform().rotate(rotateFactor).scale(s, s)); - } + if (rotate || scale) { + qreal s = 0.5 + scaleFactor / 50.0; + setTransform(QTransform().rotate(rotateFactor).scale(s, s)); + } } private: @@ -657,37 +663,37 @@ void tst_QGraphicsView::textRiver() view.show(); QPixmap pix(":/images/designer.png"); - QVERIFY(!pix.isNull()); + QVERIFY(!pix.isNull()); QList items; QFile file(":/random.data"); QVERIFY(file.open(QIODevice::ReadOnly)); QDataStream str(&file); for (int i = 0; i < 100; ++i) { - 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); - if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale); + 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); + if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale); int rnd1, rnd2; str >> rnd1 >> rnd2; - item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), - -pix.height() + rnd2 % (view.height() + pix.height())); - scene.addItem(item); + item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), + -pix.height() + rnd2 % (view.height() + pix.height())); + scene.addItem(item); } view.count = 0; QBENCHMARK { #ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION + CALLGRIND_START_INSTRUMENTATION #endif - for (int i = 0; i < 100; ++i) { - scene.advance(); - while (view.count < (i+1)) - qApp->processEvents(); - } + for (int i = 0; i < 100; ++i) { + scene.advance(); + while (view.count < (i+1)) + qApp->processEvents(); + } #ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION + CALLGRIND_STOP_INSTRUMENTATION #endif } } -- cgit v0.12 From 693ad0f9ca5ee424dc1e3c7aca88adb4915f5cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Dec 2009 14:29:25 +0100 Subject: Improved raster blur implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We use more bits of precision in the fixed point exponential blur algorithm, which allows more fine-grained radii which is required for animating the blur. Also optimize the implementation a bit by transposing the image instead of blurring vertically which isn't very cache-efficient. Reviewed-by: Bjørn Erik Nilsen --- src/gui/image/qpixmapfilter.cpp | 358 +++++++++++++++++++++++++++++++++------- 1 file changed, 299 insertions(+), 59 deletions(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 3723500..6289efe 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -52,6 +52,10 @@ #include "private/qgraphicssystem_p.h" #include "private/qpaintengineex_p.h" #include "private/qpaintengine_raster_p.h" +#include "qmath.h" +#include "private/qmath_p.h" +#include "private/qmemrotate_p.h" +#include "private/qdrawhelper_p.h" #ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE @@ -585,97 +589,327 @@ QGraphicsBlurEffect::BlurHints QPixmapBlurFilter::blurHints() const return d->hints; } +const qreal radiusScale = qreal(2.5); + /*! \internal */ QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const { Q_D(const QPixmapBlurFilter); - const qreal delta = d->radius + 1; + const qreal delta = radiusScale * d->radius + 1; return rect.adjusted(-delta, -delta, delta, delta); } // Blur the image according to the blur radius // Based on exponential blur algorithm by Jani Huhtanen -// (maximum radius is set to 16) -static QImage blurred(const QImage& image, const QRect& rect, int radius, bool alphaOnly = false) + +template +static inline void blurrow( QImage & im, int line, int alpha); + +/* +* expblur(QImage &img, int radius) +* +* In-place blur of image 'img' with kernel +* of approximate radius 'radius'. +* +* Blurs with two sided exponential impulse +* response. +* +* aprec = precision of alpha parameter +* in fixed-point format 0.aprec +* +* zprec = precision of state parameters +* zR,zG,zB and zA in fp format 8.zprec +*/ +template +void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transposed = 0) { - int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 }; - int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1]; + // halve the radius if we're using two passes + if (improvedQuality) + radius *= 0.5; + + Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied + || img.format() == QImage::Format_RGB32); + + // choose the alpha such that pixels at radius distance from a fully + // saturated pixel will have an alpha component of no greater than + // the cutOffIntensity + const qreal cutOffIntensity = 2; + int alpha = radius <= qreal(1e-5) + ? ((1 << aprec)-1) + : qRound((1<(img, row, alpha); + } - QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); - int r1 = rect.top(); - int r2 = rect.bottom(); - int c1 = rect.left(); - int c2 = rect.right(); + QImage temp(img.height(), img.width(), img.format()); + if (transposed >= 0) { + if (img.depth() == 8) { + qt_memrotate270(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } else { + qt_memrotate270(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } + } else { + if (img.depth() == 8) { + qt_memrotate90(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } else { + qt_memrotate90(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } + } - int bpl = result.bytesPerLine(); - int rgba[4]; - unsigned char* p; + img_height = temp.height(); + for (int row = 0; row < img_height; ++row) { + for (int i = 0; i <= improvedQuality; ++i) + blurrow(temp, row, alpha); + } - int i1 = 0; - int i2 = 3; + if (transposed == 0) { + qt_memrotate90(reinterpret_cast(temp.bits()), + temp.width(), temp.height(), temp.bytesPerLine(), + reinterpret_cast(img.bits()), + img.bytesPerLine()); + } else { + img = temp; + } +} - if (alphaOnly) - i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3); +template +static inline int static_shift(int value) +{ + if (shift == 0) + return value; + else if (shift > 0) + return value << (uint(shift) & 0x1f); + else + return value >> (uint(-shift) & 0x1f); +} + +template +static inline void blurinner(uchar *bptr, int &zR, int &zG, int &zB, int &zA, int alpha) +{ + QRgb *pixel = (QRgb *)bptr; + +#define Z_MASK (0xff << zprec) + const int A_zprec = static_shift(*pixel) & Z_MASK; + const int R_zprec = static_shift(*pixel) & Z_MASK; + const int G_zprec = static_shift(*pixel) & Z_MASK; + const int B_zprec = static_shift(*pixel) & Z_MASK; +#undef Z_MASK + + const int zR_zprec = zR >> aprec; + const int zG_zprec = zG >> aprec; + const int zB_zprec = zB >> aprec; + const int zA_zprec = zA >> aprec; + + zR += alpha * (R_zprec - zR_zprec); + zG += alpha * (G_zprec - zG_zprec); + zB += alpha * (B_zprec - zB_zprec); + zA += alpha * (A_zprec - zA_zprec); + +#define ZA_MASK (0xff << (zprec + aprec)) + *pixel = + static_shift<24 - zprec - aprec>(zA & ZA_MASK) + | static_shift<16 - zprec - aprec>(zR & ZA_MASK) + | static_shift<8 - zprec - aprec>(zG & ZA_MASK) + | static_shift<-zprec - aprec>(zB & ZA_MASK); +#undef ZA_MASK +} + +const int alphaIndex = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3); + +template +static inline void blurinner_alphaOnly(uchar *bptr, int &z, int alpha) +{ + const int A_zprec = int(*(bptr)) << zprec; + const int z_zprec = z >> aprec; + z += alpha * (A_zprec - z_zprec); + *(bptr) = z >> (zprec + aprec); +} + +template +static inline void blurrow(QImage & im, int line, int alpha) +{ + uchar *bptr = im.scanLine(line); + + int zR = 0, zG = 0, zB = 0, zA = 0; - for (int col = c1; col <= c2; col++) { - p = result.scanLine(r1) + col * 4; - for (int i = i1; i <= i2; i++) - rgba[i] = p[i] << 4; + if (alphaOnly && im.format() != QImage::Format_Indexed8) + bptr += alphaIndex; - p += bpl; - for (int j = r1; j < r2; j++, p += bpl) - for (int i = i1; i <= i2; i++) - p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; + const int stride = im.depth() >> 3; + const int im_width = im.width(); + for (int index = 0; index < im_width; ++index) { + if (alphaOnly) + blurinner_alphaOnly(bptr, zA, alpha); + else + blurinner(bptr, zR, zG, zB, zA, alpha); + bptr += stride; } - for (int row = r1; row <= r2; row++) { - p = result.scanLine(row) + c1 * 4; - for (int i = i1; i <= i2; i++) - rgba[i] = p[i] << 4; + bptr -= stride; - p += 4; - for (int j = c1; j < c2; j++, p += 4) - for (int i = i1; i <= i2; i++) - p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; + for (int index = im_width - 2; index >= 0; --index) { + bptr -= stride; + if (alphaOnly) + blurinner_alphaOnly(bptr, zA, alpha); + else + blurinner(bptr, zR, zG, zB, zA, alpha); } +} + +#define AVG(a,b) ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) ) +#define AVG16(a,b) ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) ) - for (int col = c1; col <= c2; col++) { - p = result.scanLine(r2) + col * 4; - for (int i = i1; i <= i2; i++) - rgba[i] = p[i] << 4; +Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source) +{ + QImage srcImage = source; + + if (source.format() == QImage::Format_Indexed8) { + // assumes grayscale + QImage dest(source.width() / 2, source.height() / 2, srcImage.format()); + + const uchar *src = reinterpret_cast(const_cast(srcImage).bits()); + int sx = srcImage.bytesPerLine(); + int sx2 = sx << 1; + + uchar *dst = reinterpret_cast(dest.bits()); + int dx = dest.bytesPerLine(); + int ww = dest.width(); + int hh = dest.height(); + + for (int y = hh; y; --y, dst += dx, src += sx2) { + const uchar *p1 = src; + const uchar *p2 = src + sx; + uchar *q = dst; + for (int x = ww; x; --x, ++q, p1 += 2, p2 += 2) + *q = ((int(p1[0]) + int(p1[1]) + int(p2[0]) + int(p2[1])) + 2) >> 2; + } + + return dest; + } else if (source.format() == QImage::Format_ARGB8565_Premultiplied) { + QImage dest(source.width() / 2, source.height() / 2, srcImage.format()); + + const uchar *src = reinterpret_cast(const_cast(srcImage).bits()); + int sx = srcImage.bytesPerLine(); + int sx2 = sx << 1; + + uchar *dst = reinterpret_cast(dest.bits()); + int dx = dest.bytesPerLine(); + int ww = dest.width(); + int hh = dest.height(); + + for (int y = hh; y; --y, dst += dx, src += sx2) { + const uchar *p1 = src; + const uchar *p2 = src + sx; + uchar *q = dst; + for (int x = ww; x; --x, q += 3, p1 += 6, p2 += 6) { + // alpha + q[0] = AVG(AVG(p1[0], p1[3]), AVG(p2[0], p2[3])); + // rgb + const quint16 p16_1 = (p1[2] << 8) | p1[1]; + const quint16 p16_2 = (p1[5] << 8) | p1[4]; + const quint16 p16_3 = (p2[2] << 8) | p2[1]; + const quint16 p16_4 = (p2[5] << 8) | p2[4]; + const quint16 result = AVG16(AVG16(p16_1, p16_2), AVG16(p16_3, p16_4)); + q[1] = result & 0xff; + q[2] = result >> 8; + } + } - p -= bpl; - for (int j = r1; j < r2; j++, p -= bpl) - for (int i = i1; i <= i2; i++) - p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; + return dest; + } else if (source.format() != QImage::Format_ARGB32_Premultiplied + && source.format() != QImage::Format_RGB32) + { + srcImage = source.convertToFormat(QImage::Format_ARGB32_Premultiplied); } - for (int row = r1; row <= r2; row++) { - p = result.scanLine(row) + c2 * 4; - for (int i = i1; i <= i2; i++) - rgba[i] = p[i] << 4; + QImage dest(source.width() / 2, source.height() / 2, srcImage.format()); + + const quint32 *src = reinterpret_cast(const_cast(srcImage).bits()); + int sx = srcImage.bytesPerLine() >> 2; + int sx2 = sx << 1; - p -= 4; - for (int j = c1; j < c2; j++, p -= 4) - for (int i = i1; i <= i2; i++) - p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4; + quint32 *dst = reinterpret_cast(dest.bits()); + int dx = dest.bytesPerLine() >> 2; + int ww = dest.width(); + int hh = dest.height(); + + for (int y = hh; y; --y, dst += dx, src += sx2) { + const quint32 *p1 = src; + const quint32 *p2 = src + sx; + quint32 *q = dst; + for (int x = ww; x; --x, q++, p1 += 2, p2 += 2) + *q = AVG(AVG(p1[0], p1[1]), AVG(p2[0], p2[1])); } - return result; + return dest; +} + +Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0) +{ + if (blurImage.format() != QImage::Format_ARGB32_Premultiplied + && blurImage.format() != QImage::Format_RGB32) + { + blurImage = blurImage.convertToFormat(QImage::Format_ARGB32_Premultiplied); + } + + qreal scale = 1; + if (radius >= 4) { + blurImage = qt_halfScaled(blurImage); + scale = 2; + radius *= 0.5; + } + + if (alphaOnly) + expblur<12, 10, true>(blurImage, radius, quality, transposed); + else + expblur<12, 10, false>(blurImage, radius, quality, transposed); + + if (p) { + p->scale(scale, scale); + p->setRenderHint(QPainter::SmoothPixmapTransform); + p->drawImage(QRect(0, 0, blurImage.width(), blurImage.height()), blurImage); + } +} + +Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0) +{ + if (blurImage.format() == QImage::Format_Indexed8) + expblur<12, 10, true>(blurImage, radius, quality, transposed); + else + expblur<12, 10, false>(blurImage, radius, quality, transposed); } /*! \internal */ -void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF &srcRect) const +void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF &rect) const { Q_D(const QPixmapBlurFilter); if (!painter->isActive()) return; - if (d->radius <= 0) { + QRectF srcRect = rect; + if (srcRect.isNull()) + srcRect = src.rect(); + + if (d->radius <= 1) { painter->drawPixmap(srcRect.translated(p), src, srcRect); return; } @@ -684,7 +918,7 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapBlurFilter *blurFilter = static_cast(filter); if (blurFilter) { - blurFilter->setRadius(d->radius); + blurFilter->setRadius(radiusScale * d->radius); blurFilter->setBlurHints(d->hints); blurFilter->draw(painter, p, src, srcRect); return; @@ -693,17 +927,17 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap QImage srcImage; QImage destImage; - if (srcRect.isNull()) { + if (srcRect == src.rect()) { srcImage = src.toImage(); - destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius)); } else { QRect rect = srcRect.toAlignedRect().intersected(src.rect()); - srcImage = src.copy(rect).toImage(); - destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius)); } - painter->drawImage(p, destImage); + QTransform transform = painter->worldTransform(); + painter->translate(p); + qt_blurImage(painter, srcImage, radiusScale * d->radius, (d->hints & QGraphicsBlurEffect::QualityHint), false); + painter->setWorldTransform(transform); } // grayscales the image to dest (could be same). If rect isn't defined @@ -1095,7 +1329,13 @@ void QPixmapDropShadowFilter::draw(QPainter *p, tmpPainter.end(); // blur the alpha channel - tmp = blurred(tmp, tmp.rect(), qRound(d->radius), true); + QImage blurred(tmp.size(), QImage::Format_ARGB32_Premultiplied); + blurred.fill(0); + QPainter blurPainter(&blurred); + qt_blurImage(&blurPainter, tmp, d->radius, false, true); + blurPainter.end(); + + tmp = blurred; // blacken the image... tmpPainter.begin(&tmp); -- cgit v0.12 From be525c78c8ac44e7c188a45a4e04a1d80ad9ba51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Dec 2009 10:06:12 +0100 Subject: Optimize QGraphicsItemEffectSourcePrivate::pixmap() for QGraphicsPixmapItems. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even for DeviceCoordinate mode we can return the raw pixmap if the graphics item size is untransformed. Reviewed-by: Bjørn Erik Nilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 18 ++++---- tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 49 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index d955f16..b6820f7 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10717,7 +10717,6 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); return QPixmap(); } - if (!item->d_ptr->scene) return QPixmap(); QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); @@ -10725,9 +10724,11 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP const QRectF sourceRect = boundingRect(system); QRectF effectRectF; + bool unpadded = false; if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { if (info) { effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates)); + unpadded = (effectRectF.size() == sourceRect.size()); if (info && system == Qt::LogicalCoordinates) effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF); } else { @@ -10739,6 +10740,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5); } else { effectRectF = sourceRect; + unpadded = true; } QRect effectRect = effectRectF.toAlignedRect(); @@ -10746,6 +10748,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP if (offset) *offset = effectRect.topLeft(); + bool untransformed = !deviceCoordinates + || info->painter->worldTransform().type() <= QTransform::TxTranslate; + if (untransformed && unpadded && isPixmap()) { + if (offset) + *offset = boundingRect(system).topLeft().toPoint(); + return static_cast(item)->pixmap(); + } + if (deviceCoordinates) { // Clip to viewport rect. int left, top, right, bottom; @@ -10773,12 +10783,6 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP if (effectRect.isEmpty()) return QPixmap(); - if (system == Qt::LogicalCoordinates - && effectRect.size() == sourceRect.size() - && isPixmap()) { - return static_cast(item)->pixmap(); - } - QPixmap pixmap(effectRect.size()); pixmap.fill(Qt::transparent); QPainter pixmapPainter(&pixmap); diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 259df4d..69fc118 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -69,6 +69,7 @@ private slots: void opacity(); void grayscale(); void colorize(); + void drawPixmapItem(); }; void tst_QGraphicsEffect::initTestCase() @@ -465,6 +466,54 @@ void tst_QGraphicsEffect::colorize() QCOMPARE(image.pixel(10, 10), qRgb(122, 193, 66)); } +class PixmapItemEffect : public QGraphicsEffect +{ +public: + PixmapItemEffect(const QPixmap &source) + : QGraphicsEffect() + , pixmap(source) + , repaints(0) + {} + + QRectF boundingRectFor(const QRectF &rect) const + { return rect; } + + void draw(QPainter *painter) + { + QVERIFY(sourcePixmap(Qt::LogicalCoordinates).pixmapData() == pixmap.pixmapData()); + QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).pixmapData() == pixmap.pixmapData())); + + ++repaints; + } + QPixmap pixmap; + int repaints; +}; + +void tst_QGraphicsEffect::drawPixmapItem() +{ + QImage image(32, 32, QImage::Format_RGB32); + QPainter p(&image); + p.fillRect(0, 0, 32, 16, Qt::blue); + p.fillRect(0, 16, 32, 16, Qt::red); + p.end(); + + QGraphicsScene scene; + QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap::fromImage(image)); + scene.addItem(item); + + PixmapItemEffect *effect = new PixmapItemEffect(item->pixmap()); + item->setGraphicsEffect(effect); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + item->rotate(180); + QTest::qWait(50); + + QTRY_VERIFY(effect->repaints >= 2); +} + QTEST_MAIN(tst_QGraphicsEffect) #include "tst_qgraphicseffect.moc" -- cgit v0.12 From 8bbb0e70d189d7027494004a8dece8aeb4e37366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 11 Dec 2009 12:21:49 +0100 Subject: Fixed bug in QGraphicsPixmapItem shortcut for graphics effects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to take the pixmap item's drawing offset into consideration. Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index d6cabaa..4f7ffc8 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -313,7 +313,10 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse // Shortcut, no cache for childless pixmap items... const QGraphicsItem *item = graphicsItem(); if (system == Qt::LogicalCoordinates && mode == QGraphicsEffect::NoPad && item && isPixmap()) { - return ((QGraphicsPixmapItem *) item)->pixmap(); + const QGraphicsPixmapItem *pixmapItem = static_cast(item); + if (offset) + *offset = pixmapItem->offset().toPoint(); + return pixmapItem->pixmap(); } if (system == Qt::DeviceCoordinates && item -- cgit v0.12 From 21c31b4a3ae972a4c2f03adebd43a2d6a27f8c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 11 Dec 2009 12:24:23 +0100 Subject: Added InvalidateReason to invalidateCache to optimize effects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets us ignore the invalidateCache call when the transform of a graphics item with an effect changes, and the cached system is LogicalCoordinates and cached mode is not PadToEffectiveBoundingRect. Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 10 +++++++--- src/gui/effects/qgraphicseffect_p.h | 11 ++++++++++- src/gui/graphicsview/qgraphicsscene.cpp | 7 +++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 4f7ffc8..dafea52 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -374,10 +374,14 @@ QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate() invalidateCache(); } -void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const +void QGraphicsEffectSourcePrivate::invalidateCache(InvalidateReason reason) const { - if (effectRectChanged && m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect) + if (m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect + && (reason == EffectRectChanged + || reason == TransformChanged + && m_cachedSystem == Qt::LogicalCoordinates)) return; + QPixmapCache::remove(m_cacheKey); } @@ -523,7 +527,7 @@ void QGraphicsEffect::updateBoundingRect() Q_D(QGraphicsEffect); if (d->source) { d->source->d_func()->effectBoundingRectChanged(); - d->source->d_func()->invalidateCache(true); + d->source->d_func()->invalidateCache(QGraphicsEffectSourcePrivate::EffectRectChanged); } } diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 0011eef..cab7a48 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -108,6 +108,13 @@ public: , m_cachedMode(QGraphicsEffect::PadToTransparentBorder) {} + enum InvalidateReason + { + TransformChanged, + EffectRectChanged, + SourceChanged + }; + virtual ~QGraphicsEffectSourcePrivate(); virtual void detach() = 0; virtual QRectF boundingRect(Qt::CoordinateSystem system) const = 0; @@ -121,7 +128,9 @@ public: virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0, QGraphicsEffect::PixmapPadMode mode = QGraphicsEffect::PadToTransparentBorder) const = 0; virtual void effectBoundingRectChanged() = 0; - void invalidateCache(bool effectRectChanged = false) const; + + void invalidateCache(InvalidateReason reason = SourceChanged) const; + Qt::CoordinateSystem currentCachedSystem() const { return m_cachedSystem; } friend class QGraphicsScenePrivate; friend class QGraphicsItem; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 2af90b8..ff3c1bb 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4658,10 +4658,13 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * painter->setWorldTransform(*transformPtr); painter->setOpacity(opacity); - if (sourced->lastEffectTransform != painter->worldTransform()) { + if (sourced->currentCachedSystem() != Qt::LogicalCoordinates + && sourced->lastEffectTransform != painter->worldTransform()) + { sourced->lastEffectTransform = painter->worldTransform(); - sourced->invalidateCache(); + sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); } + item->d_ptr->graphicsEffect->draw(painter); painter->setWorldTransform(restoreTransform); sourced->info = 0; -- cgit v0.12 From b543f356ca9f4a1db72e937968f06804df7c17bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 11 Dec 2009 12:28:58 +0100 Subject: Fixed bug in graphics effects caching of graphics item hierarchies. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure to invalidate the cache if the transform of a sub-item changes. Reviewed-by: Bjørn Erik Nilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b6820f7..fbfd8e6 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7177,9 +7177,16 @@ void QGraphicsItem::prepareGeometryChange() QGraphicsItem *parent = this; while ((parent = parent->d_ptr->parent)) { - parent->d_ptr->dirtyChildrenBoundingRect = 1; + QGraphicsItemPrivate *parentp = parent->d_ptr.data(); + parentp->dirtyChildrenBoundingRect = 1; // ### Only do this if the parent's effect applies to the entire subtree. - parent->d_ptr->notifyBoundingRectChanged = 1; + parentp->notifyBoundingRectChanged = 1; +#ifndef QT_NO_GRAPHICSEFFECT + if (parentp->scene && parentp->graphicsEffect) { + parentp->notifyInvalidated = 1; + static_cast(parentp->graphicsEffect->d_func()->source->d_func())->invalidateCache(); + } +#endif } } -- cgit v0.12 From 9c4a79038fcd2c2a90a277db81aaadac50eaa59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Dec 2009 10:03:42 +0100 Subject: Optimized blur / drop shadow effects for the GL 2 paint engine. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do the blur in half the resolution in software and then upload the result as a texture and smooth-scale it on the GPU. This leads to stable and decent performance regardless of the blur radius, and simplifies the implementation quite a bit. Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 11 +- src/gui/image/qpixmapfilter.cpp | 17 +- src/gui/painting/qmemrotate.cpp | 21 + src/gui/painting/qmemrotate_p.h | 2 + .../gl2paintengineex/qglcustomshaderstage_p.h | 2 +- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 3 - src/opengl/qgl.cpp | 41 +- src/opengl/qglpixmapfilter.cpp | 754 +++++---------------- 8 files changed, 237 insertions(+), 614 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index dafea52..a523bab 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -844,22 +844,19 @@ QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const void QGraphicsBlurEffect::draw(QPainter *painter) { Q_D(QGraphicsBlurEffect); - if (d->filter->radius() <= 0) { + if (d->filter->radius() < 1) { drawSource(painter); return; } PixmapPadMode mode = PadToEffectiveBoundingRect; if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) - mode = PadToTransparentBorder; + mode = NoPad; // Draw pixmap in device coordinates to avoid pixmap scaling. QPoint offset; - const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode); - QTransform restoreTransform = painter->worldTransform(); - painter->setWorldTransform(QTransform()); + QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, mode); d->filter->draw(painter, offset, pixmap); - painter->setWorldTransform(restoreTransform); } /*! @@ -1040,7 +1037,7 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter) PixmapPadMode mode = PadToEffectiveBoundingRect; if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) - mode = PadToTransparentBorder; + mode = NoPad; // Draw pixmap in device coordinates to avoid pixmap scaling. QPoint offset; diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 6289efe..9c7c28e 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -627,7 +627,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp { // halve the radius if we're using two passes if (improvedQuality) - radius *= 0.5; + radius *= qreal(0.5); Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied || img.format() == QImage::Format_RGB32); @@ -638,7 +638,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp const qreal cutOffIntensity = 2; int alpha = radius <= qreal(1e-5) ? ((1 << aprec)-1) - : qRound((1<= 4) { blurImage = qt_halfScaled(blurImage); scale = 2; - radius *= 0.5; + radius *= qreal(0.5); } if (alphaOnly) @@ -896,6 +896,8 @@ Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, in expblur<12, 10, false>(blurImage, radius, quality, transposed); } +bool qt_scaleForTransform(const QTransform &transform, qreal *scale); + /*! \internal */ @@ -914,11 +916,16 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap return; } + qreal scaledRadius = radiusScale * d->radius; + qreal scale; + if (qt_scaleForTransform(painter->transform(), &scale)) + scaledRadius /= scale; + QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapBlurFilter *blurFilter = static_cast(filter); if (blurFilter) { - blurFilter->setRadius(radiusScale * d->radius); + blurFilter->setRadius(scaledRadius); blurFilter->setBlurHints(d->hints); blurFilter->draw(painter, p, src, srcRect); return; @@ -936,7 +943,7 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap QTransform transform = painter->worldTransform(); painter->translate(p); - qt_blurImage(painter, srcImage, radiusScale * d->radius, (d->hints & QGraphicsBlurEffect::QualityHint), false); + qt_blurImage(painter, srcImage, scaledRadius, (d->hints & QGraphicsBlurEffect::QualityHint), false); painter->setWorldTransform(transform); } diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index 67dc2c7..e3a6f78 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -572,5 +572,26 @@ QT_IMPL_MEMROTATE(quint32, qrgb_generic16) QT_IMPL_MEMROTATE(quint16, qrgb_generic16) #endif +struct qrgb_gl_rgba +{ +public: + inline qrgb_gl_rgba(quint32 v) { + if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) + data = ((v << 16) & 0xff0000) | ((v >> 16) & 0xff) | (v & 0xff00ff00); + else + data = (v << 8) | ((v >> 24) & 0xff); + } + + inline operator quint32() const { return data; } + +private: + quint32 data; +} Q_PACKED; + +void Q_GUI_EXPORT qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride, + quint32 *dest, int dstStride) +{ + qt_memrotate90_template(src, srcWidth, srcHeight, srcStride, reinterpret_cast(dest), dstStride); +} QT_END_NAMESPACE diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h index 676a880..8aee575 100644 --- a/src/gui/painting/qmemrotate_p.h +++ b/src/gui/painting/qmemrotate_p.h @@ -81,6 +81,8 @@ QT_BEGIN_NAMESPACE void Q_GUI_QWS_EXPORT qt_memrotate180(const srctype*, int, int, int, desttype*, int); \ void Q_GUI_QWS_EXPORT qt_memrotate270(const srctype*, int, int, int, desttype*, int) +void Q_GUI_EXPORT qt_memrotate90(const quint32*, int, int, int, quint32*, int); + QT_DECL_MEMROTATE(quint32, quint32); QT_DECL_MEMROTATE(quint32, quint16); QT_DECL_MEMROTATE(quint16, quint32); diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h index e319389..e0033be 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h @@ -68,7 +68,7 @@ class Q_OPENGL_EXPORT QGLCustomShaderStage public: QGLCustomShaderStage(); virtual ~QGLCustomShaderStage(); - virtual void setUniforms(QGLShaderProgram*) = 0; + virtual void setUniforms(QGLShaderProgram*) {} void setUniformsDirty(); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 0084476..77ca3a8 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -291,10 +291,7 @@ public: QScopedPointer convolutionFilter; QScopedPointer colorizeFilter; QScopedPointer blurFilter; - QScopedPointer animationBlurFilter; - QScopedPointer fastBlurFilter; QScopedPointer dropShadowFilter; - QScopedPointer fastDropShadowFilter; QSet pathCaches; QVector unusedVBOSToClean; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b6f8919..2a3ce54 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2063,6 +2063,29 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G // #define QGL_BIND_TEXTURE_DEBUG +// map from Qt's ARGB endianness-dependent format to GL's big-endian RGBA layout +static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) +{ + const int width = img.width(); + const int height = img.height(); + + if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV + || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) + { + for (int i = 0; i < height; ++i) { + uint *p = (uint *) img.scanLine(i); + for (int x = 0; x < width; ++x) + p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00); + } + } else { + for (int i = 0; i < height; ++i) { + uint *p = (uint *) img.scanLine(i); + for (int x = 0; x < width; ++x) + p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff); + } + } +} + QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint internalFormat, const qint64 key, QGLContext::BindOptions options) { @@ -2215,23 +2238,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G // 32 in the switch above is for the RGB16 case, where we set // the format to GL_RGB Q_ASSERT(img.depth() == 32); - const int width = img.width(); - const int height = img.height(); - - if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV - || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) { - for (int i=0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x=0; x> 16) & 0xff) | (p[x] & 0xff00ff00); - } - } else { - for (int i=0; i < height; ++i) { - uint *p = (uint *) img.scanLine(i); - for (int x=0; x> 24) & 0xff); - } - } + qgl_byteSwapImage(img, pixel_type); } #ifdef QT_OPENGL_ES // OpenGL/ES requires that the internal and external formats be identical. diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index c478630..c0a0460 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -55,11 +55,17 @@ #include "qgl_p.h" #include "private/qapplication_p.h" +#include "private/qdrawhelper_p.h" +#include "private/qmemrotate_p.h" #include "private/qmath_p.h" #include "qmath.h" QT_BEGIN_NAMESPACE +// qpixmapfilter.cpp +void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0); +QImage qt_halfScaled(const QImage &source); + void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const { const_cast(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, QGLContext::BindOptions(QGLContext::DefaultBindOption | QGLContext::MemoryManagedBindOption)); @@ -102,48 +108,21 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints); - - void setUniforms(QGLShaderProgram *program); - - static QByteArray generateGaussianShader(int radius, bool singlePass = false, bool dropShadow = false); + QGLPixmapBlurFilter(); protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; - -private: - - mutable QSize m_textureSize; - mutable bool m_horizontalBlur; - mutable bool m_singlePass; - mutable bool m_animatedBlur; - - mutable qreal m_t; - mutable QSize m_targetSize; - - mutable bool m_haveCached; - mutable int m_cachedRadius; - mutable QGraphicsBlurEffect::BlurHints m_hints; }; class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints); + QGLPixmapDropShadowFilter(); void setUniforms(QGLShaderProgram *program); protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; - -private: - mutable QSize m_textureSize; - mutable bool m_horizontalBlur; - mutable bool m_singlePass; - - mutable bool m_haveCached; - mutable int m_cachedRadius; - mutable QGraphicsBlurEffect::BlurHints m_hints; }; extern QGLWidget *qt_gl_share_widget(); @@ -158,31 +137,14 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr return d->colorizeFilter.data(); case QPixmapFilter::BlurFilter: { - const QPixmapBlurFilter *proto = static_cast(prototype); - if (proto->blurHints() & QGraphicsBlurEffect::AnimationHint) { - if (!d->animationBlurFilter) - d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHints())); - return d->animationBlurFilter.data(); - } - if ((proto->blurHints() & QGraphicsBlurEffect::QualityHint) && proto->radius() > 5) { - if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); - return d->blurFilter.data(); - } - if (!d->fastBlurFilter) - d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); - return d->fastBlurFilter.data(); + if (!d->blurFilter) + d->blurFilter.reset(new QGLPixmapBlurFilter()); + return d->blurFilter.data(); } case QPixmapFilter::DropShadowFilter: { - const QPixmapDropShadowFilter *proto = static_cast(prototype); - if (proto->blurRadius() <= 5) { - if (!d->fastDropShadowFilter) - d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::PerformanceHint)); - return d->fastDropShadowFilter.data(); - } if (!d->dropShadowFilter) - d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::QualityHint)); + d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter()); return d->dropShadowFilter.data(); } @@ -311,59 +273,43 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *painter, const QPointF &pos return true; } -static const char *qt_gl_texture_sampling_helper = - "lowp float texture2DAlpha(lowp sampler2D src, highp vec2 srcCoords) {\n" - " return texture2D(src, srcCoords).a;\n" - "}\n"; - -QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints) - : m_animatedBlur(false) - , m_haveCached(false) - , m_cachedRadius(0) - , m_hints(hints) -{ -} - -// should be even numbers as they will be divided by two -static const int qCachedBlurLevels[] = { 6, 14, 30 }; -static const int qNumCachedBlurTextures = sizeof(qCachedBlurLevels) / sizeof(*qCachedBlurLevels); -static const int qMaxCachedBlurLevel = qCachedBlurLevels[qNumCachedBlurTextures - 1]; - -static qreal qLogBlurLevel(int level) +QGLPixmapBlurFilter::QGLPixmapBlurFilter() { - static bool initialized = false; - static qreal logBlurLevelCache[qNumCachedBlurTextures]; - if (!initialized) { - for (int i = 0; i < qNumCachedBlurTextures; ++i) - logBlurLevelCache[i] = qLn(qCachedBlurLevels[i]); - initialized = true; - } - return logBlurLevelCache[level]; } class QGLBlurTextureInfo { public: - QGLBlurTextureInfo(QSize size, GLuint textureIds[]) - : m_size(size) + QGLBlurTextureInfo(const QImage &image, GLuint tex, qreal r) + : m_texture(tex) + , m_radius(r) { - for (int i = 0; i < qNumCachedBlurTextures; ++i) - m_textureIds[i] = textureIds[i]; + m_paddedImage << image; } ~QGLBlurTextureInfo() { - glDeleteTextures(qNumCachedBlurTextures, m_textureIds); + glDeleteTextures(1, &m_texture); } - QSize size() const { return m_size; } - GLuint textureId(int i) const { return m_textureIds[i]; } + QImage paddedImage(int scaleLevel = 0) const; + GLuint texture() const { return m_texture; } + qreal radius() const { return m_radius; } private: - GLuint m_textureIds[qNumCachedBlurTextures]; - QSize m_size; + mutable QList m_paddedImage; + GLuint m_texture; + qreal m_radius; }; +QImage QGLBlurTextureInfo::paddedImage(int scaleLevel) const +{ + for (int i = m_paddedImage.size() - 1; i <= scaleLevel; ++i) + m_paddedImage << qt_halfScaled(m_paddedImage.at(i)); + + return m_paddedImage.at(scaleLevel); +} + class QGLBlurTextureCache : public QObject { public: @@ -373,7 +319,6 @@ public: ~QGLBlurTextureCache(); QGLBlurTextureInfo *takeBlurTextureInfo(const QPixmap &pixmap); - bool fitsInCache(const QPixmap &pixmap) const; bool hasBlurTextureInfo(const QPixmap &pixmap) const; void insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info); void clearBlurTextureInfo(const QPixmap &pixmap); @@ -458,12 +403,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe if (timerId) killTimer(timerId); - timerId = startTimer(1000); -} - -bool QGLBlurTextureCache::fitsInCache(const QPixmap &pixmap) const -{ - return pixmap.width() * pixmap.height() <= cache.maxCost(); + timerId = startTimer(8000); } void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap) @@ -474,567 +414,219 @@ void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap) } } -static const char *qt_gl_interpolate_filter = - "uniform lowp float interpolationValue;" - "uniform lowp sampler2D interpolateTarget;" - "uniform highp vec4 interpolateMapping;" - "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" - "{" - " return mix(texture2D(interpolateTarget, interpolateMapping.xy + interpolateMapping.zw * srcCoords)," - " texture2D(src, srcCoords), interpolationValue);" - "}"; +static const int qAnimatedBlurLevelIncrement = 16; +static const int qMaxBlurHalfScaleLevel = 1; -static void initializeTexture(GLuint id, int width, int height) +static GLuint generateBlurTexture(const QSize &size, GLenum format = GL_RGBA) { - glBindTexture(GL_TEXTURE_2D, id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glBindTexture(GL_TEXTURE_2D, 0); + GLuint texture; + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + glTexImage2D(GL_TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, + GL_UNSIGNED_BYTE, 0); + return texture; } -bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const +static inline uint nextMultiple(uint x, uint multiplier) { - QGLPixmapBlurFilter *filter = const_cast(this); - - QGLContext *ctx = const_cast(QGLContext::currentContext()); - QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); - - if ((m_hints & QGraphicsBlurEffect::AnimationHint) && blurTextureCache->fitsInCache(src)) { - QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel); - // ensure even dimensions (going to divide by two) - targetRect.setWidth((targetRect.width() + 1) & ~1); - targetRect.setHeight((targetRect.height() + 1) & ~1); - - QGLBlurTextureInfo *info = 0; - if (blurTextureCache->hasBlurTextureInfo(src)) { - info = blurTextureCache->takeBlurTextureInfo(src); - } else { - m_animatedBlur = false; - m_hints = QGraphicsBlurEffect::QualityHint; - m_singlePass = false; - - QGLFramebufferObjectFormat format; - format.setInternalTextureFormat(GLenum(GL_RGBA)); - QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true); - - if (!fbo) - return false; - - QPainter fboPainter(fbo); - QGL2PaintEngineEx *engine = static_cast(fboPainter.paintEngine()); - - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - - // ensure GL_LINEAR filtering is used for scaling down to half the size - fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); - fboPainter.setCompositionMode(QPainter::CompositionMode_Source); - fboPainter.drawPixmap(qMaxCachedBlurLevel / 2, qMaxCachedBlurLevel / 2, - targetRect.width() / 2 - qMaxCachedBlurLevel, targetRect.height() / 2 - qMaxCachedBlurLevel, src); - - GLuint textures[qNumCachedBlurTextures]; // blur textures - glGenTextures(qNumCachedBlurTextures, textures); - GLuint temp; // temp texture - glGenTextures(1, &temp); - - initializeTexture(temp, fbo->width(), fbo->height()); - m_textureSize = fbo->size(); - - int currentBlur = 0; - - QRect fboRect(0, 0, fbo->width(), fbo->height()); - GLuint sourceTexture = fbo->texture(); - for (int i = 0; i < qNumCachedBlurTextures; ++i) { - int targetBlur = qCachedBlurLevels[i] / 2; - - int blurDelta = qRound(qSqrt(targetBlur * targetBlur - currentBlur * currentBlur)); - QByteArray source = generateGaussianShader(blurDelta); - filter->setSource(source); - - currentBlur = targetBlur; - - // now we're going to be nasty and keep using the same FBO with different textures - glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, temp, 0); - - m_horizontalBlur = true; - filter->setOnPainter(&fboPainter); - engine->drawTexture(fboRect, sourceTexture, fbo->size(), fboRect); - filter->removeFromPainter(&fboPainter); - - sourceTexture = textures[i]; - initializeTexture(sourceTexture, fbo->width(), fbo->height()); - - glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, textures[i], 0); - - m_horizontalBlur = false; - filter->setOnPainter(&fboPainter); - engine->drawTexture(fboRect, temp, fbo->size(), fboRect); - filter->removeFromPainter(&fboPainter); - } + uint mod = x % multiplier; + if (mod == 0) + return x; + return x + multiplier - mod; +} - glDeleteTextures(1, &temp); +void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride, + quint32 *dest, int dstStride); - // reattach the original FBO texture - glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, fbo->texture(), 0); +bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const +{ + if (radius() < 1) { + painter->drawPixmap(pos, src); + return true; + } - fboPainter.end(); + qreal actualRadius = radius(); - qgl_fbo_pool()->release(fbo); + QGLPixmapBlurFilter *filter = const_cast(this); - info = new QGLBlurTextureInfo(fboRect.size(), textures); - } + QGLContext *ctx = const_cast(QGLContext::currentContext()); - if (!m_haveCached || !m_animatedBlur) { - m_haveCached = true; - m_animatedBlur = true; - m_hints = QGraphicsBlurEffect::AnimationHint; - filter->setSource(qt_gl_interpolate_filter); - } + QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); + QGLBlurTextureInfo *info = 0; + int padding = nextMultiple(qCeil(actualRadius), qAnimatedBlurLevelIncrement); + QRect targetRect = src.rect().adjusted(-padding, -padding, padding, padding); - QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); - painter->setRenderHint(QPainter::SmoothPixmapTransform); - filter->setOnPainter(painter); + // pad so that we'll be able to half-scale qMaxBlurHalfScaleLevel times + targetRect.setWidth((targetRect.width() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1)); + targetRect.setHeight((targetRect.height() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1)); - qreal logRadius = qLn(radius()); + QSize textureSize; - int t; - for (t = -1; t < qNumCachedBlurTextures - 2; ++t) { - if (logRadius < qLogBlurLevel(t+1)) - break; - } + info = blurTextureCache->takeBlurTextureInfo(src); + if (!info || info->radius() < actualRadius) { + QSize paddedSize = targetRect.size() / 2; - qreal logBase = t >= 0 ? qLogBlurLevel(t) : 0; - m_t = qBound(qreal(0), (logRadius - logBase) / (qLogBlurLevel(t+1) - logBase), qreal(1)); + QImage padded(paddedSize.height(), paddedSize.width(), QImage::Format_ARGB32_Premultiplied); + padded.fill(0); - m_textureSize = info->size(); + if (info) { + int oldPadding = qRound(info->radius()); - glActiveTexture(GL_TEXTURE0 + 3); - if (t >= 0) { - glBindTexture(GL_TEXTURE_2D, info->textureId(t)); - m_targetSize = info->size(); + QPainter p(&padded); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.drawImage((padding - oldPadding) / 2, (padding - oldPadding) / 2, info->paddedImage()); + p.end(); } else { - QGLTexture *texture = - ctx->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, - QGLContext::InternalBindOption - | QGLContext::CanFlipNativePixmapBindOption); - m_targetSize = src.size(); - if (!(texture->options & QGLContext::InvertedYBindOption)) - m_targetSize.setHeight(-m_targetSize.height()); + // TODO: combine byteswapping and memrotating into one by declaring + // custom GL_RGBA pixel type and qt_colorConvert template for it + QImage prepadded = qt_halfScaled(src.toImage()).convertToFormat(QImage::Format_ARGB32_Premultiplied); + + // byte-swap and memrotates in one go + qt_memrotate90_gl(reinterpret_cast(prepadded.bits()), + prepadded.width(), prepadded.height(), prepadded.bytesPerLine(), + reinterpret_cast(padded.scanLine(padding / 2)) + padding / 2, + padded.bytesPerLine()); } - // restrict the target rect to the max of the radii we are interpolating between - int radiusDelta = qMaxCachedBlurLevel - qCachedBlurLevels[t+1]; - targetRect = targetRect.translated(pos.toPoint()).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); - - radiusDelta /= 2; - QRect sourceRect = QRect(QPoint(), m_textureSize).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta); - - engine->drawTexture(targetRect, info->textureId(t+1), m_textureSize, sourceRect); + delete info; + info = new QGLBlurTextureInfo(padded, generateBlurTexture(paddedSize), padding); - glActiveTexture(GL_TEXTURE0 + 3); - glBindTexture(GL_TEXTURE_2D, 0); - - filter->removeFromPainter(painter); - blurTextureCache->insertBlurTextureInfo(src, info); - - return true; - } - - if (blurTextureCache->hasBlurTextureInfo(src)) - blurTextureCache->clearBlurTextureInfo(src); - - int actualRadius = qRound(radius()); - int filterRadius = actualRadius; - int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (!(m_hints & QGraphicsBlurEffect::QualityHint)) { - uint i = 0; - for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { - if (fastRadii[i+1] > filterRadius) - break; - } - filterRadius = fastRadii[i]; + textureSize = paddedSize; + } else { + textureSize = QSize(info->paddedImage().height(), info->paddedImage().width()); } - m_singlePass = filterRadius <= 3; - - if (!m_haveCached || m_animatedBlur || filterRadius != m_cachedRadius) { - // Only regenerate the shader from source if parameters have changed. - m_haveCached = true; - m_animatedBlur = false; - m_cachedRadius = filterRadius; - QByteArray source = generateGaussianShader(filterRadius, m_singlePass); - filter->setSource(source); + actualRadius *= qreal(0.5); + int level = 1; + for (; level < qMaxBlurHalfScaleLevel; ++level) { + if (actualRadius <= 16) + break; + actualRadius *= qreal(0.5); } - QRect targetRect = QRectF(src.rect()).translated(pos).adjusted(-actualRadius, -actualRadius, actualRadius, actualRadius).toAlignedRect(); + const int s = (1 << level); - if (m_singlePass) { - // prepare for updateUniforms - m_textureSize = src.size(); + int prepadding = qRound(info->radius()); + padding = qMin(prepadding, qCeil(actualRadius) << level); + targetRect = src.rect().adjusted(-padding, -padding, padding, padding); - // ensure GL_LINEAR filtering is used - painter->setRenderHint(QPainter::SmoothPixmapTransform); - filter->setOnPainter(painter); - QBrush pixmapBrush = src; - pixmapBrush.setTransform(QTransform::fromTranslate(pos.x(), pos.y())); - painter->fillRect(targetRect, pixmapBrush); - filter->removeFromPainter(painter); - } else { - QGLFramebufferObjectFormat format; - format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB)); - QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size(), format); + targetRect.setWidth(targetRect.width() & ~(s-1)); + targetRect.setHeight(targetRect.height() & ~(s-1)); - if (!fbo) - return false; + int paddingDelta = (prepadding - padding) >> level; - // prepare for updateUniforms - m_textureSize = src.size(); + QRect subRect(paddingDelta, paddingDelta, targetRect.width() >> level, targetRect.height() >> level); + QImage sourceImage = info->paddedImage(level-1); - // horizontal pass, to pixmap - m_horizontalBlur = true; + QImage subImage(subRect.height(), subRect.width(), QImage::Format_ARGB32_Premultiplied); + qt_rectcopy((QRgb *)subImage.bits(), ((QRgb *)sourceImage.scanLine(paddingDelta)) + paddingDelta, + 0, 0, subRect.height(), subRect.width(), subImage.bytesPerLine(), sourceImage.bytesPerLine()); - QPainter fboPainter(fbo); + GLuint texture = info->texture(); - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); + qt_blurImage(subImage, actualRadius, blurHints() & QGraphicsBlurEffect::QualityHint, 1); - // ensure GL_LINEAR filtering is used - fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); - fboPainter.setCompositionMode(QPainter::CompositionMode_Source); - filter->setOnPainter(&fboPainter); - QBrush pixmapBrush = src; - pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); - fboPainter.fillRect(QRect(0, 0, targetRect.width(), targetRect.height()), pixmapBrush); - filter->removeFromPainter(&fboPainter); - fboPainter.end(); + // subtract one pixel off the end to prevent the bilinear sampling from sampling uninitialized data + QRect textureSubRect = subImage.rect().adjusted(0, 0, -1, -1); + QRectF targetRectF = QRectF(targetRect).adjusted(0, 0, -targetRect.width() / qreal(textureSize.width()), -targetRect.height() / qreal(textureSize.height())); - QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); + glBindTexture(GL_TEXTURE_2D, texture); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subImage.width(), subImage.height(), GL_RGBA, + GL_UNSIGNED_BYTE, const_cast(subImage).bits()); - // vertical pass, to painter - m_horizontalBlur = false; - m_textureSize = fbo->size(); + QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); + painter->setRenderHint(QPainter::SmoothPixmapTransform); - painter->save(); - // ensure GL_LINEAR filtering is used - painter->setRenderHint(QPainter::SmoothPixmapTransform); - filter->setOnPainter(painter); - engine->drawTexture(targetRect, fbo->texture(), fbo->size(), QRect(QPoint(), targetRect.size()).translated(0, fbo->height() - targetRect.height())); - filter->removeFromPainter(painter); - painter->restore(); + // texture is flipped on the y-axis + targetRectF = QRectF(targetRectF.x(), targetRectF.bottom(), targetRectF.width(), -targetRectF.height()); + engine->drawTexture(targetRectF.translated(pos), texture, textureSize, textureSubRect); - qgl_fbo_pool()->release(fbo); - } + blurTextureCache->insertBlurTextureInfo(src, info); return true; } -void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) -{ - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - if (m_animatedBlur) { - program->setUniformValue("interpolateTarget", 3); - program->setUniformValue("interpolationValue", GLfloat(m_t)); - - if (m_textureSize == m_targetSize) { - program->setUniformValue("interpolateMapping", 0.0f, 0.0f, 1.0f, 1.0f); - } else { - float offsetX = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.width()); - float offsetY = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.height()); - - if (m_targetSize.height() < 0) - offsetY = 1 + offsetY; - - float scaleX = 2.0f * qreal(m_textureSize.width()) / qreal(m_targetSize.width()); - float scaleY = 2.0f * qreal(m_textureSize.height()) / qreal(m_targetSize.height()); - - program->setUniformValue("interpolateMapping", offsetX, offsetY, scaleX, scaleY); - } - - return; - } +static const char *qt_gl_drop_shadow_filter = + "uniform lowp vec4 shadowColor;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" + "{" + " return shadowColor * texture2D(src, srcCoords.yx).a;" + "}"; - if (m_hints & QGraphicsBlurEffect::QualityHint) { - if (m_singlePass) - program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); - else if (m_horizontalBlur) - program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0); - else - program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height()); - } else { - qreal blur = radius() / qreal(m_cachedRadius); - - if (m_singlePass) - program->setUniformValue("delta", blur / m_textureSize.width(), blur / m_textureSize.height()); - else if (m_horizontalBlur) - program->setUniformValue("delta", blur / m_textureSize.width(), 0.0); - else - program->setUniformValue("delta", 0.0, blur / m_textureSize.height()); - } -} -static inline qreal gaussian(qreal dx, qreal sigma) +QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter() { - return exp(-dx * dx / (2 * sigma * sigma)) / (Q_2PI * sigma * sigma); + setSource(qt_gl_drop_shadow_filter); } -QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePass, bool dropShadow) +bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const { - Q_ASSERT(radius >= 1); - - radius = qMin(127, radius); - - static QCache shaderSourceCache; - uint key = radius | (int(singlePass) << 7) | (int(dropShadow) << 8); - QByteArray *cached = shaderSourceCache.object(key); - if (cached) - return *cached; - - QByteArray source; - source.reserve(1000); - source.append(qt_gl_texture_sampling_helper); - - source.append("uniform highp vec2 delta;\n"); - if (dropShadow) - source.append("uniform mediump vec4 shadowColor;\n"); - source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n"); - - QVector sampleOffsets; - QVector weights; - - QVector gaussianComponents; - - qreal sigma = radius / 1.65; - - qreal sum = 0; - for (int i = -radius; i < radius; ++i) { - float value = gaussian(i, sigma); - gaussianComponents << value; - sum += value; - } - - // normalize - for (int i = 0; i < gaussianComponents.size(); ++i) - gaussianComponents[i] /= sum; - - for (int i = 0; i < gaussianComponents.size() - 1; i += 2) { - qreal weight = gaussianComponents.at(i) + gaussianComponents.at(i + 1); - qreal offset = i - radius + gaussianComponents.at(i + 1) / weight; - - sampleOffsets << offset; - weights << weight; - } - - int limit = sampleOffsets.size(); - if (singlePass) - limit *= limit; - - QByteArray baseCoordinate = "srcCoords"; - - for (int i = 0; i < limit; ++i) { - QByteArray coordinate = baseCoordinate; - - qreal weight; - if (singlePass) { - const int xIndex = i % sampleOffsets.size(); - const int yIndex = i / sampleOffsets.size(); - - const qreal deltaX = sampleOffsets.at(xIndex); - const qreal deltaY = sampleOffsets.at(yIndex); - weight = weights.at(xIndex) * weights.at(yIndex); - - if (!qFuzzyCompare(deltaX, deltaY)) { - coordinate.append(" + vec2(delta.x * float("); - coordinate.append(QByteArray::number(deltaX)); - coordinate.append("), delta.y * float("); - coordinate.append(QByteArray::number(deltaY)); - coordinate.append("))"); - } else if (!qFuzzyIsNull(deltaX)) { - coordinate.append(" + delta * float("); - coordinate.append(QByteArray::number(deltaX)); - coordinate.append(")"); - } - } else { - const qreal delta = sampleOffsets.at(i); - weight = weights.at(i); - if (!qFuzzyIsNull(delta)) { - coordinate.append(" + delta * float("); - coordinate.append(QByteArray::number(delta)); - coordinate.append(")"); - } - } - - if (i == 0) { - if (dropShadow) - source.append(" mediump float sample = "); - else - source.append(" mediump vec4 sample = "); - } else { - if (dropShadow) - source.append(" sample += "); - else - source.append(" sample += "); - } + QGLPixmapDropShadowFilter *filter = const_cast(this); - source.append("texture2D(src, "); - source.append(coordinate); - source.append(")"); + qreal r = blurRadius(); + QRectF targetRectUnaligned = QRectF(src.rect()).translated(pos + offset()).adjusted(-r, -r, r, r); + QRect targetRect = targetRectUnaligned.toAlignedRect(); - if (dropShadow) - source.append(".a"); + // ensure even dimensions (going to divide by two) + targetRect.setWidth((targetRect.width() + 1) & ~1); + targetRect.setHeight((targetRect.height() + 1) & ~1); - if (!qFuzzyCompare(weight, qreal(1))) { - source.append(" * float("); - source.append(QByteArray::number(weight)); - source.append(");\n"); - } else { - source.append(";\n"); - } - } + QGLContext *ctx = const_cast(QGLContext::currentContext()); + QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); - source.append(" return "); - if (dropShadow) - source.append("shadowColor * "); - source.append("sample;\n"); - source.append("}\n"); + QGLBlurTextureInfo *info = blurTextureCache->takeBlurTextureInfo(src); + if (!info || info->radius() != r) { + QImage half = qt_halfScaled(src.toImage().alphaChannel()); - cached = new QByteArray(source); - shaderSourceCache.insert(key, cached); + qreal rx = r + targetRect.left() - targetRectUnaligned.left(); + qreal ry = r + targetRect.top() - targetRectUnaligned.top(); - return source; -} + QImage image = QImage(targetRect.size() / 2, QImage::Format_Indexed8); + image.setColorTable(half.colorTable()); + image.fill(0); + int dx = qRound(rx * qreal(0.5)); + int dy = qRound(ry * qreal(0.5)); + qt_rectcopy(image.bits(), half.bits(), dx, dy, + half.width(), half.height(), + image.bytesPerLine(), half.bytesPerLine()); -QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints) - : m_haveCached(false) - , m_cachedRadius(0) - , m_hints(hints) -{ -} + qt_blurImage(image, r * qreal(0.5), false, 1); -bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const -{ - QGLPixmapDropShadowFilter *filter = const_cast(this); + GLuint texture = generateBlurTexture(image.size(), GL_ALPHA); - int actualRadius = qRound(blurRadius()); - int filterRadius = actualRadius; - m_singlePass = filterRadius <= 3; + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), GL_ALPHA, + GL_UNSIGNED_BYTE, image.bits()); - if (!m_haveCached || filterRadius != m_cachedRadius) { - // Only regenerate the shader from source if parameters have changed. - m_haveCached = true; - m_cachedRadius = filterRadius; - QByteArray source = QGLPixmapBlurFilter::generateGaussianShader(filterRadius, m_singlePass, true); - filter->setSource(source); + info = new QGLBlurTextureInfo(image, texture, r); } - QRect targetRect = QRectF(src.rect()).translated(pos + offset()).adjusted(-actualRadius, -actualRadius, actualRadius, actualRadius).toAlignedRect(); - - if (m_singlePass) { - // prepare for updateUniforms - m_textureSize = src.size(); - - painter->save(); - // ensure GL_LINEAR filtering is used - painter->setRenderHint(QPainter::SmoothPixmapTransform); - filter->setOnPainter(painter); - QBrush pixmapBrush = src; - pixmapBrush.setTransform(QTransform::fromTranslate(pos.x() + offset().x(), pos.y() + offset().y())); - painter->fillRect(targetRect, pixmapBrush); - filter->removeFromPainter(painter); - painter->restore(); - } else { - QGLFramebufferObjectFormat format; - format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB)); - QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size(), format); - - if (!fbo) - return false; - - // prepare for updateUniforms - m_textureSize = src.size(); - - // horizontal pass, to pixmap - m_horizontalBlur = true; - - QPainter fboPainter(fbo); + GLuint texture = info->texture(); - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - - // ensure GL_LINEAR filtering is used - fboPainter.setRenderHint(QPainter::SmoothPixmapTransform); - fboPainter.setCompositionMode(QPainter::CompositionMode_Source); - filter->setOnPainter(&fboPainter); - QBrush pixmapBrush = src; - pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius)); - fboPainter.fillRect(QRect(0, 0, targetRect.width(), targetRect.height()), pixmapBrush); - filter->removeFromPainter(&fboPainter); - fboPainter.end(); - - QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); + filter->setOnPainter(painter); - // vertical pass, to painter - m_horizontalBlur = false; - m_textureSize = fbo->size(); + QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); + painter->setRenderHint(QPainter::SmoothPixmapTransform); - painter->save(); - // ensure GL_LINEAR filtering is used - painter->setRenderHint(QPainter::SmoothPixmapTransform); - filter->setOnPainter(painter); - engine->drawTexture(targetRect, fbo->texture(), fbo->size(), QRectF(0, fbo->height() - targetRect.height(), targetRect.width(), targetRect.height())); - filter->removeFromPainter(painter); - painter->restore(); + engine->drawTexture(targetRect, texture, info->paddedImage().size(), info->paddedImage().rect()); - qgl_fbo_pool()->release(fbo); - } + filter->removeFromPainter(painter); // Now draw the actual pixmap over the top. painter->drawPixmap(pos, src, srcRect); + blurTextureCache->insertBlurTextureInfo(src, info); + return true; } void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) { - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - QColor col = color(); - if (m_horizontalBlur && !m_singlePass) { - program->setUniformValue("shadowColor", 1.0f, 1.0f, 1.0f, 1.0f); - } else { - qreal alpha = col.alphaF(); - program->setUniformValue("shadowColor", col.redF() * alpha, - col.greenF() * alpha, - col.blueF() * alpha, - alpha); - } - - if (m_hints & QGraphicsBlurEffect::QualityHint) { - if (m_singlePass) - program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); - else if (m_horizontalBlur) - program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0); - else - program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height()); - } else { - qreal blur = blurRadius() / qreal(m_cachedRadius); - - if (m_singlePass) - program->setUniformValue("delta", blur / m_textureSize.width(), blur / m_textureSize.height()); - else if (m_horizontalBlur) - program->setUniformValue("delta", blur / m_textureSize.width(), 0.0); - else - program->setUniformValue("delta", 0.0, blur / m_textureSize.height()); - } + qreal alpha = col.alphaF(); + program->setUniformValue("shadowColor", col.redF() * alpha, + col.greenF() * alpha, + col.blueF() * alpha, + alpha); } QT_END_NAMESPACE -- cgit v0.12 From 19a2bd42d11d070e229cf00c43d6aa777d590415 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 14 Dec 2009 15:02:53 +0100 Subject: Add "nocopy" mode for seperate-debug-info to configure This patch was written by Harald Fernengel for Maemo5 port. This effectively just adds -g to QMAKE_CFLAGS & QMAKE_CXXFLAGS and is mainly for packagers who want to build Qt in release mode and still have debug symbols, but will want to strip those debug symbols out themselves (rather than let Qt do it). Reviewed-By: Harald Fernengel Reviewed-By: Thiago Macieira --- configure | 7 +++++++ mkspecs/features/unix/separate_debug_info.prf | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 6dc3898..f186944 100755 --- a/configure +++ b/configure @@ -712,6 +712,7 @@ CFG_PTMALLOC=no CFG_STL=auto CFG_PRECOMPILE=auto CFG_SEPARATE_DEBUG_INFO=auto +CFG_SEPARATE_DEBUG_INFO_NOCOPY=no CFG_REDUCE_EXPORTS=auto CFG_MMX=auto CFG_3DNOW=auto @@ -1543,6 +1544,9 @@ while [ "$#" -gt 0 ]; do separate-debug-info) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_SEPARATE_DEBUG_INFO="$VAL" + elif [ "$VAL" = "nocopy" ] ; then + CFG_SEPARATE_DEBUG_INFO="yes" + CFG_SEPARATE_DEBUG_INFO_NOCOPY="yes" else UNKNOWN_OPT=yes fi @@ -6083,6 +6087,9 @@ if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then QMakeVar add QMAKE_CXXFLAGS -g QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info" fi +if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then + QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy" +fi [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx" [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow" [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse" diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf index 0c95baf..c675828 100644 --- a/mkspecs/features/unix/separate_debug_info.prf +++ b/mkspecs/features/unix/separate_debug_info.prf @@ -1,5 +1,5 @@ -!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) { +!separate_debug_info_nocopy:!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) { QMAKE_SEPARATE_DEBUG_INFO = (test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" ) ; QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z "$(DESTDIR)" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.debug $(INSTALL_ROOT)/\$\$target_path/ -- cgit v0.12 From e45b9b43b427128295ff00a6f09c451c766c17e2 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 14 Dec 2009 15:57:02 +0100 Subject: Make mkspec/unsupported/linux-host-g++ use correct include Reviewed-By: Trustme --- mkspecs/unsupported/linux-host-g++/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf index 237477c..8a480c4 100644 --- a/mkspecs/unsupported/linux-host-g++/qmake.conf +++ b/mkspecs/unsupported/linux-host-g++/qmake.conf @@ -134,5 +134,5 @@ QMAKE_MKDIR = mkdir -p QMAKE_INSTALL_FILE = install -m 644 -p QMAKE_INSTALL_PROGRAM = install -m 755 -p -include(../common/unix.conf) +include(../../common/unix.conf) load(qt_config) -- cgit v0.12 From df512b3bc5c4e10c5dc0410dbc4d6bdfe9d593f1 Mon Sep 17 00:00:00 2001 From: ninerider Date: Mon, 23 Nov 2009 15:03:42 +0100 Subject: Compilation fix for Windows Mobile The default style (plastique) used was not available if not included in the build. Using now the windows style instead. Reviewed-by: Maurice --- tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index d3087dc..ab110e6 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -146,7 +146,7 @@ void tst_QGraphicsLinearLayout::initTestCase() { // since the style will influence the results, we have to ensure // that the tests are run using the same style on all platforms -#ifdef Q_WS_S60 +#if defined( Q_WS_S60 )|| defined (Q_WS_WINCE) QApplication::setStyle(new QWindowsStyle); #else QApplication::setStyle(new QPlastiqueStyle); -- cgit v0.12 From 7e9e5bc366ef76ec1f4b5f683f84e6beb66fa0ea Mon Sep 17 00:00:00 2001 From: ninerider Date: Tue, 24 Nov 2009 14:45:19 +0100 Subject: Removed the chip demo for windows CE The chip demo causes a memory exception on most Windows CE devices. For now we simply will not include this demo in the package for Windows CE. In the future a specialized version might be created. Reviewed-by: Maurice --- demos/demos.pro | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/demos/demos.pro b/demos/demos.pro index a943bfd..5a9b6db 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -20,7 +20,24 @@ symbian: SUBDIRS = \ demos_shared \ demos_deform \ demos_pathstroke - + +wince*: SUBDIRS = \ + demos_shared \ + demos_deform \ + demos_gradients \ + demos_pathstroke \ + demos_affine \ + demos_composition \ + demos_books \ + demos_interview \ + demos_mainwindow \ + demos_spreadsheet \ + demos_textedit \ + # demos_chip \ + demos_embeddeddialogs \ + demos_undo \ + demos_sub-attaq + contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl):!contains(QT_CONFIG, opengles2):{ SUBDIRS += demos_boxes } @@ -33,7 +50,7 @@ wince*|symbian|embedded|x11: SUBDIRS += embedded !cross_compile:{ contains(QT_BUILD_PARTS, tools):{ !wince*:SUBDIRS += demos_sqlbrowser demos_qtdemo -wince*: SUBDIRS += demos_sqlbrowser +wince*:SUBDIRS += demos_sqlbrowser } } contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer -- cgit v0.12 From a72468e820c2922540737c053eef27d033c2e77b Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 3 Dec 2009 13:31:01 +0100 Subject: Test fixed for Windows CE. Some test very corrected, the low level file descriptor tests mostly skipped as well as the multiple memory mapping of a file, which resulted in the file handle not beeign properly released. Reviewed-by: thartman --- tests/auto/qfile/tst_qfile.cpp | 75 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 13 deletions(-) diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 7ee5665..2b2f431 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -220,6 +220,9 @@ public: private: enum FileType { OpenQFile, OpenFd, OpenStream }; + void openStandardStreamsFileDescriptors(); + void openStandardStreamsBufferedStreams(); + bool openFd(QFile &file, QIODevice::OpenMode mode) { int fdMode = QT_OPEN_LARGEFILE | QT_OPEN_BINARY; @@ -554,6 +557,10 @@ void tst_QFile::size() QFETCH( QString, filename ); QFETCH( qint64, size ); +#ifdef Q_WS_WINCE + filename = QFileInfo(filename).absoluteFilePath(); +#endif + { QFile f( filename ); QCOMPARE( f.size(), size ); @@ -564,24 +571,29 @@ void tst_QFile::size() { QFile f; - int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY); - QVERIFY( fd != -1 ); - QVERIFY( f.open(fd, QIODevice::ReadOnly) ); + FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb"); + QVERIFY( stream ); + QVERIFY( f.open(stream, QIODevice::ReadOnly) ); QCOMPARE( f.size(), size ); f.close(); - QT_CLOSE(fd); + fclose(stream); } { +#ifdef Q_WS_WINCE + QSKIP("Currently low level file I/O not well supported on Windows CE", SkipSingle); +#endif QFile f; - FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb"); - QVERIFY( stream ); - QVERIFY( f.open(stream, QIODevice::ReadOnly) ); + + int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY); + + QVERIFY( fd != -1 ); + QVERIFY( f.open(fd, QIODevice::ReadOnly) ); QCOMPARE( f.size(), size ); f.close(); - fclose(stream); + QT_CLOSE(fd); } } @@ -603,6 +615,7 @@ void tst_QFile::seek() QVERIFY(file.seek(10)); QCOMPARE(file.pos(), qint64(10)); QCOMPARE(file.size(), qint64(0)); + file.close(); QFile::remove("newfile.txt"); } @@ -1128,9 +1141,15 @@ void tst_QFile::copyFallback() QVERIFY(QFile::exists("file-copy-destination.txt")); QVERIFY(!file.isOpen()); +#ifdef Q_WS_WINCE // Need to reset permissions on Windows to be able to delete QVERIFY(QFile::setPermissions("file-copy-destination.txt", - QFile::ReadOwner | QFile::WriteOwner)); + QFile::WriteOther)); +#else + // Need to reset permissions on Windows to be able to delete + QVERIFY(QFile::setPermissions("file-copy-destination.txt", + QFile::ReadOwner | QFile::WriteOwner)); +#endif QVERIFY(QFile::remove("file-copy-destination.txt")); // Fallback copy of open file. @@ -1139,6 +1158,7 @@ void tst_QFile::copyFallback() QVERIFY(QFile::exists("file-copy-destination.txt")); QVERIFY(!file.isOpen()); + file.close(); QFile::remove("file-copy-destination.txt"); } @@ -2239,6 +2259,7 @@ void tst_QFile::rename() QFile file(source); QCOMPARE(file.rename(destination), result); + if (result) QCOMPARE(file.error(), QFile::NoError); else @@ -2367,6 +2388,7 @@ void tst_QFile::appendAndRead() QCOMPARE(readFile.read(1 << j).size(), 1 << j); } + readFile.close(); QFile::remove(QLatin1String("appendfile.txt")); } @@ -2608,10 +2630,15 @@ void tst_QFile::map() QFETCH(QFile::FileError, error); QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile"; + +#ifdef Q_WS_WINCE + fileName = QFileInfo(fileName).absoluteFilePath(); +#endif + if (QFile::exists(fileName)) { QVERIFY(QFile::setPermissions(fileName, QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser)); - QFile::remove(fileName); + QFile::remove(fileName); } QFile file(fileName); @@ -2650,8 +2677,13 @@ void tst_QFile::map() QCOMPARE(file.error(), QFile::NoError); // hpux wont let you map multiple times. -#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) +#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE) // exotic test to make sure that multiple maps work + + // note: windows ce does not reference count mutliple maps + // it's essentially just the same reference but it + // cause a resource lock on the file which prevents it + // from being removed uchar *memory1 = file.map(0, file.size()); uchar *memory1 = file.map(0, file.size()); QCOMPARE(file.error(), QFile::NoError); uchar *memory2 = file.map(0, file.size()); @@ -2687,7 +2719,6 @@ void tst_QFile::map() QVERIFY(!memory); QVERIFY(file.setPermissions(originalPermissions)); } - QVERIFY(file.remove()); } @@ -2800,8 +2831,14 @@ void tst_QFile::openDirectory() f1.close(); } -void tst_QFile::openStandardStreams() +void tst_QFile::openStandardStreamsFileDescriptors() { +#ifdef Q_WS_WINCE + //allthough Windows CE (not mobile!) has functions that allow redirecting + //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW) + //it does not have functions to simply open them like below . + QSKIP("Opening standard streams on Windows CE via descriptor not implemented", SkipAll); +#endif // Using file descriptors { QFile in; @@ -2826,7 +2863,13 @@ void tst_QFile::openStandardStreams() QCOMPARE( err.size(), (qint64)0 ); QVERIFY( err.isSequential() ); } +} +void tst_QFile::openStandardStreamsBufferedStreams() +{ +#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN) + QSKIP("Unix only test.", SkipAll); +#endif // Using streams { QFile in; @@ -2853,6 +2896,12 @@ void tst_QFile::openStandardStreams() } } +void tst_QFile::openStandardStreams() +{ + openStandardStreamsFileDescriptors(); + openStandardStreamsBufferedStreams(); +} + void tst_QFile::writeNothing() { for (int i = 0; i < 3; ++i) { -- cgit v0.12 From 2ba459c2adcaa4d0f865956048ac2e24f3fe6924 Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 14 Dec 2009 17:13:23 +0100 Subject: QPlainTextEdit scrolling issue with folded paragraphs With Qt Creator, we could reproduce scrolling problems when paragraphs were folded away. Effectively the first "visible" block could be an invisible one, resulting in firstVisibleBlock() returning something bogus. The result were drawing errors. Reviewed-by: con --- src/gui/widgets/qplaintextedit.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 89fe7b8..028ffe8 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -684,8 +684,12 @@ void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceC qreal h = center ? line.naturalTextRect().center().y() : line.naturalTextRect().bottom(); + QTextBlock previousVisibleBlock = block; while (h < height && block.previous().isValid()) { - block = block.previous(); + previousVisibleBlock = block; + do { + block = block.previous(); + } while (!block.isVisible() && block.previous().isValid()); h += q->blockBoundingRect(block).height(); } @@ -699,8 +703,8 @@ void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceC ++l; } - if (block.next().isValid() && l >= lineCount) { - block = block.next(); + if (l >= lineCount) { + block = previousVisibleBlock; l = 0; } setTopBlock(block.blockNumber(), l); -- cgit v0.12 From 74bec871abb48baadf239fd12e77bb85924436a1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 14 Dec 2009 15:10:33 +0100 Subject: Fix QMetaObject::connect and disconnect with "dynamic signals" QML might pass index that are larger that the method cound. We must not call QMetaObjectPrivate::originalClone in that case as this would read invalid memory Reviewed-by: brad --- src/corelib/kernel/qmetaobject.cpp | 1 + src/corelib/kernel/qobject.cpp | 43 +++++------ tests/auto/qobject/tst_qobject.cpp | 144 +++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 20 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 6e6da19..72d6786 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2648,6 +2648,7 @@ const char* QMetaClassInfo::value() const */ int QMetaObjectPrivate::originalClone(const QMetaObject *mobj, int local_method_index) { + Q_ASSERT(local_method_index < get(mobj)->methodCount); int handle = get(mobj)->methodData + 5 * local_method_index; while (mobj->d.data[handle + 4] & MethodCloned) { Q_ASSERT(local_method_index > 0); diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 85915c2..4370ee0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2850,6 +2850,27 @@ void QObject::disconnectNotify(const char *) { } +/* \internal + convert a signal index from the method range to the signal range + */ +static int methodIndexToSignalIndex(const QMetaObject *metaObject, int signal_index) +{ + if (signal_index < 0) + return signal_index; + while (metaObject && metaObject->methodOffset() > signal_index) + metaObject = metaObject->superClass(); + + if (metaObject) { + int signalOffset, methodOffset; + computeOffsets(metaObject, &signalOffset, &methodOffset); + if (signal_index < metaObject->methodCount()) + signal_index = QMetaObjectPrivate::originalClone(metaObject, signal_index - methodOffset) + signalOffset; + else + signal_index = signal_index - methodOffset + signalOffset; + } + return signal_index; +} + /*!\internal \a types is a 0-terminated vector of meta types for queued connections. @@ -2860,16 +2881,7 @@ void QObject::disconnectNotify(const char *) bool QMetaObject::connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type, int *types) { - if (signal_index > 0) { - const QMetaObject *mo = sender->metaObject(); - while (mo && mo->methodOffset() > signal_index) - mo = mo->superClass(); - if (mo) { - int signalOffset, methodOffset; - computeOffsets(mo, &signalOffset, &methodOffset); - signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset; - } - } + signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index); return QMetaObjectPrivate::connect(sender, signal_index, receiver, method_index, type, types); } @@ -2938,16 +2950,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, bool QMetaObject::disconnect(const QObject *sender, int signal_index, const QObject *receiver, int method_index) { - if (signal_index > 0) { - const QMetaObject *mo = sender->metaObject(); - while (mo && mo->methodOffset() > signal_index) - mo = mo->superClass(); - if (mo) { - int signalOffset, methodOffset; - computeOffsets(mo, &signalOffset, &methodOffset); - signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset; - } - } + signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index); return QMetaObjectPrivate::disconnect(sender, signal_index, receiver, method_index); } diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index a2524aa..75d7a0a 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -126,6 +126,7 @@ private slots: void deleteQObjectWhenDeletingEvent(); void overloads(); void isSignalConnected(); + void qMetaObjectConnect(); protected: }; @@ -3125,5 +3126,148 @@ void tst_QObject::isSignalConnected() QCOMPARE(o.rec, 2); } +void tst_QObject::qMetaObjectConnect() +{ + SenderObject *s = new SenderObject; + ReceiverObject *r1 = new ReceiverObject; + ReceiverObject *r2 = new ReceiverObject; + r1->reset(); + r2->reset(); + ReceiverObject::sequence = 0; + + int signal1Index = s->metaObject()->indexOfSignal("signal1()"); + int signal3Index = s->metaObject()->indexOfSignal("signal3()"); + int slot1Index = r1->metaObject()->indexOfSlot("slot1()"); + int slot2Index = r1->metaObject()->indexOfSlot("slot2()"); + int slot3Index = r1->metaObject()->indexOfSlot("slot3()"); + + QVERIFY(slot1Index > 0); + QVERIFY(slot2Index > 0); + QVERIFY(slot3Index > 0); + + QVERIFY( QMetaObject::connect( s, signal1Index, r1, slot1Index) ); + QVERIFY( QMetaObject::connect( s, signal3Index, r2, slot3Index) ); + QVERIFY( QMetaObject::connect( s, -1, r2, slot2Index) ); + + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 0 ); + QCOMPARE( r1->count_slot3, 0 ); + QCOMPARE( r2->count_slot1, 0 ); + QCOMPARE( r2->count_slot2, 0 ); + QCOMPARE( r2->count_slot3, 0 ); + + s->emitSignal1(); + + QCOMPARE( r1->count_slot1, 1 ); + QCOMPARE( r1->count_slot2, 0 ); + QCOMPARE( r1->count_slot3, 0 ); + QCOMPARE( r2->count_slot1, 0 ); + QCOMPARE( r2->count_slot2, 1 ); + QCOMPARE( r2->count_slot3, 0 ); + + s->emitSignal2(); + s->emitSignal3(); + s->emitSignal4(); + + QCOMPARE( r1->count_slot1, 1 ); + QCOMPARE( r1->count_slot2, 0 ); + QCOMPARE( r1->count_slot3, 0 ); + QCOMPARE( r2->count_slot1, 0 ); + QCOMPARE( r2->count_slot2, 4 ); + QCOMPARE( r2->count_slot3, 1 ); + + QVERIFY( QMetaObject::disconnect( s, signal1Index, r1, slot1Index) ); + QVERIFY( QMetaObject::disconnect( s, signal3Index, r2, slot3Index) ); + QVERIFY( QMetaObject::disconnect( s, -1, r2, slot2Index) ); + + s->emitSignal1(); + s->emitSignal2(); + s->emitSignal3(); + s->emitSignal4(); + + QCOMPARE( r1->count_slot1, 1 ); + QCOMPARE( r1->count_slot2, 0 ); + QCOMPARE( r1->count_slot3, 0 ); + QCOMPARE( r2->count_slot1, 0 ); + QCOMPARE( r2->count_slot2, 4 ); + QCOMPARE( r2->count_slot3, 1 ); + + //some "dynamic" signal + QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 20, r1, slot3Index) ); + QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 35, r2, slot1Index) ); + QVERIFY( QMetaObject::connect( s, -1, r1, slot2Index) ); + + r1->reset(); + r2->reset(); + + void *args[] = { 0 , 0 }; + QMetaObject::activate(s, s->metaObject()->methodOffset() + 20, args); + QMetaObject::activate(s, s->metaObject()->methodOffset() + 48, args); + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 2 ); + QCOMPARE( r1->count_slot3, 1 ); + QCOMPARE( r2->count_slot1, 0 ); + QCOMPARE( r2->count_slot2, 0 ); + QCOMPARE( r2->count_slot3, 0 ); + + QMetaObject::activate(s, s->metaObject()->methodOffset() + 35, args); + s->emitSignal1(); + s->emitSignal2(); + + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 5 ); + QCOMPARE( r1->count_slot3, 1 ); + QCOMPARE( r2->count_slot1, 1 ); + QCOMPARE( r2->count_slot2, 0 ); + QCOMPARE( r2->count_slot3, 0 ); + + delete s; + r1->reset(); + r2->reset(); + +#define SIGNAL_INDEX(S) obj1.metaObject()->indexOfSignal(QMetaObject::normalizedSignature(#S)) + OverloadObject obj1; + QObject obj2, obj3; + + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int)) , r1, slot1Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *)) , r2, slot1Index); + + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *, QObject *)) , r1, slot2Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *)) , r2, slot2Index); + QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int, int)) , r1, slot3Index); + + emit obj1.sig(0.5); //connected to nothing + emit obj1.sig(1, 'a'); //connected to nothing + QCOMPARE( r1->count_slot1, 0 ); + QCOMPARE( r1->count_slot2, 0 ); + QCOMPARE( r1->count_slot3, 0 ); + QCOMPARE( r2->count_slot1, 0 ); + QCOMPARE( r2->count_slot2, 0 ); + QCOMPARE( r2->count_slot3, 0 ); + + emit obj1.sig(1); //this signal is connected + emit obj1.sig(&obj2); + + QCOMPARE( r1->count_slot1, 1 ); + QCOMPARE( r1->count_slot2, 0 ); + QCOMPARE( r1->count_slot3, 1 ); + QCOMPARE( r2->count_slot1, 0 ); + QCOMPARE( r2->count_slot2, 1 ); + QCOMPARE( r2->count_slot3, 0 ); + + emit obj1.sig(&obj2, &obj3); //this signal is connected + + QCOMPARE( r1->count_slot1, 1 ); + QCOMPARE( r1->count_slot2, 1 ); + QCOMPARE( r1->count_slot3, 1 ); + QCOMPARE( r2->count_slot1, 1 ); + QCOMPARE( r2->count_slot2, 1 ); + QCOMPARE( r2->count_slot3, 0 ); + + delete r1; + delete r2; + +} + QTEST_MAIN(tst_QObject) #include "tst_qobject.moc" -- cgit v0.12 From 504d6d4ac0d782c1fbca1f2dc1e8425dac773113 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 15 Dec 2009 11:59:56 +1000 Subject: Fixed compile for S60 (.def file updates). More private API changes, and mark QEgl symbols as ABSENT so compilation is not broken when OpenVG is disabled. --- src/s60installs/eabi/QtGuiu.def | 92 +++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index bfad2e7..b6862e5 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -698,13 +698,13 @@ EXPORTS _ZN11QFontDialogD2Ev @ 697 NONAME _ZN11QFontEngine11boundingBoxEjRK10QTransform @ 698 NONAME _ZN11QFontEngine11grayPaletteEv @ 699 NONAME - _ZN11QFontEngine13setGlyphCacheEN21QFontEngineGlyphCache4TypeEPS0_ @ 700 NONAME + _ZN11QFontEngine13setGlyphCacheEN21QFontEngineGlyphCache4TypeEPS0_ @ 700 NONAME ABSENT _ZN11QFontEngine13setGlyphCacheEPvP21QFontEngineGlyphCache @ 701 NONAME _ZN11QFontEngine15addGlyphsToPathEPjP11QFixedPointiP12QPainterPath6QFlagsIN9QTextItem10RenderFlagEE @ 702 NONAME _ZN11QFontEngine16addOutlineToPathEffRK12QGlyphLayoutP12QPainterPath6QFlagsIN9QTextItem10RenderFlagEE @ 703 NONAME _ZN11QFontEngine16alphaMapForGlyphEj @ 704 NONAME _ZN11QFontEngine16alphaMapForGlyphEjRK10QTransform @ 705 NONAME - _ZN11QFontEngine16expireGlyphCacheEv @ 706 NONAME + _ZN11QFontEngine16expireGlyphCacheEv @ 706 NONAME ABSENT _ZN11QFontEngine16getUnscaledGlyphEjP12QPainterPathP15glyph_metrics_t @ 707 NONAME _ZN11QFontEngine16loadKerningPairsE6QFixed @ 708 NONAME _ZN11QFontEngine16tightBoundingBoxERK12QGlyphLayout @ 709 NONAME @@ -7615,8 +7615,8 @@ EXPORTS _ZNK11QFontDialog11currentFontEv @ 7614 NONAME _ZNK11QFontDialog12selectedFontEv @ 7615 NONAME _ZNK11QFontDialog7optionsEv @ 7616 NONAME - _ZNK11QFontEngine10glyphCacheEN21QFontEngineGlyphCache4TypeERK10QTransform @ 7617 NONAME - _ZNK11QFontEngine10glyphCacheEPvRK10QTransform @ 7618 NONAME + _ZNK11QFontEngine10glyphCacheEN21QFontEngineGlyphCache4TypeERK10QTransform @ 7617 NONAME ABSENT + _ZNK11QFontEngine10glyphCacheEPvRK10QTransform @ 7618 NONAME ABSENT _ZNK11QFontEngine10glyphCountEv @ 7619 NONAME _ZNK11QFontEngine10propertiesEv @ 7620 NONAME _ZNK11QFontEngine12getSfntTableEj @ 7621 NONAME @@ -11741,45 +11741,47 @@ EXPORTS _ZN11QVectorPathD2Ev @ 11740 NONAME _ZNK11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS1_S2_E @ 11741 NONAME _ZNK20QGraphicsItemPrivate20discardUpdateRequestEbbb @ 11742 NONAME - _ZN11QEglContext10extensionsEv @ 11743 NONAME - _ZN11QEglContext10getDisplayEP12QPaintDevice @ 11744 NONAME - _ZN11QEglContext10waitClientEv @ 11745 NONAME - _ZN11QEglContext10waitNativeEv @ 11746 NONAME - _ZN11QEglContext11doneCurrentEv @ 11747 NONAME - _ZN11QEglContext11errorStringEi @ 11748 NONAME - _ZN11QEglContext11makeCurrentEi @ 11749 NONAME - _ZN11QEglContext11openDisplayEP12QPaintDevice @ 11750 NONAME - _ZN11QEglContext11swapBuffersEi @ 11751 NONAME - _ZN11QEglContext12chooseConfigERK14QEglPropertiesN4QEgl16PixelFormatMatchE @ 11752 NONAME - _ZN11QEglContext12hasExtensionEPKc @ 11753 NONAME - _ZN11QEglContext13createContextEPS_PK14QEglProperties @ 11754 NONAME - _ZN11QEglContext13createSurfaceEP12QPaintDevicePK14QEglProperties @ 11755 NONAME - _ZN11QEglContext14currentContextEN4QEgl3APIE @ 11756 NONAME - _ZN11QEglContext14defaultDisplayEP12QPaintDevice @ 11757 NONAME - _ZN11QEglContext14destroySurfaceEi @ 11758 NONAME - _ZN11QEglContext14dumpAllConfigsEv @ 11759 NONAME - _ZN11QEglContext15lazyDoneCurrentEv @ 11760 NONAME - _ZN11QEglContext17setCurrentContextEN4QEgl3APIEPS_ @ 11761 NONAME - _ZN11QEglContext7destroyEv @ 11762 NONAME - _ZN11QEglContextC1Ev @ 11763 NONAME - _ZN11QEglContextC2Ev @ 11764 NONAME - _ZN11QEglContextD1Ev @ 11765 NONAME - _ZN11QEglContextD2Ev @ 11766 NONAME - _ZN14QEglProperties11removeValueEi @ 11767 NONAME - _ZN14QEglProperties14dumpAllConfigsEv @ 11768 NONAME - _ZN14QEglProperties14setPixelFormatEN6QImage6FormatE @ 11769 NONAME - _ZN14QEglProperties17setRenderableTypeEN4QEgl3APIE @ 11770 NONAME - _ZN14QEglProperties19reduceConfigurationEv @ 11771 NONAME - _ZN14QEglProperties20setPaintDeviceFormatEP12QPaintDevice @ 11772 NONAME - _ZN14QEglProperties8setValueEii @ 11773 NONAME - _ZN14QEglPropertiesC1Ei @ 11774 NONAME - _ZN14QEglPropertiesC1Ev @ 11775 NONAME - _ZN14QEglPropertiesC2Ei @ 11776 NONAME - _ZN14QEglPropertiesC2Ev @ 11777 NONAME - _ZNK11QEglContext12configAttribEiPi @ 11778 NONAME - _ZNK11QEglContext16configPropertiesEi @ 11779 NONAME - _ZNK11QEglContext7isValidEv @ 11780 NONAME - _ZNK11QEglContext9isCurrentEv @ 11781 NONAME - _ZNK14QEglProperties5valueEi @ 11782 NONAME - _ZNK14QEglProperties8toStringEv @ 11783 NONAME + _ZN11QEglContext10extensionsEv @ 11743 NONAME ABSENT + _ZN11QEglContext10getDisplayEP12QPaintDevice @ 11744 NONAME ABSENT + _ZN11QEglContext10waitClientEv @ 11745 NONAME ABSENT + _ZN11QEglContext10waitNativeEv @ 11746 NONAME ABSENT + _ZN11QEglContext11doneCurrentEv @ 11747 NONAME ABSENT + _ZN11QEglContext11errorStringEi @ 11748 NONAME ABSENT + _ZN11QEglContext11makeCurrentEi @ 11749 NONAME ABSENT + _ZN11QEglContext11openDisplayEP12QPaintDevice @ 11750 NONAME ABSENT + _ZN11QEglContext11swapBuffersEi @ 11751 NONAME ABSENT + _ZN11QEglContext12chooseConfigERK14QEglPropertiesN4QEgl16PixelFormatMatchE @ 11752 NONAME ABSENT + _ZN11QEglContext12hasExtensionEPKc @ 11753 NONAME ABSENT + _ZN11QEglContext13createContextEPS_PK14QEglProperties @ 11754 NONAME ABSENT + _ZN11QEglContext13createSurfaceEP12QPaintDevicePK14QEglProperties @ 11755 NONAME ABSENT + _ZN11QEglContext14currentContextEN4QEgl3APIE @ 11756 NONAME ABSENT + _ZN11QEglContext14defaultDisplayEP12QPaintDevice @ 11757 NONAME ABSENT + _ZN11QEglContext14destroySurfaceEi @ 11758 NONAME ABSENT + _ZN11QEglContext14dumpAllConfigsEv @ 11759 NONAME ABSENT + _ZN11QEglContext15lazyDoneCurrentEv @ 11760 NONAME ABSENT + _ZN11QEglContext17setCurrentContextEN4QEgl3APIEPS_ @ 11761 NONAME ABSENT + _ZN11QEglContext7destroyEv @ 11762 NONAME ABSENT + _ZN11QEglContextC1Ev @ 11763 NONAME ABSENT + _ZN11QEglContextC2Ev @ 11764 NONAME ABSENT + _ZN11QEglContextD1Ev @ 11765 NONAME ABSENT + _ZN11QEglContextD2Ev @ 11766 NONAME ABSENT + _ZN14QEglProperties11removeValueEi @ 11767 NONAME ABSENT + _ZN14QEglProperties14dumpAllConfigsEv @ 11768 NONAME ABSENT + _ZN14QEglProperties14setPixelFormatEN6QImage6FormatE @ 11769 NONAME ABSENT + _ZN14QEglProperties17setRenderableTypeEN4QEgl3APIE @ 11770 NONAME ABSENT + _ZN14QEglProperties19reduceConfigurationEv @ 11771 NONAME ABSENT + _ZN14QEglProperties20setPaintDeviceFormatEP12QPaintDevice @ 11772 NONAME ABSENT + _ZN14QEglProperties8setValueEii @ 11773 NONAME ABSENT + _ZN14QEglPropertiesC1Ei @ 11774 NONAME ABSENT + _ZN14QEglPropertiesC1Ev @ 11775 NONAME ABSENT + _ZN14QEglPropertiesC2Ei @ 11776 NONAME ABSENT + _ZN14QEglPropertiesC2Ev @ 11777 NONAME ABSENT + _ZNK11QEglContext12configAttribEiPi @ 11778 NONAME ABSENT + _ZNK11QEglContext16configPropertiesEi @ 11779 NONAME ABSENT + _ZNK11QEglContext7isValidEv @ 11780 NONAME ABSENT + _ZNK11QEglContext9isCurrentEv @ 11781 NONAME ABSENT + _ZNK14QEglProperties5valueEi @ 11782 NONAME ABSENT + _ZNK14QEglProperties8toStringEv @ 11783 NONAME ABSENT + _ZNK11QFontEngine10glyphCacheEPvN21QFontEngineGlyphCache4TypeERK10QTransform @ 11784 NONAME + _ZNK20QGraphicsItemPrivate21effectiveBoundingRectERK6QRectF @ 11785 NONAME -- cgit v0.12 From 82ec0a6c26c683dedd20fb6dd3923dce98c3f7e3 Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 15 Dec 2009 13:09:12 +1000 Subject: (ODBC) Fixes segfault when error string is larger than 256 chars. SqlServer can throw custom error messages (via RaiseError) that can be up to 8000 chars long. Fixed this with a pre-query as to the length of the error string, then allocating enough space to retrieve the whole error string at once. Task-number: QTBUG-6618 Reviewed-by: Derick Hawcroft --- src/sql/drivers/odbc/qsql_odbc.cpp | 23 +++++++++++++++++------ tests/auto/qsqlquery/tst_qsqlquery.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index e686873..fdf0c2c 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -172,28 +172,39 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode SQLSMALLINT msgLen = 0; SQLRETURN r = SQL_NO_DATA; SQLTCHAR state_[SQL_SQLSTATE_SIZE+1]; - SQLTCHAR description_[SQL_MAX_MESSAGE_LENGTH]; + QVarLengthArray description_(SQL_MAX_MESSAGE_LENGTH); QString result; int i = 1; description_[0] = 0; + r = SQLGetDiagRec(handleType, + handle, + i, + state_, + &nativeCode_, + 0, + NULL, + &msgLen); + if(r == SQL_NO_DATA) + return QString(); + description_.resize(msgLen+1); do { r = SQLGetDiagRec(handleType, handle, i, - (SQLTCHAR*)state_, + state_, &nativeCode_, - (SQLTCHAR*)description_, - SQL_MAX_MESSAGE_LENGTH, /* in bytes, not in characters */ + description_.data(), + description_.size(), &msgLen); if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { if (nativeCode) *nativeCode = nativeCode_; QString tmpstore; #ifdef UNICODE - tmpstore = QString((const QChar*)description_, msgLen); + tmpstore = QString((const QChar*)description_.data(), msgLen); #else - tmpstore = QString::fromLocal8Bit((const char*)description_, msgLen); + tmpstore = QString::fromLocal8Bit((const char*)description_.data(), msgLen); #endif if(result != tmpstore) { if(!result.isEmpty()) diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index a8908fd..2a55c32 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -201,6 +201,8 @@ private slots: void QTBUG_5251(); void QTBUG_6421_data() { generic_data("QOCI"); } void QTBUG_6421(); + void QTBUG_6618_data() { generic_data("QODBC"); } + void QTBUG_6618(); private: // returns all database connections @@ -2961,5 +2963,27 @@ void tst_QSqlQuery::QTBUG_6421() QCOMPARE(q.value(0).toString(), QLatin1String("\"COL3\"")); } +void tst_QSqlQuery::QTBUG_6618() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + if (!tst_Databases::isSqlServer( db )) + QSKIP("SQL Server specific test", SkipSingle); + + QSqlQuery q(db); + q.exec( "drop procedure " + qTableName( "tst_raiseError" ) ); //non-fatal + QString errorString; + for (int i=0;i<110;i++) + errorString+="reallylong"; + errorString+=" error"; + QVERIFY_SQL( q, exec("create procedure " + qTableName( "tst_raiseError" ) + " as\n" + "begin\n" + " raiserror('" + errorString + "', 16, 1)\n" + "end\n" )); + q.exec( "{call " + qTableName( "tst_raiseError" ) + "}" ); + QVERIFY(q.lastError().text().contains(errorString)); +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" -- cgit v0.12 From c5ae0ffd52ee3f2964404bf85dee55712fb6bd8c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 15 Dec 2009 11:11:20 +1000 Subject: Add an image allocation pool to the OpenVG paint engine Some OpenVG GPU's have limitations on the amount of memory available to create VGImage's. When the memory runs out, vgCreateImage() will fail. This change introduces QVGImagePool, which keeps track of all QVGPixmapData image allocations and ejects least-recently-used pixmaps when GPU memory is exhausted. Task-number: QT-2554 Reviewed-by: trustme --- src/openvg/openvg.pro | 6 +- src/openvg/qpaintengine_vg.cpp | 16 ++- src/openvg/qpixmapdata_vg.cpp | 92 +++++++++------ src/openvg/qpixmapdata_vg_p.h | 17 ++- src/openvg/qpixmapfilter_vg.cpp | 25 +++-- src/openvg/qvgimagepool.cpp | 215 ++++++++++++++++++++++++++++++++++++ src/openvg/qvgimagepool_p.h | 157 ++++++++++++++++++++++++++ src/openvg/qwindowsurface_vgegl.cpp | 4 + 8 files changed, 479 insertions(+), 53 deletions(-) create mode 100644 src/openvg/qvgimagepool.cpp create mode 100644 src/openvg/qvgimagepool_p.h diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro index 8927c4c..c8c9917 100644 --- a/src/openvg/openvg.pro +++ b/src/openvg/openvg.pro @@ -16,11 +16,13 @@ HEADERS += \ qpaintengine_vg_p.h \ qpixmapdata_vg_p.h \ qpixmapfilter_vg_p.h \ - qvgcompositionhelper_p.h + qvgcompositionhelper_p.h \ + qvgimagepool_p.h SOURCES += \ qpaintengine_vg.cpp \ qpixmapdata_vg.cpp \ - qpixmapfilter_vg.cpp + qpixmapfilter_vg.cpp \ + qvgimagepool.cpp contains(QT_CONFIG, egl) { HEADERS += \ diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 6b829dd..04fee08 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -43,6 +43,7 @@ #include "qpixmapdata_vg_p.h" #include "qpixmapfilter_vg_p.h" #include "qvgcompositionhelper_p.h" +#include "qvgimagepool_p.h" #if !defined(QT_NO_EGL) #include #include "qwindowsurface_vgegl_p.h" @@ -1018,7 +1019,7 @@ static VGImage toVGImage const uchar *pixels = img.bits(); - VGImage vgImg = vgCreateImage + VGImage vgImg = QVGImagePool::instance()->createPermanentImage (format, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); vgImageSubData (vgImg, pixels, img.bytesPerLine(), format, 0, 0, @@ -1063,7 +1064,7 @@ static VGImage toVGImageSubRect const uchar *pixels = img.bits() + bpp * sr.x() + img.bytesPerLine() * sr.y(); - VGImage vgImg = vgCreateImage + VGImage vgImg = QVGImagePool::instance()->createPermanentImage (format, sr.width(), sr.height(), VG_IMAGE_QUALITY_FASTER); vgImageSubData (vgImg, pixels, img.bytesPerLine(), format, 0, 0, @@ -1084,7 +1085,7 @@ static VGImage toVGImageWithOpacity(const QImage & image, qreal opacity) const uchar *pixels = img.bits(); - VGImage vgImg = vgCreateImage + VGImage vgImg = QVGImagePool::instance()->createPermanentImage (VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); vgImageSubData (vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, @@ -1106,7 +1107,7 @@ static VGImage toVGImageWithOpacitySubRect const uchar *pixels = img.bits(); - VGImage vgImg = vgCreateImage + VGImage vgImg = QVGImagePool::instance()->createPermanentImage (VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); vgImageSubData (vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, @@ -1194,6 +1195,12 @@ VGPaintType QVGPaintEnginePrivate::setBrush if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast(pd); vgImg = vgpd->toVGImage(); + + // We don't want the pool to reclaim this image + // because we cannot predict when the paint object + // will stop using it. Replacing the image with + // new data will make the paint object invalid. + vgpd->detachImageFromPool(); } else { vgImg = toVGImage(*(pd->buffer())); deref = true; @@ -1201,6 +1208,7 @@ VGPaintType QVGPaintEnginePrivate::setBrush } else if (pd->classId() == QPixmapData::OpenVGClass) { QVGPixmapData *vgpd = static_cast(pd); vgImg = vgpd->toVGImage(opacity); + vgpd->detachImageFromPool(); } else { vgImg = toVGImageWithOpacity(*(pd->buffer()), opacity); deref = true; diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index af6f0f0..358ec4d 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -43,6 +43,7 @@ #include "qpaintengine_vg_p.h" #include #include "qvg_p.h" +#include "qvgimagepool_p.h" #ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE #include @@ -63,6 +64,8 @@ QVGPixmapData::QVGPixmapData(PixelType type) vgImageOpacity = VG_INVALID_HANDLE; cachedOpacity = 1.0f; recreate = true; + inImagePool = false; + inLRU = false; #if !defined(QT_NO_EGL) context = 0; qt_vg_register_pixmap(this); @@ -78,32 +81,43 @@ QVGPixmapData::~QVGPixmapData() #endif } +void QVGPixmapData::destroyImages() +{ + if (inImagePool) { + QVGImagePool *pool = QVGImagePool::instance(); + if (vgImage != VG_INVALID_HANDLE) + pool->releaseImage(this, vgImage); + if (vgImageOpacity != VG_INVALID_HANDLE) + pool->releaseImage(this, vgImageOpacity); + } else { + if (vgImage != VG_INVALID_HANDLE) + vgDestroyImage(vgImage); + if (vgImageOpacity != VG_INVALID_HANDLE) + vgDestroyImage(vgImageOpacity); + } + vgImage = VG_INVALID_HANDLE; + vgImageOpacity = VG_INVALID_HANDLE; + inImagePool = false; +} + void QVGPixmapData::destroyImageAndContext() { if (vgImage != VG_INVALID_HANDLE) { // We need to have a context current to destroy the image. #if !defined(QT_NO_EGL) if (context->isCurrent()) { - vgDestroyImage(vgImage); - if (vgImageOpacity != VG_INVALID_HANDLE) - vgDestroyImage(vgImageOpacity); + destroyImages(); } else { // We don't currently have a widget surface active, but we // need a surface to make the context current. So use the // shared pbuffer surface instead. context->makeCurrent(qt_vg_shared_surface()); - vgDestroyImage(vgImage); - if (vgImageOpacity != VG_INVALID_HANDLE) - vgDestroyImage(vgImageOpacity); + destroyImages(); context->lazyDoneCurrent(); } #else - vgDestroyImage(vgImage); - if (vgImageOpacity != VG_INVALID_HANDLE) - vgDestroyImage(vgImageOpacity); + destroyImages(); #endif - vgImage = VG_INVALID_HANDLE; - vgImageOpacity = VG_INVALID_HANDLE; } #if !defined(QT_NO_EGL) if (context) { @@ -234,26 +248,22 @@ VGImage QVGPixmapData::toVGImage() context = qt_vg_create_context(0, QInternal::Pixmap); #endif - if (recreate && prevSize != QSize(w, h)) { - if (vgImage != VG_INVALID_HANDLE) { - vgDestroyImage(vgImage); - vgImage = VG_INVALID_HANDLE; - } - if (vgImageOpacity != VG_INVALID_HANDLE) { - vgDestroyImage(vgImageOpacity); - vgImageOpacity = VG_INVALID_HANDLE; - } - } else if (recreate) { + if (recreate && prevSize != QSize(w, h)) + destroyImages(); + else if (recreate) cachedOpacity = -1.0f; // Force opacity image to be refreshed later. - } if (vgImage == VG_INVALID_HANDLE) { - vgImage = vgCreateImage - (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); + vgImage = QVGImagePool::instance()->createImageForPixmap + (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER, this); // Bail out if we run out of GPU memory - try again next time. if (vgImage == VG_INVALID_HANDLE) return VG_INVALID_HANDLE; + + inImagePool = true; + } else if (inImagePool) { + QVGImagePool::instance()->useImage(this); } if (!source.isNull() && recreate) { @@ -282,8 +292,13 @@ VGImage QVGPixmapData::toVGImage(qreal opacity) // Create an alternative image for the selected opacity. if (vgImageOpacity == VG_INVALID_HANDLE || cachedOpacity != opacity) { if (vgImageOpacity == VG_INVALID_HANDLE) { - vgImageOpacity = vgCreateImage - (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); + if (inImagePool) { + vgImageOpacity = QVGImagePool::instance()->createImageForPixmap + (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER, this); + } else { + vgImageOpacity = vgCreateImage + (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); + } // Bail out if we run out of GPU memory - try again next time. if (vgImageOpacity == VG_INVALID_HANDLE) @@ -308,6 +323,14 @@ VGImage QVGPixmapData::toVGImage(qreal opacity) #endif } +void QVGPixmapData::detachImageFromPool() +{ + if (inImagePool) { + QVGImagePool::instance()->detachImage(this); + inImagePool = false; + } +} + void QVGPixmapData::hibernate() { // If the image was imported (e.g, from an SgImage under Symbian), @@ -319,6 +342,14 @@ void QVGPixmapData::hibernate() destroyImageAndContext(); } +void QVGPixmapData::reclaimImages() +{ + if (!inImagePool) + return; + forceToImage(); + destroyImages(); +} + extern int qt_defaultDpiX(); extern int qt_defaultDpiY(); @@ -411,14 +442,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) if (!context) context = qt_vg_create_context(0, QInternal::Pixmap); - if (vgImage != VG_INVALID_HANDLE) { - vgDestroyImage(vgImage); - vgImage = VG_INVALID_HANDLE; - } - if (vgImageOpacity != VG_INVALID_HANDLE) { - vgDestroyImage(vgImageOpacity); - vgImageOpacity = VG_INVALID_HANDLE; - } + destroyImages(); prevSize = QSize(); TInt err = 0; diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index c0bb098..4ff95c1 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -63,6 +63,7 @@ class RSGImage; QT_BEGIN_NAMESPACE class QEglContext; +class QVGImagePool; #if !defined(QT_NO_EGL) class QVGPixmapData; @@ -101,6 +102,9 @@ public: // Return the VGImage form for a specific opacity setting. virtual VGImage toVGImage(qreal opacity); + // Detach this image from the image pool. + virtual void detachImageFromPool(); + // Release the VG resources associated with this pixmap and copy // the pixmap's contents out of the GPU back into main memory. // The VG resource will be automatically recreated the next time @@ -109,6 +113,10 @@ public: // process via a SgImage). virtual void hibernate(); + // Called when the QVGImagePool wants to reclaim this pixmap's + // VGImage objects to reuse storage. + virtual void reclaimImages(); + QSize size() const { return QSize(w, h); } #if defined(Q_OS_SYMBIAN) @@ -123,8 +131,13 @@ protected: void cleanup(); #endif -#if !defined(QT_NO_EGL) private: + QVGPixmapData *nextLRU; + QVGPixmapData *prevLRU; + bool inLRU; + friend class QVGImagePool; + +#if !defined(QT_NO_EGL) QVGPixmapData *next; QVGPixmapData *prev; @@ -140,6 +153,7 @@ protected: qreal cachedOpacity; mutable QImage source; mutable bool recreate; + bool inImagePool; #if !defined(QT_NO_EGL) mutable QEglContext *context; #endif @@ -148,6 +162,7 @@ protected: QImage::Format sourceFormat() const; void destroyImageAndContext(); + void destroyImages(); }; QT_END_NAMESPACE diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index e17c728..aa526ed 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qpixmapfilter_vg_p.h" +#include "qvgimagepool_p.h" #include #include @@ -82,9 +83,9 @@ void QVGPixmapConvolutionFilter::draw return; QSize size = pd->size(); - VGImage dstImage = vgCreateImage + VGImage dstImage = QVGImagePool::instance()->createTemporaryImage (VG_sARGB_8888_PRE, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER); + VG_IMAGE_QUALITY_FASTER, pd); if (dstImage == VG_INVALID_HANDLE) return; @@ -124,7 +125,7 @@ void QVGPixmapConvolutionFilter::draw if(child != dstImage) vgDestroyImage(child); - vgDestroyImage(dstImage); + QVGImagePool::instance()->releaseImage(0, dstImage); } QVGPixmapColorizeFilter::QVGPixmapColorizeFilter() @@ -155,9 +156,9 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const return; QSize size = pd->size(); - VGImage dstImage = vgCreateImage + VGImage dstImage = QVGImagePool::instance()->createTemporaryImage (VG_sARGB_8888_PRE, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER); + VG_IMAGE_QUALITY_FASTER, pd); if (dstImage == VG_INVALID_HANDLE) return; @@ -217,7 +218,7 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const if(child != dstImage) vgDestroyImage(child); - vgDestroyImage(dstImage); + QVGImagePool::instance()->releaseImage(0, dstImage); } QVGPixmapDropShadowFilter::QVGPixmapDropShadowFilter() @@ -248,9 +249,9 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con return; QSize size = pd->size(); - VGImage dstImage = vgCreateImage + VGImage dstImage = QVGImagePool::instance()->createTemporaryImage (VG_A_8, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER); + VG_IMAGE_QUALITY_FASTER, pd); if (dstImage == VG_INVALID_HANDLE) return; @@ -282,7 +283,7 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con if(child != dstImage) vgDestroyImage(child); - vgDestroyImage(dstImage); + QVGImagePool::instance()->releaseImage(0, dstImage); // Now draw the actual pixmap over the top. painter->drawPixmap(dest, src, srect); @@ -316,9 +317,9 @@ void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPi return; QSize size = pd->size(); - VGImage dstImage = vgCreateImage + VGImage dstImage = QVGImagePool::instance()->createTemporaryImage (VG_sARGB_8888_PRE, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER); + VG_IMAGE_QUALITY_FASTER, pd); if (dstImage == VG_INVALID_HANDLE) return; @@ -347,7 +348,7 @@ void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPi if(child != dstImage) vgDestroyImage(child); - vgDestroyImage(dstImage); + QVGImagePool::instance()->releaseImage(0, dstImage); } #endif diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp new file mode 100644 index 0000000..93e6e03 --- /dev/null +++ b/src/openvg/qvgimagepool.cpp @@ -0,0 +1,215 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvgimagepool_p.h" +#include "qpixmapdata_vg_p.h" + +QT_BEGIN_NAMESPACE + +static QVGImagePool *qt_vg_image_pool = 0; + +class QVGImagePoolPrivate +{ +public: + QVGImagePoolPrivate() : lruFirst(0), lruLast(0) {} + + QVGPixmapData *lruFirst; + QVGPixmapData *lruLast; +}; + +QVGImagePool::QVGImagePool() + : d_ptr(new QVGImagePoolPrivate()) +{ +} + +QVGImagePool::~QVGImagePool() +{ +} + +QVGImagePool *QVGImagePool::instance() +{ + if (!qt_vg_image_pool) + qt_vg_image_pool = new QVGImagePool(); + return qt_vg_image_pool; +} + +void QVGImagePool::setImagePool(QVGImagePool *pool) +{ + if (qt_vg_image_pool != pool) + delete qt_vg_image_pool; + qt_vg_image_pool = pool; +} + +VGImage QVGImagePool::createTemporaryImage(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality, + QVGPixmapData *keepData) +{ + VGImage image; + do { + image = vgCreateImage(format, width, height, allowedQuality); + if (image != VG_INVALID_HANDLE) + return image; + } while (reclaimSpace(format, width, height, keepData)); + qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d temporary image", + width, height); + return VG_INVALID_HANDLE; +} + +VGImage QVGImagePool::createImageForPixmap(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality, + QVGPixmapData *data) +{ + VGImage image; + do { + image = vgCreateImage(format, width, height, allowedQuality); + if (image != VG_INVALID_HANDLE) { + if (data) + moveToHeadOfLRU(data); + return image; + } + } while (reclaimSpace(format, width, height, data)); + qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d pixmap", + width, height); + return VG_INVALID_HANDLE; +} + +VGImage QVGImagePool::createPermanentImage(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality) +{ + VGImage image; + do { + image = vgCreateImage(format, width, height, allowedQuality); + if (image != VG_INVALID_HANDLE) + return image; + } while (reclaimSpace(format, width, height, 0)); + qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d image", + width, height); + return VG_INVALID_HANDLE; +} + +void QVGImagePool::releaseImage(QVGPixmapData *data, VGImage image) +{ + // Very simple strategy at the moment: just destroy the image. + if (data) + removeFromLRU(data); + vgDestroyImage(image); +} + +void QVGImagePool::useImage(QVGPixmapData *data) +{ + moveToHeadOfLRU(data); +} + +void QVGImagePool::detachImage(QVGPixmapData *data) +{ + removeFromLRU(data); +} + +bool QVGImagePool::reclaimSpace(VGImageFormat format, + VGint width, VGint height, + QVGPixmapData *data) +{ + Q_UNUSED(format); // For future use in picking the best image to eject. + Q_UNUSED(width); + Q_UNUSED(height); + + if (data) + moveToHeadOfLRU(data); + + QVGPixmapData *lrudata = pixmapLRU(); + if (lrudata && lrudata != data) { + lrudata->reclaimImages(); + return true; + } + + return false; +} + +void QVGImagePool::hibernate() +{ + // Nothing to do here at the moment since the pool does not + // retain VGImage's after they have been released. +} + +void QVGImagePool::moveToHeadOfLRU(QVGPixmapData *data) +{ + Q_D(QVGImagePool); + if (data->inLRU) { + if (!data->prevLRU) + return; // Already at the head of the list. + removeFromLRU(data); + } + data->inLRU = true; + data->nextLRU = d->lruFirst; + data->prevLRU = 0; + if (d->lruFirst) + d->lruFirst->prevLRU = data; + else + d->lruLast = data; + d->lruFirst = data; +} + +void QVGImagePool::removeFromLRU(QVGPixmapData *data) +{ + Q_D(QVGImagePool); + if (!data->inLRU) + return; + if (data->nextLRU) + data->nextLRU->prevLRU = data->prevLRU; + else + d->lruLast = data->prevLRU; + if (data->prevLRU) + data->prevLRU->nextLRU = data->nextLRU; + else + d->lruFirst = data->nextLRU; + data->inLRU = false; +} + +QVGPixmapData *QVGImagePool::pixmapLRU() +{ + Q_D(QVGImagePool); + return d->lruLast; +} + +QT_END_NAMESPACE diff --git a/src/openvg/qvgimagepool_p.h b/src/openvg/qvgimagepool_p.h new file mode 100644 index 0000000..66a4998 --- /dev/null +++ b/src/openvg/qvgimagepool_p.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVGIMAGEPOOL_P_H +#define QVGIMAGEPOOL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qvg.h" +#include + +QT_BEGIN_NAMESPACE + +class QVGPixmapData; +class QVGImagePoolPrivate; + +class Q_OPENVG_EXPORT QVGImagePool +{ +public: + QVGImagePool(); + virtual ~QVGImagePool(); + + static QVGImagePool *instance(); + + // This function can be used from system-specific graphics system + // plugins to alter the image allocation strategy. + static void setImagePool(QVGImagePool *pool); + + // Create a new VGImage from the pool with the specified parameters + // that is not associated with a pixmap. The VGImage is returned to + // the pool when releaseImage() is called. + // + // This function will call reclaimSpace() when vgCreateImage() fails. + // + // This function is typically called when allocating temporary + // VGImage's for pixmap filters. The "keepData" object will not + // be reclaimed if reclaimSpace() needs to be called. + virtual VGImage createTemporaryImage(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality, + QVGPixmapData *keepData = 0); + + // Create a new VGImage with the specified parameters and associate + // it with "data". The QVGPixmapData will be notified when the + // VGImage needs to be reclaimed by the pool. + // + // This function will call reclaimSpace() when vgCreateImage() fails. + virtual VGImage createImageForPixmap(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality, + QVGPixmapData *data); + + // Create a permanent VGImage with the specified parameters. + // If there is insufficient space for the vgCreateImage call, + // then this function will call reclaimSpace() and try again. + // + // The caller is responsible for calling vgDestroyImage() + // when it no longer needs the VGImage, as the image is not + // recorded in the image pool. + // + // This function is typically used for pattern brushes where + // the OpenVG engine is responsible for managing the lifetime + // of the VGImage, destroying it automatically when the brush + // is no longer in use. + virtual VGImage createPermanentImage(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality); + + // Release a VGImage that is no longer required. + virtual void releaseImage(QVGPixmapData *data, VGImage image); + + // Notify the pool that a QVGPixmapData object is using + // an image again. This allows the pool to move the image + // within a least-recently-used list of QVGPixmapData objects. + virtual void useImage(QVGPixmapData *data); + + // Notify the pool that the VGImage's associated with a + // QVGPixmapData are being detached from the pool. The caller + // will become responsible for calling vgDestroyImage(). + virtual void detachImage(QVGPixmapData *data); + + // Reclaim space for an image allocation with the specified parameters. + // Returns true if space was reclaimed, or false if there is no + // further space that can be reclaimed. The "data" parameter + // indicates the pixmap that is trying to obtain space which should + // not itself be reclaimed. + virtual bool reclaimSpace(VGImageFormat format, + VGint width, VGint height, + QVGPixmapData *data); + + // Hibernate the image pool because the context is about to be + // destroyed. All VGImage's left in the pool should be released. + virtual void hibernate(); + +protected: + // Helper functions for managing the LRU list of QVGPixmapData objects. + void moveToHeadOfLRU(QVGPixmapData *data); + void removeFromLRU(QVGPixmapData *data); + QVGPixmapData *pixmapLRU(); + +private: + QScopedPointer d_ptr; + + Q_DECLARE_PRIVATE(QVGImagePool) + Q_DISABLE_COPY(QVGImagePool) +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 1571083..bda6096 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -42,6 +42,7 @@ #include "qwindowsurface_vgegl_p.h" #include "qpaintengine_vg_p.h" #include "qpixmapdata_vg_p.h" +#include "qvgimagepool_p.h" #include "qvg_p.h" #if !defined(QT_NO_EGL) @@ -360,6 +361,9 @@ void qt_vg_hibernate_pixmaps(QVGSharedContext *shared) pd = pd->next; } + // Hibernate any remaining VGImage's in the image pool. + QVGImagePool::instance()->hibernate(); + // Don't need the current context any more. shared->context->lazyDoneCurrent(); -- cgit v0.12 From 1a867a3c692e375565618532b8ca686dab7e7d5e Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 15 Dec 2009 18:54:43 +1000 Subject: def file maintenance. --- src/s60installs/bwins/QtCoreu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index 49c4361..fe752c8 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -2264,7 +2264,7 @@ EXPORTS ?isSequential@QIODevice@@UBE_NXZ @ 2263 NONAME ; bool QIODevice::isSequential(void) const ?isSequential@QIODevicePrivate@@QBE_NXZ @ 2264 NONAME ; bool QIODevicePrivate::isSequential(void) const ?isSequential@QProcess@@UBE_NXZ @ 2265 NONAME ; bool QProcess::isSequential(void) const - ?isSignalConnected@QObjectPrivate@@QBE_NH@Z @ 2266 NONAME ; bool QObjectPrivate::isSignalConnected(int) const + ?isSignalConnected@QObjectPrivate@@QBE_NI@Z @ 2266 NONAME ; bool QObjectPrivate::isSignalConnected(unsigned int) const ?isSimpleText@QString@@QBE_NXZ @ 2267 NONAME ; bool QString::isSimpleText(void) const ?isSingleShot@QTimer@@QBE_NXZ @ 2268 NONAME ; bool QTimer::isSingleShot(void) const ?isSpace@QChar@@QBE_NXZ @ 2269 NONAME ; bool QChar::isSpace(void) const -- cgit v0.12 From 9305fba2d3a69c50aad6d6b96a6ca37801d72f9e Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 15 Dec 2009 11:01:20 +0100 Subject: Enabled input method update code for all platforms. These don't have to be platform specific. RevBy: Trust me --- src/gui/widgets/qlineedit_p.cpp | 2 -- src/gui/widgets/qplaintextedit.cpp | 2 -- src/gui/widgets/qtextedit.cpp | 3 --- 3 files changed, 7 deletions(-) diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index bdf7993..4122bc4 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -150,10 +150,8 @@ void QLineEditPrivate::init(const QString& txt) QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)), q, SLOT(updateMicroFocus())); -#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus())); -#endif // for now, going completely overboard with updates. QObject::connect(control, SIGNAL(selectionChanged()), diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 31f8bb4..f79931a 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -761,9 +761,7 @@ void QPlainTextEditPrivate::init(const QString &txt) QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); -#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus())); -#endif // set a null page size initially to avoid any relayouting until the textedit // is shown. relayoutDocument() will take care of setting the page size to the diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index f79c870..63fac2a 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -158,11 +158,8 @@ void QTextEditPrivate::init(const QString &html) QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); -#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus())); -#endif - QTextDocument *doc = control->document(); // set a null page size initially to avoid any relayouting until the textedit // is shown. relayoutDocument() will take care of setting the page size to the -- cgit v0.12 From d6cd6c59dae36b2890baae98f0bf94b23e5509da Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 14 Dec 2009 14:09:36 +0100 Subject: Clicking on a selected item wouldn't reset the selection anymore. Before commit 88ecc8c8250505129ccff2660c60412996e2fd85, this case was handled during the mouse release event, but was responsible for selections being made twice sometimes. We now check whether a selection actually happened during the mouse press event. If not, we will try to select again during the mouse release event. Auto-test included. Reviewed-by: Thierry Task-number: QTBUG-6753 --- src/gui/itemviews/qabstractitemview.cpp | 9 ++++++--- src/gui/itemviews/qabstractitemview_p.h | 1 + .../qabstractitemview/tst_qabstractitemview.cpp | 23 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 4a450b7..47b5f66 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -70,6 +70,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() itemDelegate(0), selectionModel(0), ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate), + noSelectionOnMousePress(false), selectionMode(QAbstractItemView::ExtendedSelection), selectionBehavior(QAbstractItemView::SelectItems), currentlyCommittingEditor(0), @@ -1622,6 +1623,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event) d->pressedIndex = index; d->pressedModifiers = event->modifiers(); QItemSelectionModel::SelectionFlags command = selectionCommand(index, event); + d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid(); QPoint offset = d->offset(); if ((command & QItemSelectionModel::Current) == 0) d->pressedPosition = pos + offset; @@ -1760,9 +1762,10 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate; - //in the case the user presses on no item we might decide to clear the selection - if (d->selectionModel && !index.isValid()) - d->selectionModel->select(QModelIndex(), selectionCommand(index, event)); + if (d->selectionModel && d->noSelectionOnMousePress) { + d->noSelectionOnMousePress = false; + d->selectionModel->select(index, selectionCommand(index, event)); + } setState(NoState); diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 0b5cfbe..7fc6780 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -347,6 +347,7 @@ public: QMap > columnDelegates; QPointer selectionModel; QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag; + bool noSelectionOnMousePress; QAbstractItemView::SelectionMode selectionMode; QAbstractItemView::SelectionBehavior selectionBehavior; diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index 6479829..bf3af63 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -226,6 +227,7 @@ private slots: void shiftSelectionAfterRubberbandSelection(); void ctrlRubberbandSelection(); void QTBUG6407_extendedSelection(); + void QTBUG6753_selectOnSelection(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -1475,5 +1477,26 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection() } +void tst_QAbstractItemView::QTBUG6753_selectOnSelection() +{ + QTableWidget table(5, 5); + for (int i = 0; i < table.rowCount(); ++i) + for (int j = 0; j < table.columnCount(); ++j) + table.setItem(i, j, new QTableWidgetItem("choo-be-doo-wah")); + + table.show(); + table.setSelectionMode(QAbstractItemView::ExtendedSelection); + table.selectAll(); + QTest::qWaitForWindowShown(&table); + QModelIndex item = table.model()->index(1,1); + QRect itemRect = table.visualRect(item); + QTest::mouseMove(table.viewport(), itemRect.center()); + QTest::mouseClick(table.viewport(), Qt::LeftButton, Qt::NoModifier, itemRect.center()); + QTest::qWait(20); + + QCOMPARE(table.selectedItems().count(), 1); + QCOMPARE(table.selectedItems().first(), table.item(item.row(), item.column())); +} + QTEST_MAIN(tst_QAbstractItemView) #include "tst_qabstractitemview.moc" -- cgit v0.12 From e8280d71c1a2f8822d775bbedaecfab42194c218 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 15 Dec 2009 20:23:17 +1000 Subject: def file maintenance. --- src/s60installs/bwins/QtGuiu.def | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 3371fe0..303c463 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -2503,7 +2503,7 @@ EXPORTS ?cacheMode@QMovie@@QAE?AW4CacheMode@1@XZ @ 2502 NONAME ; enum QMovie::CacheMode QMovie::cacheMode(void) ?cacheMode@QMovie@@QBE?AW4CacheMode@1@XZ @ 2503 NONAME ; enum QMovie::CacheMode QMovie::cacheMode(void) const ?cacheStatistics@QFont@@SAXXZ @ 2504 NONAME ; void QFont::cacheStatistics(void) - ?cacheType@QTextureGlyphCache@@QBE?AW4Type@QFontEngineGlyphCache@@XZ @ 2505 NONAME ; enum QFontEngineGlyphCache::Type QTextureGlyphCache::cacheType(void) const + ?cacheType@QTextureGlyphCache@@QBE?AW4Type@QFontEngineGlyphCache@@XZ @ 2505 NONAME ABSENT ; enum QFontEngineGlyphCache::Type QTextureGlyphCache::cacheType(void) const ?calcEffectiveOpacity@QGraphicsItemPrivate@@QBEMXZ @ 2506 NONAME ; float QGraphicsItemPrivate::calcEffectiveOpacity(void) const ?calculateTabWidth@QTextEngine@@QBE?AUQFixed@@HU2@@Z @ 2507 NONAME ; struct QFixed QTextEngine::calculateTabWidth(int, struct QFixed) const ?calendarPopup@QDateTimeEdit@@QBE_NXZ @ 2508 NONAME ; bool QDateTimeEdit::calendarPopup(void) const @@ -4299,7 +4299,7 @@ EXPORTS ?expandingDirections@QSpacerItem@@UBE?AV?$QFlags@W4Orientation@Qt@@@@XZ @ 4298 NONAME ; class QFlags QSpacerItem::expandingDirections(void) const ?expandingDirections@QWidgetItem@@UBE?AV?$QFlags@W4Orientation@Qt@@@@XZ @ 4299 NONAME ; class QFlags QWidgetItem::expandingDirections(void) const ?expandsOnDoubleClick@QTreeView@@QBE_NXZ @ 4300 NONAME ; bool QTreeView::expandsOnDoubleClick(void) const - ?expireGlyphCache@QFontEngine@@AAEXXZ @ 4301 NONAME ; void QFontEngine::expireGlyphCache(void) + ?expireGlyphCache@QFontEngine@@AAEXXZ @ 4301 NONAME ABSENT ; void QFontEngine::expireGlyphCache(void) ?extension@QDialog@@QBEPAVQWidget@@XZ @ 4302 NONAME ; class QWidget * QDialog::extension(void) const ?extension@QGraphicsEllipseItem@@MBE?AVQVariant@@ABV2@@Z @ 4303 NONAME ; class QVariant QGraphicsEllipseItem::extension(class QVariant const &) const ?extension@QGraphicsItem@@MBE?AVQVariant@@ABV2@@Z @ 4304 NONAME ; class QVariant QGraphicsItem::extension(class QVariant const &) const @@ -4933,8 +4933,8 @@ EXPORTS ?globalY@QMouseEvent@@QBEHXZ @ 4932 NONAME ; int QMouseEvent::globalY(void) const ?globalY@QTabletEvent@@QBEHXZ @ 4933 NONAME ; int QTabletEvent::globalY(void) const ?globalY@QWheelEvent@@QBEHXZ @ 4934 NONAME ; int QWheelEvent::globalY(void) const - ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXABVQTransform@@@Z @ 4935 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, class QTransform const &) const - ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@W4Type@2@ABVQTransform@@@Z @ 4936 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(enum QFontEngineGlyphCache::Type, class QTransform const &) const + ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXABVQTransform@@@Z @ 4935 NONAME ABSENT ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, class QTransform const &) const + ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@W4Type@2@ABVQTransform@@@Z @ 4936 NONAME ABSENT ; class QFontEngineGlyphCache * QFontEngine::glyphCache(enum QFontEngineGlyphCache::Type, class QTransform const &) const ?glyphCount@QFontEngine@@UBEHXZ @ 4937 NONAME ; int QFontEngine::glyphCount(void) const ?glyphMargin@QTextureGlyphCache@@UBEHXZ @ 4938 NONAME ; int QTextureGlyphCache::glyphMargin(void) const ?gotFocus@QFocusEvent@@QBE_NXZ @ 4939 NONAME ; bool QFocusEvent::gotFocus(void) const @@ -9103,7 +9103,7 @@ EXPORTS ?setGestureCancelPolicy@QGesture@@QAEXW4GestureCancelPolicy@1@@Z @ 9102 NONAME ; void QGesture::setGestureCancelPolicy(enum QGesture::GestureCancelPolicy) ?setGlobalStrut@QApplication@@SAXABVQSize@@@Z @ 9103 NONAME ; void QApplication::setGlobalStrut(class QSize const &) ?setGlyphCache@QFontEngine@@QAEXPAXPAVQFontEngineGlyphCache@@@Z @ 9104 NONAME ; void QFontEngine::setGlyphCache(void *, class QFontEngineGlyphCache *) - ?setGlyphCache@QFontEngine@@QAEXW4Type@QFontEngineGlyphCache@@PAV3@@Z @ 9105 NONAME ; void QFontEngine::setGlyphCache(enum QFontEngineGlyphCache::Type, class QFontEngineGlyphCache *) + ?setGlyphCache@QFontEngine@@QAEXW4Type@QFontEngineGlyphCache@@PAV3@@Z @ 9105 NONAME ABSENT ; void QFontEngine::setGlyphCache(enum QFontEngineGlyphCache::Type, class QFontEngineGlyphCache *) ?setGraphicsEffect@QGraphicsItem@@QAEXPAVQGraphicsEffect@@@Z @ 9106 NONAME ; void QGraphicsItem::setGraphicsEffect(class QGraphicsEffect *) ?setGraphicsEffect@QWidget@@QAEXPAVQGraphicsEffect@@@Z @ 9107 NONAME ; void QWidget::setGraphicsEffect(class QGraphicsEffect *) ?setGraphicsEffectSource@QGraphicsEffectPrivate@@QAEXPAVQGraphicsEffectSource@@@Z @ 9108 NONAME ; void QGraphicsEffectPrivate::setGraphicsEffectSource(class QGraphicsEffectSource *) -- cgit v0.12 From 5a1b5fc1b6233ee2e1f99d6c5f6ff1115341d02f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 15 Dec 2009 12:21:30 +0200 Subject: Fixed qgraphicsview autotest build for winscw. NokiaX86 compiler doesn't like QCOMPAREs unless the compared pointers are cast correctly. Reviewed-by: Janne Anttila --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 797e1fb..69df39b 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3601,7 +3601,7 @@ void tst_QGraphicsView::inputMethodSensitivity() item->setFlag(QGraphicsItem::ItemIsFocusable); scene.addItem(item); scene.setFocusItem(item); - QCOMPARE(scene.focusItem(), item); + QCOMPARE(scene.focusItem(), static_cast(item)); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false); @@ -3616,35 +3616,35 @@ void tst_QGraphicsView::inputMethodSensitivity() scene.addItem(item2); scene.setFocusItem(item2); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); - QCOMPARE(scene.focusItem(), item2); + QCOMPARE(scene.focusItem(), static_cast(item2)); scene.setFocusItem(item); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); - QCOMPARE(scene.focusItem(), item); + QCOMPARE(scene.focusItem(), static_cast(item)); view.setScene(0); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); - QCOMPARE(scene.focusItem(), item); + QCOMPARE(scene.focusItem(), static_cast(item)); view.setScene(&scene); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); - QCOMPARE(scene.focusItem(), item); + QCOMPARE(scene.focusItem(), static_cast(item)); scene.setFocusItem(item2); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); - QCOMPARE(scene.focusItem(), item2); + QCOMPARE(scene.focusItem(), static_cast(item2)); view.setScene(0); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); - QCOMPARE(scene.focusItem(), item2); + QCOMPARE(scene.focusItem(), static_cast(item2)); scene.setFocusItem(item); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); - QCOMPARE(scene.focusItem(), item); + QCOMPARE(scene.focusItem(), static_cast(item)); view.setScene(&scene); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); - QCOMPARE(scene.focusItem(), item); + QCOMPARE(scene.focusItem(), static_cast(item)); } class InputContextTester : public QInputContext @@ -3878,7 +3878,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() { lastBackgroundExposedRect = rect; } QRectF lastBackgroundExposedRect; }; - + class CustomRectItem : public QGraphicsRectItem { public: -- cgit v0.12 From a0ce8bba1aae7c1aaf189b83bfe83eb6b80bf0bf Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 15 Dec 2009 13:09:09 +0200 Subject: QS60Style: Remove layouts with mirrored information Currently QS60Style stores pixel metrics values (96 of them for each layout) in a static lookup table. There is one "line" for each screensize, orientation and layout direction (ten in total). This fix removes the layout direction specific "lines" as there are only two pixel metrics values that differ depending on direction. We can handle those two inside QS60Style::pixelMetrics() and thus remove half of the rows, and thus gain 16*96*5 ~ 8kB of RAM. Task-number: QTBUG-6803 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 27 +++---- src/gui/styles/qs60style_s60.cpp | 20 +---- util/s60pixelmetrics/pm_mapper.hrh | 9 +-- util/s60pixelmetrics/pm_mapper.rss | 4 +- util/s60pixelmetrics/pm_mapperapp.cpp | 138 ++++++--------------------------- util/s60pixelmetrics/pm_mapperapp.h | 14 +--- util/s60pixelmetrics/pm_mapperview.cpp | 12 +-- util/s60pixelmetrics/pm_mapperview.h | 2 +- 8 files changed, 50 insertions(+), 176 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 17db53d..ed86f5a 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -88,16 +88,11 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,15,true,"QVGA Landscape Mirrored"}, -{240,320,1,15,false,"QVGA Landscape"}, -{320,240,1,15,true,"QVGA Portrait Mirrored"}, -{320,240,1,15,false,"QVGA Portrait"}, -{360,640,1,15,true,"NHD Landscape Mirrored"}, -{360,640,1,15,false,"NHD Landscape"}, -{640,360,1,15,true,"NHD Portrait Mirrored"}, -{640,360,1,15,false,"NHD Portrait"}, -{352,800,1,12,true,"E90 Landscape Mirrored"}, -{352,800,1,12,false,"E90 Landscape"} +{240,320,1,15,"QVGA Landscape"}, +{320,240,1,15,"QVGA Portrait"}, +{360,640,1,15,"NHD Landscape"}, +{640,360,1,15,"NHD Portrait"}, +{352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; const int QS60StylePrivate::m_numberOfLayouts = @@ -105,15 +100,10 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,6,3,3,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, {5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,7,4,4,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, {5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} // *** End of generated data *** }; @@ -2329,6 +2319,13 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const metricValue = -menuWidth; } } + //if layout direction is mirrored, switch left and right border margins + if (option && option->direction == Qt::RightToLeft) { + if (metric == PM_LayoutLeftMargin) + metricValue = QS60StylePrivate::pixelMetric(PM_LayoutRightMargin); + else if (metric == PM_LayoutRightMargin) + metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin); + } return metricValue; } diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index d5b3f73..13ac301 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -960,37 +960,23 @@ void QS60StylePrivate::setActiveLayout() { const QSize activeScreenSize(screenSize()); int activeLayoutIndex = -1; - const bool mirrored = !QApplication::isLeftToRight(); const short screenHeight = (short)activeScreenSize.height(); const short screenWidth = (short)activeScreenSize.width(); for (int i=0; i #include -#include // KAknLayoutId #include #include @@ -89,7 +88,7 @@ _LIT(KEndBraceWithCommaAndCRLF, "},\n"); _LIT(KCRLF, "\n"); // Number of header lines in layout data. -const TInt KHeaderValues = 5; +const TInt KHeaderValues = 4; // ============================ MEMBER FUNCTIONS =============================== @@ -156,37 +155,27 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) Exit(); break; case ECmdSwitchOutput: + { + HBufC* buffer = HBufC::NewLC( 100 ); + TPtr bufferPtr = buffer->Des(); + TBool last = ETrue; + bufferPtr.Append(_L("Output switched to ")); iFileOutputOn = !iFileOutputOn; + if (iFileOutputOn) + bufferPtr.Append(_L("file.")); + else + bufferPtr.Append(_L("screen.")); + ShowL( *buffer, last ); + } break; case ECmdStatus: { ClearL(); // layout - CRepository* repository = NULL; - TInt value = KErrNotFound; - TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon)); - if (ret == KErrNone) - { - ret = repository->Get(KAknLayoutId, value); - } - delete repository; - ret= 0; HBufC* buffer = HBufC::NewLC( 100 ); TPtr bufferPtr = buffer->Des(); - bufferPtr.Append(_L("Layout: ")); - if (ret==KErrNone) - { - bufferPtr.AppendNum(value); - } - else - { - bufferPtr.Append(_L("(error) ")); - bufferPtr.AppendNum(ret); - } TBool last = ETrue; - ShowL( *buffer, last ); - bufferPtr.Zero(); // Orientation bufferPtr.Append(_L("Orientation: ")); @@ -201,12 +190,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) ShowL( *buffer, last ); bufferPtr.Zero(); - // Automode - bufferPtr.Append(_L("AutoMode: ")); - bufferPtr.AppendNum((TInt)iAutoMode); - ShowL( *buffer, last ); - bufferPtr.Zero(); - CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode(); TInt hashValue = localAppScreenMode.ScreenStyleHash(); TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation(); @@ -261,47 +244,24 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) CleanupStack::PopAndDestroy( buffer ); } break; - case ECmdSwitchMirroring: - { - // set the shared data value - CRepository* repository = NULL; - TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon)); - if (ret == KErrNone) - { - TInt value = KErrNotFound; - repository->Get(KAknLayoutId, value); - if ( value == EAknLayoutIdELAF) - { - value = EAknLayoutIdABRW; - } - else if (value ==EAknLayoutIdABRW) - { - value = EAknLayoutIdELAF; - } - ret = repository->Set(KAknLayoutId, value); - } - delete repository; - // now inform all open apps of the switch - TWsEvent event; - event.SetType(KEikDynamicLayoutVariantSwitch); - iEikonEnv->WsSession().SendEventToAllWindowGroups(event); - } - break; case ECmdSwitchOrientation: { ClearL(); + HBufC* buffer = HBufC::NewLC( 100 ); + TPtr bufferPtr = buffer->Des(); + TBool last = ETrue; + #ifndef __SERIES60_31__ if (!iAvkonAppUi->OrientationCanBeChanged()) { - HBufC* buffer = HBufC::NewLC( 100 ); - TPtr bufferPtr = buffer->Des(); bufferPtr.Append(_L("Orientation cannot be changed.")); - TBool last = EFalse; ShowL( *buffer, last ); bufferPtr.Zero(); delete buffer; + break; } #endif //__SERIES60_31__ + if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait) { iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); @@ -314,15 +274,11 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) { // unspecified iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); - /*User::After(100000); - HBufC* buffer = HBufC::NewLC( 100 ); - TPtr bufferPtr = buffer->Des(); - bufferPtr.Append(_L("Orientation unspecified.")); - TBool last = EFalse; - ShowL( *buffer, last ); - bufferPtr.Zero(); - delete buffer;*/ } + bufferPtr.Append(_L("Orientation changed.")); + ShowL( *buffer, last ); + bufferPtr.Zero(); + delete buffer; break; } case ECmdStartCalculations: @@ -362,12 +318,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file ShowL( tgt, last ); tgt.Zero(); - // MIRRORED - TBool mirrored = AknLayoutUtils::LayoutMirrored(); - tgt.Append(_L("mirrored: \t")); - tgt.AppendNum(mirrored, EDecimal); // put mirrored state into text file - ShowL( tgt, last ); - tgt.Zero(); } TInt myValue = KErrNotFound; @@ -385,33 +335,15 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase; index++; } - if (iAutoMode && !iMode) - { - HandleCommandL(ECmdSwitchMirroring); - iMode = ETrue; - } } break; case ECmdCreateHeaderFile: CreateHeaderFileL(); break; - case ECmdSetAutoMode: - iAutoMode = !iAutoMode; default: break; } } -void CPixelMetricsMapperAppUi::DoAutoOperationL() - { - HandleCommandL(ECmdStartCalculations); - iMode = EFalse; - HandleCommandL(ECmdSwitchMirroring); - } - -TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const - { - return (iAutoMode && iMode); - } // ----------------------------------------------------------------------------- // @@ -834,21 +766,7 @@ void CPixelMetricsMapperAppUi::CreateHeaderFileL() const User::LeaveIfError( lex.Val(nextValue) ); if ( loop <= KHeaderValues-1) { - if (loop == KHeaderValues -1 ) // true / false values - { - if (nextValue == 1) - { - bufferLayoutHdr.Append(_L("true")); - } - else - { - bufferLayoutHdr.Append(_L("false")); - } - } - else - { - bufferLayoutHdr.AppendNum(nextValue); - } + bufferLayoutHdr.AppendNum(nextValue); } else { @@ -882,13 +800,11 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co // Layout data is deployed like this: // first line - height // second line - width - // fifth line mirror info TFileName lines; TFileName layoutName; TInt height = -666; TInt width = -666; - TInt mirroring = -666; // Collect name information. for (TInt i=0; i<6; i++) { @@ -907,10 +823,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co { error = myLexer.Val(width); } - if (i==4) //mirror info is fourth - { - error = myLexer.Val(mirroring); - } User::LeaveIfError(error); } @@ -966,10 +878,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co { layoutName.Append(_L("Portrait")); } - if (mirroring) - { - layoutName.Append(_L(" Mirrored")); - } return layoutName; } diff --git a/util/s60pixelmetrics/pm_mapperapp.h b/util/s60pixelmetrics/pm_mapperapp.h index cd119bc..aa6a63b 100644 --- a/util/s60pixelmetrics/pm_mapperapp.h +++ b/util/s60pixelmetrics/pm_mapperapp.h @@ -111,7 +111,7 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi /** * Constructor. */ - CPixelMetricsMapperAppUi(); + CPixelMetricsMapperAppUi(); /** * Symbian 2nd phase constructor. @@ -123,12 +123,6 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi */ ~CPixelMetricsMapperAppUi(); - public: - void DoAutoOperationL(); - - TBool ReadyForAutoOp() const; - - private: // Functions from base classes /** @@ -158,18 +152,16 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi private: // Data // Test view. - CPixelMetricsMapperView* iView; + CPixelMetricsMapperView* iView; CEikDialog* iDialog; TBool iFileOutputOn; + TBool iMode; CFbsBitmap* icon; CFbsBitmap* iconMask; - TBool iAutoMode; - TBool iMode; - }; diff --git a/util/s60pixelmetrics/pm_mapperview.cpp b/util/s60pixelmetrics/pm_mapperview.cpp index 82b825d..04bc3e8 100644 --- a/util/s60pixelmetrics/pm_mapperview.cpp +++ b/util/s60pixelmetrics/pm_mapperview.cpp @@ -129,8 +129,6 @@ void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast fileName.Append('_'); fileName.AppendNum(width); - if (AknLayoutUtils::LayoutMirrored()) - fileName.Append(_L("_mirrored")); fileName.Append(_L(".txt")); TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny); @@ -263,11 +261,9 @@ void CPixelMetricsMapperViewContainer::HandleResourceChange(TInt aType) mainPaneRect ); SetRect( mainPaneRect ); - CPixelMetricsMapperAppUi* myApp = static_cast (ControlEnv()->AppUi()); - if (myApp->ReadyForAutoOp()) - myApp->DoAutoOperationL(); } - if (iListbox) iListbox->HandleResourceChange(aType); + if (iListbox) + iListbox->HandleResourceChange(aType); } @@ -329,6 +325,7 @@ void CPixelMetricsMapperView::HandleCommandL( TInt aCommand ) AppUi()->HandleCommandL( aCommand ); } + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -342,6 +339,7 @@ void CPixelMetricsMapperView::HandleStatusPaneSizeChange() } } + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -358,6 +356,7 @@ void CPixelMetricsMapperView::DoActivateL( AppUi()->AddToViewStackL( *this, iView ); } + // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -372,4 +371,5 @@ void CPixelMetricsMapperView::DoDeactivate() iView = NULL; } + // End of File diff --git a/util/s60pixelmetrics/pm_mapperview.h b/util/s60pixelmetrics/pm_mapperview.h index be40a15..36376cd 100644 --- a/util/s60pixelmetrics/pm_mapperview.h +++ b/util/s60pixelmetrics/pm_mapperview.h @@ -219,7 +219,7 @@ class CPixelMetricsMapperView : public CAknView private: // Data // The view container. - CPixelMetricsMapperViewContainer* iView; + CPixelMetricsMapperViewContainer* iView; }; -- cgit v0.12 From 0b402f10a26115332ae72bbf263fd15c8354ecb9 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 15 Dec 2009 13:19:22 +0100 Subject: Fix precision loss warning (qreal vs. float on Windows) Reviewed-by: Oswald Buddenhagen modified: tools/linguist/linguist/messageeditor.h --- tools/linguist/linguist/messageeditor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h index b69af9c..d73c216 100644 --- a/tools/linguist/linguist/messageeditor.h +++ b/tools/linguist/linguist/messageeditor.h @@ -67,7 +67,7 @@ struct MessageEditorData { QList transTexts; QString invariantForm; QString firstForm; - float fontSize; + qreal fontSize; bool pluralEditMode; }; -- cgit v0.12 From da918327fdaaf45774c074d911882141cf77ea7e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 15 Dec 2009 13:15:34 +0100 Subject: Fix vertical text centering on Mac OS X Change 04d18b38 fixed the windows and ft font engines so that the height reported in QFontMetrics is now correct, but this make vertical text centering one off as the platform defaults is to round down rather than up when the vertical position of the text is in the middle of a pixel. When this was fixed in change 1de8a5b, the vertical centering broke on Mac, since it still reported a too great font height. This patch applies the same hack to the mac font engines to report the correct font height. Task-number: QTBUG-6770 Reviewed-by: joerg --- src/gui/text/qfontengine_mac.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index a4e7c04..a75d70f 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -404,7 +404,9 @@ QFixed QCoreTextFontEngine::ascent() const } QFixed QCoreTextFontEngine::descent() const { - return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil(); + // subtract a pixel to even out the historical +1 in QFontMetrics::height(). + // Fix in Qt 5. + return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil() - 1; } QFixed QCoreTextFontEngine::leading() const { @@ -1406,7 +1408,9 @@ QFixed QFontEngineMac::ascent() const QFixed QFontEngineMac::descent() const { - return m_descent; + // subtract a pixel to even out the historical +1 in QFontMetrics::height(). + // Fix in Qt 5. + return m_descent - 1; } QFixed QFontEngineMac::leading() const -- cgit v0.12 From 100ad353689b8203988c87afe30953d59bdad736 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 15 Dec 2009 13:14:20 +0100 Subject: qreal-ization Using math wrapper functions instead direct call. This gives us top-level control to what (single/double) precision we are effectively using. Task-number: QTBUG-4894 Reviewed-by: janarve Reviewed-by: Kim Motoyoshi Kalland --- src/svg/qsvghandler.cpp | 8 ++++---- src/svg/qsvgstyle.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 3ed918e..b2619bf 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -1147,12 +1147,12 @@ static QMatrix parseTransformationMatrix(const QStringRef &value) if (points.count() != 1) goto error; const qreal deg2rad = qreal(0.017453292519943295769); - matrix.shear(tan(points[0]*deg2rad), 0); + matrix.shear(qTan(points[0]*deg2rad), 0); } else if (state == SkewY) { if (points.count() != 1) goto error; const qreal deg2rad = qreal(0.017453292519943295769); - matrix.shear(0, tan(points[0]*deg2rad)); + matrix.shear(0, qTan(points[0]*deg2rad)); } } error: @@ -1481,8 +1481,8 @@ static void pathArc(QPainterPath &path, yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); /* (xc, yc) is center of the circle. */ - th0 = atan2(y0 - yc, x0 - xc); - th1 = atan2(y1 - yc, x1 - xc); + th0 = qAtan2(y0 - yc, x0 - xc); + th1 = qAtan2(y1 - yc, x1 - xc); th_arc = th1 - th0; if (th_arc < 0 && sweep_flag) diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index 57927fd..c67f7d2 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -771,7 +771,7 @@ void QSvgAnimateTransform::resolveMatrix(QSvgNode *node) qreal transXDiff = (to1-from1) * percentOfAnimation; qreal transX = from1 + transXDiff; m_transform = QTransform(); - m_transform.shear(tan(transX * deg2rad), 0); + m_transform.shear(qTan(transX * deg2rad), 0); break; } case SkewY: { @@ -786,7 +786,7 @@ void QSvgAnimateTransform::resolveMatrix(QSvgNode *node) qreal transYDiff = (to1 - from1) * percentOfAnimation; qreal transY = from1 + transYDiff; m_transform = QTransform(); - m_transform.shear(0, tan(transY * deg2rad)); + m_transform.shear(0, qTan(transY * deg2rad)); break; } default: -- cgit v0.12 From 4391014d4533e60dc4e5e413db50b21f68f4658c Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 15 Dec 2009 13:50:01 +0100 Subject: qreal-ization Using math wrapper functions instead direct call. This gives us top-level control to what (single/double) precision we are effectively using. Task-number: QTBUG-4894 Reviewed-by: janarve Reviewed-by: Kim Motoyoshi Kalland --- src/gui/graphicsview/qgridlayoutengine.cpp | 3 ++- src/gui/painting/qbezier.cpp | 20 ++++++++++---------- src/gui/painting/qdrawhelper.cpp | 12 ++++++------ src/gui/painting/qpathclipper.cpp | 2 +- src/gui/painting/qstroker.cpp | 4 ++-- src/gui/styles/qcommonstyle.cpp | 2 +- src/gui/styles/qstylehelper.cpp | 2 +- src/gui/widgets/qdial.cpp | 3 ++- 8 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index f61360a..9497a2f 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -51,6 +51,7 @@ #include "qvarlengtharray.h" #include +#include QT_BEGIN_NAMESPACE @@ -70,7 +71,7 @@ static void insertOrRemoveItems(QVector &items, int index, int delta) static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired) { Q_ASSERT(sumDesired != 0.0); - return desired * ::pow(sumAvailable / sumDesired, desired / sumDesired); + return desired * qPow(sumAvailable / sumDesired, desired / sumDesired); } static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize) diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index a6b4cef..f626494 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -497,7 +497,7 @@ static bool addCircle(const QBezier *b, qreal offset, QBezier *o) cos_a = 1.; if (cos_a < -1.) cos_a = -1; - angles[i] = acos(cos_a)/Q_PI; + angles[i] = qAcos(cos_a)/Q_PI; } if (angles[0] + angles[1] > 1.) { @@ -816,17 +816,17 @@ bool QBezier::findIntersections(const QBezier &a, const QBezier &b, QVector > *t) { if (IntersectBB(a, b)) { - QPointF la1(fabs((a.x3 - a.x2) - (a.x2 - a.x1)), - fabs((a.y3 - a.y2) - (a.y2 - a.y1))); - QPointF la2(fabs((a.x4 - a.x3) - (a.x3 - a.x2)), - fabs((a.y4 - a.y3) - (a.y3 - a.y2))); + QPointF la1(qFabs((a.x3 - a.x2) - (a.x2 - a.x1)), + qFabs((a.y3 - a.y2) - (a.y2 - a.y1))); + QPointF la2(qFabs((a.x4 - a.x3) - (a.x3 - a.x2)), + qFabs((a.y4 - a.y3) - (a.y3 - a.y2))); QPointF la; if (la1.x() > la2.x()) la.setX(la1.x()); else la.setX(la2.x()); if (la1.y() > la2.y()) la.setY(la1.y()); else la.setY(la2.y()); - QPointF lb1(fabs((b.x3 - b.x2) - (b.x2 - b.x1)), - fabs((b.y3 - b.y2) - (b.y2 - b.y1))); - QPointF lb2(fabs((b.x4 - b.x3) - (b.x3 - b.x2)), - fabs((b.y4 - b.y3) - (b.y3 - b.y2))); + QPointF lb1(qFabs((b.x3 - b.x2) - (b.x2 - b.x1)), + qFabs((b.y3 - b.y2) - (b.y2 - b.y1))); + QPointF lb2(qFabs((b.x4 - b.x3) - (b.x3 - b.x2)), + qFabs((b.y4 - b.y3) - (b.y3 - b.y2))); QPointF lb; if (lb1.x() > lb2.x()) lb.setX(lb1.x()); else lb.setX(lb2.x()); if (lb1.y() > lb2.y()) lb.setY(lb1.y()); else lb.setY(lb2.y()); @@ -1120,7 +1120,7 @@ static inline void bindInflectionPoint(const QBezier &bez, const qreal t, qreal ey = 3 * (right.y2 - right.y3); qreal s4 = qAbs(6 * (ey * ax - ex * ay) / qSqrt(ex * ex + ey * ey)) + 0.00001f; - qreal tf = pow(qreal(9 * flatness / s4), qreal(1./3.)); + qreal tf = qPow(qreal(9 * flatness / s4), qreal(1./3.)); *tMinus = t - (1 - t) * tf; *tPlus = t + (1 - t) * tf; } diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 4df7f8a..23236ec 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1182,7 +1182,7 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato rx -= data->gradient.conical.center.x; ry -= data->gradient.conical.center.y; while (buffer < end) { - qreal angle = atan2(ry, rx) + data->gradient.conical.angle; + qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle; *buffer = qt_gradient_pixel(&data->gradient, 1 - angle / (2*Q_PI)); @@ -1196,7 +1196,7 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato if (!rw) rw = 1; while (buffer < end) { - qreal angle = atan2(ry/rw - data->gradient.conical.center.x, + qreal angle = qAtan2(ry/rw - data->gradient.conical.center.x, rx/rw - data->gradient.conical.center.y) + data->gradient.conical.angle; @@ -7140,17 +7140,17 @@ void qt_build_pow_tables() { } #else for (int i=0; i<256; ++i) { - qt_pow_rgb_gamma[i] = uchar(qRound(pow(i / qreal(255.0), smoothing) * 255)); - qt_pow_rgb_invgamma[i] = uchar(qRound(pow(i / qreal(255.), 1 / smoothing) * 255)); + qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255)); + qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255)); } #endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) const qreal gray_gamma = 2.31; for (int i=0; i<256; ++i) - qt_pow_gamma[i] = uint(qRound(pow(i / qreal(255.), gray_gamma) * 2047)); + qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047)); for (int i=0; i<2048; ++i) - qt_pow_invgamma[i] = uchar(qRound(pow(i / 2047.0, 1 / gray_gamma) * 255)); + qt_pow_invgamma[i] = uchar(qRound(qPow(i / 2047.0, 1 / gray_gamma) * 255)); #endif } diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 51d6195..a41ab6d 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1209,7 +1209,7 @@ static qreal computeAngle(const QPointF &v) } #else // doesn't seem to be robust enough - return atan2(v.x(), v.y()) + Q_PI; + return qAtan2(v.x(), v.y()) + Q_PI; #endif } diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 228a6b1..8bb4728 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -910,8 +910,8 @@ QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLengt } } - int startSegment = int(floor(startAngle / 90)); - int endSegment = int(floor((startAngle + sweepLength) / 90)); + int startSegment = int(qFloor(startAngle / 90)); + int endSegment = int(qFloor((startAngle + sweepLength) / 90)); qreal startT = (startAngle - startSegment * 90) / 90; qreal endT = (startAngle + sweepLength - endSegment * 90) / 90; diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 5028e5f..c1beb6a 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -2775,7 +2775,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, QSize size = (sr == SE_TabBarTabLeftButton) ? tab->leftButtonSize : tab->rightButtonSize; int w = size.width(); int h = size.height(); - int midHeight = static_cast(ceil(float(tr.height() - h) / 2)); + int midHeight = static_cast(qCeil(float(tr.height() - h) / 2)); int midWidth = ((tr.width() - w) / 2); bool atTheTop = true; diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index af30f15..f5af960 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -154,7 +154,7 @@ qreal angle(const QPointF &p1, const QPointF &p2) } qreal m = -(y2 - y1) / (x2 - x1); - _angle = atan(m) * rad_factor; + _angle = qAtan(m) * rad_factor; if (p1.x() < p2.x()) _angle = 180 - _angle; diff --git a/src/gui/widgets/qdial.cpp b/src/gui/widgets/qdial.cpp index 95e6ed5..dc02c02 100644 --- a/src/gui/widgets/qdial.cpp +++ b/src/gui/widgets/qdial.cpp @@ -59,6 +59,7 @@ #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif +#include QT_BEGIN_NAMESPACE @@ -135,7 +136,7 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const Q_Q(const QDial); double yy = (double)q->height()/2.0 - p.y(); double xx = (double)p.x() - q->width()/2.0; - double a = (xx || yy) ? atan2(yy, xx) : 0; + double a = (xx || yy) ? qAtan2(yy, xx) : 0; if (a < Q_PI / -2) a = a + Q_PI * 2; -- cgit v0.12 From 8152bd167c1a728c54a9976297bb53e09d131d66 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 15 Dec 2009 14:29:31 +0100 Subject: qreal-ization Using Symbian Math package. Benhcmarks are showing that some Symbian native math functions (trigonometric, exp, pow ...) are faster then their Open C counterparts. Task-number: QTBUG-4894 Reviewed-by: Iain --- src/corelib/kernel/qmath.h | 154 ++++++++++++++++++++++++++++++++------------- 1 file changed, 109 insertions(+), 45 deletions(-) diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index 820f424..16e6bb7 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -46,6 +46,10 @@ #include +#ifdef Q_OS_SYMBIAN +# include +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -88,82 +92,130 @@ inline qreal qFabs(qreal v) inline qreal qSin(qreal v) { -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return sinf(float(v)); - else +#ifdef Q_OS_SYMBIAN + TReal sin_v; + Math::Sin(sin_v, static_cast(v)); + return static_cast(sin_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return sinf(float(v)); + else +# endif + return sin(v); #endif - return sin(v); } inline qreal qCos(qreal v) { -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return cosf(float(v)); - else +#ifdef Q_OS_SYMBIAN + TReal cos_v; + Math::Cos(cos_v, static_cast(v)); + return static_cast(cos_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return cosf(float(v)); + else +# endif + return cos(v); #endif - return cos(v); } inline qreal qTan(qreal v) { -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return tanf(float(v)); - else +#ifdef Q_OS_SYMBIAN + TReal tan_v; + Math::Tan(tan_v, static_cast(v)); + return static_cast(tan_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return tanf(float(v)); + else +# endif + return tan(v); #endif - return tan(v); } inline qreal qAcos(qreal v) { -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return acosf(float(v)); - else +#ifdef Q_OS_SYMBIAN + TReal acos_v; + Math::ACos(acos_v, static_cast(v)); + return static_cast(acos_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return acosf(float(v)); + else +# endif + return acos(v); #endif - return acos(v); } inline qreal qAsin(qreal v) { -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return asinf(float(v)); - else +#ifdef Q_OS_SYMBIAN + TReal asin_v; + Math::ASin(asin_v, static_cast(v)); + return static_cast(asin_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return asinf(float(v)); + else +# endif + return asin(v); #endif - return asin(v); } inline qreal qAtan(qreal v) { -#ifdef QT_USE_MATH_H_FLOATS - if(sizeof(qreal) == sizeof(float)) - return atanf(float(v)); - else +#ifdef Q_OS_SYMBIAN + TReal atan_v; + Math::ATan(atan_v, static_cast(v)); + return static_cast(atan_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atanf(float(v)); + else +# endif + return atan(v); #endif - return atan(v); } inline qreal qAtan2(qreal x, qreal y) { -#ifdef QT_USE_MATH_H_FLOATS - if(sizeof(qreal) == sizeof(float)) - return atan2f(float(x), float(y)); - else +#ifdef Q_OS_SYMBIAN + TReal atan2_v; + Math::ATan(atan2_v, static_cast(x), static_cast(y)); + return static_cast(atan2_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atan2f(float(x), float(y)); + else +# endif + return atan2(x, y); #endif - return atan2(x, y); } inline qreal qSqrt(qreal v) { -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return sqrtf(float(v)); - else +#ifdef Q_OS_SYMBIAN + TReal sqrt_v; + Math::Sqrt(sqrt_v, static_cast(v)); + return static_cast(sqrt_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return sqrtf(float(v)); + else +# endif + return sqrt(v); #endif - return sqrt(v); } inline qreal qLn(qreal v) @@ -178,19 +230,31 @@ inline qreal qLn(qreal v) inline qreal qExp(qreal v) { +#ifdef Q_OS_SYMBIAN + TReal exp_v; + Math::Exp(exp_v, static_cast(v)); + return static_cast(exp_v); +#else // only one signature // exists, exp(double) return exp(v); +#endif } inline qreal qPow(qreal x, qreal y) { -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return powf(float(x), float(y)); - else +#ifdef Q_OS_SYMBIAN + TReal pow_v; + Math::Pow(pow_v, static_cast(x), static_cast(y)); + return static_cast(pow_v); +#else +# ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return powf(float(x), float(y)); + else +# endif + return pow(x, y); #endif - return pow(x, y); } #ifndef M_PI -- cgit v0.12 From ebe0c4dfe4d1abb06bdd57783e2a850d67354d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Dec 2009 12:43:00 +0100 Subject: Got rid of unused variable compiler warning. --- src/opengl/qglpixmapfilter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index c0a0460..d4bcbe9 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -447,8 +447,6 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const qreal actualRadius = radius(); - QGLPixmapBlurFilter *filter = const_cast(this); - QGLContext *ctx = const_cast(QGLContext::currentContext()); QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); -- cgit v0.12 From a88cb5b07d635525bd300a59ed24540ae286fd08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Dec 2009 15:35:48 +0100 Subject: Attempt at fixing compilation on Symbian. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Symbian compiler seems to have a problem with forward declarations of template functions. Reviewed-by: Bjørn Erik Nilsen --- src/gui/image/qpixmapfilter.cpp | 171 +++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 88 deletions(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 9c7c28e..caa0752 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -601,94 +601,6 @@ QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const return rect.adjusted(-delta, -delta, delta, delta); } -// Blur the image according to the blur radius -// Based on exponential blur algorithm by Jani Huhtanen - -template -static inline void blurrow( QImage & im, int line, int alpha); - -/* -* expblur(QImage &img, int radius) -* -* In-place blur of image 'img' with kernel -* of approximate radius 'radius'. -* -* Blurs with two sided exponential impulse -* response. -* -* aprec = precision of alpha parameter -* in fixed-point format 0.aprec -* -* zprec = precision of state parameters -* zR,zG,zB and zA in fp format 8.zprec -*/ -template -void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transposed = 0) -{ - // halve the radius if we're using two passes - if (improvedQuality) - radius *= qreal(0.5); - - Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied - || img.format() == QImage::Format_RGB32); - - // choose the alpha such that pixels at radius distance from a fully - // saturated pixel will have an alpha component of no greater than - // the cutOffIntensity - const qreal cutOffIntensity = 2; - int alpha = radius <= qreal(1e-5) - ? ((1 << aprec)-1) - : qRound((1<(img, row, alpha); - } - - QImage temp(img.height(), img.width(), img.format()); - if (transposed >= 0) { - if (img.depth() == 8) { - qt_memrotate270(reinterpret_cast(img.bits()), - img.width(), img.height(), img.bytesPerLine(), - reinterpret_cast(temp.bits()), - temp.bytesPerLine()); - } else { - qt_memrotate270(reinterpret_cast(img.bits()), - img.width(), img.height(), img.bytesPerLine(), - reinterpret_cast(temp.bits()), - temp.bytesPerLine()); - } - } else { - if (img.depth() == 8) { - qt_memrotate90(reinterpret_cast(img.bits()), - img.width(), img.height(), img.bytesPerLine(), - reinterpret_cast(temp.bits()), - temp.bytesPerLine()); - } else { - qt_memrotate90(reinterpret_cast(img.bits()), - img.width(), img.height(), img.bytesPerLine(), - reinterpret_cast(temp.bits()), - temp.bytesPerLine()); - } - } - - img_height = temp.height(); - for (int row = 0; row < img_height; ++row) { - for (int i = 0; i <= improvedQuality; ++i) - blurrow(temp, row, alpha); - } - - if (transposed == 0) { - qt_memrotate90(reinterpret_cast(temp.bits()), - temp.width(), temp.height(), temp.bytesPerLine(), - reinterpret_cast(img.bits()), - img.bytesPerLine()); - } else { - img = temp; - } -} - template static inline int static_shift(int value) { @@ -773,6 +685,89 @@ static inline void blurrow(QImage & im, int line, int alpha) } } +/* +* expblur(QImage &img, int radius) +* +* Based on exponential blur algorithm by Jani Huhtanen +* +* In-place blur of image 'img' with kernel +* of approximate radius 'radius'. +* +* Blurs with two sided exponential impulse +* response. +* +* aprec = precision of alpha parameter +* in fixed-point format 0.aprec +* +* zprec = precision of state parameters +* zR,zG,zB and zA in fp format 8.zprec +*/ +template +void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transposed = 0) +{ + // halve the radius if we're using two passes + if (improvedQuality) + radius *= qreal(0.5); + + Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied + || img.format() == QImage::Format_RGB32); + + // choose the alpha such that pixels at radius distance from a fully + // saturated pixel will have an alpha component of no greater than + // the cutOffIntensity + const qreal cutOffIntensity = 2; + int alpha = radius <= qreal(1e-5) + ? ((1 << aprec)-1) + : qRound((1<(img, row, alpha); + } + + QImage temp(img.height(), img.width(), img.format()); + if (transposed >= 0) { + if (img.depth() == 8) { + qt_memrotate270(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } else { + qt_memrotate270(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } + } else { + if (img.depth() == 8) { + qt_memrotate90(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } else { + qt_memrotate90(reinterpret_cast(img.bits()), + img.width(), img.height(), img.bytesPerLine(), + reinterpret_cast(temp.bits()), + temp.bytesPerLine()); + } + } + + img_height = temp.height(); + for (int row = 0; row < img_height; ++row) { + for (int i = 0; i <= improvedQuality; ++i) + blurrow(temp, row, alpha); + } + + if (transposed == 0) { + qt_memrotate90(reinterpret_cast(temp.bits()), + temp.width(), temp.height(), temp.bytesPerLine(), + reinterpret_cast(img.bits()), + img.bytesPerLine()); + } else { + img = temp; + } +} #define AVG(a,b) ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) ) #define AVG16(a,b) ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) ) -- cgit v0.12 From cc70bffdfb1539eceb355cf172fce75efa5e7589 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 15 Dec 2009 17:22:38 +0100 Subject: Add QT_DEBUG_X11_VISUAL_SELECTION to aid debugging X11/EGL --- src/opengl/qgl_x11egl.cpp | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index a868e83..b10e7e9 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -173,10 +173,16 @@ void QGLWidget::updateOverlayGL() //handle overlay } +//#define QT_DEBUG_X11_VISUAL_SELECTION 1 + bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, const QX11Info &x11Info, bool useArgbVisual) { bool foundVisualIsArgb = useArgbVisual; +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("qt_egl_setup_x11_visual() - useArgbVisual=%d", useArgbVisual); +#endif + memset(&vi, 0, sizeof(XVisualInfo)); EGLint eglConfigColorSize; @@ -199,7 +205,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf XRenderPictFormat *format; format = XRenderFindVisualFormat(x11Info.display(), chosenVisualInfo->visual); if (format->type == PictTypeDirect && format->direct.alphaMask) { -// qDebug("Using ARGB X Visual ID (%d) provided by EGL", (int)vi.visualid); +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using ARGB X Visual ID (%d) provided by EGL", (int)vi.visualid); +#endif foundVisualIsArgb = true; vi = *chosenVisualInfo; } @@ -212,7 +220,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf #endif { if (eglConfigColorSize == chosenVisualInfo->depth) { -// qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid); +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid); +#endif vi = *chosenVisualInfo; } else qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!", @@ -248,7 +258,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf if (format->type == PictTypeDirect && format->direct.alphaMask) { vi = matchingVisuals[i]; foundVisualIsArgb = true; -// qDebug("Using X Visual ID (%d) for ARGB visual as provided by XRender", (int)vi.visualid); +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using X Visual ID (%d) for ARGB visual as provided by XRender", (int)vi.visualid); +#endif break; } } @@ -272,24 +284,28 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf } else qWarning(" - Falling back to X11 suggested depth (%d)", depth); } -// else -// qDebug("Using X Visual ID (%d) for EGL provided depth (%d)", (int)vi.visualid, depth); +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("Using X Visual ID (%d) for EGL provided depth (%d)", (int)vi.visualid, depth); +#endif // Don't try to use ARGB now unless the visual is 32-bit - even then it might stil fail :-( if (useArgbVisual) foundVisualIsArgb = vi.depth == 32; //### We might at some point (soon) get ARGB4444 } -// qDebug("Visual Info:"); -// qDebug(" bits_per_rgb=%d", vi.bits_per_rgb); -// qDebug(" red_mask=0x%x", vi.red_mask); -// qDebug(" green_mask=0x%x", vi.green_mask); -// qDebug(" blue_mask=0x%x", vi.blue_mask); -// qDebug(" colormap_size=%d", vi.colormap_size); -// qDebug(" c_class=%d", vi.c_class); -// qDebug(" depth=%d", vi.depth); -// qDebug(" screen=%d", vi.screen); -// qDebug(" visualid=%d", vi.visualid); +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Visual Info:"); + qDebug(" bits_per_rgb=%d", vi.bits_per_rgb); + qDebug(" red_mask=0x%x", vi.red_mask); + qDebug(" green_mask=0x%x", vi.green_mask); + qDebug(" blue_mask=0x%x", vi.blue_mask); + qDebug(" colormap_size=%d", vi.colormap_size); + qDebug(" c_class=%d", vi.c_class); + qDebug(" depth=%d", vi.depth); + qDebug(" screen=%d", vi.screen); + qDebug(" visualid=%d", vi.visualid); +#endif return foundVisualIsArgb; } -- cgit v0.12 From 6b29466ed7b5328ee61c1751bd4efb72f70946d3 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 15 Dec 2009 17:26:37 +0100 Subject: Fix QGLWidgets created with an alpha channel on X11/EGL If the QGLWidget's QGLFormat says it should have an alpha channel, try to find an ARGB Visual. Reviewed-By: Trond Task-number: QT-2602 --- src/opengl/qgl_x11egl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index b10e7e9..19026b3 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -336,7 +336,7 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, // If the application has set WA_TranslucentBackground and not explicitly set // the alpha buffer size to zero, modify the format so it have an alpha channel QGLFormat& fmt = d->glcx->d_func()->glFormat; - const bool tryArgbVisual = testAttribute(Qt::WA_TranslucentBackground); + const bool tryArgbVisual = testAttribute(Qt::WA_TranslucentBackground) || fmt.alpha(); if (tryArgbVisual && fmt.alphaBufferSize() == -1) fmt.setAlphaBufferSize(1); -- cgit v0.12 From 4b5b74835f6323415f7df43ddb74caa078c4ab62 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 15 Dec 2009 16:48:03 +0100 Subject: fix Cocoa build with change 83940f25, we used LIBS_PRIVATE on the Mac; somewhere the line where we linked against the Mac libs in the network kernel was lost. Reviewed-By: Thiago --- src/network/kernel/kernel.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 8aa6ff4..d3e9774 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -23,7 +23,7 @@ SOURCES += kernel/qauthenticator.cpp \ unix:SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp win32:SOURCES += kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp -mac:LIBS+= -framework SystemConfiguration +mac:LIBS+= -framework SystemConfiguration -framework CoreFoundation mac:SOURCES += kernel/qnetworkproxy_mac.cpp else:win32:SOURCES += kernel/qnetworkproxy_win.cpp else:SOURCES += kernel/qnetworkproxy_generic.cpp -- cgit v0.12 From 0bde9d70b1a327b973a3e65efb138ff508ec4986 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 15 Dec 2009 18:08:40 +0100 Subject: Add autotest for creating a QGLWidget with alpha channel Task-number: QT-2602 --- tests/auto/qgl/tst_qgl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 5dc072d..7b701eb 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -75,6 +75,7 @@ private slots: void graphicsViewClipping(); void partialGLWidgetUpdates_data(); void partialGLWidgetUpdates(); + void glWidgetWithAlpha(); void glWidgetRendering(); void glFBOSimpleRendering(); void glFBORendering(); @@ -927,6 +928,17 @@ void tst_QGL::glPBufferRendering() QFUZZY_COMPARE_IMAGES(fb, reference); } +void tst_QGL::glWidgetWithAlpha() +{ + QGLWidget* w = new QGLWidget(QGLFormat(QGL::AlphaChannel)); + w->show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(w); +#endif + + delete w; +} + class GLWidget : public QGLWidget { public: -- cgit v0.12 From 9f3ae04fae52cd37855b135a0f2f519d1c5b969c Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 15 Dec 2009 18:11:05 +0100 Subject: Fix EGL surface leaks when re-parenting QGLWidget on X11/EGL When a QGLWidget is re-parented, it's native X11 window usually gets destroyed and re-created. This also happens when you set a window attribute or flag. On EGL, we must destroy the surface for the window before destroying the window itself, otherwise we can leak the surface. This also fixes lots of BadDrawable errors when running the autotests (which were due to surface leaks!). Reviewed-By: TrustMe --- src/opengl/qgl.cpp | 5 +++++ src/opengl/qgl.h | 1 + src/opengl/qgl_egl.cpp | 34 +++++++++++++++++++++------------- src/opengl/qgl_p.h | 1 + 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2a3ce54..32534aa 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3810,6 +3810,11 @@ bool QGLWidget::event(QEvent *e) } #if defined(QT_OPENGL_ES) + // A re-parent is likely to destroy the X11 window and re-create it. It is important + // that we free the EGL surface _before_ the winID changes - otherwise we can leak. + if (e->type() == QEvent::ParentAboutToChange) + d->glcx->d_func()->destroyEglSurfaceForDevice(); + if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) { // The window may have been re-created during re-parent or state change - if so, the EGL // surface will need to be re-created. diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 079953f..2076c46 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -546,6 +546,7 @@ private: friend class QGLPixelBuffer; friend class QGLPixelBufferPrivate; friend class QGLContext; + friend class QGLContextPrivate; friend class QGLOverlayWidget; friend class QOpenGLPaintEngine; friend class QGLPaintDevice; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index fbf0349..839e8eb 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -142,19 +142,7 @@ void QGLContext::reset() d->cleanup(); doneCurrent(); if (d->eglContext) { - if (d->eglSurface != EGL_NO_SURFACE) { -#ifdef Q_WS_X11 - // Make sure we don't call eglDestroySurface on a surface which - // was created for a different winId: - if (d->paintDevice->devType() == QInternal::Widget) { - QGLWidget* w = static_cast(d->paintDevice); - - if (w->d_func()->eglSurfaceWindowId == w->winId()) - eglDestroySurface(d->eglContext->display(), d->eglSurface); - } else -#endif - eglDestroySurface(d->eglContext->display(), d->eglSurface); - } + d->destroyEglSurfaceForDevice(); delete d->eglContext; } d->eglContext = 0; @@ -198,6 +186,26 @@ void QGLContext::swapBuffers() const d->eglContext->swapBuffers(d->eglSurface); } +void QGLContextPrivate::destroyEglSurfaceForDevice() +{ + if (eglSurface != EGL_NO_SURFACE) { +#ifdef Q_WS_X11 + // Make sure we don't call eglDestroySurface on a surface which + // was created for a different winId: + if (paintDevice->devType() == QInternal::Widget) { + QGLWidget* w = static_cast(paintDevice); + + if (w->d_func()->eglSurfaceWindowId == w->winId()) + eglDestroySurface(eglContext->display(), eglSurface); + else + qWarning("WARNING: Potential EGL surface leak!"); + } else +#endif + eglDestroySurface(eglContext->display(), eglSurface); + eglSurface = EGL_NO_SURFACE; + } +} + void QGLWidget::setMouseTracking(bool enable) { QWidget::setMouseTracking(enable); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 11770d3..99c0f33 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -288,6 +288,7 @@ public: #if defined(QT_OPENGL_ES) QEglContext *eglContext; EGLSurface eglSurface; + void destroyEglSurfaceForDevice(); #elif defined(Q_WS_X11) || defined(Q_WS_MAC) void* cx; #endif -- cgit v0.12 From 802efaf0b20e08bcc04763a288a05551121493e8 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 15 Dec 2009 18:20:45 +0100 Subject: Fix autotest which checks for sample buffers Change c4d66e27 made sample buffers on EGL platforms to default to off, matching desktop GL. This patch fixes the autotest which was still testing for the old behaviour. Reviewed-By: TrustMe --- tests/auto/qgl/tst_qgl.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 7b701eb..532e550 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -252,15 +252,10 @@ void tst_QGL::getSetCheck() // bool QGLFormat::sampleBuffers() // void QGLFormat::setSampleBuffers(bool) -#if !defined(QT_OPENGL_ES_2) QCOMPARE(false, obj1.sampleBuffers()); QVERIFY(!obj1.testOption(QGL::SampleBuffers)); QVERIFY(obj1.testOption(QGL::NoSampleBuffers)); -#else - QCOMPARE(true, obj1.sampleBuffers()); - QVERIFY(obj1.testOption(QGL::SampleBuffers)); - QVERIFY(!obj1.testOption(QGL::NoSampleBuffers)); -#endif + obj1.setSampleBuffers(false); QCOMPARE(false, obj1.sampleBuffers()); QVERIFY(obj1.testOption(QGL::NoSampleBuffers)); -- cgit v0.12 From 0414a73942272d8e863e464b3fbffeb9982964c1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 15 Dec 2009 22:25:00 +0100 Subject: Fix moc generated code with dummy Q_PROPERTY If there is properties, we cannot skip the code that substract the property number from the id Task-number: QTBUG-5590 Reviewed-by: Brad --- src/tools/moc/generator.cpp | 11 ----------- tests/auto/moc/tst_moc.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 8fcc0df..1a75cf6 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -725,16 +725,6 @@ void Generator::generateMetacall() needEditable |= p.editable.endsWith(')'); needUser |= p.user.endsWith(')'); } - bool needAnything = needGet - | needSet - | needReset - | needDesignable - | needScriptable - | needStored - | needEditable - | needUser; - if (!needAnything) - goto skip_properties; fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n "); if (needElse) @@ -904,7 +894,6 @@ void Generator::generateMetacall() fprintf(out, "\n#endif // QT_NO_PROPERTIES"); } - skip_properties: if (methodList.size() || cdef->signalList.size() || cdef->propertyList.size()) fprintf(out, "\n "); fprintf(out,"return _id;\n}\n"); diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index 2316ba2..1ca2b3a 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -489,6 +489,7 @@ private slots: void constructors(); void typenameWithUnsigned(); void warnOnVirtualSignal(); + void QTBUG5590_dummyProperty(); signals: void sigWithUnsignedArg(unsigned foo); void sigWithSignedArg(signed foo); @@ -1216,6 +1217,40 @@ void tst_Moc::warnOnVirtualSignal() #endif } + +class QTBUG5590_DummyObject: public QObject +{ + Q_OBJECT + Q_PROPERTY(bool dummy) +}; + +class QTBUG5590_PropertyObject: public QTBUG5590_DummyObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(int value2 READ value2 WRITE setValue2) + + public: + QTBUG5590_PropertyObject() : m_value(85), m_value2(40) { } + int value() const { return m_value; } + void setValue(int value) { m_value = value; } + int value2() const { return m_value2; } + void setValue2(int value) { m_value2 = value; } + private: + int m_value, m_value2; +}; + +void tst_Moc::QTBUG5590_dummyProperty() +{ + QTBUG5590_PropertyObject o; + QCOMPARE(o.property("value").toInt(), 85); + QCOMPARE(o.property("value2").toInt(), 40); + o.setProperty("value", 32); + QCOMPARE(o.value(), 32); + o.setProperty("value2", 82); + QCOMPARE(o.value2(), 82); +} + QTEST_APPLESS_MAIN(tst_Moc) #include "tst_moc.moc" -- cgit v0.12 From a43868ca114562502618b4e9c3dd096c65c2e192 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 16 Dec 2009 12:17:41 +0200 Subject: Long informative texts causes messagebox to grow outside of screen area Currently if we launch QMessageBox::aboutQt(), the dialog grows too large to fit into any kind of device display. To fix this, we have added a QTextEdit instead of QLabel into QMessageBox. QTextEdit automatically adds scrollbars to its content, if the text won't fit into the designated area. This change causes error QTBUG-6853. This is due to that QTextEdit does not support activating external links. Task-number: QTBUG-3232 Reviewed-by: Alessandro Portale --- src/gui/dialogs/qmessagebox.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index a318c43..8ec8d1c 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -188,6 +188,9 @@ public: bool autoAddOkButton; QAbstractButton *detectedEscapeButton; QLabel *informativeLabel; +#ifdef Q_OS_SYMBIAN + QTextEdit *textEdit; +#endif QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; QByteArray signalToDisconnectOnClose; @@ -2459,10 +2462,24 @@ void QMessageBox::setInformativeText(const QString &text) #endif label->setWordWrap(true); QGridLayout *grid = static_cast(layout()); +#ifdef Q_OS_SYMBIAN + label->hide(); + QTextEdit *textEdit = new QTextEdit(this); + textEdit->setReadOnly(true); + grid->addWidget(textEdit, 1, 1, 1, 1); + d->textEdit = textEdit; +#else grid->addWidget(label, 1, 1, 1, 1); +#endif d->informativeLabel = label; } d->informativeLabel->setText(text); + +#ifdef Q_OS_SYMBIAN + //We need to put the informative label inside textEdit to enable scrolling of long texts. + d->textEdit->setText(d->informativeLabel->text()); +#endif + d->updateSize(); } -- cgit v0.12 From 8fdf9f14c662b8d92cd232e09baf526476fcb297 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 16 Dec 2009 12:24:28 +0100 Subject: fix build with namespaced qt --- tools/linguist/lrelease/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index c45459a..b8e8eb2 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -55,6 +55,8 @@ #include #include +QT_USE_NAMESPACE + #ifdef QT_BOOTSTRAPPED static void initBinaryDir( #ifndef Q_OS_WIN -- cgit v0.12 From 4b815774358c3c981dc8bbbcb0dd68abe2e812f2 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 16 Dec 2009 15:21:10 +0200 Subject: Fix for QTBUG-4908 SVG transparency rendering problem. QPixmap::copy discarded alpha channel. This fix also removes usage of member variables CFbsBitGc and CFbsBitmapDevice. Now those are used only in function scope. Reviewed-by: Sami Merila --- src/gui/image/qpixmap_s60.cpp | 97 +++++++++++++-------------------- src/gui/image/qpixmap_s60_p.h | 6 +- src/gui/painting/qwindowsurface_s60.cpp | 8 ++- tests/auto/qpixmap/tst_qpixmap.cpp | 6 ++ 4 files changed, 51 insertions(+), 66 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 610317d..8194db5 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -235,7 +235,7 @@ static CFbsBitmap* uncompress(CFbsBitmap* bitmap) QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); bitmapGc->Activate(bitmapDevice); - bitmapGc->DrawBitmap(TPoint(), bitmap); + bitmapGc->BitBlt(TPoint(), bitmap); delete bitmapGc; delete bitmapDevice; @@ -346,8 +346,6 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), symbianBitmapDataAccess(new QSymbianBitmapDataAccess), cfbsBitmap(0), - bitmapDevice(0), - bitmapGc(0), pengine(0), bytes(0), formatLocked(false) @@ -385,8 +383,6 @@ void QS60PixmapData::resize(int width, int height) if(cfbsBitmap->SizeInPixels() != newSize) { cfbsBitmap->Resize(TSize(width, height)); - bitmapDevice->Resize(TSize(width, height)); - bitmapGc->Resized(); if(pengine) { delete pengine; pengine = 0; @@ -397,21 +393,10 @@ void QS60PixmapData::resize(int width, int height) } } -bool QS60PixmapData::initSymbianBitmapContext() -{ - QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(cfbsBitmap)); - QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); - bitmapGc->Activate(bitmapDevice); - - return true; -} - void QS60PixmapData::release() { if (cfbsBitmap) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - delete bitmapGc; - delete bitmapDevice; delete cfbsBitmap; lock.relock(); } @@ -419,8 +404,6 @@ void QS60PixmapData::release() delete pengine; image = QImage(); cfbsBitmap = 0; - bitmapGc = 0; - bitmapDevice = 0; pengine = 0; bytes = 0; } @@ -428,42 +411,52 @@ void QS60PixmapData::release() /*! * Takes ownership of bitmap. Used by window surface */ -void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap) +void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) { - cfbsBitmap = bitmap; - formatLocked = true; + Q_ASSERT(bitmap); - if(!initSymbianBitmapContext()) { - qWarning("Could not create CBitmapContext"); - release(); - return; - } + release(); + + cfbsBitmap = bitmap; + formatLocked = lockFormat; - setSerialNumber(cfbsBitmap->Handle()); + setSerialNumber(cfbsBitmap->Handle()); - UPDATE_BUFFER(); + UPDATE_BUFFER(); - // Create default palette if needed - if (cfbsBitmap->DisplayMode() == EGray2) { - image.setColorCount(2); - image.setColor(0, QColor(Qt::color0).rgba()); - image.setColor(1, QColor(Qt::color1).rgba()); + // Create default palette if needed + if (cfbsBitmap->DisplayMode() == EGray2) { + image.setColorCount(2); + image.setColor(0, QColor(Qt::color0).rgba()); + image.setColor(1, QColor(Qt::color1).rgba()); //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid //So invert mono bitmaps so that masks work correctly. image.invertPixels(); - } else if (cfbsBitmap->DisplayMode() == EGray256) { - for (int i=0; i < 256; ++i) - image.setColor(i, qRgb(i, i, i)); - }else if (cfbsBitmap->DisplayMode() == EColor256) { - const TColor256Util *palette = TColor256Util::Default(); - for (int i=0; i < 256; ++i) - image.setColor(i, (QRgb)(palette->Color256(i).Value())); - } + } else if (cfbsBitmap->DisplayMode() == EGray256) { + for (int i=0; i < 256; ++i) + image.setColor(i, qRgb(i, i, i)); + } else if (cfbsBitmap->DisplayMode() == EColor256) { + const TColor256Util *palette = TColor256Util::Default(); + for (int i=0; i < 256; ++i) + image.setColor(i, (QRgb)(palette->Color256(i).Value())); + } +} + +QImage QS60PixmapData::toImage(const QRect &r) const +{ + QS60PixmapData *that = const_cast(this); + that->beginDataAccess(); + QImage copy = that->image.copy(r); + that->endDataAccess(); + + return copy; } void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { + release(); + QImage sourceImage; if (pixelType() == BitmapType) { @@ -517,8 +510,8 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags } cfbsBitmap = createSymbianCFbsBitmap(TSize(sourceImage.width(), sourceImage.height()), mode); - if (!(cfbsBitmap && initSymbianBitmapContext())) { - qWarning("Could not create CFbsBitmap and/or CBitmapContext"); + if (!cfbsBitmap) { + qWarning("Could not create CFbsBitmap"); release(); return; } @@ -544,17 +537,8 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect) { - if (data->pixelType() == BitmapType) { - QBitmap::fromImage(data->toImage().copy(rect)); - return; - } - const QS60PixmapData *s60Data = static_cast(data); - - resize(rect.width(), rect.height()); - cfbsBitmap->SetDisplayMode(s60Data->cfbsBitmap->DisplayMode()); - - bitmapGc->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect)); + fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither); } bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) @@ -661,12 +645,7 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) QImage QS60PixmapData::toImage() const { - QS60PixmapData *that = const_cast(this); - that->beginDataAccess(); - QImage copy = that->image.copy(); - that->endDataAccess(); - - return copy; + return toImage(QRect()); } QPaintEngine* QS60PixmapData::paintEngine() const diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index 8631ebd..2d93622 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -109,14 +109,12 @@ public: private: void release(); - void fromSymbianBitmap(CFbsBitmap* bitmap); - bool initSymbianBitmapContext(); + void fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat=false); + QImage toImage(const QRect &r) const; QSymbianBitmapDataAccess *symbianBitmapDataAccess; CFbsBitmap *cfbsBitmap; - CFbsBitmapDevice *bitmapDevice; - CFbsBitGc *bitmapGc; QPaintEngine *pengine; uchar* bytes; diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index c66da71..15427c6 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -68,12 +68,14 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) mode = EColor16MA; // Try for transparency anyway // We create empty CFbsBitmap here -> it will be resized in setGeometry - CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new + CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); - data->fromSymbianBitmap(bitmap); - d_ptr->device = QPixmap(data); + if (data) { + data->fromSymbianBitmap(bitmap, true); + d_ptr->device = QPixmap(data); + } setStaticContentsSupport(true); } diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 0effd01..0164c9d 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -1289,6 +1289,12 @@ void tst_QPixmap::copy() QPixmap expected(10, 10); expected.fill(Qt::blue); QVERIFY(lenientCompare(dest, expected)); + + QPixmap trans; + trans.fill(Qt::transparent); + + QPixmap transCopy = trans.copy(); + QVERIFY(pixmapsAreEqual(&trans, &transCopy)); } #ifdef QT3_SUPPORT -- cgit v0.12 From 06034e9ab2560e777f457fedc8a8cf4380461fed Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 16 Dec 2009 13:21:44 +0200 Subject: Fixed events benchmark postEvent function The postEvent function was causing problems in Symbian because it couldn't handle multiple iterations of the benchmark. - Moved event allocation inside QBENCHMARK so that each iteration will have a fresh event object. - Added resetting of the PingPong counters inside QBENCHMARK. - Used QTestEventLoop::instance().exitLoop() instead of QCoreApplication::quit() to make the cases beyond first to actually test something meaningful. - Added a "first time" case to postEvent_data, as the first time the event loop is used it takes much longer that the subsequent times, at least in Symbian, so that skewed the results. Task-number: QTBUG-6688 Reviewed-by: axis --- tests/benchmarks/events/main.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/events/main.cpp b/tests/benchmarks/events/main.cpp index 7c9de8f..09d6c53 100644 --- a/tests/benchmarks/events/main.cpp +++ b/tests/benchmarks/events/main.cpp @@ -47,6 +47,7 @@ class PingPong : public QObject { public: void setPeer(QObject *peer); + void resetCounter() {m_counter = 100;} protected: bool event(QEvent *e); @@ -69,7 +70,7 @@ bool PingPong::event(QEvent *) QEvent *e = new QEvent(QEvent::User); QCoreApplication::postEvent(m_peer, e); } else { - QCoreApplication::quit(); + QTestEventLoop::instance().exitLoop(); } return true; } @@ -149,6 +150,10 @@ void EventsBench::sendEvent() void EventsBench::postEvent_data() { QTest::addColumn("filterEvents"); + // The first time an eventloop is executed, the case runs radically slower at least + // on some platforms, so test the "no eventfilter" case to get a comparable results + // with the "eventfilter" case. + QTest::newRow("first time, no eventfilter") << false; QTest::newRow("no eventfilter") << false; QTest::newRow("eventfilter") << true; } @@ -164,8 +169,14 @@ void EventsBench::postEvent() ping.installEventFilter(this); pong.installEventFilter(this); } - QEvent *e = new QEvent(QEvent::User); + QBENCHMARK { + // In case multiple iterations are done, event needs to be created inside the QBENCHMARK, + // or it gets deleted once first iteration exits and can cause a crash. Similarly, + // ping and pong need their counters reset. + QEvent *e = new QEvent(QEvent::User); + ping.resetCounter(); + pong.resetCounter(); QCoreApplication::postEvent(&ping, e); QTestEventLoop::instance().enterLoop( 61 ); } -- cgit v0.12 From 851344b93b797a9c6fb13f8c6d4ede0594040633 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 16 Dec 2009 15:06:25 +0200 Subject: Fixed qdiriterator benchmark for Symbian Deployment was handled similarly to WinCE. Some whitespace was also removed. Task-number: QTBUG-6690 Reviewed-by: Janne Anttila --- tests/benchmarks/qdiriterator/main.cpp | 10 +++++----- tests/benchmarks/qdiriterator/qdiriterator.pro | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/benchmarks/qdiriterator/main.cpp b/tests/benchmarks/qdiriterator/main.cpp index 2a400e3..9e4e53e 100644 --- a/tests/benchmarks/qdiriterator/main.cpp +++ b/tests/benchmarks/qdiriterator/main.cpp @@ -73,7 +73,7 @@ private slots: void tst_qdiriterator::data() { -#ifdef Q_OS_WINCE +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath()); qtdir += "/depot"; #else @@ -148,9 +148,9 @@ static int posix_helper(const char *dirpath) int count = 0; while ((entry = ::readdir(dir))) { - if (qstrcmp(entry->d_name, ".") == 0) + if (qstrcmp(entry->d_name, ".") == 0) continue; - if (qstrcmp(entry->d_name, "..") == 0) + if (qstrcmp(entry->d_name, "..") == 0) continue; ++count; QByteArray ba = dirpath; @@ -198,7 +198,7 @@ void tst_qdiriterator::diriterator() //QDir::AllEntries | QDir::Hidden, QDir::Files, QDirIterator::Subdirectories); - + while (dir.hasNext()) { dir.next(); //printf("%s\n", qPrintable(dir.fileName())); @@ -231,7 +231,7 @@ void tst_qdiriterator::fsiterator() //QDir::Files | QDir::NoDotAndDotDot, QDir::Files, QFileSystemIterator::Subdirectories); - + for (; !dir.atEnd(); dir.next()) { dump && printf("%d %s\n", dir.fileInfo().isDir(), diff --git a/tests/benchmarks/qdiriterator/qdiriterator.pro b/tests/benchmarks/qdiriterator/qdiriterator.pro index fb4b753..e06d746 100755 --- a/tests/benchmarks/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/qdiriterator/qdiriterator.pro @@ -15,7 +15,7 @@ SOURCES += main.cpp SOURCES += qfilesystemiterator.cpp HEADERS += qfilesystemiterator.h -wince*: { +wince*|symbian: { corelibdir.sources = $$QT_SOURCE_TREE/src/corelib corelibdir.path = ./depot/src DEPLOYMENT += corelibdir -- cgit v0.12 From a2ec72ee604181892050093669b870580708842d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 16 Dec 2009 15:59:05 +0200 Subject: Fixed qstylesheetstyle benchmark for Symbian The benchmark ran out of stack for large grids somewhere inside QWidget::show(). Skipped show cases for large grids in Symbian, since we cannot increase application stack any further. Also removed some unnecessary whitespace. Task-number: QTBUG-6693 Reviewed-by: Janne Anttila --- tests/benchmarks/qstylesheetstyle/main.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/benchmarks/qstylesheetstyle/main.cpp b/tests/benchmarks/qstylesheetstyle/main.cpp index 19efcab..d6fa48c 100644 --- a/tests/benchmarks/qstylesheetstyle/main.cpp +++ b/tests/benchmarks/qstylesheetstyle/main.cpp @@ -49,16 +49,16 @@ class tst_qstylesheetstyle : public QObject private slots: void empty(); void empty_events(); - + void simple(); void simple_events(); - + void grid_data(); void grid(); - + private: QWidget *buildSimpleWidgets(); - + }; @@ -103,7 +103,7 @@ void tst_qstylesheetstyle::empty_events() delete w; } -static const char *simple_css = +static const char *simple_css = " QLineEdit { background: red; } QPushButton { border: 1px solid yellow; color: pink; } \n" " QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n" " QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; } "; @@ -138,7 +138,7 @@ void tst_qstylesheetstyle::grid_data() QTest::addColumn("events"); QTest::addColumn("show"); QTest::addColumn("N"); - for (int n = 5; n <= 25; n += 5) { + for (int n = 5; n <= 25; n += 5) { const QByteArray nString = QByteArray::number(n*n); QTest::newRow(("simple--" + nString).constData()) << false << false << n; QTest::newRow(("events--" + nString).constData()) << true << false << n; @@ -153,6 +153,13 @@ void tst_qstylesheetstyle::grid() QFETCH(bool, show); QFETCH(int, N); +#ifdef Q_OS_SYMBIAN + // Symbian has limited stack (max 80k), which will run out when N >= 20 due to + // QWidget::show() using recursion among grid labels somewhere down the line. + if (show && N >= 20) + QSKIP("Grid too big for device to show", SkipSingle); +#endif + QWidget *w = new QWidget(); QGridLayout *layout = new QGridLayout(w); w->setLayout(layout); -- cgit v0.12 From 11ec7b3694feed8514f9559c7b732ad6217e88c6 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Dec 2009 10:27:37 +1000 Subject: Disable benchlibwalltime test. The test is inherently dependent on the timing behavior of the test machine. For now, it seems too difficult to ensure this works everywhere. --- tests/auto/selftests/tst_selftests.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 579f4eb..ed3b08e 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -182,12 +182,12 @@ void tst_Selftests::runSubTest_data() #endif QTest::newRow("benchlibeventcounter") << "benchlibeventcounter" << QStringList("-eventcounter"); QTest::newRow("benchliboptions") << "benchliboptions" << QStringList("-eventcounter"); - QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList(); - //### This test is affected by the speed of the CPU and whether the tick counter is - //### monotonically increasing. It won't work on some machines so leave it off by default. + //### These tests are affected by timing and whether the CPU tick counter is + //### monotonically increasing. They won't work on some machines so leave them off by default. //### Feel free to uncomment for your own testing. #if 0 + QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList(); QTest::newRow("benchlibtickcounter") << "benchlibtickcounter" << QStringList("-tickcounter"); #endif -- cgit v0.12 From 7371d787d9b2667132c0caadb9964189b1d8c9fc Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 17 Dec 2009 11:17:11 +1000 Subject: Disable depth testing during the 2D QGLWidget::renderText() Also document the depth testing conditions for the 2D and 3D versions of the function. Task-number: QTBUG-5041 Reviewed-by: Daniel Pope --- src/opengl/qgl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 32534aa..466e851 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4302,6 +4302,7 @@ static void qt_save_gl_state() glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } @@ -4355,6 +4356,10 @@ static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str, \note This function clears the stencil buffer. \note This function is not supported on OpenGL/ES systems. + + \note This function temporarily disables depth-testing when the + text is drawn. + \l{Overpainting Example}{Overpaint} with QPainter::drawText() instead. */ @@ -4445,6 +4450,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, have the labels move with the model as it is rotated etc. \note This function is not supported on OpenGL/ES systems. + + \note If depth testing is enabled before this function is called, + then the drawn text will be depth-tested against the models that + have already been drawn in the scene. Use \c{glDisable(GL_DEPTH_TEST)} + before calling this function to annotate the models without + depth-testing the text. + \l{Overpainting Example}{Overpaint} with QPainter::drawText() instead. */ void QGLWidget::renderText(double x, double y, double z, const QString &str, const QFont &font, int) -- cgit v0.12 From 65fe21e8c1cfb70e5b763818928c6570bb67b5e3 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 17 Dec 2009 13:49:31 +1000 Subject: (OCI) Fixes problem with clobs being handled as binary CLOB/NCLOB/LONG are actually strings, so treat them as such. Task-number: QTBUG-4461 Reviewed-by: Justin McPherson --- src/sql/drivers/oci/qsql_oci.cpp | 4 ++-- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index f130087..a384ba0 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -517,7 +517,7 @@ QVariant::Type qDecodeOCIType(const QString& ocitype, QSql::NumericalPrecisionPo } else if (ocitype == QLatin1String("LONG") || ocitype == QLatin1String("NCLOB") || ocitype == QLatin1String("CLOB")) - type = QVariant::ByteArray; + type = QVariant::String; else if (ocitype == QLatin1String("RAW") || ocitype == QLatin1String("LONG RAW") || ocitype == QLatin1String("ROWID") || ocitype == QLatin1String("BLOB") || ocitype == QLatin1String("CFILE") || ocitype == QLatin1String("BFILE")) @@ -543,6 +543,7 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis case SQLT_AVC: case SQLT_RDD: case SQLT_LNG: + case SQLT_CLOB: #ifdef SQLT_INTERVAL_YM case SQLT_INTERVAL_YM: #endif @@ -584,7 +585,6 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis case SQLT_NTY: case SQLT_REF: case SQLT_RID: - case SQLT_CLOB: type = QVariant::ByteArray; break; case SQLT_DAT: diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index cb4e103..4f89708 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -942,9 +942,9 @@ void tst_QSqlDatabase::recordOCI() FieldDef("raw(2000)", QVariant::ByteArray, QByteArray(Q3CString("blah6")), false), FieldDef("blob", QVariant::ByteArray, QByteArray(Q3CString("blah7"))), #endif -//FIXME FieldDef("clob", QVariant::CString, Q3CString("blah8")), -//FIXME FieldDef("nclob", QVariant::CString, Q3CString("blah9")), -//X FieldDef("bfile", QVariant::ByteArray, QByteArray(Q3CString("blah10"))), + FieldDef("clob", QVariant::String, QString("blah8")), + FieldDef("nclob", QVariant::String, QString("blah9")), + FieldDef("bfile", QVariant::ByteArray, QByteArray("blah10")), intytm, intdts, -- cgit v0.12 From cc5ae2db39bd5cb5e7710b1b7ce1b5c92b705450 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 17 Dec 2009 14:54:05 +1000 Subject: Update FBO docs to describe how QPainter changes the GL state Using a QPainter on a QGLFramebufferObject will not return the GL context to its original conditions, especially with the OpenGL2 paint engine. Update the docs to make this clearer. Task-number: QTBUG-6712 Reviewed-by: Daniel Pope --- src/opengl/qglframebufferobject.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index d0297c9..4b5c30a 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -597,6 +597,12 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, the constructors that take a QGLFramebufferObject parameter, and set the QGLFramebufferObject::samples() property to a non-zero value. + When painting to a QGLFramebufferObject using QPainter, the state of + the current GL context will be altered by the paint engine to reflect + its needs. Applications should not rely upon the GL state being reset + to its original conditions, particularly the current shader program, + GL viewport, texture units, and drawing modes. + For multisample framebuffer objects a color render buffer is created, otherwise a texture with the specified texture target is created. The color render buffer or texture will have the specified internal -- cgit v0.12 From 91cc7d1dabfd5f42db45bedefad78a63e63c4dc8 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 17 Dec 2009 10:13:21 +0100 Subject: Fixed parsing of svg paths. Commit 928ee705 introduced a bug which affected paths with relative offsets. Task-number: QTBUG-6867 Reviewed-by: Trond --- src/svg/qsvghandler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index b2619bf..ac220bd 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -1578,8 +1578,8 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) count--; break; } - x = x0 = num[0] + offsetX; - y = y0 = num[1] + offsetY; + x = num[0] + offsetX; + y = num[1] + offsetY; num += 2; count -= 2; path.lineTo(x, y); @@ -1592,8 +1592,8 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path) count--; break; } - x = x0 = num[0]; - y = y0 = num[1]; + x = num[0]; + y = num[1]; num += 2; count -= 2; path.lineTo(x, y); -- cgit v0.12 From bc01bb10da23d0d2308cf02a16947be836bc9a21 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 17 Dec 2009 10:20:46 +0100 Subject: Avoid timer starvation when handling many X11 events After commit d0d0fdb8e46351b4ab8492de31e5363ef6662b57, timers are normally run at idle priority. This makes it possible for the X11 handler to starve timers indefinitely. Fix this by enforcing one normal priority pass of the timer source after we have processed all X11 events. This has the added benefit of keeping animation timers smooth and consistent, which is the intention of this change. Reviewed-by: Jens Bache-Wiig --- src/corelib/kernel/qeventdispatcher_glib.cpp | 5 +++++ src/corelib/kernel/qeventdispatcher_glib_p.h | 2 ++ src/gui/kernel/qguieventdispatcher_glib.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 665b73e..16871c3 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -341,6 +341,11 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) g_source_attach(&idleTimerSource->source, mainContext); } +void QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority() +{ + timerSource->runWithIdlePriority = false; +} + QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent) : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate), parent) { diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h index 6a4e726..57cbf94 100644 --- a/src/corelib/kernel/qeventdispatcher_glib_p.h +++ b/src/corelib/kernel/qeventdispatcher_glib_p.h @@ -110,6 +110,8 @@ public: GSocketNotifierSource *socketNotifierSource; GTimerSource *timerSource; GIdleTimerSource *idleTimerSource; + + void runTimersOnceWithNormalPriority(); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/gui/kernel/qguieventdispatcher_glib.cpp index f8a638c..a252499 100644 --- a/src/gui/kernel/qguieventdispatcher_glib.cpp +++ b/src/gui/kernel/qguieventdispatcher_glib.cpp @@ -152,6 +152,8 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe out: + source->d->runTimersOnceWithNormalPriority(); + if (callback) callback(user_data); return true; -- cgit v0.12 From 274afe71968739b3387d0250baa59845e912e0c0 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 17 Dec 2009 10:20:03 +0100 Subject: Stack overflow when closing a Color panel in Cocoa. The QCocoaColorPanelDelegate was going into an infinite recrusion in this particular case. The patch guards the delegate from calling accept() or reject() more than once. Task-number: QTBUG-6636 Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qcolordialog_mac.mm | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 53d2e1e..5753954 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -79,6 +79,7 @@ QT_USE_NAMESPACE BOOL mHackedPanel; NSInteger mResultCode; BOOL mDialogIsExecuting; + BOOL mResultSet; } - (id)initWithColorPanel:(NSColorPanel *)panel stolenContentView:(NSView *)stolenContentView @@ -116,6 +117,7 @@ QT_USE_NAMESPACE mHackedPanel = (okButton != 0); mResultCode = NSCancelButton; mDialogIsExecuting = false; + mResultSet = false; if (mHackedPanel) { [self relayout]; @@ -159,11 +161,13 @@ QT_USE_NAMESPACE - (BOOL)windowShouldClose:(id)window { Q_UNUSED(window); - if (mHackedPanel) { - [self onCancelClicked]; - } else { + if (!mHackedPanel) [self updateQtColor]; + if (mDialogIsExecuting) { [self finishOffWithCode:NSCancelButton]; + } else { + mResultSet = true; + mPriv->colorDialog()->reject(); } return true; } @@ -240,11 +244,12 @@ QT_USE_NAMESPACE - (void)onCancelClicked { - Q_ASSERT(mHackedPanel); - [[mStolenContentView window] close]; - delete mQtColor; - mQtColor = new QColor(); - [self finishOffWithCode:NSCancelButton]; + if (mHackedPanel) { + [[mStolenContentView window] close]; + delete mQtColor; + mQtColor = new QColor(); + [self finishOffWithCode:NSCancelButton]; + } } - (void)updateQtColor @@ -306,10 +311,16 @@ QT_USE_NAMESPACE } else { // Since we are not in a modal event loop, we can safely close // down QColorDialog - if (mResultCode == NSCancelButton) - mPriv->colorDialog()->reject(); - else - mPriv->colorDialog()->accept(); + // Calling accept() or reject() can in turn call closeCocoaColorPanel. + // This check will prevent any such recursion. + if (!mResultSet) { + mResultSet = true; + if (mResultCode == NSCancelButton) { + mPriv->colorDialog()->reject(); + } else { + mPriv->colorDialog()->accept(); + } + } } } -- cgit v0.12 From ea8d13b61097ec295721b1e6f2bf614d12253c8c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 17 Dec 2009 13:17:21 +0100 Subject: doc: Added discussion on connecting signals that have default arg values. Task-number: QTBUG-3913 --- doc/src/objectmodel/signalsandslots.qdoc | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc index 9515904..d5e3280 100644 --- a/doc/src/objectmodel/signalsandslots.qdoc +++ b/doc/src/objectmodel/signalsandslots.qdoc @@ -376,6 +376,45 @@ Some irrelevant member functions have been omitted from this example. + \section1 Signals And Slots With Default Arguments + + The signatures of signals and slots may contain arguments, and the + arguments can have defualt values. Consider QObject::destroyed(): + + \code + void destroyed(QObject* = 0); + \endcode + + When a QObject is deleted, it emits this QObject::destroyed() + signal. We want to catch this signal, wherever we might have a + dangling reference to the deleted QObject, so we can clean it up. + A suitable slot signature might be: + + \code + void objectDestroyed(QObject* obj = 0); + \endcode + + To connect the signal to the slot, we use QObject::connect() and + the \c{SIGNAL()} and \c{SLOT()} macros. The rule about whether to + include arguments or not in the \c{SIGNAL()} and \c{SLOT()} + macros, if the arguments have default values, is that the + signature passed to the \c{SIGNAL()} macro must \e not have fewer + arguments than the signature passed to the \c{SLOT()} macro. + + All of these would work: + \code + connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(Qbject*))); + connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed())); + connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed())); + \endcode + But this one won't work: + \code + connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed(QObject*))); + \endcode + + ...because the slot will be expecting a QObject that the signal + will not send. This connection will report a runtime error. + \section1 Advanced Signals and Slots Usage For cases where you may require information on the sender of the -- cgit v0.12 From 124a77d258346d8d1bbffa7c42249d09433bc18f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 17 Dec 2009 15:10:55 +0200 Subject: Fixed QCoeFepInputContext::widgetDestroyed Calling SetFocus twice here was obsolete and caused intermittent panics. Replaced them with proper queueInputCapabilitiesChanged call. Task-number: QTBUG-6519 Reviewed-by: axis --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index a295d66..1bf7662 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -139,8 +139,7 @@ void QCoeFepInputContext::widgetDestroyed(QWidget *w) // Make sure that the input capabilities of whatever new widget got focused are queried. CCoeControl *ctrl = w->effectiveWinId(); if (ctrl->IsFocused()) { - ctrl->SetFocus(false); - ctrl->SetFocus(true); + queueInputCapabilitiesChanged(); } } -- cgit v0.12 From 05d1efb5322651cbe227c9fd6ac200cfff423a91 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 17 Dec 2009 15:33:04 +0200 Subject: WeatherInfo now shows Oslo info upon launch instead of blank screen Task-number: QTBUG-6367 Reviewed-by: Janne Anttila --- demos/embedded/weatherinfo/weatherinfo.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/demos/embedded/weatherinfo/weatherinfo.cpp b/demos/embedded/weatherinfo/weatherinfo.cpp index 842f05b..3b78a5f 100644 --- a/demos/embedded/weatherinfo/weatherinfo.cpp +++ b/demos/embedded/weatherinfo/weatherinfo.cpp @@ -105,9 +105,8 @@ private slots: void delayedInit() { #if defined(Q_OS_SYMBIAN) qt_SetDefaultIap(); -#else - request("Oslo"); #endif + request("Oslo"); } private slots: -- cgit v0.12 From c74d9d92f0d9c372de71ccf865edffae92a92d98 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 17 Dec 2009 14:45:04 +0100 Subject: Doc: fix typo Fixes: QTBUG-6539 --- src/network/access/qnetworkreply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 9ab4057..e6ca367 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -171,7 +171,7 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() \value UnknownProxyError an unknown proxy-related error was detected - \value UnknownContentError an unknonwn error related to + \value UnknownContentError an unknown error related to the remote content was detected \value ProtocolFailure a breakdown in protocol was -- cgit v0.12 From face84c73a2196432020dda18755af7955d2de39 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 16 Dec 2009 14:10:36 +0100 Subject: Change QHostInfo to use 5 parallel lookup threads Instead of sequentially looking up and potentially taking a long time, we now do work in parallel. Reviewed-by: ogoffart Reviewed-by: lars --- src/network/kernel/qhostinfo.cpp | 297 ++++++++++++++++++++++----------- src/network/kernel/qhostinfo_p.h | 148 ++++++---------- src/network/kernel/qhostinfo_win.cpp | 6 +- tests/auto/qhostinfo/tst_qhostinfo.cpp | 49 +++++- 4 files changed, 305 insertions(+), 195 deletions(-) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 98a39cd..e77a425 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -60,11 +60,9 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QHostInfoAgent, theAgent) -void QHostInfoAgent::staticCleanup() -{ - theAgent()->cleanup(); -} +#ifndef QT_NO_THREAD +Q_GLOBAL_STATIC(QHostInfoLookupManager, theHostInfoLookupManager) +#endif //#define QHOSTINFO_DEBUG @@ -143,6 +141,9 @@ static QBasicAtomicInt theIdCounter = Q_BASIC_ATOMIC_INITIALIZER(1); \snippet doc/src/snippets/code/src_network_kernel_qhostinfo.cpp 4 + \note There is no guarantee on the order the signals will be emitted + if you start multiple requests with lookupHost(). + \sa abortHostLookup(), addresses(), error(), fromName() */ int QHostInfo::lookupHost(const QString &name, QObject *receiver, @@ -159,38 +160,32 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver, qRegisterMetaType("QHostInfo"); -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) - QWindowsSockInit bust; // makes sure WSAStartup was callled -#endif - - QScopedPointer result(new QHostInfoResult); - result.data()->autoDelete = false; - QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)), - receiver, member); - int id = result.data()->lookupId = theIdCounter.fetchAndAddRelaxed(1); + int id = theIdCounter.fetchAndAddRelaxed(1); // generate unique ID if (name.isEmpty()) { - QHostInfo info(id); - info.setError(QHostInfo::HostNotFound); - info.setErrorString(QObject::tr("No host name given")); - QMetaObject::invokeMethod(result.data(), "emitResultsReady", Qt::QueuedConnection, - Q_ARG(QHostInfo, info)); - result.take()->autoDelete = true; + QHostInfo hostInfo(id); + hostInfo.setError(QHostInfo::HostNotFound); + hostInfo.setErrorString(QObject::tr("No host name given")); + QScopedPointer result(new QHostInfoResult); + QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)), + receiver, member, Qt::QueuedConnection); + result.data()->emitResultsReady(hostInfo); return id; } - QHostInfoAgent *agent = theAgent(); - agent->addHostName(name, result.take()); - -#if !defined QT_NO_THREAD - if (!agent->isRunning()) - agent->start(); +#ifdef QT_NO_THREAD + QHostInfo hostInfo = QHostInfoAgent::fromName(name); + hostInfo.setLookupId(id); + QScopedPointer result(new QHostInfoResult); + QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)), + receiver, member, Qt::QueuedConnection); + result.data()->emitResultsReady(hostInfo); #else -// if (!agent->isRunning()) - agent->run(); -// else -// agent->wakeOne(); + QHostInfoRunnable* runnable = new QHostInfoRunnable(name, id); + QObject::connect(&runnable->resultEmitter, SIGNAL(resultsReady(QHostInfo)), receiver, member, Qt::QueuedConnection); + theHostInfoLookupManager()->scheduleLookup(runnable); #endif + return id; } @@ -201,8 +196,12 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver, */ void QHostInfo::abortHostLookup(int id) { - QHostInfoAgent *agent = theAgent(); - agent->abortLookup(id); +#ifndef QT_NO_THREAD + theHostInfoLookupManager()->abortLookup(id); +#else + // we cannot abort if it was non threaded.. the result signal has already been posted + Q_UNUSED(id); +#endif } /*! @@ -228,70 +227,6 @@ QHostInfo QHostInfo::fromName(const QString &name) } /*! - \internal - Pops a query off the queries list, performs a blocking call to - QHostInfoAgent::lookupHost(), and emits the resultsReady() - signal. This process repeats until the queries list is empty. -*/ -void QHostInfoAgent::run() -{ -#ifndef QT_NO_THREAD - // Dont' allow thread termination during event delivery, but allow it - // during the actual blocking host lookup stage. - setTerminationEnabled(false); - forever -#endif - { - QHostInfoQuery *query; - { -#ifndef QT_NO_THREAD - // the queries list is shared between threads. lock all - // access to it. - QMutexLocker locker(&mutex); - if (!quit && queries.isEmpty()) - cond.wait(&mutex); - if (quit) { - // Reset the quit variable in case QCoreApplication is - // destroyed and recreated. - quit = false; - break; - } - if (queries.isEmpty()) - continue; -#else - if (queries.isEmpty()) - return; -#endif - query = queries.takeFirst(); - pendingQueryId = query->object->lookupId; - } - -#if defined(QHOSTINFO_DEBUG) - qDebug("QHostInfoAgent::run(%p): looking up \"%s\"", this, - query->hostName.toLatin1().constData()); -#endif - -#ifndef QT_NO_THREAD - // Start query - allow termination at this point, but not outside. We - // don't want to all termination during event delivery, but we don't - // want the lookup to prevent the app from quitting (the agent - // destructor terminates the thread). - setTerminationEnabled(true); -#endif - QHostInfo info = fromName(query->hostName); -#ifndef QT_NO_THREAD - setTerminationEnabled(false); -#endif - - int id = query->object->lookupId; - info.setLookupId(id); - if (pendingQueryId == id) - query->object->emitResultsReady(info); - delete query; - } -} - -/*! \enum QHostInfo::HostInfoError This enum describes the various errors that can occur when trying @@ -467,4 +402,174 @@ void QHostInfo::setErrorString(const QString &str) \sa hostName() */ +#ifndef QT_NO_THREAD +QHostInfoRunnable::QHostInfoRunnable(QString hn, int i) : toBeLookedUp(hn), id(i) +{ + setAutoDelete(true); +} + +// the QHostInfoLookupManager will at some point call this via a QThreadPool +void QHostInfoRunnable::run() +{ + QHostInfoLookupManager *manager = theHostInfoLookupManager(); + // check aborted + if (manager->wasAborted(id)) { + manager->lookupFinished(this); + return; + } + + // check cache + // FIXME + + // if not in cache: OS lookup + QHostInfo hostInfo = QHostInfoAgent::fromName(toBeLookedUp); + + // save to cache + // FIXME + + // check aborted again + if (manager->wasAborted(id)) { + manager->lookupFinished(this); + return; + } + + // signal emission + hostInfo.setLookupId(id); + resultEmitter.emitResultsReady(hostInfo); + + manager->lookupFinished(this); + + // thread goes back to QThreadPool +} + +QHostInfoLookupManager::QHostInfoLookupManager() : mutex(QMutex::Recursive), wasDeleted(false) +{ + moveToThread(QCoreApplicationPrivate::mainThread()); + threadPool.setMaxThreadCount(5); // do 5 DNS lookups in parallel +} + +QHostInfoLookupManager::~QHostInfoLookupManager() +{ + wasDeleted = true; +} + +void QHostInfoLookupManager::work() +{ + if (wasDeleted) + return; + + // goals of this function: + // - launch new lookups via the thread pool + // - make sure only one lookup per host/IP is in progress + + QMutexLocker locker(&mutex); + + if (!finishedLookups.isEmpty()) { + // remove ID from aborted if it is in there + for (int i = 0; i < finishedLookups.length(); i++) { + abortedLookups.removeAll(finishedLookups.at(i)->id); + } + + finishedLookups.clear(); + } + + if (!postponedLookups.isEmpty()) { + // try to start the postponed ones + + QMutableListIterator iterator(postponedLookups); + while (iterator.hasNext()) { + QHostInfoRunnable* postponed = iterator.next(); + + // check if none of the postponed hostnames is currently running + bool alreadyRunning = false; + for (int i = 0; i < currentLookups.length(); i++) { + if (currentLookups.at(i)->toBeLookedUp == postponed->toBeLookedUp) { + alreadyRunning = true; + break; + } + } + if (!alreadyRunning) { + iterator.remove(); + scheduledLookups.prepend(postponed); // prepend! we want to finish it ASAP + } + } + } + + if (!scheduledLookups.isEmpty()) { + // try to start the new ones + QMutableListIterator iterator(scheduledLookups); + while (iterator.hasNext()) { + QHostInfoRunnable *scheduled = iterator.next(); + + // check if a lookup for this host is already running, then postpone + for (int i = 0; i < currentLookups.size(); i++) { + if (currentLookups.at(i)->toBeLookedUp == scheduled->toBeLookedUp) { + iterator.remove(); + postponedLookups.append(scheduled); + scheduled = 0; + break; + } + } + + if (scheduled && threadPool.tryStart(scheduled)) { + // runnable now running in new thread, track this in currentLookups + iterator.remove(); + currentLookups.append(scheduled); + } else if (scheduled) { + // wanted to start, but could not because thread pool is busy + break; + } else { + // was postponed, continue iterating + continue; + } + }; + } +} + +// called by QHostInfo +void QHostInfoLookupManager::scheduleLookup(QHostInfoRunnable *r) +{ + if (wasDeleted) + return; + + QMutexLocker locker(&this->mutex); + scheduledLookups.enqueue(r); + work(); +} + +// called by QHostInfo +void QHostInfoLookupManager::abortLookup(int id) +{ + if (wasDeleted) + return; + + QMutexLocker locker(&this->mutex); + if (!abortedLookups.contains(id)) + abortedLookups.append(id); +} + +// called from QHostInfoRunnable +bool QHostInfoLookupManager::wasAborted(int id) +{ + if (wasDeleted) + return true; + + QMutexLocker locker(&this->mutex); + return abortedLookups.contains(id); +} + +// called from QHostInfoRunnable +void QHostInfoLookupManager::lookupFinished(QHostInfoRunnable *r) +{ + if (wasDeleted) + return; + + QMutexLocker locker(&this->mutex); + currentLookups.removeOne(r); + finishedLookups.append(r); + work(); +} + +#endif // QT_NO_THREAD + QT_END_NAMESPACE diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index afd3570..643bb73 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -61,17 +61,17 @@ #include "QtCore/qobject.h" #include "QtCore/qpointer.h" -#if !defined QT_NO_THREAD +#ifndef QT_NO_THREAD #include "QtCore/qthread.h" -# define QHostInfoAgentBase QThread -#else -# define QHostInfoAgentBase QObject +#include "QtCore/qthreadpool.h" +#include "QtCore/qmutex.h" +#include "QtCore/qrunnable.h" +#include "QtCore/qlist.h" +#include "QtCore/qqueue.h" #endif QT_BEGIN_NAMESPACE -static const int QHOSTINFO_THREAD_WAIT = 250; // ms - class QHostInfoResult : public QObject { Q_OBJECT @@ -79,102 +79,18 @@ public Q_SLOTS: inline void emitResultsReady(const QHostInfo &info) { emit resultsReady(info); - if (autoDelete) - delete this; } Q_SIGNALS: - void resultsReady(const QHostInfo &info); - -public: - int lookupId; - bool autoDelete; + void resultsReady(const QHostInfo info); }; -struct QHostInfoQuery -{ - inline QHostInfoQuery() : object(0) {} - inline ~QHostInfoQuery() { delete object; } - inline QHostInfoQuery(const QString &name, QHostInfoResult *result) - : hostName(name), object(result) {} - - QString hostName; - QHostInfoResult *object; -}; - -class QHostInfoAgent : public QHostInfoAgentBase +// needs to be QObject because fromName calls tr() +class QHostInfoAgent : public QObject { Q_OBJECT public: - inline QHostInfoAgent() - { - // There is a chance that there will be two instances of - // QHostInfoAgent if two threads try to get Q_GLOBAL_STATIC - // object at the same time. The second object will be deleted - // immediately before anyone uses it, but we need to be - // careful about what we do in the constructor. - static QBasicAtomicInt done = Q_BASIC_ATOMIC_INITIALIZER(0); - if (done.testAndSetRelaxed(0, 1)) - qAddPostRoutine(staticCleanup); - moveToThread(QCoreApplicationPrivate::mainThread()); - quit = false; - pendingQueryId = -1; - } - inline ~QHostInfoAgent() - { cleanup(); } - - void run(); static QHostInfo fromName(const QString &hostName); - - inline void addHostName(const QString &name, QHostInfoResult *result) - { - QMutexLocker locker(&mutex); - queries << new QHostInfoQuery(name, result); - cond.wakeOne(); - } - - inline void abortLookup(int id) - { - QMutexLocker locker(&mutex); - for (int i = 0; i < queries.size(); ++i) { - QHostInfoResult *result = queries.at(i)->object; - if (result->lookupId == id) { - result->disconnect(); - delete queries.takeAt(i); - return; - } - } - if (pendingQueryId == id) - pendingQueryId = -1; - } - - static void staticCleanup(); - -public Q_SLOTS: - inline void cleanup() - { - { - QMutexLocker locker(&mutex); - qDeleteAll(queries); - queries.clear(); - quit = true; - cond.wakeOne(); - } -#ifndef QT_NO_THREAD - if (!wait(QHOSTINFO_THREAD_WAIT)) { - terminate(); - // Don't wait forever; see QTBUG-5296. - wait(QHOSTINFO_THREAD_WAIT); - } -#endif - } - -private: - QList queries; - QMutex mutex; - QWaitCondition cond; - volatile bool quit; - int pendingQueryId; }; class QHostInfoPrivate @@ -194,6 +110,52 @@ public: int lookupId; }; +#ifndef QT_NO_THREAD +// the following classes are used for the (normal) case: We use multiple threads to lookup DNS + +class QHostInfoRunnable : public QRunnable +{ +public: + QHostInfoRunnable (QString hn, int i); + void run(); + + QString toBeLookedUp; + int id; + QHostInfoResult resultEmitter; +}; + +class QHostInfoLookupManager : public QObject +{ + Q_OBJECT +public: + QHostInfoLookupManager(); + ~QHostInfoLookupManager(); + + void work(); + + // called from QHostInfo + void scheduleLookup(QHostInfoRunnable *r); + void abortLookup(int id); + + // called from QHostInfoRunnable + void lookupFinished(QHostInfoRunnable *r); + bool wasAborted(int id); + +protected: + QList currentLookups; // in progress + QList postponedLookups; // postponed because in progress for same host + QQueue scheduledLookups; // not yet started + QList finishedLookups; // recently finished + QList abortedLookups; // ids of aborted lookups + + QThreadPool threadPool; + + QMutex mutex; + + bool wasDeleted; +}; +#endif + QT_END_NAMESPACE #endif // QHOSTINFO_P_H diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index 720aaa5..727a8b0 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -105,11 +105,7 @@ static void resolveLibrary() #include QMutex qPrivCEMutex; #endif -/* - Performs a blocking call to gethostbyname or getaddrinfo, stores - the results in a QHostInfo structure and emits the - resultsReady() signal. -*/ + QHostInfo QHostInfoAgent::fromName(const QString &hostName) { #if defined(Q_OS_WINCE) diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index 4d63e10..348c41b 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -88,6 +88,7 @@ #endif #include "../network-settings.h" +#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= @@ -124,6 +125,9 @@ private slots: void raceCondition(); void threadSafety(); + void multipleSameLookups(); + void multipleDifferentLookups(); + protected slots: void resultsReady(const QHostInfo &); @@ -131,6 +135,7 @@ private: bool ipv6LookupsAvailable; bool ipv6Available; bool lookupDone; + int lookupsDoneCounter; QHostInfo lookupResults; }; @@ -411,11 +416,53 @@ void tst_QHostInfo::threadSafety() } } +// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all, +// not about getting correct IPs +void tst_QHostInfo::multipleSameLookups() +{ + const int COUNT = 10; + lookupsDoneCounter = 0; + + for (int i = 0; i < COUNT; i++) + QHostInfo::lookupHost("localhost", this, SLOT(resultsReady(const QHostInfo))); + + QTRY_VERIFY(lookupsDoneCounter == COUNT); + + // spin two seconds more to see if it is not more :) + QTestEventLoop::instance().enterLoop(2); + QTRY_VERIFY(lookupsDoneCounter == COUNT); +} + +// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all, +// not about getting correct IPs +void tst_QHostInfo::multipleDifferentLookups() +{ + QStringList hostnameList; + hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no" + << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com" + << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----"; + + const int COUNT = hostnameList.size(); + lookupsDoneCounter = 0; + + for (int i = 0; i < hostnameList.size(); i++) + QHostInfo::lookupHost(hostnameList.at(i), this, SLOT(resultsReady(const QHostInfo))); + + // give some time + QTestEventLoop::instance().enterLoop(5); + // try_verify gives some more time + QTRY_VERIFY(lookupsDoneCounter == COUNT); + + // spin two seconds more to see if it is not more than expected + QTestEventLoop::instance().enterLoop(2); + QTRY_VERIFY(lookupsDoneCounter == COUNT); +} + void tst_QHostInfo::resultsReady(const QHostInfo &hi) { lookupDone = true; lookupResults = hi; - + lookupsDoneCounter++; QTestEventLoop::instance().exitLoop(); } -- cgit v0.12 From d64c29e18cedace91bea31d83b62e5c0b6c6049e Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 17 Dec 2009 15:11:42 +0100 Subject: Fixed QResource to respect the explicitely set locale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using QResource directly, the loader should respect the locale that the user asked to use for the resource. Reviewed-by: João Abecasis --- src/corelib/io/qresource.cpp | 2 +- tests/auto/qresourceengine/tst_qresourceengine.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 5c543d4..a061ad1 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -273,7 +273,7 @@ QResourcePrivate::load(const QString &file) QString cleaned = cleanPath(file); for(int i = 0; i < list->size(); ++i) { QResourceRoot *res = list->at(i); - const int node = res->findNode(cleaned); + const int node = res->findNode(cleaned, locale); if(node != -1) { if(related.isEmpty()) { container = res->isContainer(node); diff --git a/tests/auto/qresourceengine/tst_qresourceengine.cpp b/tests/auto/qresourceengine/tst_qresourceengine.cpp index cc6eda3..ed7de23 100644 --- a/tests/auto/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp @@ -62,6 +62,7 @@ private slots: void searchPath_data(); void searchPath(); void doubleSlashInRoot(); + void setLocale(); private: QString builddir; @@ -460,6 +461,27 @@ void tst_QResourceEngine::doubleSlashInRoot() QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt")); } +void tst_QResourceEngine::setLocale() +{ + QLocale::setDefault(QLocale::c()); + + // default constructed QResource gets the default locale + QResource resource; + resource.setFileName("aliasdir/aliasdir.txt"); + QVERIFY(!resource.isCompressed()); + + // change the default locale and make sure it doesn't affect the resource + QLocale::setDefault(QLocale("de_CH")); + QVERIFY(!resource.isCompressed()); + + // then explicitly set the locale on qresource + resource.setLocale(QLocale("de_CH")); + QVERIFY(resource.isCompressed()); + + // the reset the default locale back + QLocale::setDefault(QLocale::system()); +} + QTEST_MAIN(tst_QResourceEngine) #include "tst_qresourceengine.moc" -- cgit v0.12 From 371420d5f31a04b91c01807139d49e97db040bee Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 18 Dec 2009 10:06:20 +0100 Subject: doc: Fixed typos. Task-number: QTBUG-6898 --- doc/src/qt4-intro.qdoc | 2 +- src/activeqt/container/qaxbase.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index fb1d0e4..a90544f 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -549,7 +549,7 @@ the state machine, it is also easier to use the framework for animating GUIs, for instance. - See \l{The State Machine Framework} documentation for more infromation. + See \l{The State Machine Framework} documentation for more information. \section1 Multi-Touch and Gestures diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 3795f56..ed7ac29 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -909,7 +909,7 @@ QAxMetaObject *QAxBase::internalMetaObject() const \property QAxBase::control \brief the name of the COM object wrapped by this QAxBase object. - Setting this property initilializes the COM object. Any COM object + Setting this property initializes the COM object. Any COM object previously set is shut down. The most efficient way to set this property is by using the -- cgit v0.12 From 03f28cfc174dbad3d9531b29b6dfed9983ea5d73 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 18 Dec 2009 13:42:35 +0100 Subject: Improve the performance of the Anomaly browser demo Some minor changes to improve the demo: -use QUrl::fromUserInput() -scroll a surface instead of moving the widgets to minimize the repaint -use the animation framework instead of QTimeLine --- demos/embedded/anomaly/src/BrowserWindow.cpp | 146 ++++++++++++--------------- demos/embedded/anomaly/src/BrowserWindow.h | 12 ++- 2 files changed, 70 insertions(+), 88 deletions(-) diff --git a/demos/embedded/anomaly/src/BrowserWindow.cpp b/demos/embedded/anomaly/src/BrowserWindow.cpp index 1036735..1163b6a 100644 --- a/demos/embedded/anomaly/src/BrowserWindow.cpp +++ b/demos/embedded/anomaly/src/BrowserWindow.cpp @@ -43,92 +43,44 @@ #include #include +#include +#include #include "BrowserView.h" #include "HomeView.h" BrowserWindow::BrowserWindow() - : QWidget() - , m_homeView(0) - , m_browserView(0) + : m_slidingSurface(new QWidget(this)) + , m_homeView(new HomeView(m_slidingSurface)) + , m_browserView(new BrowserView(m_slidingSurface)) + , m_animation(new QPropertyAnimation(this, "slideValue")) { - m_timeLine = new QTimeLine(300, this); - m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve); - QTimer::singleShot(0, this, SLOT(initialize())); -} - -void BrowserWindow::initialize() -{ - m_homeView = new HomeView(this); - m_browserView = new BrowserView(this); + m_slidingSurface->setAutoFillBackground(true); - m_homeView->hide(); m_homeView->resize(size()); - m_homeView->move(0, 0); - m_browserView->hide(); m_browserView->resize(size()); - m_browserView->move(0, 0); connect(m_homeView, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString))); connect(m_homeView, SIGNAL(urlActivated(QUrl)), SLOT(navigate(QUrl))); connect(m_browserView, SIGNAL(menuButtonClicked()), SLOT(showHomeView())); - m_homeView->setVisible(false); - m_browserView->setVisible(false); - slide(0); + m_animation->setDuration(200); + connect(m_animation, SIGNAL(finished()), SLOT(animationFinished())); - connect(m_timeLine, SIGNAL(frameChanged(int)), SLOT(slide(int))); + setSlideValue(0.0f); } - -// from Demo Browser -QUrl guessUrlFromString(const QString &string) +void BrowserWindow::gotoAddress(const QString &address) { - QString urlStr = string.trimmed(); - QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); - - // Check if it looks like a qualified URL. Try parsing it and see. - bool hasSchema = test.exactMatch(urlStr); - if (hasSchema) { - QUrl url = QUrl::fromEncoded(urlStr.toUtf8(), QUrl::TolerantMode); - if (url.isValid()) - return url; - } - - // Might be a file. - if (QFile::exists(urlStr)) { - QFileInfo info(urlStr); - return QUrl::fromLocalFile(info.absoluteFilePath()); - } - - // Might be a shorturl - try to detect the schema. - if (!hasSchema) { - int dotIndex = urlStr.indexOf(QLatin1Char('.')); - if (dotIndex != -1) { - QString prefix = urlStr.left(dotIndex).toLower(); - QString schema = (prefix == QString("ftp")) ? prefix.toLatin1() : QString("http"); - QString location = schema + "://" + urlStr; - QUrl url = QUrl::fromEncoded(location.toUtf8(), QUrl::TolerantMode); - if (url.isValid()) - return url; - } - } - - // Fall back to QUrl's own tolerant parser. - QUrl url = QUrl::fromEncoded(string.toUtf8(), QUrl::TolerantMode); - - // finally for cases where the user just types in a hostname add http - if (url.scheme().isEmpty()) - url = QUrl::fromEncoded("http://" + string.toUtf8(), QUrl::TolerantMode); - return url; + m_browserView->navigate(QUrl::fromUserInput(address)); + showBrowserView(); } -void BrowserWindow::gotoAddress(const QString &address) +void BrowserWindow::animationFinished() { - m_browserView->navigate(guessUrlFromString(address)); - showBrowserView(); + m_animation->setDirection(QAbstractAnimation::Forward); } void BrowserWindow::navigate(const QUrl &url) @@ -137,31 +89,44 @@ void BrowserWindow::navigate(const QUrl &url) showBrowserView(); } -void BrowserWindow::slide(int pos) +void BrowserWindow::setSlideValue(qreal slideRatio) { - m_browserView->move(pos, 0); - m_homeView->move(pos - width(), 0); - m_browserView->show(); - m_homeView->show(); + // we use a ratio to handle resize corectly + const int pos = -qRound(slideRatio * width()); + m_slidingSurface->scroll(pos - m_homeView->x(), 0); + + if (qFuzzyCompare(slideRatio, static_cast(1.0f))) { + m_browserView->show(); + m_homeView->hide(); + } else if (qFuzzyCompare(slideRatio, static_cast(0.0f))) { + m_homeView->show(); + m_browserView->hide(); + } else { + m_browserView->show(); + m_homeView->show(); + } } -void BrowserWindow::showHomeView() +qreal BrowserWindow::slideValue() const { - if (m_timeLine->state() != QTimeLine::NotRunning) - return; + Q_ASSERT(m_slidingSurface->x() < width()); + return static_cast(qAbs(m_homeView->x())) / width(); +} - m_timeLine->setFrameRange(0, width()); - m_timeLine->start(); +void BrowserWindow::showHomeView() +{ + m_animation->setStartValue(slideValue()); + m_animation->setEndValue(0.0f); + m_animation->start(); m_homeView->setFocus(); } void BrowserWindow::showBrowserView() { - if (m_timeLine->state() != QTimeLine::NotRunning) - return; + m_animation->setStartValue(slideValue()); + m_animation->setEndValue(1.0f); + m_animation->start(); - m_timeLine->setFrameRange(width(), 0); - m_timeLine->start(); m_browserView->setFocus(); } @@ -170,18 +135,31 @@ void BrowserWindow::keyReleaseEvent(QKeyEvent *event) QWidget::keyReleaseEvent(event); if (event->key() == Qt::Key_F3) { - if (m_homeView->isVisible()) - showBrowserView(); - else + if (m_animation->state() == QAbstractAnimation::Running) { + const QAbstractAnimation::Direction direction = m_animation->direction() == QAbstractAnimation::Forward + ? QAbstractAnimation::Forward + : QAbstractAnimation::Backward; + m_animation->setDirection(direction); + } else if (qFuzzyCompare(slideValue(), static_cast(1.0f))) showHomeView(); + else + showBrowserView(); + event->accept(); } } void BrowserWindow::resizeEvent(QResizeEvent *event) { - if (m_homeView) - m_homeView->resize(size()); + const QSize newSize = event->size(); + m_slidingSurface->resize(newSize.width() * 2, newSize.height()); + + m_homeView->resize(newSize); + m_homeView->move(0, 0); + + m_browserView->resize(newSize); + m_browserView->move(newSize.width(), 0); - if (m_browserView) - m_browserView->resize(size()); + const QSize oldSize = event->oldSize(); + const qreal oldSlidingRatio = static_cast(qAbs(m_slidingSurface->x())) / oldSize.width(); + setSlideValue(oldSlidingRatio); } diff --git a/demos/embedded/anomaly/src/BrowserWindow.h b/demos/embedded/anomaly/src/BrowserWindow.h index 9647efb..2b77939 100644 --- a/demos/embedded/anomaly/src/BrowserWindow.h +++ b/demos/embedded/anomaly/src/BrowserWindow.h @@ -43,7 +43,7 @@ #define BROWSERWINDOW_H #include -class QTimeLine; +class QPropertyAnimation; class QUrl; class BrowserView; @@ -52,28 +52,32 @@ class HomeView; class BrowserWindow : public QWidget { Q_OBJECT + Q_PROPERTY(qreal slideValue READ slideValue WRITE setSlideValue) public: BrowserWindow(); private slots: - void initialize(); void navigate(const QUrl &url); void gotoAddress(const QString &address); + void animationFinished(); public slots: void showBrowserView(); void showHomeView(); - void slide(int); protected: void keyReleaseEvent(QKeyEvent *event); void resizeEvent(QResizeEvent *event); private: + void setSlideValue(qreal); + qreal slideValue() const; + + QWidget *m_slidingSurface; HomeView *m_homeView; BrowserView *m_browserView; - QTimeLine *m_timeLine; + QPropertyAnimation *m_animation; }; #endif // BROWSERWINDOW_H -- cgit v0.12 From 12e2c9075e694897ae52048c2069f57a22ef4031 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 18 Dec 2009 14:23:13 +0100 Subject: doc: Added a missing \sa command, plus a \l in the text. Task-number: QTBUG-6288 --- src/corelib/kernel/qobject.cpp | 15 ++++++++------- tools/qdoc3/cppcodeparser.cpp | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 4370ee0..305ec4f 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -578,12 +578,13 @@ int QMetaCallEvent::placeMetaCall(QObject *object) protected functions connectNotify() and disconnectNotify() make it possible to track connections. - QObjects organize themselves in object trees. When you create a - QObject with another object as parent, the object will - automatically add itself to the parent's children() list. The - parent takes ownership of the object; i.e., it will automatically - delete its children in its destructor. You can look for an object - by name and optionally type using findChild() or findChildren(). + QObjects organize themselves in \l {Object Trees and Object + Ownership} {object trees}. When you create a QObject with another + object as parent, the object will automatically add itself to the + parent's children() list. The parent takes ownership of the + object; i.e., it will automatically delete its children in its + destructor. You can look for an object by name and optionally type + using findChild() or findChildren(). Every object has an objectName() and its class name can be found via the corresponding metaObject() (see QMetaObject::className()). @@ -682,7 +683,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object) \l{Writing Source Code for Translation} document. \sa QMetaObject, QPointer, QObjectCleanupHandler, Q_DISABLE_COPY() - {Object Trees and Object Ownership} + \sa {Object Trees and Object Ownership} */ /*! diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 41a2456..9ec7fdf 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -2318,9 +2318,9 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) exampleFile.mid(sizeOfBoringPartOfName), Node::File); foreach (const QString &imageFile, imageFiles) { - FakeNode* newFake = new FakeNode(fake, - imageFile.mid(sizeOfBoringPartOfName), - Node::Image); + new FakeNode(fake, + imageFile.mid(sizeOfBoringPartOfName), + Node::Image); } } -- cgit v0.12