From 24071323009135108023698ef2f8b266f5437f5c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 22 Sep 2009 16:28:15 +0200 Subject: QJpegImageHandle: Avoid smooth scalling when it should not. Task-number: QTBUG-3211 Task-number: 236875 Reviewed-by: Alex --- src/plugins/imageformats/jpeg/qjpeghandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 5fcbb5f..3b23e56 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -895,7 +895,8 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, (void) jpeg_finish_decompress(&cinfo); } #ifndef QT_NO_IMAGE_SMOOTHSCALE - } else if (scaledSize.isValid()) { + } else if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height) + && quality >= HIGH_QUALITY_THRESHOLD) { jpegSmoothScaler scaler(&cinfo, QString().sprintf("Scale( %d, %d, ScaleFree )", scaledSize.width(), @@ -946,6 +947,9 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage, outImage->setDotsPerMeterX(int(100. * cinfo.X_density)); outImage->setDotsPerMeterY(int(100. * cinfo.Y_density)); } + + if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height)) + *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation); } } -- cgit v0.12 From e73d4d577410ce0724c818cd0d4a28b7ff7350bb Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 23 Sep 2009 10:01:37 +0200 Subject: Fix compilation errors in qcombobox autotest Dependency on windows style, without including the header file Needed static casts to compare QWidget* with QComboBox* at least for the Nokia x86 compiler. Reviewed-by: axis --- tests/auto/qcombobox/tst_qcombobox.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index b549af6..8dfe836 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -77,6 +77,9 @@ #include #include "../../shared/util.h" #include +#ifndef QT_NO_STYLE_WINDOWS +#include +#endif //TESTED_CLASS= //TESTED_FILES= @@ -2140,7 +2143,7 @@ void tst_QComboBox::task247863_keyBoardSelection() combo.addItem( QLatin1String("222")); combo.show(); QApplication::setActiveWindow(&combo); - QTRY_COMPARE(QApplication::activeWindow(), &combo); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&combo)); QSignalSpy spy(&combo, SIGNAL(activated(const QString &))); qApp->setEffectEnabled(Qt::UI_AnimateCombo, false); @@ -2161,7 +2164,7 @@ void tst_QComboBox::task220195_keyBoardSelection2() combo.addItem( QLatin1String("foo3")); combo.show(); QApplication::setActiveWindow(&combo); - QTRY_COMPARE(QApplication::activeWindow(), &combo); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&combo)); combo.setCurrentIndex(-1); QVERIFY(combo.currentText().isNull()); @@ -2353,6 +2356,9 @@ void tst_QComboBox::subControlRectsWithOffset() void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup() { +#ifdef QT_NO_STYLE_WINDOWS + QSKIP("test depends on windows style", QTest::SkipAll); +#else class TestStyle: public QWindowsStyle { public: @@ -2385,6 +2391,7 @@ void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup() QTRY_VERIFY(style.discoveredRect.width() <= comboBox.width()); } +#endif } QTEST_MAIN(tst_QComboBox) -- cgit v0.12 From d05b4b85ebdf520895faa1e360aa673b739866a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 23 Sep 2009 10:51:27 +0200 Subject: Added a comment to clarify the purpose of a piece of code. Reviewed-by: Trust Me --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 25f4184..9db1de8 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -297,7 +297,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) for (int y = 0; y < maskHeight; ++y) { uchar *src = (uchar *) mask.scanLine(y); for (int x = 0; x < maskWidth; ++x) - src[x] = -src[x]; + src[x] = -src[x]; // convert 0 and 1 into 0 and 255 } } -- cgit v0.12 From 4d7b6f75073eb2559cbc3e63db6743641539ac4e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Sep 2009 10:49:54 +0200 Subject: tests/auto/qaudiooutput deployment rules fixed for Windows CE Reviewed-by: TrustMe --- tests/auto/qaudiooutput/qaudiooutput.pro | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/auto/qaudiooutput/qaudiooutput.pro b/tests/auto/qaudiooutput/qaudiooutput.pro index 6c07c64..8657edb 100644 --- a/tests/auto/qaudiooutput/qaudiooutput.pro +++ b/tests/auto/qaudiooutput/qaudiooutput.pro @@ -1,12 +1,14 @@ load(qttest_p4) -DEFINES += SRCDIR=\\\"$$PWD/\\\" - SOURCES += tst_qaudiooutput.cpp QT = core multimedia -wince*: { - deploy.sources += 4.wav - DEPLOYMENT = deploy +wince* { + deploy.sources += 4.wav + DEPLOYMENT = deploy + DEFINES += SRCDIR=\\\"\\\" + QT += gui +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" } -- cgit v0.12 From 05647bc3a8d5085885dca398682b8b315bc79e6c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Sep 2009 10:52:35 +0200 Subject: tests/auto/qaudioinput deployment rules fixed for Windows CE Reviewed-by: TrustMe --- tests/auto/qaudioinput/qaudioinput.pro | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/auto/qaudioinput/qaudioinput.pro b/tests/auto/qaudioinput/qaudioinput.pro index 8a03749..f545a11 100644 --- a/tests/auto/qaudioinput/qaudioinput.pro +++ b/tests/auto/qaudioinput/qaudioinput.pro @@ -1,7 +1,15 @@ load(qttest_p4) -DEFINES += SRCDIR=\\\"$$PWD/\\\" - SOURCES += tst_qaudioinput.cpp QT = core multimedia + +wince* { + deploy.sources += 4.wav + DEPLOYMENT = deploy + DEFINES += SRCDIR=\\\"\\\" + QT += gui +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + -- cgit v0.12 From b3a9565c99c44cdf4d3236de211110382c7b908b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Sep 2009 10:53:36 +0200 Subject: more meaningful output in tst_QAudioOutput::pullFile Reviewed-by: TrustMe --- tests/auto/qaudiooutput/tst_qaudiooutput.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index 6356fb3..db2444b 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -117,37 +117,37 @@ void tst_QAudioOutput::notifyInterval() void tst_QAudioOutput::pullFile() { if(available) { - QFile filename(SRCDIR "4.wav"); - QVERIFY(filename.exists()); - filename.open(QIODevice::ReadOnly); + QFile file(SRCDIR "4.wav"); + QVERIFY(file.exists()); + file.open(QIODevice::ReadOnly); QSignalSpy readSignal(audio, SIGNAL(notify())); audio->setNotifyInterval(100); - audio->start(&filename); + audio->start(&file); QTestEventLoop::instance().enterLoop(1); + QCOMPARE(audio->totalTime(), qint64(692250)); // 4.wav is a little less than 700ms, so notify should fire 6 times! QVERIFY(readSignal.count() >= 6); - QVERIFY(audio->totalTime() == 692250); audio->stop(); - filename.close(); + file.close(); } } void tst_QAudioOutput::pushFile() { if(available) { - QFile filename(SRCDIR "4.wav"); - QVERIFY(filename.exists()); - filename.open(QIODevice::ReadOnly); + QFile file(SRCDIR "4.wav"); + QVERIFY(file.exists()); + file.open(QIODevice::ReadOnly); - const qint64 fileSize = filename.size(); + const qint64 fileSize = file.size(); QIODevice* feed = audio->start(0); char* buffer = new char[fileSize]; - filename.read(buffer, fileSize); + file.read(buffer, fileSize); qint64 counter=0; qint64 written=0; @@ -162,7 +162,7 @@ void tst_QAudioOutput::pushFile() QVERIFY(audio->totalTime() == 692250); audio->stop(); - filename.close(); + file.close(); delete [] buffer; delete audio; } -- cgit v0.12 From 0ab4d027de7ed6ae0c848499aacea8a23dc9042c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 23 Sep 2009 11:06:45 +0200 Subject: Small API addition: Make addChildLayoutItem available for subclasses. Many people have requested this. And since its protected it does not really pollute the API a lot. Task: QTBUG-3524 Reviewed-by: mbm --- src/gui/graphicsview/qgraphicslayout.cpp | 18 ++++++++++++++++++ src/gui/graphicsview/qgraphicslayout.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 0e4df71..f9800bc 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -419,6 +419,24 @@ void QGraphicsLayout::widgetEvent(QEvent *e) \sa itemAt(), count() */ +/*! + This function is a convenience function provided for custom layouts, and will go through + all items in the layout and reparent their graphics items to the closest QGraphicsWidget + ancestor of the layout. + + If \a layoutItem is already in a different layout, it will be removed from that layout. + + If custom layouts want special behaviour they can ignore to use this function, and implement + their own behaviour. + + \sa graphicsItem() + */ +void QGraphicsLayout::addChildLayoutItem(QGraphicsLayoutItem *layoutItem) +{ + Q_D(QGraphicsLayout); + d->addChildLayoutItem(layoutItem); +} + QT_END_NAMESPACE #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicslayout.h b/src/gui/graphicsview/qgraphicslayout.h index e872980..e214a62 100644 --- a/src/gui/graphicsview/qgraphicslayout.h +++ b/src/gui/graphicsview/qgraphicslayout.h @@ -78,6 +78,7 @@ public: protected: QGraphicsLayout(QGraphicsLayoutPrivate &, QGraphicsLayoutItem *); + void addChildLayoutItem(QGraphicsLayoutItem *layoutItem); private: Q_DISABLE_COPY(QGraphicsLayout) -- cgit v0.12 From 55cb8b6d1765d1446ae046a54d98aceeba9d9146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 23 Sep 2009 12:04:54 +0200 Subject: Fix autotest compilation --- tests/auto/q3table/tst_q3table.cpp | 2 +- tests/auto/qprogressbar/tst_qprogressbar.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp index 1fe4412..ca65852 100644 --- a/tests/auto/q3table/tst_q3table.cpp +++ b/tests/auto/q3table/tst_q3table.cpp @@ -1379,7 +1379,7 @@ void tst_Q3Table::dateTimeEdit() TimeTableItem *ti = new TimeTableItem(testWidget); testWidget->setItem(0, 0, ti); testWidget->show(); - QTest::qWaitForWindowShown(&testWidget); + QTest::qWaitForWindowShown(testWidget); #ifdef WAITS QTest::qWait(50); #endif diff --git a/tests/auto/qprogressbar/tst_qprogressbar.cpp b/tests/auto/qprogressbar/tst_qprogressbar.cpp index ea9798b..d86094d 100644 --- a/tests/auto/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/qprogressbar/tst_qprogressbar.cpp @@ -48,6 +48,8 @@ #include #include +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= -- cgit v0.12 From 77ac469063064a85cfec79fdc8d45cee0fa8e426 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 23 Sep 2009 13:39:40 +0300 Subject: Removed explicit TARGET.EPOCHEAPSIZE statements from script tests Large enough max heap for script tests is now defined by default for all tests in qttest_p4.prf, so removed the statements from individual script tests. Reviewed-by: Janne Anttila --- tests/auto/qscriptengine/qscriptengine.pro | 1 - tests/auto/qscriptextqobject/qscriptextqobject.pro | 4 ---- tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro | 10 ++++------ tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro | 2 -- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index f72c070..d4c0f4c 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -12,5 +12,4 @@ wince*|symbian*: { symbian: { TARGET.UID3 = 0xE0340006 DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) - TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" } diff --git a/tests/auto/qscriptextqobject/qscriptextqobject.pro b/tests/auto/qscriptextqobject/qscriptextqobject.pro index 9da7f47..140a4e6 100644 --- a/tests/auto/qscriptextqobject/qscriptextqobject.pro +++ b/tests/auto/qscriptextqobject/qscriptextqobject.pro @@ -1,7 +1,3 @@ load(qttest_p4) QT = core gui script SOURCES += tst_qscriptextqobject.cpp - -symbian: { - TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" -} diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro index 06b861e..07a4672 100644 --- a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro +++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro @@ -1,12 +1,10 @@ load(qttest_p4) QT = core script SOURCES += tst_qscriptjstestsuite.cpp -symbian { - TARGET.EPOCHEAPSIZE = 0x020000 0xA00000 -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} -wince*|symbian*: { + +!symbian: DEFINES += SRCDIR=\\\"$$PWD\\\" + +wince*|symbian: { testFiles.sources = tests testFiles.path = . DEPLOYMENT += testFiles diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro index 3f641b5..03e26bd 100644 --- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro +++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro @@ -8,5 +8,3 @@ testFiles.sources = tests testFiles.path = . DEPLOYMENT += testFiles } - -symbian:TARGET.EPOCHEAPSIZE = 0x00020000 0x02000000 -- cgit v0.12 From d1d65ed17d0f21e979a98ab695aa9e50c6ee078c Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 23 Sep 2009 12:50:12 +0200 Subject: Make gtkstyle work on non-developer machines again While refactoring gtkstyle in 4.6, the "0" .so suffix was dropped. This patch restores the 4.5 behavior to look for *.so.0 since the *.so is only available if you install the gtk developer packages. Reviewed-by: jbache --- src/gui/styles/gtksymbols.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index 23d25bd..1cb0ca4 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -211,7 +211,8 @@ static QString classPath(GtkWidget *widget) static void resolveGtk() { - QLibrary libgtk(QLS("gtk-x11-2.0")); + // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0 + QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0); QGtk::gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init"); QGtk::gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new"); QGtk::gtk_style_attach = (Ptr_gtk_style_attach)libgtk.resolve("gtk_style_attach"); -- cgit v0.12