From 8e276783918d25d05eee65fd9eb5510ebcfbecc4 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 17 Sep 2010 17:15:29 +0200 Subject: Added default value documentation for two variables. Reviewed-by: David Boddie: --- src/corelib/io/qtextstream.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index eab0662..6091ec0 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -3019,8 +3019,8 @@ void QTextStream::setAutoDetectUnicode(bool enabled) } /*! - Returns true if automatic Unicode detection is enabled; otherwise - returns false. + Returns true if automatic Unicode detection is enabled, otherwise + returns false. Automatic Unicode detection is enabled by default. \sa setAutoDetectUnicode(), setCodec() */ @@ -3051,7 +3051,8 @@ void QTextStream::setGenerateByteOrderMark(bool generate) /*! Returns true if QTextStream is set to generate the UTF BOM (Byte Order - Mark) when using a UTF codec; otherwise returns false. + Mark) when using a UTF codec; otherwise returns false. UTF BOM generation is + set to false by default. \sa setGenerateByteOrderMark() */ -- cgit v0.12 From f3a9990f6c46d596b9a53e0cca14c66d58b1dbe3 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Mon, 20 Sep 2010 10:38:09 +0200 Subject: Doc: Added info on QWidget::render to printing docs Task-number: QTBUG-2210 Reviewed-by: David Boddie --- doc/src/painting-and-printing/printing.qdoc | 11 ++++++ doc/src/snippets/widgetprinting.cpp | 54 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 doc/src/snippets/widgetprinting.cpp diff --git a/doc/src/painting-and-printing/printing.qdoc b/doc/src/painting-and-printing/printing.qdoc index 62c8192..97cd92f 100644 --- a/doc/src/painting-and-printing/printing.qdoc +++ b/doc/src/painting-and-printing/printing.qdoc @@ -136,6 +136,17 @@ used is constructed using the form of the constructor that accepts a QPaintDevice argument. + \section1 Printing Widgets + + To print a widget, you can use the QWidget::render() function. As mentioned, + the printer's resolution is usually higher than the screen resolution, so you + will have to scale the painter. You may also want to position the widget on the + page. The following code sample shows how this may look. + + \snippet doc/src/snippets/widgetprinting.cpp 0 + + This will center the widget on the page and scale it so that it fits the page. + \section1 Printing from Complex Widgets Certain widgets, such as QTextEdit and QGraphicsView, display rich content diff --git a/doc/src/snippets/widgetprinting.cpp b/doc/src/snippets/widgetprinting.cpp new file mode 100644 index 0000000..b3d5b7c --- /dev/null +++ b/doc/src/snippets/widgetprinting.cpp @@ -0,0 +1,54 @@ + +#include + +class Window : public QWidget +{ + Q_OBJECT + +public: + Window() { + myWidget = new QPushButton("Print Me"); + connect(myWidget, SIGNAL(clicked()), this, SLOT(print())); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(myWidget); + setLayout(layout); + } + +private slots: + void print() { + QPrinter printer(QPrinter::HighResolution); + + printer.setOutputFileName("test.pdf"); + +//! [0] + QPainter painter; + painter.begin(&printer); + double xscale = printer.pageRect().width()/double(myWidget->width()); + double yscale = printer.pageRect().height()/double(myWidget->height()); + double scale = qMin(xscale, yscale); + painter.translate(printer.paperRect().x() + printer.pageRect().width()/2, + printer.paperRect().y() + printer.pageRect().height()/2); + painter.scale(scale, scale); + painter.translate(-width()/2, -height()/2); + + myWidget->render(&painter); +//! [0] + } + +private: + QPushButton *myWidget; +}; + +int main(int argv, char **args) +{ + QApplication app(argv, args); + + Window window; + window.show(); + + return app.exec(); +} + +#include "main.moc" + -- cgit v0.12 From f5fcf515f73390ce124027335bb74d4a4c5f7b43 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Mon, 20 Sep 2010 11:05:26 +0200 Subject: Doc: Fixing overlapping text problem in columns --- doc/src/template/style/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index b60aa41..51c4f7e 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -898,6 +898,7 @@ margin-left:10px; min-width:250px; line-height: 1.2; + min-width:100%; } -- cgit v0.12 From b69686dd0e8701bf6e8f4e7c215dba7e8168d603 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 21 Sep 2010 10:13:52 +1000 Subject: Small optimization for QDeclarativeVisualDataModel. Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index a70886e..7b48758 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1187,7 +1187,7 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, if (propId != -1) { if (data->hasValue(propId)) { if (d->m_listModelInterface) { - data->setValue(propId, d->m_listModelInterface->data(idx, QList() << role).value(role)); + data->setValue(propId, d->m_listModelInterface->data(idx, role)); } else if (d->m_abstractItemModel) { QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root); data->setValue(propId, d->m_abstractItemModel->data(index, role)); @@ -1208,7 +1208,7 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, if (data->hasValue(propId)) { int role = roles.at(0); if (d->m_listModelInterface) { - data->setValue(propId, d->m_listModelInterface->data(idx, QList() << role).value(role)); + data->setValue(propId, d->m_listModelInterface->data(idx, role)); } else if (d->m_abstractItemModel) { QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root); data->setValue(propId, d->m_abstractItemModel->data(index, role)); -- cgit v0.12 From 46e49547f8e4614cd504b0af0d52d4e2768b57c3 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 21 Sep 2010 16:25:48 +1000 Subject: Fix a crash in QDeclarativeVisualDataModel Task-number: QTBUG-13754 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 6 +++--- .../qdeclarativelistmodel/data/multipleroles.qml | 25 ++++++++++++++++++++++ .../tst_qdeclarativelistmodel.cpp | 16 ++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 7b48758..21d1ea7 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -621,7 +621,7 @@ QDeclarativeVisualDataModelParts::QDeclarativeVisualDataModelParts(QDeclarativeV QDeclarativeVisualDataModelPrivate::QDeclarativeVisualDataModelPrivate(QDeclarativeContext *ctxt) : m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0) -, m_context(ctxt), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false) +, m_context(ctxt), m_modelDataPropId(-1), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false) , m_metaDataCacheable(false), m_delegateValidated(false), m_completePending(false), m_listAccessor(0) { } @@ -1202,11 +1202,11 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, qmlInfo(this) << "Changing role not present in item: " << roleName; } } - if (roles.count() == 1) { + if (d->m_roles.count() == 1) { // Handle the modelData role we add if there is just one role. int propId = data->modelDataPropertyId(); if (data->hasValue(propId)) { - int role = roles.at(0); + int role = d->m_roles.at(0); if (d->m_listModelInterface) { data->setValue(propId, d->m_listModelInterface->data(idx, role)); } else if (d->m_abstractItemModel) { diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml new file mode 100644 index 0000000..b8f2f32 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml @@ -0,0 +1,25 @@ +import Qt 4.7 +ListView { + width: 100 + height: 250 + delegate: Rectangle { + width: 100 + height: 50 + color: black ? "black": "white" + } + model: ListModel { + objectName: "listModel" + ListElement { + black: false + rounded: false + } + ListElement { + black: true + rounded: false + } + ListElement { + black: true + rounded: false + } + } +} \ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index f456778..31cb545 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -98,6 +98,7 @@ private slots: void get_worker_data(); void get_nested(); void get_nested_data(); + void crash_model_with_multiple_roles(); }; int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName) { @@ -886,6 +887,21 @@ void tst_qdeclarativelistmodel::get_nested_data() get_data(); } +//QTBUG-13754 +void tst_qdeclarativelistmodel::crash_model_with_multiple_roles() +{ + QDeclarativeEngine eng; + QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/multipleroles.qml")); + QObject *rootItem = component.create(); + QVERIFY(component.errorString().isEmpty()); + QVERIFY(rootItem != 0); + QDeclarativeListModel *model = rootItem->findChild("listModel"); + QVERIFY(model != 0); + + // used to cause a crash in QDeclarativeVisualDataModel + model->setProperty(0, "black", true); +} + QTEST_MAIN(tst_qdeclarativelistmodel) #include "tst_qdeclarativelistmodel.moc" -- cgit v0.12 From 8b97765d6e7cf207fb3a5ea8ac4fc5adbbcd3610 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 21 Sep 2010 17:13:09 +1000 Subject: Fix easing example having wrong contentHeight --- examples/declarative/animation/easing/easing.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/animation/easing/easing.qml b/examples/declarative/animation/easing/easing.qml index ffb129d..9349a25 100644 --- a/examples/declarative/animation/easing/easing.qml +++ b/examples/declarative/animation/easing/easing.qml @@ -137,7 +137,7 @@ Rectangle { Flickable { anchors.fill: parent - contentHeight: layout.height + contentHeight: layout.height+50 Rectangle { id: titlePane color: "#444444" -- cgit v0.12 From 37ba2e1140c62ac0123479b3d1a7f2638f095e20 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 21 Sep 2010 17:32:22 +1000 Subject: Fix corkboards example for smaller screens Task-number: Reviewed-by: Martin Jones --- examples/declarative/toys/corkboards/Day.qml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/declarative/toys/corkboards/Day.qml b/examples/declarative/toys/corkboards/Day.qml index f406f7b..3525a5b 100644 --- a/examples/declarative/toys/corkboards/Day.qml +++ b/examples/declarative/toys/corkboards/Day.qml @@ -45,9 +45,16 @@ Component { property variant stickies id: page - width: 840; height: 480 + width: ListView.view.width+40; height: ListView.view.height - Image { source: "cork.jpg" } + + Image { + source: "cork.jpg" + width: page.ListView.view.width + height: page.ListView.view.height + fillMode: Image.PreserveAspectCrop + clip: true + } MouseArea { anchors.fill: parent @@ -65,8 +72,8 @@ Component { Item { id: stickyPage - property int randomX: Math.random() * 500 + 100 - property int randomY: Math.random() * 200 + 50 + property int randomX: Math.random() * (page.ListView.view.width-0.5*stickyImage.width) +100 + property int randomY: Math.random() * (page.ListView.view.height-0.5*stickyImage.height) +50 x: randomX; y: randomY -- cgit v0.12 From 8ad396891f2a4966ad3cf943f99e208211e956bb Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 21 Sep 2010 13:00:02 +0200 Subject: Add exports for Bauhaus The QmlDesigner(Bauhaus) should not rely on -nokia-developer Reviewed-by: Marco Bubke --- src/declarative/util/qdeclarativeanimation_p.h | 2 +- src/declarative/util/qdeclarativetimer_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index cdd5041..8cb17e4 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -63,7 +63,7 @@ QT_MODULE(Declarative) class QDeclarativeAbstractAnimationPrivate; class QDeclarativeAnimationGroup; -class Q_AUTOTEST_EXPORT QDeclarativeAbstractAnimation : public QObject, public QDeclarativePropertyValueSource, public QDeclarativeParserStatus +class Q_DECLARATIVE_EXPORT QDeclarativeAbstractAnimation : public QObject, public QDeclarativePropertyValueSource, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeAbstractAnimation) diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h index 93b0965..08c3d4e 100644 --- a/src/declarative/util/qdeclarativetimer_p.h +++ b/src/declarative/util/qdeclarativetimer_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeTimerPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus +class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeTimer) -- cgit v0.12 From 38e11cfd56eba198e9d11b4084a02afa9a794da8 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 22 Sep 2010 12:50:08 +1000 Subject: Update QtDeclarative def files --- src/s60installs/bwins/QtDeclarativeu.def | 83 +++++++++++++++++++++++++++++++ src/s60installs/eabi/QtDeclarativeu.def | 84 ++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index cf2f325..43735a5 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1715,4 +1715,87 @@ EXPORTS ??0QDeclarativeListModel@@AAE@PBV0@PAVQDeclarativeListModelWorkerAgent@@@Z @ 1714 NONAME ; QDeclarativeListModel::QDeclarativeListModel(class QDeclarativeListModel const *, class QDeclarativeListModelWorkerAgent *) ?inWorkerThread@QDeclarativeListModel@@ABE_NXZ @ 1715 NONAME ; bool QDeclarativeListModel::inWorkerThread(void) const ?canMove@QDeclarativeListModel@@ABE_NHHH@Z @ 1716 NONAME ; bool QDeclarativeListModel::canMove(int, int, int) const + ?setLoops@QDeclarativeAbstractAnimation@@QAEXH@Z @ 1717 NONAME ; void QDeclarativeAbstractAnimation::setLoops(int) + ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0@Z @ 1718 NONAME ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *) + ?staticMetaObject@QDeclarativeAbstractAnimation@@2UQMetaObject@@B @ 1719 NONAME ; struct QMetaObject const QDeclarativeAbstractAnimation::staticMetaObject + ?setRunning@QDeclarativeTimer@@QAEX_N@Z @ 1720 NONAME ; void QDeclarativeTimer::setRunning(bool) + ?tr@QDeclarativeTimer@@SA?AVQString@@PBD0@Z @ 1721 NONAME ; class QString QDeclarativeTimer::tr(char const *, char const *) + ?qt_metacall@QDeclarativeTimer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1722 NONAME ; int QDeclarativeTimer::qt_metacall(enum QMetaObject::Call, int, void * *) + ?setPaused@QDeclarativeAbstractAnimation@@QAEX_N@Z @ 1723 NONAME ; void QDeclarativeAbstractAnimation::setPaused(bool) + ?setRepeating@QDeclarativeTimer@@QAEX_N@Z @ 1724 NONAME ; void QDeclarativeTimer::setRepeating(bool) + ?interval@QDeclarativeTimer@@QBEHXZ @ 1725 NONAME ; int QDeclarativeTimer::interval(void) const + ?start@QDeclarativeTimer@@QAEXXZ @ 1726 NONAME ; void QDeclarativeTimer::start(void) + ?transition@QDeclarativeAbstractAnimation@@UAEXAAV?$QList@VQDeclarativeAction@@@@AAV?$QList@VQDeclarativeProperty@@@@W4TransitionDirection@1@@Z @ 1727 NONAME ; void QDeclarativeAbstractAnimation::transition(class QList &, class QList &, enum QDeclarativeAbstractAnimation::TransitionDirection) + ?componentComplete@QDeclarativeAbstractAnimation@@UAEXXZ @ 1728 NONAME ; void QDeclarativeAbstractAnimation::componentComplete(void) + ?runningChanged@QDeclarativeAbstractAnimation@@IAEX_N@Z @ 1729 NONAME ; void QDeclarativeAbstractAnimation::runningChanged(bool) + ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0H@Z @ 1730 NONAME ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *, int) + ?metaObject@QDeclarativeTimer@@UBEPBUQMetaObject@@XZ @ 1731 NONAME ; struct QMetaObject const * QDeclarativeTimer::metaObject(void) const + ?setGroup@QDeclarativeAbstractAnimation@@QAEXPAVQDeclarativeAnimationGroup@@@Z @ 1732 NONAME ; void QDeclarativeAbstractAnimation::setGroup(class QDeclarativeAnimationGroup *) + ?isRepeating@QDeclarativeTimer@@QBE_NXZ @ 1733 NONAME ; bool QDeclarativeTimer::isRepeating(void) const + ?setTriggeredOnStart@QDeclarativeTimer@@QAEX_N@Z @ 1734 NONAME ; void QDeclarativeTimer::setTriggeredOnStart(bool) + ?currentTime@QDeclarativeAbstractAnimation@@QAEHXZ @ 1735 NONAME ; int QDeclarativeAbstractAnimation::currentTime(void) + ??1QDeclarativeAbstractAnimation@@UAE@XZ @ 1736 NONAME ; QDeclarativeAbstractAnimation::~QDeclarativeAbstractAnimation(void) + ?triggered@QDeclarativeTimer@@IAEXXZ @ 1737 NONAME ; void QDeclarativeTimer::triggered(void) + ?finished@QDeclarativeTimer@@AAEXXZ @ 1738 NONAME ; void QDeclarativeTimer::finished(void) + ?pausedChanged@QDeclarativeAbstractAnimation@@IAEX_N@Z @ 1739 NONAME ; void QDeclarativeAbstractAnimation::pausedChanged(bool) + ?complete@QDeclarativeAbstractAnimation@@QAEXXZ @ 1740 NONAME ; void QDeclarativeAbstractAnimation::complete(void) + ?setRunning@QDeclarativeAbstractAnimation@@QAEX_N@Z @ 1741 NONAME ; void QDeclarativeAbstractAnimation::setRunning(bool) + ?completed@QDeclarativeAbstractAnimation@@IAEXXZ @ 1742 NONAME ; void QDeclarativeAbstractAnimation::completed(void) + ?trUtf8@QDeclarativeTimer@@SA?AVQString@@PBD0@Z @ 1743 NONAME ; class QString QDeclarativeTimer::trUtf8(char const *, char const *) + ?loopCountChanged@QDeclarativeAbstractAnimation@@IAEXH@Z @ 1744 NONAME ; void QDeclarativeAbstractAnimation::loopCountChanged(int) + ?repeatChanged@QDeclarativeTimer@@IAEXXZ @ 1745 NONAME ; void QDeclarativeTimer::repeatChanged(void) + ?setDisableUserControl@QDeclarativeAbstractAnimation@@QAEXXZ @ 1746 NONAME ; void QDeclarativeAbstractAnimation::setDisableUserControl(void) + ?setDefaultTarget@QDeclarativeAbstractAnimation@@QAEXABVQDeclarativeProperty@@@Z @ 1747 NONAME ; void QDeclarativeAbstractAnimation::setDefaultTarget(class QDeclarativeProperty const &) + ?triggeredOnStart@QDeclarativeTimer@@QBE_NXZ @ 1748 NONAME ; bool QDeclarativeTimer::triggeredOnStart(void) const + ?notifyRunningChanged@QDeclarativeAbstractAnimation@@AAEX_N@Z @ 1749 NONAME ; void QDeclarativeAbstractAnimation::notifyRunningChanged(bool) + ?componentComplete@QDeclarativeTimer@@MAEXXZ @ 1750 NONAME ; void QDeclarativeTimer::componentComplete(void) + ?tr@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0@Z @ 1751 NONAME ; class QString QDeclarativeAbstractAnimation::tr(char const *, char const *) + ?isRunning@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1752 NONAME ; bool QDeclarativeAbstractAnimation::isRunning(void) const + ?d_func@QDeclarativeAbstractAnimation@@ABEPBVQDeclarativeAbstractAnimationPrivate@@XZ @ 1753 NONAME ; class QDeclarativeAbstractAnimationPrivate const * QDeclarativeAbstractAnimation::d_func(void) const + ??_EQDeclarativeAbstractAnimation@@UAE@I@Z @ 1754 NONAME ; QDeclarativeAbstractAnimation::~QDeclarativeAbstractAnimation(unsigned int) + ?d_func@QDeclarativeAbstractAnimation@@AAEPAVQDeclarativeAbstractAnimationPrivate@@XZ @ 1755 NONAME ; class QDeclarativeAbstractAnimationPrivate * QDeclarativeAbstractAnimation::d_func(void) + ?componentFinalized@QDeclarativeAbstractAnimation@@AAEXXZ @ 1756 NONAME ; void QDeclarativeAbstractAnimation::componentFinalized(void) + ??_EQDeclarativeTimer@@UAE@I@Z @ 1757 NONAME ; QDeclarativeTimer::~QDeclarativeTimer(unsigned int) + ?pause@QDeclarativeAbstractAnimation@@QAEXXZ @ 1758 NONAME ; void QDeclarativeAbstractAnimation::pause(void) + ?stop@QDeclarativeTimer@@QAEXXZ @ 1759 NONAME ; void QDeclarativeTimer::stop(void) + ?timelineComplete@QDeclarativeAbstractAnimation@@AAEXXZ @ 1760 NONAME ; void QDeclarativeAbstractAnimation::timelineComplete(void) + ?setAlwaysRunToEnd@QDeclarativeAbstractAnimation@@QAEX_N@Z @ 1761 NONAME ; void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool) + ?classBegin@QDeclarativeAbstractAnimation@@UAEXXZ @ 1762 NONAME ; void QDeclarativeAbstractAnimation::classBegin(void) + ?d_func@QDeclarativeTimer@@AAEPAVQDeclarativeTimerPrivate@@XZ @ 1763 NONAME ; class QDeclarativeTimerPrivate * QDeclarativeTimer::d_func(void) + ??0QDeclarativeAbstractAnimation@@QAE@PAVQObject@@@Z @ 1764 NONAME ; QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(class QObject *) + ?metaObject@QDeclarativeAbstractAnimation@@UBEPBUQMetaObject@@XZ @ 1765 NONAME ; struct QMetaObject const * QDeclarativeAbstractAnimation::metaObject(void) const + ?tr@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0H@Z @ 1766 NONAME ; class QString QDeclarativeAbstractAnimation::tr(char const *, char const *, int) + ?started@QDeclarativeAbstractAnimation@@IAEXXZ @ 1767 NONAME ; void QDeclarativeAbstractAnimation::started(void) + ?setInterval@QDeclarativeTimer@@QAEXH@Z @ 1768 NONAME ; void QDeclarativeTimer::setInterval(int) + ?d_func@QDeclarativeTimer@@ABEPBVQDeclarativeTimerPrivate@@XZ @ 1769 NONAME ; class QDeclarativeTimerPrivate const * QDeclarativeTimer::d_func(void) const + ?staticMetaObject@QDeclarativeTimer@@2UQMetaObject@@B @ 1770 NONAME ; struct QMetaObject const QDeclarativeTimer::staticMetaObject + ?qt_metacast@QDeclarativeAbstractAnimation@@UAEPAXPBD@Z @ 1771 NONAME ; void * QDeclarativeAbstractAnimation::qt_metacast(char const *) + ?setCurrentTime@QDeclarativeAbstractAnimation@@QAEXH@Z @ 1772 NONAME ; void QDeclarativeAbstractAnimation::setCurrentTime(int) + ?restart@QDeclarativeAbstractAnimation@@QAEXXZ @ 1773 NONAME ; void QDeclarativeAbstractAnimation::restart(void) + ??0QDeclarativeAbstractAnimation@@IAE@AAVQDeclarativeAbstractAnimationPrivate@@PAVQObject@@@Z @ 1774 NONAME ; QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(class QDeclarativeAbstractAnimationPrivate &, class QObject *) + ?resume@QDeclarativeAbstractAnimation@@QAEXXZ @ 1775 NONAME ; void QDeclarativeAbstractAnimation::resume(void) + ?runningChanged@QDeclarativeTimer@@IAEXXZ @ 1776 NONAME ; void QDeclarativeTimer::runningChanged(void) + ?ticked@QDeclarativeTimer@@AAEXXZ @ 1777 NONAME ; void QDeclarativeTimer::ticked(void) + ?trUtf8@QDeclarativeTimer@@SA?AVQString@@PBD0H@Z @ 1778 NONAME ; class QString QDeclarativeTimer::trUtf8(char const *, char const *, int) + ??0QDeclarativeTimer@@QAE@PAVQObject@@@Z @ 1779 NONAME ; QDeclarativeTimer::QDeclarativeTimer(class QObject *) + ?loops@QDeclarativeAbstractAnimation@@QBEHXZ @ 1780 NONAME ; int QDeclarativeAbstractAnimation::loops(void) const + ?setTarget@QDeclarativeAbstractAnimation@@EAEXABVQDeclarativeProperty@@@Z @ 1781 NONAME ; void QDeclarativeAbstractAnimation::setTarget(class QDeclarativeProperty const &) + ?alwaysRunToEnd@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1782 NONAME ; bool QDeclarativeAbstractAnimation::alwaysRunToEnd(void) const + ?tr@QDeclarativeTimer@@SA?AVQString@@PBD0H@Z @ 1783 NONAME ; class QString QDeclarativeTimer::tr(char const *, char const *, int) + ?intervalChanged@QDeclarativeTimer@@IAEXXZ @ 1784 NONAME ; void QDeclarativeTimer::intervalChanged(void) + ?isPaused@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1785 NONAME ; bool QDeclarativeAbstractAnimation::isPaused(void) const + ?getStaticMetaObject@QDeclarativeAbstractAnimation@@SAABUQMetaObject@@XZ @ 1786 NONAME ; struct QMetaObject const & QDeclarativeAbstractAnimation::getStaticMetaObject(void) + ?group@QDeclarativeAbstractAnimation@@QBEPAVQDeclarativeAnimationGroup@@XZ @ 1787 NONAME ; class QDeclarativeAnimationGroup * QDeclarativeAbstractAnimation::group(void) const + ?classBegin@QDeclarativeTimer@@MAEXXZ @ 1788 NONAME ; void QDeclarativeTimer::classBegin(void) + ?restart@QDeclarativeTimer@@QAEXXZ @ 1789 NONAME ; void QDeclarativeTimer::restart(void) + ??1QDeclarativeTimer@@UAE@XZ @ 1790 NONAME ; QDeclarativeTimer::~QDeclarativeTimer(void) + ?getStaticMetaObject@QDeclarativeTimer@@SAABUQMetaObject@@XZ @ 1791 NONAME ; struct QMetaObject const & QDeclarativeTimer::getStaticMetaObject(void) + ?qt_metacast@QDeclarativeTimer@@UAEPAXPBD@Z @ 1792 NONAME ; void * QDeclarativeTimer::qt_metacast(char const *) + ?alwaysRunToEndChanged@QDeclarativeAbstractAnimation@@IAEX_N@Z @ 1793 NONAME ; void QDeclarativeAbstractAnimation::alwaysRunToEndChanged(bool) + ?triggeredOnStartChanged@QDeclarativeTimer@@IAEXXZ @ 1794 NONAME ; void QDeclarativeTimer::triggeredOnStartChanged(void) + ?isRunning@QDeclarativeTimer@@QBE_NXZ @ 1795 NONAME ; bool QDeclarativeTimer::isRunning(void) const + ?update@QDeclarativeTimer@@AAEXXZ @ 1796 NONAME ; void QDeclarativeTimer::update(void) + ?stop@QDeclarativeAbstractAnimation@@QAEXXZ @ 1797 NONAME ; void QDeclarativeAbstractAnimation::stop(void) + ?start@QDeclarativeAbstractAnimation@@QAEXXZ @ 1798 NONAME ; void QDeclarativeAbstractAnimation::start(void) + ?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1799 NONAME ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 11dee4d..8aefb2c 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1747,4 +1747,88 @@ EXPORTS _ZN21QDeclarativeListModelC1EPKS_P32QDeclarativeListModelWorkerAgent @ 1746 NONAME _ZN21QDeclarativeListModelC2EPKS_P32QDeclarativeListModelWorkerAgent @ 1747 NONAME _ZNK21QDeclarativeListModel14inWorkerThreadEv @ 1748 NONAME + _ZN17QDeclarativeTimer10classBeginEv @ 1749 NONAME + _ZN17QDeclarativeTimer10setRunningEb @ 1750 NONAME + _ZN17QDeclarativeTimer11qt_metacallEN11QMetaObject4CallEiPPv @ 1751 NONAME + _ZN17QDeclarativeTimer11qt_metacastEPKc @ 1752 NONAME + _ZN17QDeclarativeTimer11setIntervalEi @ 1753 NONAME + _ZN17QDeclarativeTimer12setRepeatingEb @ 1754 NONAME + _ZN17QDeclarativeTimer13repeatChangedEv @ 1755 NONAME + _ZN17QDeclarativeTimer14runningChangedEv @ 1756 NONAME + _ZN17QDeclarativeTimer15intervalChangedEv @ 1757 NONAME + _ZN17QDeclarativeTimer16staticMetaObjectE @ 1758 NONAME DATA 16 + _ZN17QDeclarativeTimer17componentCompleteEv @ 1759 NONAME + _ZN17QDeclarativeTimer19getStaticMetaObjectEv @ 1760 NONAME + _ZN17QDeclarativeTimer19setTriggeredOnStartEb @ 1761 NONAME + _ZN17QDeclarativeTimer23triggeredOnStartChangedEv @ 1762 NONAME + _ZN17QDeclarativeTimer4stopEv @ 1763 NONAME + _ZN17QDeclarativeTimer5startEv @ 1764 NONAME + _ZN17QDeclarativeTimer6tickedEv @ 1765 NONAME + _ZN17QDeclarativeTimer6updateEv @ 1766 NONAME + _ZN17QDeclarativeTimer7restartEv @ 1767 NONAME + _ZN17QDeclarativeTimer8finishedEv @ 1768 NONAME + _ZN17QDeclarativeTimer9triggeredEv @ 1769 NONAME + _ZN17QDeclarativeTimerC1EP7QObject @ 1770 NONAME + _ZN17QDeclarativeTimerC2EP7QObject @ 1771 NONAME + _ZN29QDeclarativeAbstractAnimation10classBeginEv @ 1772 NONAME + _ZN29QDeclarativeAbstractAnimation10setRunningEb @ 1773 NONAME + _ZN29QDeclarativeAbstractAnimation10transitionER5QListI18QDeclarativeActionERS0_I20QDeclarativePropertyENS_19TransitionDirectionE @ 1774 NONAME + _ZN29QDeclarativeAbstractAnimation11currentTimeEv @ 1775 NONAME + _ZN29QDeclarativeAbstractAnimation11qt_metacallEN11QMetaObject4CallEiPPv @ 1776 NONAME + _ZN29QDeclarativeAbstractAnimation11qt_metacastEPKc @ 1777 NONAME + _ZN29QDeclarativeAbstractAnimation13pausedChangedEb @ 1778 NONAME + _ZN29QDeclarativeAbstractAnimation14runningChangedEb @ 1779 NONAME + _ZN29QDeclarativeAbstractAnimation14setCurrentTimeEi @ 1780 NONAME + _ZN29QDeclarativeAbstractAnimation16loopCountChangedEi @ 1781 NONAME + _ZN29QDeclarativeAbstractAnimation16setDefaultTargetERK20QDeclarativeProperty @ 1782 NONAME + _ZN29QDeclarativeAbstractAnimation16staticMetaObjectE @ 1783 NONAME DATA 16 + _ZN29QDeclarativeAbstractAnimation16timelineCompleteEv @ 1784 NONAME + _ZN29QDeclarativeAbstractAnimation17componentCompleteEv @ 1785 NONAME + _ZN29QDeclarativeAbstractAnimation17setAlwaysRunToEndEb @ 1786 NONAME + _ZN29QDeclarativeAbstractAnimation18componentFinalizedEv @ 1787 NONAME + _ZN29QDeclarativeAbstractAnimation19getStaticMetaObjectEv @ 1788 NONAME + _ZN29QDeclarativeAbstractAnimation20notifyRunningChangedEb @ 1789 NONAME + _ZN29QDeclarativeAbstractAnimation21alwaysRunToEndChangedEb @ 1790 NONAME + _ZN29QDeclarativeAbstractAnimation21setDisableUserControlEv @ 1791 NONAME + _ZN29QDeclarativeAbstractAnimation4stopEv @ 1792 NONAME + _ZN29QDeclarativeAbstractAnimation5pauseEv @ 1793 NONAME + _ZN29QDeclarativeAbstractAnimation5startEv @ 1794 NONAME + _ZN29QDeclarativeAbstractAnimation6resumeEv @ 1795 NONAME + _ZN29QDeclarativeAbstractAnimation7restartEv @ 1796 NONAME + _ZN29QDeclarativeAbstractAnimation7startedEv @ 1797 NONAME + _ZN29QDeclarativeAbstractAnimation8completeEv @ 1798 NONAME + _ZN29QDeclarativeAbstractAnimation8setGroupEP26QDeclarativeAnimationGroup @ 1799 NONAME + _ZN29QDeclarativeAbstractAnimation8setLoopsEi @ 1800 NONAME + _ZN29QDeclarativeAbstractAnimation9completedEv @ 1801 NONAME + _ZN29QDeclarativeAbstractAnimation9setPausedEb @ 1802 NONAME + _ZN29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1803 NONAME + _ZN29QDeclarativeAbstractAnimationC2EP7QObject @ 1804 NONAME + _ZN29QDeclarativeAbstractAnimationC2ER36QDeclarativeAbstractAnimationPrivateP7QObject @ 1805 NONAME + _ZN29QDeclarativeAbstractAnimationD0Ev @ 1806 NONAME + _ZN29QDeclarativeAbstractAnimationD1Ev @ 1807 NONAME + _ZN29QDeclarativeAbstractAnimationD2Ev @ 1808 NONAME + _ZNK17QDeclarativeTimer10metaObjectEv @ 1809 NONAME + _ZNK17QDeclarativeTimer11isRepeatingEv @ 1810 NONAME + _ZNK17QDeclarativeTimer16triggeredOnStartEv @ 1811 NONAME + _ZNK17QDeclarativeTimer8intervalEv @ 1812 NONAME + _ZNK17QDeclarativeTimer9isRunningEv @ 1813 NONAME + _ZNK29QDeclarativeAbstractAnimation10metaObjectEv @ 1814 NONAME + _ZNK29QDeclarativeAbstractAnimation14alwaysRunToEndEv @ 1815 NONAME + _ZNK29QDeclarativeAbstractAnimation5groupEv @ 1816 NONAME + _ZNK29QDeclarativeAbstractAnimation5loopsEv @ 1817 NONAME + _ZNK29QDeclarativeAbstractAnimation8isPausedEv @ 1818 NONAME + _ZNK29QDeclarativeAbstractAnimation9isRunningEv @ 1819 NONAME + _ZTI17QDeclarativeTimer @ 1820 NONAME + _ZTI29QDeclarativeAbstractAnimation @ 1821 NONAME + _ZTV17QDeclarativeTimer @ 1822 NONAME + _ZTV29QDeclarativeAbstractAnimation @ 1823 NONAME + _ZThn12_N29QDeclarativeAbstractAnimation10classBeginEv @ 1824 NONAME + _ZThn12_N29QDeclarativeAbstractAnimation17componentCompleteEv @ 1825 NONAME + _ZThn12_N29QDeclarativeAbstractAnimationD0Ev @ 1826 NONAME + _ZThn12_N29QDeclarativeAbstractAnimationD1Ev @ 1827 NONAME + _ZThn8_N17QDeclarativeTimer10classBeginEv @ 1828 NONAME + _ZThn8_N17QDeclarativeTimer17componentCompleteEv @ 1829 NONAME + _ZThn8_N29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1830 NONAME + _ZThn8_N29QDeclarativeAbstractAnimationD0Ev @ 1831 NONAME + _ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1832 NONAME -- cgit v0.12 From 5b7d75a57e0ec8ee78f843ab0eb6485b8e3b4a22 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 22 Sep 2010 15:41:34 +1000 Subject: Verify the audio format before trying to open an audio device. This was causing a crash on windows because the buffer and period sizes were worked out to 0 with an invalid sample size and dividing one by the other is division by 0. Task-number: QTMOBILITY-438 Reviewed-by: Justin McPherson --- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 23 ++++++----- src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp | 8 +++- src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 11 +++++- src/multimedia/audio/qaudioinput_alsa_p.cpp | 24 ++++++++++-- src/multimedia/audio/qaudioinput_mac_p.cpp | 2 +- src/multimedia/audio/qaudioinput_win32_p.cpp | 41 +++++++++++++++++--- src/multimedia/audio/qaudiooutput_alsa_p.cpp | 23 +++++++++-- src/multimedia/audio/qaudiooutput_mac_p.cpp | 6 ++- src/multimedia/audio/qaudiooutput_mac_p.h | 2 + src/multimedia/audio/qaudiooutput_win32_p.cpp | 36 ++++++++++++----- tests/auto/qaudioinput/tst_qaudioinput.cpp | 47 +++++++++++++++++++++++ tests/auto/qaudiooutput/tst_qaudiooutput.cpp | 47 +++++++++++++++++++++++ 12 files changed, 235 insertions(+), 35 deletions(-) diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 633b309..25622a4 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -257,37 +257,40 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const // set the values! snd_pcm_hw_params_set_channels(handle,params,format.channels()); snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir); + + err = -1; + switch(format.sampleSize()) { case 8: if(format.sampleType() == QAudioFormat::SignedInt) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8); else if(format.sampleType() == QAudioFormat::UnSignedInt) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8); break; case 16: if(format.sampleType() == QAudioFormat::SignedInt) { if(format.byteOrder() == QAudioFormat::LittleEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE); else if(format.byteOrder() == QAudioFormat::BigEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE); } else if(format.sampleType() == QAudioFormat::UnSignedInt) { if(format.byteOrder() == QAudioFormat::LittleEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE); else if(format.byteOrder() == QAudioFormat::BigEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE); } break; case 32: if(format.sampleType() == QAudioFormat::SignedInt) { if(format.byteOrder() == QAudioFormat::LittleEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE); else if(format.byteOrder() == QAudioFormat::BigEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE); } else if(format.sampleType() == QAudioFormat::UnSignedInt) { if(format.byteOrder() == QAudioFormat::LittleEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE); else if(format.byteOrder() == QAudioFormat::BigEndian) - snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE); + err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE); } } diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp index ecd03e5..1909009 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp @@ -78,7 +78,13 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray const& handle, QAu bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const { - return format.codec() == QString::fromLatin1("audio/pcm"); + QAudioDeviceInfoInternal *self = const_cast(this); + + return format.isValid() + && format.codec() == QString::fromLatin1("audio/pcm") + && self->supportedSampleRates().contains(format.sampleRate()) + && self->supportedChannelCounts().contains(format.channelCount()) + && self->supportedSampleSizes().contains(format.sampleSize()); } QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 4e6b2df..a4b28d4 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -196,8 +196,9 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const break; } } + if (!match) + failed = true; } - if (!match) failed = true; // check frequency match = false; @@ -208,6 +209,8 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const break; } } + if (!match) + failed = true; } // check sample size @@ -219,6 +222,8 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const break; } } + if (!match) + failed = true; } // check byte order @@ -230,6 +235,8 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const break; } } + if (!match) + failed = true; } // check sample type @@ -241,6 +248,8 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const break; } } + if (!match) + failed = true; } if(!failed) { diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 58669b3..ddafa3d 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -152,7 +152,7 @@ int QAudioInputPrivate::xrun_recovery(int err) int QAudioInputPrivate::setFormat() { - snd_pcm_format_t format = SND_PCM_FORMAT_S16; + snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN; if(settings.sampleSize() == 8) { format = SND_PCM_FORMAT_U8; @@ -204,7 +204,9 @@ int QAudioInputPrivate::setFormat() format = SND_PCM_FORMAT_FLOAT64_BE; } - return snd_pcm_hw_params_set_format( handle, hwparams, format); + return format != SND_PCM_FORMAT_UNKNOWN + ? snd_pcm_hw_params_set_format( handle, hwparams, format) + : -1; } QIODevice* QAudioInputPrivate::start(QIODevice* device) @@ -259,10 +261,26 @@ bool QAudioInputPrivate::open() elapsedTimeOffset = 0; int dir; - int err=-1; + int err = 0; int count=0; unsigned int freakuency=settings.frequency(); + if (!settings.isValid()) { + qWarning("QAudioOutput: open error, invalid format."); + } else if (settings.frequency() <= 0) { + qWarning("QAudioOutput: open error, invalid sample rate (%d).", + settings.frequency()); + } else { + err = -1; + } + + if (err == 0) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + return false; + } + + QString dev = QString(QLatin1String(m_device.constData())); QList devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioInput); if(dev.compare(QLatin1String("default")) == 0) { diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index 5897e75..c3d2ae2 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -717,7 +717,7 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) { QIODevice* op = device; - if (!audioFormat.isValid() || !open()) { + if (!audioDeviceInfo->isFormatSupported(audioFormat) || !open()) { stateCode = QAudio::StoppedState; errorCode = QAudio::OpenError; return audioIO; diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 3f6e778..225d2f1 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -214,13 +214,44 @@ bool QAudioInputPrivate::open() qDebug()< 48000) { + qWarning("QAudioInput: open error, frequency out of range (%d).", settings.frequency()); + } else if (buffer_size == 0) { + + buffer_size + = (settings.frequency() + * settings.channels() + * settings.sampleSize() +#ifndef Q_OS_WINCE // Default buffer size, 200ms, default period size is 40ms + + 39) / 40; + period_size = buffer_size / 5; + } else { + period_size = buffer_size / 5; +#else // For wince reduce size to 40ms for buffer size and 20ms period + + 199) / 200; + period_size = buffer_size / 2; } else { - period_size = buffer_size/5; + period_size = buffer_size / 2; +#endif } + + if (period_size == 0) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + return false; + } + timeStamp.restart(); elapsedTimeOffset = 0; wfx.nSamplesPerSec = settings.frequency(); diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 49b32c0..ecf3215 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -155,7 +155,7 @@ int QAudioOutputPrivate::xrun_recovery(int err) int QAudioOutputPrivate::setFormat() { - snd_pcm_format_t pcmformat = SND_PCM_FORMAT_S16; + snd_pcm_format_t pcmformat = SND_PCM_FORMAT_UNKNOWN; if(settings.sampleSize() == 8) { pcmformat = SND_PCM_FORMAT_U8; @@ -208,7 +208,9 @@ int QAudioOutputPrivate::setFormat() pcmformat = SND_PCM_FORMAT_FLOAT64_BE; } - return snd_pcm_hw_params_set_format( handle, hwparams, pcmformat); + return pcmformat != SND_PCM_FORMAT_UNKNOWN + ? snd_pcm_hw_params_set_format( handle, hwparams, pcmformat) + : -1; } QIODevice* QAudioOutputPrivate::start(QIODevice* device) @@ -275,10 +277,25 @@ bool QAudioOutputPrivate::open() elapsedTimeOffset = 0; int dir; - int err=-1; + int err = 0; int count=0; unsigned int freakuency=settings.frequency(); + if (!settings.isValid()) { + qWarning("QAudioOutput: open error, invalid format."); + } else if (settings.frequency() <= 0) { + qWarning("QAudioOutput: open error, invalid sample rate (%d).", + settings.frequency()); + } else { + err = -1; + } + + if (err == 0) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + return false; + } + QString dev = QString(QLatin1String(m_device.constData())); QList devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput); if(dev.compare(QLatin1String("default")) == 0) { diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index cc52d90..86a2e31 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -60,11 +60,11 @@ #include #include -#include #include #include "qaudio_mac_p.h" #include "qaudiooutput_mac_p.h" +#include "qaudiodeviceinfo_mac_p.h" QT_BEGIN_NAMESPACE @@ -278,6 +278,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray& device, const QAudioF if (QAudio::Mode(mode) == QAudio::AudioInput) errorCode = QAudio::OpenError; else { + audioDeviceInfo = new QAudioDeviceInfoInternal(device, QAudio::AudioOutput); isOpen = false; audioDeviceId = AudioDeviceID(did); audioUnit = 0; @@ -299,6 +300,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray& device, const QAudioF QAudioOutputPrivate::~QAudioOutputPrivate() { + delete audioDeviceInfo; close(); } @@ -424,7 +426,7 @@ QIODevice* QAudioOutputPrivate::start(QIODevice* device) { QIODevice* op = device; - if (!audioFormat.isValid() || !open()) { + if (!audioDeviceInfo->isFormatSupported(audioFormat) || !open()) { stateCode = QAudio::StoppedState; errorCode = QAudio::OpenError; return audioIO; diff --git a/src/multimedia/audio/qaudiooutput_mac_p.h b/src/multimedia/audio/qaudiooutput_mac_p.h index 752905c..7013961 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.h +++ b/src/multimedia/audio/qaudiooutput_mac_p.h @@ -73,6 +73,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QIODevice; +class QAbstractAudioDeviceInfo; namespace QtMultimediaInternal { @@ -101,6 +102,7 @@ public: QWaitCondition threadFinished; QMutex mutex; QTimer* intervalTimer; + QAbstractAudioDeviceInfo *audioDeviceInfo; QAudio::Error errorCode; QAudio::State stateCode; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 09771b3..f038e51 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -251,20 +251,38 @@ bool QAudioOutputPrivate::open() QTime now(QTime::currentTime()); qDebug()<= 8000 && settings.frequency() <= 48000)) { + + period_size = 0; + + if (!settings.isValid()) { + qWarning("QAudioOutput: open error, invalid format."); + } else if (settings.channels() <= 0) { + qWarning("QAudioOutput: open error, invalid number of channels (%d).", + settings.channels()); + } else if (settings.sampleSize() <= 0) { + qWarning("QAudioOutput: open error, invalid sample size (%d).", + settings.sampleSize()); + } else if (settings.frequency() < 8000 || settings.frequency() > 48000) { + qWarning("QAudioOutput: open error, frequency out of range (%d).", settings.frequency()); + } else if (buffer_size == 0) { + // Default buffer size, 200ms, default period size is 40ms + buffer_size + = (settings.frequency() + * settings.channels() + * settings.sampleSize() + + 39) / 40; + period_size = buffer_size / 5; + } else { + period_size = buffer_size / 5; + } + + if (period_size == 0) { errorState = QAudio::OpenError; deviceState = QAudio::StoppedState; emit stateChanged(deviceState); - qWarning("QAudioOutput: open error, frequency out of range."); return false; } - if(buffer_size == 0) { - // Default buffer size, 200ms, default period size is 40ms - buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2; - period_size = buffer_size/5; - } else { - period_size = buffer_size/5; - } + waveBlocks = allocateBlocks(period_size, buffer_size/period_size); mutex.lock(); diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index 84c3874..1808b1d 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -50,6 +50,8 @@ #define SRCDIR "" #endif +Q_DECLARE_METATYPE(QAudioFormat) + class tst_QAudioInput : public QObject { Q_OBJECT @@ -58,6 +60,8 @@ public: private slots: void initTestCase(); + void invalidFormat_data(); + void invalidFormat(); void settings(); void buffers(); void notifyInterval(); @@ -71,6 +75,8 @@ private: void tst_QAudioInput::initTestCase() { + qRegisterMetaType(); + format.setFrequency(8000); format.setChannels(1); format.setSampleSize(8); @@ -91,6 +97,47 @@ void tst_QAudioInput::initTestCase() audio = new QAudioInput(format, this); } +void tst_QAudioInput::invalidFormat_data() +{ + QTest::addColumn("invalidFormat"); + + QAudioFormat audioFormat; + + QTest::newRow("Null Format") + << audioFormat; + + audioFormat = format; + audioFormat.setChannels(0); + QTest::newRow("Channel count 0") + << audioFormat; + + audioFormat = format; + audioFormat.setFrequency(0); + QTest::newRow("Sample rate 0") + << audioFormat; + + audioFormat = format; + audioFormat.setSampleSize(0); + QTest::newRow("Sample size 0") + << audioFormat; +} + +void tst_QAudioInput::invalidFormat() +{ + QFETCH(QAudioFormat, invalidFormat); + + QAudioInput audioInput(invalidFormat, this); + + // Check that we are in the default state before calling start + QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()"); + QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()"); + + audioInput.start(); + + // Check that error is raised + QVERIFY2((audioInput.error() == QAudio::OpenError),"error() was not set to QAudio::OpenError after start()"); +} + void tst_QAudioInput::settings() { if(available) { diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index 437ef5e..e6d11a6 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -52,6 +52,8 @@ #define SRCDIR "" #endif +Q_DECLARE_METATYPE(QAudioFormat) + class tst_QAudioOutput : public QObject { Q_OBJECT @@ -60,6 +62,8 @@ public: private slots: void initTestCase(); + void invalidFormat_data(); + void invalidFormat(); void settings(); void buffers(); void notifyInterval(); @@ -74,6 +78,8 @@ private: void tst_QAudioOutput::initTestCase() { + qRegisterMetaType(); + format.setFrequency(8000); format.setChannels(1); format.setSampleSize(8); @@ -92,6 +98,47 @@ void tst_QAudioOutput::initTestCase() audio = new QAudioOutput(format, this); } +void tst_QAudioOutput::invalidFormat_data() +{ + QTest::addColumn("invalidFormat"); + + QAudioFormat audioFormat; + + QTest::newRow("Null Format") + << audioFormat; + + audioFormat = format; + audioFormat.setChannels(0); + QTest::newRow("Channel count 0") + << audioFormat; + + audioFormat = format; + audioFormat.setFrequency(0); + QTest::newRow("Sample rate 0") + << audioFormat; + + audioFormat = format; + audioFormat.setSampleSize(0); + QTest::newRow("Sample size 0") + << audioFormat; +} + +void tst_QAudioOutput::invalidFormat() +{ + QFETCH(QAudioFormat, invalidFormat); + + QAudioOutput audioOutput(invalidFormat, this); + + // Check that we are in the default state before calling start + QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()"); + QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()"); + + audioOutput.start(); + + // Check that error is raised + QVERIFY2((audioOutput.error() == QAudio::OpenError),"error() was not set to QAudio::OpenError after start()"); +} + void tst_QAudioOutput::settings() { if(available) { -- cgit v0.12 From 6da6b7099d4e0b49329793e4b90703ec3d868048 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Wed, 22 Sep 2010 10:19:59 +0200 Subject: QTreeView: do not scroll to top if last item is removed When the last item is the current item and is removed, QTreeViewPrivate::updateScrollBars() is called after QTreeViewPrivate's viewItems member is cleared. This commit makes sure that viewItems is restored by calling QTreeView::doItemsLayout() in this case, preventing that the scroll bar range is set to zero temporarily and the view is scrolled to the top unexpectedly (this was a regression in 4.7.0: QTBUG-13567). Merge-request: 2481 Reviewed-by: Olivier Goffart --- src/gui/itemviews/qtreeview.cpp | 4 ++++ tests/auto/qtreeview/tst_qtreeview.cpp | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index b797776..40b51fe 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -3435,6 +3435,10 @@ void QTreeViewPrivate::updateScrollBars() if (!viewportSize.isValid()) viewportSize = QSize(0, 0); + if (viewItems.isEmpty()) { + q->doItemsLayout(); + } + int itemsInViewport = 0; if (uniformRowHeights) { if (defaultItemHeight <= 0) diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 7e2e800..c7b53e9 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -240,6 +240,7 @@ private slots: void taskQTBUG_6450_selectAllWith1stColumnHidden(); void taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint(); void taskQTBUG_11466_keyboardNavigationRegression(); + void taskQTBUG_13567_removeLastItemRegression(); }; class QtTestModel: public QAbstractItemModel @@ -3910,5 +3911,26 @@ void tst_QTreeView::taskQTBUG_11466_keyboardNavigationRegression() QTRY_COMPARE(treeView.currentIndex(), treeView.selectionModel()->selection().indexes().first()); } +void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression() +{ + QtTestModel model(200, 1); + + QTreeView view; + view.setSelectionMode(QAbstractItemView::ExtendedSelection); + view.setModel(&model); + view.show(); + QTest::qWaitForWindowShown(&view); + + view.scrollToBottom(); + QTest::qWait(10); + CHECK_VISIBLE(199, 0); + + view.setCurrentIndex(model.index(199, 0)); + model.removeLastRow(); + QTest::qWait(10); + QCOMPARE(view.currentIndex(), model.index(198, 0)); + CHECK_VISIBLE(198, 0); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" -- cgit v0.12 From 22ee6863458885c900e8294a44bd782acbdd8201 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 22 Sep 2010 10:11:41 +0200 Subject: Keep other text format with QTextOption::SuppressColors tag on Setting the QTextOption::SuppressColors tag on a QTextDocument breaks all text format, not just colors. This patch fix this by selectively ignoring color properties in the format and keeping other properties. Task-number: QTBUG-13090 Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index f432b7e..a7f619e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2219,8 +2219,12 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR QTextCharFormat format; if (eng->hasFormats() || selection) { - if (!suppressColors) - format = eng->format(&si); + format = eng->format(&si); + if (suppressColors) { + format.clearForeground(); + format.clearBackground(); + format.clearProperty(QTextFormat::TextUnderlineColor); + } if (selection) format.merge(selection->format); -- cgit v0.12 From dbe4dd5262c7ae7b4c61bddc7b8d9b895b462b32 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 21 Sep 2010 17:50:24 +0200 Subject: Fixed stencil buffer on FBOs with OpenGL ES. If combined depth-stencil buffer is not supported, create separate depth and stencil buffers. Task-number: QTBUG-12861 Reviewed-by: Trond --- src/opengl/qglframebufferobject.cpp | 101 +++++++++++++++++++++++++++--------- src/opengl/qglframebufferobject_p.h | 5 +- 2 files changed, 79 insertions(+), 27 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index adbba85..7c84946 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -472,13 +472,17 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT, &samples); } + // In practice, a combined depth-stencil buffer is supported by all desktop platforms, while a + // separate stencil buffer is not. On embedded devices however, a combined depth-stencil buffer + // might not be supported while separate buffers are, according to QTBUG-12861. + if (attachment == QGLFramebufferObject::CombinedDepthStencil && (QGLExtensions::glExtensions() & QGLExtensions::PackedDepthStencil)) { // depth and stencil buffer needs another extension - glGenRenderbuffers(1, &depth_stencil_buffer); - Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer)); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_stencil_buffer); - Q_ASSERT(glIsRenderbuffer(depth_stencil_buffer)); + glGenRenderbuffers(1, &depth_buffer); + Q_ASSERT(!glIsRenderbuffer(depth_buffer)); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_buffer); + Q_ASSERT(glIsRenderbuffer(depth_buffer)); if (samples != 0 && glRenderbufferStorageMultisampleEXT) glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); @@ -486,24 +490,26 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); - GLint i = 0; - glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); + stencil_buffer = depth_buffer; glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, depth_stencil_buffer); + GL_RENDERBUFFER_EXT, depth_buffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, depth_stencil_buffer); - fbo_attachment = QGLFramebufferObject::CombinedDepthStencil; + GL_RENDERBUFFER_EXT, stencil_buffer); valid = checkFramebufferStatus(); - if (!valid) - glDeleteRenderbuffers(1, &depth_stencil_buffer); - } else if (attachment == QGLFramebufferObject::Depth - || attachment == QGLFramebufferObject::CombinedDepthStencil) + if (!valid) { + glDeleteRenderbuffers(1, &depth_buffer); + stencil_buffer = depth_buffer = 0; + } + } + + if (depth_buffer == 0 && (attachment == QGLFramebufferObject::CombinedDepthStencil + || (attachment == QGLFramebufferObject::Depth))) { - glGenRenderbuffers(1, &depth_stencil_buffer); - Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer)); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_stencil_buffer); - Q_ASSERT(glIsRenderbuffer(depth_stencil_buffer)); + glGenRenderbuffers(1, &depth_buffer); + Q_ASSERT(!glIsRenderbuffer(depth_buffer)); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_buffer); + Q_ASSERT(glIsRenderbuffer(depth_buffer)); if (samples != 0 && glRenderbufferStorageMultisampleEXT) { #ifdef QT_OPENGL_ES #define GL_DEPTH_COMPONENT16 0x81A5 @@ -521,14 +527,53 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, size.width(), size.height()); #endif } - GLint i = 0; - glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, depth_stencil_buffer); - fbo_attachment = QGLFramebufferObject::Depth; + GL_RENDERBUFFER_EXT, depth_buffer); + valid = checkFramebufferStatus(); + if (!valid) { + glDeleteRenderbuffers(1, &depth_buffer); + depth_buffer = 0; + } + } + + if (stencil_buffer == 0 && (attachment == QGLFramebufferObject::CombinedDepthStencil)) { + glGenRenderbuffers(1, &stencil_buffer); + Q_ASSERT(!glIsRenderbuffer(stencil_buffer)); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, stencil_buffer); + Q_ASSERT(glIsRenderbuffer(stencil_buffer)); + if (samples != 0 && glRenderbufferStorageMultisampleEXT) { +#ifdef QT_OPENGL_ES + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, + GL_STENCIL_INDEX8_EXT, size.width(), size.height()); +#else + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, + GL_STENCIL_INDEX_EXT, size.width(), size.height()); +#endif + } else { +#ifdef QT_OPENGL_ES + glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX8_EXT, + size.width(), size.height()); +#else + glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX_EXT, + size.width(), size.height()); +#endif + } + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, stencil_buffer); valid = checkFramebufferStatus(); - if (!valid) - glDeleteRenderbuffers(1, &depth_stencil_buffer); + if (!valid) { + glDeleteRenderbuffers(1, &stencil_buffer); + stencil_buffer = 0; + } + } + + // The FBO might have become valid after removing the depth or stencil buffer. + valid = checkFramebufferStatus(); + + if (depth_buffer && stencil_buffer) { + fbo_attachment = QGLFramebufferObject::CombinedDepthStencil; + } else if (depth_buffer) { + fbo_attachment = QGLFramebufferObject::Depth; } else { fbo_attachment = QGLFramebufferObject::NoAttachment; } @@ -539,6 +584,10 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glDeleteRenderbuffers(1, &color_buffer); else glDeleteTextures(1, &texture); + if (depth_buffer) + glDeleteRenderbuffers(1, &depth_buffer); + if (stencil_buffer && depth_buffer != stencil_buffer) + glDeleteRenderbuffers(1, &stencil_buffer); glDeleteFramebuffers(1, &fbo); fbo_guard.setId(0); } @@ -821,8 +870,10 @@ QGLFramebufferObject::~QGLFramebufferObject() glDeleteTextures(1, &d->texture); if (d->color_buffer) glDeleteRenderbuffers(1, &d->color_buffer); - if (d->depth_stencil_buffer) - glDeleteRenderbuffers(1, &d->depth_stencil_buffer); + if (d->depth_buffer) + glDeleteRenderbuffers(1, &d->depth_buffer); + if (d->stencil_buffer && d->stencil_buffer != d->depth_buffer) + glDeleteRenderbuffers(1, &d->stencil_buffer); GLuint fbo = d->fbo(); glDeleteFramebuffers(1, &fbo); } diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index d8ff012..58b4e9e 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -126,7 +126,7 @@ private: class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0) + QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_buffer(0), stencil_buffer(0) , color_buffer(0), valid(false), engine(0) {} ~QGLFramebufferObjectPrivate() {} @@ -136,7 +136,8 @@ public: bool checkFramebufferStatus() const; QGLSharedResourceGuard fbo_guard; GLuint texture; - GLuint depth_stencil_buffer; + GLuint depth_buffer; + GLuint stencil_buffer; GLuint color_buffer; GLenum target; QSize size; -- cgit v0.12 From 9333dd84757086c93b95a60e66f891883c36974e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Sep 2010 10:49:59 +0200 Subject: Update the ICC mkspec: keep the stack aligned to 16-byte After discussing with Intel, turns out that ICC defaults to aligning the stack when it needs to (e.g., when issuing aligned operations), but doesn't care otherwise. GCC, on the other hand, expects the stack to always be aligned and will issue instructions without checking. We'll probably add __attribute__((force_align_arg_pointer)) to some functions in our code, but we won't be able to catch everything. Reviewed-By: Bradley T. Hughes --- mkspecs/linux-icc/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index 3b26f7d..af56a9a 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -21,7 +21,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = yacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = +QMAKE_CFLAGS = -falign-stack=maintain-16-byte QMAKE_CFLAGS_DEPS = -M QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125 QMAKE_CFLAGS_WARN_OFF = -w -- cgit v0.12 From a9af4502e50bcbe80ff93fabb2da7f07a1dcf53b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Sep 2010 10:55:52 +0200 Subject: Make the de-inlined isRightToLeft not get called from updateProperties Before Qt 4.7, QString::isRightToLeft was an inline function that called QString::updateProperties(). In Qt 4.7, QString::isRightToLeft was de-inlined and is now called from QString::updateProperties(). According to the Binary Compatibility Guidelines, it's ok to de-inline a function provided that it's ok the old method is called. Under some rare circumstances nowadays, the old method could be called from updateProperties(), which would result in an infinite loop (updateProperties -> isRightToLeft -> updateProperties -> ...) This is usually prevented by -fvisibility-inlines-hidden in GCC (automatic in Qt) and also by -Wl,-Bsymbolic-functions (not automatic, must pass -reduced-relocations to configure). Reviewed-by: Bradley T. Hughes --- src/corelib/tools/qstring.cpp | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 3521b31..5be885b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6941,6 +6941,27 @@ QString QString::multiArg(int numArgs, const QString **args) const return result; } +static bool isStringRightToLeft(const ushort *p, const ushort *end) +{ + bool righttoleft = false; + while (p < end) { + switch(QChar::direction(*p)) + { + case QChar::DirL: + goto end; + case QChar::DirR: + case QChar::DirAL: + righttoleft = true; + goto end; + default: + break; + } + ++p; + } + end: + return righttoleft; +} + /*! \internal */ void QString::updateProperties() const @@ -6957,31 +6978,13 @@ void QString::updateProperties() const p++; } - d->righttoleft = isRightToLeft(); + d->righttoleft = isStringRightToLeft(d->data, d->data + d->size); d->clean = true; } bool QString::isRightToLeft() const { - ushort *p = d->data; - const ushort * const end = p + d->size; - bool righttoleft = false; - while (p < end) { - switch(QChar::direction(*p)) - { - case QChar::DirL: - goto end; - case QChar::DirR: - case QChar::DirAL: - righttoleft = true; - goto end; - default: - break; - } - ++p; - } - end: - return righttoleft; + return isStringRightToLeft(d->data, d->data + d->size); } /*! \fn bool QString::isSimpleText() const -- cgit v0.12 From 709eea77bf6e7b4539ae5268b5c2811a1551b1b0 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 22 Sep 2010 11:04:25 +0200 Subject: Revert "Keep other text format with QTextOption::SuppressColors tag on" This reverts commit 22ee6863458885c900e8294a44bd782acbdd8201. --- src/gui/text/qtextlayout.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a7f619e..f432b7e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2219,12 +2219,8 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR QTextCharFormat format; if (eng->hasFormats() || selection) { - format = eng->format(&si); - if (suppressColors) { - format.clearForeground(); - format.clearBackground(); - format.clearProperty(QTextFormat::TextUnderlineColor); - } + if (!suppressColors) + format = eng->format(&si); if (selection) format.merge(selection->format); -- cgit v0.12 From 63c4c0449361ced03838e51d18e1113740f27fa9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 22 Sep 2010 09:16:42 +0200 Subject: Mitigate private header problems in QtCreator by adding semi-private API Add a semi-private API to get QScriptEngine for a QDeclarativeEngine. So far the qmljsdebugger lib in QtCreator accessed the script engine via QDeclarativeEnginePrivate. Replace this by a minimal API that is still in a private header, where we nevertheless can make some BC checks/guarantees. Aaron Kennedy agreed with the idea. Task-number: QTCREATORBUG-2179 --- src/declarative/debugger/debugger.pri | 6 +- src/declarative/debugger/qdeclarativedebug_p.h | 1 - .../debugger/qdeclarativedebughelper.cpp | 13 +++++ .../debugger/qdeclarativedebughelper_p.h | 25 ++++++++ .../private_headers/qdeclarativedebughelper_p.h | 25 ++++++++ .../qdeclarativedebughelper.pro | 5 ++ .../tst_qdeclarativedebughelper.cpp | 68 ++++++++++++++++++++++ 7 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 src/declarative/debugger/qdeclarativedebughelper.cpp create mode 100644 src/declarative/debugger/qdeclarativedebughelper_p.h create mode 100644 tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h create mode 100644 tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro create mode 100644 tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 33d0843..25f7687 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -6,7 +6,8 @@ SOURCES += \ $$PWD/qdeclarativedebugservice.cpp \ $$PWD/qdeclarativedebugclient.cpp \ $$PWD/qdeclarativedebug.cpp \ - $$PWD/qdeclarativedebugtrace.cpp + $$PWD/qdeclarativedebugtrace.cpp \ + $$PWD/qdeclarativedebughelper.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ @@ -14,4 +15,5 @@ HEADERS += \ $$PWD/qdeclarativedebugservice_p.h \ $$PWD/qdeclarativedebugclient_p.h \ $$PWD/qdeclarativedebug_p.h \ - $$PWD/qdeclarativedebugtrace_p.h + $$PWD/qdeclarativedebugtrace_p.h \ + $$PWD/qdeclarativedebughelper_p.h diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h index f0fc488..2b1a115 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -365,7 +365,6 @@ private: int m_queryId; QVariant m_expr; QVariant m_result; - }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp new file mode 100644 index 0000000..99feff4 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -0,0 +1,13 @@ +#include "private/qdeclarativedebughelper_p.h" +#include "private/qdeclarativeengine_p.h" + +#include + +QT_BEGIN_NAMESPACE + +QScriptEngine *QDeclarativeDebugHelper::getScriptEngine(QDeclarativeEngine *engine) +{ + return QDeclarativeEnginePrivate::getScriptEngine(engine); +} + +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h new file mode 100644 index 0000000..a403c45 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebughelper_p.h @@ -0,0 +1,25 @@ +#ifndef QDECLARATIVEDEBUGHELPER_P_H +#define QDECLARATIVEDEBUGHELPER_P_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QScriptEngine; +class QDeclarativeEngine; + +// Helper methods to access private API through a stable interface +// This is used in the qmljsdebugger library of QtCreator. +class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper +{ +public: + static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h new file mode 100644 index 0000000..a403c45 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h @@ -0,0 +1,25 @@ +#ifndef QDECLARATIVEDEBUGHELPER_P_H +#define QDECLARATIVEDEBUGHELPER_P_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QScriptEngine; +class QDeclarativeEngine; + +// Helper methods to access private API through a stable interface +// This is used in the qmljsdebugger library of QtCreator. +class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper +{ +public: + static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro b/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro new file mode 100644 index 0000000..c52c652 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += network declarative script +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativedebughelper.cpp diff --git a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp new file mode 100644 index 0000000..db62455 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 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 +#include + +// We have copied the header which is used in the qmljsdebugger (part of QtCreator) +// to catch BC changes. Don't update it unless you know what you are doing! +#include "private_headers/qdeclarativedebughelper_p.h" + +class tst_qdeclarativedebughelper : public QObject { + Q_OBJECT +private slots: + void getScriptEngine(); +}; + +void tst_qdeclarativedebughelper::getScriptEngine() +{ + QDeclarativeEngine engine; + + QScriptEngine *scriptEngine = QDeclarativeDebugHelper::getScriptEngine(&engine); + QVERIFY(scriptEngine); + QCOMPARE(scriptEngine, QDeclarativeEnginePrivate::getScriptEngine(&engine)); +} + +QTEST_MAIN(tst_qdeclarativedebughelper) + +#include "tst_qdeclarativedebughelper.moc" + -- cgit v0.12 From a7c28aa588417c0a75f82d55019814443f889340 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 22 Sep 2010 11:35:39 +0200 Subject: Fix a crash with D&d on mingw The Drag&Drop callbacks need to be correctly aligned to not crash in the graphics SSE code. Task-number: QTBUG-13787 Reviewed-by: benjamin poulain --- src/gui/kernel/qdnd_win.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp index a164c2a..7083886 100644 --- a/src/gui/kernel/qdnd_win.cpp +++ b/src/gui/kernel/qdnd_win.cpp @@ -515,7 +515,7 @@ static inline Qt::MouseButtons keystate_to_mousebutton(DWORD grfKeyState) //--------------------------------------------------------------------- // IDropSource Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) { #ifdef QDND_DEBUG @@ -545,7 +545,7 @@ QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) } } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::GiveFeedback(DWORD dwEffect) { Qt::DropAction action = translateToQDragDropAction(dwEffect); @@ -626,7 +626,7 @@ QOleDropTarget::Release(void) // IDropTarget Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -688,7 +688,7 @@ void QOleDropTarget::sendDragEnterEvent(QWidget *dragEnterWidget, DWORD grfKeySt } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -758,7 +758,7 @@ QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) return NOERROR; } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragLeave() { #ifdef QDND_DEBUG @@ -785,7 +785,7 @@ QOleDropTarget::DragLeave() #define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON) -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG -- cgit v0.12 From 4035ec3e9ed5ef904dd6f22adaf5e9deb24e9455 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 22 Sep 2010 12:12:57 +0200 Subject: Revert "Fixed painter path drawing on FBO without stencil buffer." This reverts commit 89cbb165600de9a557a8a621dc41b93c2a7a2b52. The patch should be applied to Qt 4.8, not 4.7. --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 26 ---------------------- src/opengl/qglframebufferobject.cpp | 4 ---- 2 files changed, 30 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2347e66..aa217f6 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -866,32 +866,6 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) if (do_vectorpath_cache) path.makeCacheable(); - if (!device->format().stencil()) { - // If there is no stencil buffer, triangulate the path instead. - - QRectF bbox = path.controlPointRect(); - // If the path doesn't fit within these limits, it is possible that the triangulation will fail. - bool withinLimits = (bbox.left() > -0x8000 * inverseScale) - && (bbox.right() < 0x8000 * inverseScale) - && (bbox.top() > -0x8000 * inverseScale) - && (bbox.bottom() < 0x8000 * inverseScale); - if (withinLimits) { - QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); - - QVarLengthArray vertices(polys.vertices.size()); - for (int i = 0; i < polys.vertices.size(); ++i) - vertices[i] = float(inverseScale * polys.vertices.at(i)); - - prepareForDraw(currentBrush.isOpaque()); - setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); - glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.constData()); - } else { - // We can't handle big, concave painter paths with OpenGL without stencil buffer. - qWarning("Painter path exceeds +/-32767 pixels."); - } - return; - } - // The path is too complicated & needs the stencil technique vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale, false); diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 7c84946..ba23cab 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -324,10 +324,6 @@ void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f, fboFormat.setStencil(true); } else if (attachment == QGLFramebufferObject::Depth) { fboFormat.setDepth(true); - fboFormat.setStencil(false); - } else { - fboFormat.setDepth(false); - fboFormat.setStencil(false); } GLenum format = f->format().internalTextureFormat(); -- cgit v0.12 From 5120dfec47475dd37f51df4dda9a4ef8494036ab Mon Sep 17 00:00:00 2001 From: Misha Tyutyunik Date: Wed, 22 Sep 2010 10:06:01 +0200 Subject: QNAM: Use QFileNetworkReply for qrc:/ URL schema Resources do not need network access and can be quicker loaded with QFileNetworkReply. Reviewed-by: Markus Goetz --- src/network/access/qfilenetworkreply.cpp | 5 ++++- src/network/access/qnetworkaccessmanager.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/network/access/qfilenetworkreply.cpp b/src/network/access/qfilenetworkreply.cpp index 4ac9a8c..00bd29e 100644 --- a/src/network/access/qfilenetworkreply.cpp +++ b/src/network/access/qfilenetworkreply.cpp @@ -97,7 +97,10 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { - fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); + if (url.scheme() == QLatin1String("qrc")) + fileName = QLatin1Char(':') + url.path(); + else + fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } QFileInfo fi(fileName); diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b35c318..a637474 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -946,10 +946,10 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // fast path for GET on file:// URLs // Also if the scheme is empty we consider it a file. - // The QNetworkAccessFileBackend will right now only be used - // for PUT or qrc:// + // The QNetworkAccessFileBackend will right now only be used for PUT if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) && (req.url().scheme() == QLatin1String("file") + || req.url().scheme() == QLatin1String("qrc") || req.url().scheme().isEmpty())) { return new QFileNetworkReply(this, req, op); } -- cgit v0.12 From bed1c8091e5ee5287a2587874840eadcf2b3b5f8 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Wed, 22 Sep 2010 13:54:29 +0200 Subject: Doc: Added a note to qmake INSTALLS docs Task-number: QTBUG-3171 Reviewed-by: David Boddie --- doc/src/development/qmake-manual.qdoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index f4becf8..754b8ad 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1602,6 +1602,9 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 36 + Note that \c qmake will skip files that are executable. If you need to install + executable files, you can unset the files' executable flags. + \target LEXIMPLS \section1 LEXIMPLS -- cgit v0.12 From af50ff6fccf5b8828738d4cd13edb7949100b67b Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 22 Sep 2010 10:31:27 +0200 Subject: XML schema internals: fix memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch-by: Tobias König Task-number: QTBUG-8948 --- src/xmlpatterns/schema/qxsdtypechecker.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp index 4bb03f5..217932e 100644 --- a/src/xmlpatterns/schema/qxsdtypechecker.cpp +++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp @@ -171,6 +171,7 @@ XsdTypeChecker::XsdTypeChecker(const XsdSchemaContext::Ptr &context, const QVect XsdTypeChecker::~XsdTypeChecker() { + delete m_reflection; } QString XsdTypeChecker::normalizedValue(const QString &value, const XsdFacet::Hash &facets) -- cgit v0.12 From b93947f5a25b3cc021518b944dc96b892f672bd3 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Sep 2010 14:18:44 +0200 Subject: QThread: make sure start works even if called after exit Regression in 4.7.0 introduced by 13ca61fcfdc53a6a06a Reviewed-by: brad Task-number: QTBUG-13810 --- src/corelib/thread/qthread_unix.cpp | 2 ++ src/corelib/thread/qthread_win.cpp | 2 ++ tests/auto/qthread/tst_qthread.cpp | 41 +++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 2824e15..a7601b6 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -514,6 +514,8 @@ void QThread::start(Priority priority) d->running = true; d->finished = false; d->terminated = false; + d->returnCode = 0; + d->exited = false; pthread_attr_t attr; pthread_attr_init(&attr); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 37d5b87..f0cbe8d 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -405,6 +405,8 @@ void QThread::start(Priority priority) d->running = true; d->finished = false; d->terminated = false; + d->exited = false; + d->returnCode = 0; /* NOTE: we create the thread in the suspended state, set the diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 7a5b053..843749a 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef Q_OS_UNIX #include @@ -104,6 +105,8 @@ private slots: void adoptedThreadFinished(); void adoptMultipleThreads(); + void QTBUG13810_exitAndStart(); + void stressTest(); }; @@ -934,6 +937,44 @@ void tst_QThread::stressTest() } } +class Syncronizer : public QObject +{ Q_OBJECT +public slots: + void setProp(int p) { + if(m_prop != p) { + m_prop = p; + emit propChanged(p); + } + } +signals: + void propChanged(int); +public: + Syncronizer() : m_prop(42) {} + int m_prop; +}; + +void tst_QThread::QTBUG13810_exitAndStart() +{ + QThread thread; + thread.exit(555); //should do nothing + + thread.start(); + + //test that the thread is running by executing queued connected signal there + Syncronizer sync1; + sync1.moveToThread(&thread); + Syncronizer sync2; + sync2.moveToThread(&thread); + connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection); + connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection); + QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89)); + QTest::qWait(50); + while(!thread.wait(10)) + QTest::qWait(10); + QCOMPARE(sync2.m_prop, 89); + QCOMPARE(sync1.m_prop, 89); +} + QTEST_MAIN(tst_QThread) #include "tst_qthread.moc" -- cgit v0.12 From 56bb732f1628fb23b98a2554348b309f634ca55f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Sep 2010 17:05:05 +0200 Subject: Quick performance optimisation: cache a QString with "org.freedesktop.DBus" Reviewed-By: Robin Burchell Reviewed-By: Ritt Konstantin --- src/dbus/qdbusintegrator.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 3833874..cf6ca28 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -71,6 +71,17 @@ QT_BEGIN_NAMESPACE static bool isDebugging; #define qDBusDebug if (!::isDebugging); else qDebug +Q_GLOBAL_STATIC_WITH_ARGS(const QString, orgFreedesktopDBusString, (QLatin1String(DBUS_SERVICE_DBUS))) + +static inline QString dbusServiceString() +{ return *orgFreedesktopDBusString(); } +static inline QString dbusInterfaceString() +{ + // it's the same string, but just be sure + Q_ASSERT(*orgFreedesktopDBusString() == QLatin1String(DBUS_INTERFACE_DBUS)); + return *orgFreedesktopDBusString(); +} + static inline QDebug operator<<(QDebug dbg, const QThread *th) { dbg.nospace() << "QThread(ptr=" << (void*)th; @@ -1675,10 +1686,9 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service"); } - QString busService = QLatin1String(DBUS_SERVICE_DBUS); - connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), + connectSignal(dbusServiceString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), this, SLOT(registerService(QString))); - connectSignal(busService, QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(), + connectSignal(dbusServiceString(), QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(), this, SLOT(unregisterService(QString))); @@ -2069,8 +2079,7 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; if (++data.refcount == 1) { // we need to watch for this service changing - QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); - connectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), + connectSignal(dbusServiceString(), QString(), dbusInterfaceString(), QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); data.owner = getNameOwnerNoCache(hook.service); @@ -2149,8 +2158,7 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) if (sit != watchedServices.end()) { if (--sit.value().refcount == 0) { watchedServices.erase(sit); - QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS); - disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS), + disconnectSignal(dbusServiceString(), QString(), dbusInterfaceString(), QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } @@ -2272,8 +2280,8 @@ QString QDBusConnectionPrivate::getNameOwner(const QString& serviceName) QString QDBusConnectionPrivate::getNameOwnerNoCache(const QString &serviceName) { - QDBusMessage msg = QDBusMessage::createMethodCall(QLatin1String(DBUS_SERVICE_DBUS), - QLatin1String(DBUS_PATH_DBUS), QLatin1String(DBUS_INTERFACE_DBUS), + QDBusMessage msg = QDBusMessage::createMethodCall(dbusServiceString(), + QLatin1String(DBUS_PATH_DBUS), dbusInterfaceString(), QLatin1String("GetNameOwner")); QDBusMessagePrivate::setParametersValidated(msg, true); msg << serviceName; -- cgit v0.12 From ad1fe7574f36dc54a1a0050308c52fc15e757842 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Sep 2010 17:07:29 +0200 Subject: Pre-populate the watched services hash with org.freedesktop.DBus The D-Bus specification doesn't require GetNameOwner("org.freedesktop.DBus") to return anything in specific, but the reference implementation always returns "org.freedesktop.DBus". The Python D-Bus bindings even require it. So add the same assumption to QtDBus, which saves a round-trip at the application start to ask the server what its own owner is Reviewed-By: Robin Burchell Reviewed-By: Ritt Konstantin --- src/dbus/qdbusconnection_p.h | 3 +++ src/dbus/qdbusintegrator.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 81af2c7..1bd00da 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -160,6 +160,9 @@ public: struct WatchedServiceData { WatchedServiceData() : refcount(0) {} + WatchedServiceData(const QString &owner, int refcount = 0) + : owner(owner), refcount(refcount) + {} QString owner; int refcount; }; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index cf6ca28..c7b531e 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -973,6 +973,10 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) QDBusMetaTypeId::init(); rootNode.flags = 0; + + // prepopulate watchedServices: + // we know that the owner of org.freedesktop.DBus is itself + watchedServices.insert(dbusServiceString(), WatchedServiceData(dbusServiceString(), 1)); } QDBusConnectionPrivate::~QDBusConnectionPrivate() -- cgit v0.12 From 2d3836c44ac0e97b1f7301668f0241a57aff9c4a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Sep 2010 17:12:53 +0200 Subject: Save the D-Bus's base service earlier. It's impossible for it not to be present, so there's no need to test for it. Reviewed-By: Robin Burchell Reviewed-By: Ritt Konstantin --- src/dbus/qdbusintegrator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index c7b531e..3deb738 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1661,6 +1661,10 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError connection = dbc; mode = ClientMode; + const char *service = q_dbus_bus_get_unique_name(connection); + Q_ASSERT(service); + baseService = QString::fromUtf8(service); + q_dbus_connection_set_exit_on_disconnect(connection, false); q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch, qDBusToggleWatch, this, 0); @@ -1671,7 +1675,6 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError // Initialize the match rules // We want all messages that have us as destination // signals don't have destinations, but connectSignal() takes care of them - const char *service = q_dbus_bus_get_unique_name(connection); if (service) { QVarLengthArray filter; filter.append("destination='", 13); @@ -1685,7 +1688,6 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError return; } - baseService = QString::fromUtf8(service); } else { qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service"); } -- cgit v0.12 From e824d627a8702926e81d4d5605f1a372044fbc2c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Sep 2010 15:01:59 +0200 Subject: We don't need to add a match rule to receive messages targetted at us. This wasn't explicit in the D-Bus specification until recently. The reference implementation of the daemon already does it. Task-number: QT-3881 Reviewed-By: Robin Burchell Reviewed-By: Ritt Konstantin --- src/dbus/qdbusintegrator.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 3deb738..98d6a32 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1673,24 +1673,6 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); // Initialize the match rules - // We want all messages that have us as destination - // signals don't have destinations, but connectSignal() takes care of them - if (service) { - QVarLengthArray filter; - filter.append("destination='", 13); - filter.append(service, qstrlen(service)); - filter.append("\'\0", 2); - - QDBusErrorInternal error; - q_dbus_bus_add_match(connection, filter.constData(), error); - if (handleError(error)) { - closeConnection(); - return; - } - - } else { - qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service"); - } connectSignal(dbusServiceString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), this, SLOT(registerService(QString))); -- cgit v0.12 From ef2fcad61a316e36383e8b1e437699837f0baeda Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Sep 2010 19:40:32 +0200 Subject: Avoid adding match rules for NameAcquired and NameLost These two signals from org.freedesktop.DBus are delivered no matter what, because they are directed signals. So we don't need to add match rules for it. QDBusConnectionPrivate::connectSignal builds a match rule and adds it, so we shouldn't use it. Task-number: QT-3881 Reviewed-By: Robin Burchell Reviewed-By: Ritt Konstantin --- src/dbus/qdbusintegrator.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 98d6a32..4efea75 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1671,17 +1671,25 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout, qDBusToggleTimeout, this, 0); q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0); - - // Initialize the match rules - - connectSignal(dbusServiceString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), - this, SLOT(registerService(QString))); - connectSignal(dbusServiceString(), QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(), - this, SLOT(unregisterService(QString))); - - q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); + // Initialize the hooks for the NameAcquired and NameLost signals + // we don't use connectSignal here because we don't need the rules to be sent to the bus + // the bus will always send us these two signals + SignalHook hook; + hook.service = dbusServiceString(); + hook.path.clear(); // no matching + hook.obj = this; + hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void + + hook.midx = staticMetaObject.indexOfSlot("registerService(QString)"); + Q_ASSERT(hook.midx != -1); + signalHooks.insert(QLatin1String("NameAcquired:" DBUS_INTERFACE_DBUS), hook); + + hook.midx = staticMetaObject.indexOfSlot("unregisterService(QString)"); + Q_ASSERT(hook.midx != -1); + signalHooks.insert(QLatin1String("NameLost:" DBUS_INTERFACE_DBUS), hook); + qDBusDebug() << this << ": connected successfully"; // schedule a dispatch: -- cgit v0.12 From 42f7c123e95c6d9f1d0ece648f61defa79627ab8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Sep 2010 19:48:45 +0200 Subject: We also don't need to watch for org.freedesktop.DBus changing owners It never does. Task-number: QT-3881 Reviewed-By: Robin Burchell Reviewed-By: Ritt Konstantin --- src/dbus/qdbusintegrator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 4efea75..31588e7 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -977,6 +977,10 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) // prepopulate watchedServices: // we know that the owner of org.freedesktop.DBus is itself watchedServices.insert(dbusServiceString(), WatchedServiceData(dbusServiceString(), 1)); + + // prepopulate matchRefCounts: + // we know that org.freedesktop.DBus will never change owners + matchRefCounts.insert("type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.DBus'", 1); } QDBusConnectionPrivate::~QDBusConnectionPrivate() -- cgit v0.12 From 3263e0d971ac263e42078064b3f275dff4f62650 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Sep 2010 15:16:01 +0200 Subject: Fix warning on MSVC Reviewed-by: Thierry --- src/gui/styles/qstylehelper_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h index 71fce55..3759929 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/gui/styles/qstylehelper_p.h @@ -108,7 +108,7 @@ template { typedef HexString type; enum { ExactSize = true }; - static int size(const HexString &str) { return sizeof(str.val) * 2; } + static int size(const HexString &) { return sizeof(T) * 2; } static inline void appendTo(const HexString &str, QChar *&out) { str.write(out); } }; -- cgit v0.12 From 88b5af89e35584f12330bc6932176d5df413d1b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 22 Sep 2010 16:11:02 +0200 Subject: Fixed drawing of QPixmaps with masks in the GL 2 and X11 engines. A regression from 4.6.x. This is an X11-only problem caused by the separate masks that an X11 QPixmap can contain. These masks we're not taken into account when a number optimizations were done for 4.7. Introduction of the texture-from-pixmap extension in 4.6 also broke masked pixmaps under X11. Task-number: QTBUG-13814 Reviewed-by: Samuel --- src/gui/image/qpixmap_x11.cpp | 11 ++++++++++- src/gui/image/qpixmap_x11_p.h | 1 + src/gui/image/qpixmapdata.cpp | 5 +++++ src/gui/image/qpixmapdata_p.h | 1 + src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- src/opengl/qgl_x11.cpp | 4 ++++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 3d9c363..32676ba 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1321,6 +1321,15 @@ QBitmap QX11PixmapData::mask() const return mask; } +bool QX11PixmapData::hasMask() const +{ + return +#ifndef QT_NO_XRENDER + (picture && d == 32) || +#endif + (d == 1) || x11_mask; +} + /*! Sets a mask bitmap. @@ -1549,7 +1558,7 @@ QImage QX11PixmapData::toImage(const QRect &rect) const if (!xiWrapper.xi) return QImage(); - if (canTakeQImageFromXImage(xiWrapper)) + if (!x11_mask && canTakeQImageFromXImage(xiWrapper)) return takeQImageFromXImage(xiWrapper); QImage image = toImage(xiWrapper, rect); diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index 821fb69..fcad1a2 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -82,6 +82,7 @@ public: void fill(const QColor &color); QBitmap mask() const; + bool hasMask() const; void setMask(const QBitmap &mask); bool hasAlphaChannel() const; void setAlphaChannel(const QPixmap &alphaChannel); diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index ef1f6c4..2813ed1 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -239,6 +239,11 @@ QBitmap QPixmapData::mask() const return QBitmap::fromImage(mask); } +bool QPixmapData::hasMask() const +{ + return hasAlphaChannel(); +} + QPixmap QPixmapData::transformed(const QTransform &matrix, Qt::TransformationMode mode) const { diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index ec62b0b..c341930 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -99,6 +99,7 @@ public: virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; virtual void fill(const QColor &color) = 0; virtual QBitmap mask() const; + virtual bool hasMask() const; virtual void setMask(const QBitmap &mask); virtual bool hasAlphaChannel() const = 0; virtual QPixmap transformed(const QTransform &matrix, diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index aa217f6..6eb5a36 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1314,7 +1314,7 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c QGLRect srcRect(src.left(), top, src.right(), bottom); bool isBitmap = pixmap.isQBitmap(); - bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel(); + bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel() && !pixmap.pixmapData()->hasMask(); d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index f3a4c95..7f4c670 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1776,6 +1776,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons QX11PixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); + // We can't use TFP if the pixmap has a separate X11 mask + if (pixmapData->x11_mask) + return 0; + if (!qt_resolveTextureFromPixmap(paintDevice)) return 0; -- cgit v0.12 From c1a7deedf1628e0dd3a5fbf92d97c4151d17fb5a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 22 Sep 2010 09:16:42 +0200 Subject: Mitigate private header problems in QtCreator by adding semi-private API Add a semi-private API to get QScriptEngine for a QDeclarativeEngine. So far the qmljsdebugger lib in QtCreator accessed the script engine via QDeclarativeEnginePrivate. Replace this by a minimal API that is still in a private header, where we nevertheless can make some BC checks/guarantees. Aaron Kennedy agreed with the idea. Task-number: QTCREATORBUG-2179 --- .../debugger/qdeclarativedebughelper.cpp | 56 ++++++++++++++++++++++ .../debugger/qdeclarativedebughelper_p.h | 42 ++++++++++++++++ .../private_headers/qdeclarativedebughelper_p.h | 42 ++++++++++++++++ .../tst_qdeclarativedebughelper.cpp | 47 ++++++++++++++++++ 4 files changed, 187 insertions(+) diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp index 99feff4..ea621bf 100644 --- a/src/declarative/debugger/qdeclarativedebughelper.cpp +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -3,6 +3,55 @@ #include +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative 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 "private/qdeclarativedebughelper_p.h" + +#include +#include + +#include +#include + QT_BEGIN_NAMESPACE QScriptEngine *QDeclarativeDebugHelper::getScriptEngine(QDeclarativeEngine *engine) @@ -10,4 +59,11 @@ QScriptEngine *QDeclarativeDebugHelper::getScriptEngine(QDeclarativeEngine *engi return QDeclarativeEnginePrivate::getScriptEngine(engine); } +void QDeclarativeDebugHelper::setAnimationSlowDownFactor(qreal factor) +{ + QUnifiedTimer *timer = QUnifiedTimer::instance(); + timer->setSlowModeEnabled(factor != 1.0); + timer->setSlowdownFactor(factor); +} + QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h index a403c45..c9cb839 100644 --- a/src/declarative/debugger/qdeclarativedebughelper_p.h +++ b/src/declarative/debugger/qdeclarativedebughelper_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative 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 QDECLARATIVEDEBUGHELPER_P_H #define QDECLARATIVEDEBUGHELPER_P_H @@ -16,6 +57,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper { public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); + static void setAnimationSlowDownFactor(qreal factor); }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h index a403c45..c9cb839 100644 --- a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h +++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative 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 QDECLARATIVEDEBUGHELPER_P_H #define QDECLARATIVEDEBUGHELPER_P_H @@ -16,6 +57,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper { public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); + static void setAnimationSlowDownFactor(qreal factor); }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp index db62455..36f2222 100644 --- a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp +++ b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp @@ -42,6 +42,8 @@ #include #include +#include +#include // We have copied the header which is used in the qmljsdebugger (part of QtCreator) // to catch BC changes. Don't update it unless you know what you are doing! @@ -51,6 +53,21 @@ class tst_qdeclarativedebughelper : public QObject { Q_OBJECT private slots: void getScriptEngine(); + void setAnimationSlowDownFactor(); +}; + +class TestAnimation : public QAbstractAnimation { +public: + int updateCalled; + + TestAnimation() : updateCalled(0) {} + + virtual void updateCurrentTime(int /*currentTime*/) { + updateCalled++; + } + virtual int duration() const { + return 100; + } }; void tst_qdeclarativedebughelper::getScriptEngine() @@ -62,6 +79,36 @@ void tst_qdeclarativedebughelper::getScriptEngine() QCOMPARE(scriptEngine, QDeclarativeEnginePrivate::getScriptEngine(&engine)); } +void tst_qdeclarativedebughelper::setAnimationSlowDownFactor() +{ + TestAnimation animation; + + // first check whether setup works + QCOMPARE(animation.updateCalled, 0); + animation.start(); + QTest::qWait(animation.totalDuration() + 50); +#ifdef Q_OS_WIN + if (animation.state() != QAbstractAnimation::Stopped) + QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort); +#endif + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); + QVERIFY(animation.updateCalled > 1); + + // check if we can pause all animations + animation.updateCalled = 0; + QDeclarativeDebugHelper::setAnimationSlowDownFactor(0.0); + animation.start(); + QTest::qWait(animation.totalDuration() + 50); + QVERIFY(animation.updateCalled <= 1); // updateCurrentTime seems to be called at least once + + // now run them again + animation.updateCalled = 0; + QDeclarativeDebugHelper::setAnimationSlowDownFactor(2.0); + animation.start(); + QTest::qWait(animation.totalDuration() + 50); + QVERIFY(animation.updateCalled > 1); +} + QTEST_MAIN(tst_qdeclarativedebughelper) #include "tst_qdeclarativedebughelper.moc" -- cgit v0.12 From c9dfb50c7d718028a1d24fdf78fdb61aa61866ca Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Sep 2010 17:13:04 +0200 Subject: Fix compilation Reviewed-by: Kim --- src/opengl/qglframebufferobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index ba23cab..6c9b288 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -543,14 +543,14 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, GL_STENCIL_INDEX8_EXT, size.width(), size.height()); #else glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, - GL_STENCIL_INDEX_EXT, size.width(), size.height()); + GL_STENCIL_INDEX, size.width(), size.height()); #endif } else { #ifdef QT_OPENGL_ES glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX8_EXT, size.width(), size.height()); #else - glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX_EXT, + glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX, size.width(), size.height()); #endif } -- cgit v0.12 From a8ddc56b1d80b16a3229286d7f0e02323c4203bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 22 Sep 2010 16:57:31 +0200 Subject: Setting QGraphicsItem::ItemClipsChildrenToShape forces ItemClipsToShape Problem was that setting ItemClipsChildrenToShape on an item resulted in item itself being clipped to its own shape (ItemClipsToShape). This commit also reduces state changes on the painter and re-uses the clip whenever possible, which in turn means better performance for items that clip children to shape. Auto test included. Task-number: QTBUG-12760 --- src/gui/graphicsview/qgraphicsscene.cpp | 124 ++++++++++------ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 188 +++++++++++++++++++++++++ 2 files changed, 267 insertions(+), 45 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 54fdf3f..38612a8 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4814,6 +4814,27 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * } } +static inline void setClip(QPainter *painter, QGraphicsItem *item) +{ + painter->save(); + QRectF clipRect; + const QPainterPath clipPath(item->shape()); + if (QPathClipper::pathToRect(clipPath, &clipRect)) + painter->setClipRect(clipRect, Qt::IntersectClip); + else + painter->setClipPath(clipPath, Qt::IntersectClip); +} + +static inline void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, + const QTransform *effectTransform) +{ + Q_ASSERT(transformPtr); + if (effectTransform) + painter->setWorldTransform(*transformPtr * *effectTransform); + else + painter->setWorldTransform(*transformPtr); +} + void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform, const QTransform *const transformPtr, QRegion *exposedRegion, QWidget *widget, qreal opacity, const QTransform *effectTransform, @@ -4822,36 +4843,37 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); const bool itemHasChildren = !item->d_ptr->children.isEmpty(); + bool setChildClip = itemClipsChildrenToShape; + bool itemHasChildrenStackedBehind = false; int i = 0; if (itemHasChildren) { + if (itemClipsChildrenToShape) + setWorldTransform(painter, transformPtr, effectTransform); + item->d_ptr->ensureSortedChildren(); + // Items with the 'ItemStacksBehindParent' flag are put in front of the list + // so all we have to do is to check the first item. + itemHasChildrenStackedBehind = (item->d_ptr->children.at(0)->d_ptr->flags + & QGraphicsItem::ItemStacksBehindParent); - if (itemClipsChildrenToShape) { - painter->save(); - Q_ASSERT(transformPtr); - if (effectTransform) - painter->setWorldTransform(*transformPtr * *effectTransform); - else - painter->setWorldTransform(*transformPtr); - QRectF clipRect; - const QPainterPath clipPath(item->shape()); - if (QPathClipper::pathToRect(clipPath, &clipRect)) - painter->setClipRect(clipRect, Qt::IntersectClip); - else - painter->setClipPath(clipPath, Qt::IntersectClip); - } + if (itemHasChildrenStackedBehind) { + if (itemClipsChildrenToShape) { + setClip(painter, item); + setChildClip = false; + } - // Draw children behind - for (i = 0; i < item->d_ptr->children.size(); ++i) { - QGraphicsItem *child = item->d_ptr->children.at(i); - if (wasDirtyParentSceneTransform) - child->d_ptr->dirtySceneTransform = 1; - if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) - break; - if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) - continue; - drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); + // Draw children behind + for (i = 0; i < item->d_ptr->children.size(); ++i) { + QGraphicsItem *child = item->d_ptr->children.at(i); + if (wasDirtyParentSceneTransform) + child->d_ptr->dirtySceneTransform = 1; + if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) + break; + if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) + continue; + drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); + } } } @@ -4864,38 +4886,50 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q ? *exposedRegion : QRegion(), exposedRegion == 0); const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; - const bool savePainter = itemClipsToShape || painterStateProtection; - if (savePainter) - painter->save(); + bool restorePainterClip = false; if (!itemHasChildren || !itemClipsChildrenToShape) { - if (effectTransform) - painter->setWorldTransform(*transformPtr * *effectTransform); - else - painter->setWorldTransform(*transformPtr); + // Item does not have children or clip children to shape. + setWorldTransform(painter, transformPtr, effectTransform); + if ((restorePainterClip = itemClipsToShape)) + setClip(painter, item); + } else if (itemHasChildrenStackedBehind){ + // Item clips children to shape and has children stacked behind, which means + // the painter is already clipped to the item's shape. + if (itemClipsToShape) { + // The clip is already correct. Ensure correct world transform. + setWorldTransform(painter, transformPtr, effectTransform); + } else { + // Remove clip (this also ensures correct world transform). + painter->restore(); + setChildClip = true; + } + } else if (itemClipsToShape) { + // Item clips children and itself to shape. It does not have hildren stacked + // behind, which means the clip has not yet been set. We set it now and re-use it + // for the children. + setClip(painter, item); + setChildClip = false; } - if (itemClipsToShape) { - QRectF clipRect; - const QPainterPath clipPath(item->shape()); - if (QPathClipper::pathToRect(clipPath, &clipRect)) - painter->setClipRect(clipRect, Qt::IntersectClip); - else - painter->setClipPath(clipPath, Qt::IntersectClip); - } - painter->setOpacity(opacity); + if (painterStateProtection && !restorePainterClip) + painter->save(); + painter->setOpacity(opacity); if (!item->d_ptr->cacheMode && !item->d_ptr->isWidget) item->paint(painter, &styleOptionTmp, widget); else drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection); - if (savePainter) + if (painterStateProtection || restorePainterClip) painter->restore(); } // Draw children in front if (itemHasChildren) { + if (setChildClip) + setClip(painter, item); + for (; i < item->d_ptr->children.size(); ++i) { QGraphicsItem *child = item->d_ptr->children.at(i); if (wasDirtyParentSceneTransform) @@ -4904,11 +4938,11 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q continue; drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); } - } - // Restore child clip - if (itemHasChildren && itemClipsChildrenToShape) - painter->restore(); + // Restore child clip + if (itemClipsChildrenToShape) + painter->restore(); + } } void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren, diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 4476084..25ec040 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -377,6 +377,7 @@ private slots: void itemClipsChildrenToShape2(); void itemClipsChildrenToShape3(); void itemClipsChildrenToShape4(); + void itemClipsChildrenToShape5(); void itemClipsTextChildToShape(); void itemClippingDiscovery(); void ancestorFlags(); @@ -5464,6 +5465,193 @@ void tst_QGraphicsItem::itemClipsChildrenToShape4() QTRY_COMPARE(innerWidget->painted, true); } +//#define DEBUG_ITEM_CLIPS_CHILDREN_TO_SHAPE_5 +static inline void renderSceneToImage(QGraphicsScene *scene, QImage *image, const QString &filename) +{ + image->fill(0); + QPainter painter(image); + scene->render(&painter); + painter.end(); +#ifdef DEBUG_ITEM_CLIPS_CHILDREN_TO_SHAPE_5 + image->save(filename); +#else + Q_UNUSED(filename); +#endif +} + +void tst_QGraphicsItem::itemClipsChildrenToShape5() +{ + class ParentItem : public QGraphicsRectItem + { + public: + ParentItem(qreal x, qreal y, qreal width, qreal height) + : QGraphicsRectItem(x, y, width, height) {} + + QPainterPath shape() const + { + QPainterPath path; + path.addRect(50, 50, 200, 200); + return path; + } + }; + + ParentItem *parent = new ParentItem(0, 0, 300, 300); + parent->setBrush(Qt::blue); + parent->setOpacity(0.5); + + const QRegion parentRegion(0, 0, 300, 300); + const QRegion clippedParentRegion = parentRegion & QRect(50, 50, 200, 200); + QRegion childRegion; + QRegion grandChildRegion; + + QGraphicsRectItem *topLeftChild = new QGraphicsRectItem(0, 0, 100, 100); + topLeftChild->setBrush(Qt::red); + topLeftChild->setParentItem(parent); + childRegion += QRect(0, 0, 100, 100); + + QGraphicsRectItem *topRightChild = new QGraphicsRectItem(0, 0, 100, 100); + topRightChild->setBrush(Qt::red); + topRightChild->setParentItem(parent); + topRightChild->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + topRightChild->setPos(200, 0); + childRegion += QRect(200, 0, 100, 100); + + QGraphicsRectItem *topRightGrandChild = new QGraphicsRectItem(0, 0, 100, 100); + topRightGrandChild->setBrush(Qt::green); + topRightGrandChild->setParentItem(topRightChild); + topRightGrandChild->setPos(-40, 40); + grandChildRegion += QRect(200 - 40, 0 + 40, 100, 100) & QRect(200, 0, 100, 100); + + QGraphicsRectItem *bottomLeftChild = new QGraphicsRectItem(0, 0, 100, 100); + bottomLeftChild->setBrush(Qt::red); + bottomLeftChild->setParentItem(parent); + bottomLeftChild->setFlag(QGraphicsItem::ItemClipsToShape); + bottomLeftChild->setPos(0, 200); + childRegion += QRect(0, 200, 100, 100); + + QGraphicsRectItem *bottomLeftGrandChild = new QGraphicsRectItem(0, 0, 160, 160); + bottomLeftGrandChild->setBrush(Qt::green); + bottomLeftGrandChild->setParentItem(bottomLeftChild); + bottomLeftGrandChild->setFlag(QGraphicsItem::ItemClipsToShape); + bottomLeftGrandChild->setPos(0, -60); + grandChildRegion += QRect(0, 200 - 60, 160, 160); + + QGraphicsRectItem *bottomRightChild = new QGraphicsRectItem(0, 0, 100, 100); + bottomRightChild->setBrush(Qt::red); + bottomRightChild->setParentItem(parent); + bottomRightChild->setPos(200, 200); + childRegion += QRect(200, 200, 100, 100); + + QPoint controlPoints[17] = { + QPoint(5, 5) , QPoint(95, 5) , QPoint(205, 5) , QPoint(295, 5) , + QPoint(5, 95) , QPoint(95, 95) , QPoint(205, 95) , QPoint(295, 95) , + QPoint(150, 150), + QPoint(5, 205), QPoint(95, 205), QPoint(205, 205), QPoint(295, 205), + QPoint(5, 295), QPoint(95, 295), QPoint(205, 295), QPoint(295, 295), + }; + + const QRegion clippedChildRegion = childRegion & QRect(50, 50, 200, 200); + const QRegion clippedGrandChildRegion = grandChildRegion & QRect(50, 50, 200, 200); + + QGraphicsScene scene; + scene.addItem(parent); + QImage sceneImage(300, 300, QImage::Format_ARGB32); + +#define VERIFY_CONTROL_POINTS(pRegion, cRegion, gRegion) \ + for (int i = 0; i < 17; ++i) { \ + QPoint controlPoint = controlPoints[i]; \ + QRgb pixel = sceneImage.pixel(controlPoint.x(), controlPoint.y()); \ + if (pRegion.contains(controlPoint)) \ + QVERIFY(qBlue(pixel) != 0); \ + else \ + QVERIFY(qBlue(pixel) == 0); \ + if (cRegion.contains(controlPoint)) \ + QVERIFY(qRed(pixel) != 0); \ + else \ + QVERIFY(qRed(pixel) == 0); \ + if (gRegion.contains(controlPoint)) \ + QVERIFY(qGreen(pixel) != 0); \ + else \ + QVERIFY(qGreen(pixel) == 0); \ + } + + const QList children = parent->childItems(); + const int childrenCount = children.count(); + + for (int i = 0; i < 5; ++i) { + QString clipString; + QString childString; + switch (i) { + case 0: + // All children stacked in front. + childString = QLatin1String("ChildrenInFront.png"); + foreach (QGraphicsItem *child, children) + child->setFlag(QGraphicsItem::ItemStacksBehindParent, false); + break; + case 1: + // All children stacked behind. + childString = QLatin1String("ChildrenBehind.png"); + foreach (QGraphicsItem *child, children) + child->setFlag(QGraphicsItem::ItemStacksBehindParent, true); + break; + case 2: + // First half of the children behind, second half in front. + childString = QLatin1String("FirstHalfBehind_SecondHalfInFront.png"); + for (int j = 0; j < childrenCount; ++j) { + QGraphicsItem *child = children.at(j); + child->setFlag(QGraphicsItem::ItemStacksBehindParent, (j < childrenCount / 2)); + } + break; + case 3: + // First half of the children in front, second half behind. + childString = QLatin1String("FirstHalfInFront_SecondHalfBehind.png"); + for (int j = 0; j < childrenCount; ++j) { + QGraphicsItem *child = children.at(j); + child->setFlag(QGraphicsItem::ItemStacksBehindParent, (j >= childrenCount / 2)); + } + break; + case 4: + // Child2 and child4 behind, rest in front. + childString = QLatin1String("Child2And4Behind_RestInFront.png"); + for (int j = 0; j < childrenCount; ++j) { + QGraphicsItem *child = children.at(j); + if (j == 1 || j == 3) + child->setFlag(QGraphicsItem::ItemStacksBehindParent, true); + else + child->setFlag(QGraphicsItem::ItemStacksBehindParent, false); + } + break; + default: + qFatal("internal error"); + } + + // Nothing is clipped. + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + parent->setFlag(QGraphicsItem::ItemClipsToShape, false); + clipString = QLatin1String("nothingClipped_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(parentRegion, childRegion, grandChildRegion); + + // Parent clips children to shape. + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + clipString = QLatin1String("parentClipsChildrenToShape_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(parentRegion, clippedChildRegion, clippedGrandChildRegion); + + // Parent clips itself and children to shape. + parent->setFlag(QGraphicsItem::ItemClipsToShape); + clipString = QLatin1String("parentClipsItselfAndChildrenToShape_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(clippedParentRegion, clippedChildRegion, clippedGrandChildRegion); + + // Parent clips itself to shape. + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + clipString = QLatin1String("parentClipsItselfToShape_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(clippedParentRegion, childRegion, grandChildRegion); + } +} + void tst_QGraphicsItem::itemClipsTextChildToShape() { // Construct a scene with a rect that clips its children, with one text -- cgit v0.12 From eaeaba06cea2ca0668a3c904744bab06b11077d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 22 Sep 2010 17:52:13 +0200 Subject: QPainter not restored correctly in Graphics View. World transform and opacity was sometimes not restored correctly after drawing items. Auto test included. Task-number: Discovered while working on QTBUG-12760 --- src/gui/graphicsview/qgraphicsscene.cpp | 2 ++ src/gui/graphicsview/qgraphicsview.cpp | 3 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 48 +++++++++++++++++++++++--- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 38612a8..8dc15bf 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5305,6 +5305,7 @@ void QGraphicsScene::drawItems(QPainter *painter, if (!d->unpolishedItems.isEmpty()) d->_q_polishItems(); + const qreal opacity = painter->opacity(); QTransform viewTransform = painter->worldTransform(); Q_UNUSED(options); @@ -5338,6 +5339,7 @@ void QGraphicsScene::drawItems(QPainter *painter, topLevelItems.at(i)->d_ptr->itemDiscovered = 0; painter->setWorldTransform(viewTransform); + painter->setOpacity(opacity); } /*! diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index c8aca80..a566c8e 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3475,7 +3475,8 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // IndirectPainting (the else branch), because in that case we always save() // and restore() in QGraphicsScene::drawItems(). if (!d->scene->d_func()->painterStateProtection) - painter.setWorldTransform(viewTransform); + painter.setOpacity(1.0); + painter.setWorldTransform(viewTransform); } else { // Make sure we don't have unpolished items before we draw if (!d->scene->d_func()->unpolishedItems.isEmpty()) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 7b5ac7a..af02c55 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2492,25 +2492,31 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState() void tst_QGraphicsView::optimizationFlags_dontSavePainterState2_data() { QTest::addColumn("savePainter"); - QTest::newRow("With painter state protection") << true; - QTest::newRow("Without painter state protection") << false; + QTest::addColumn("indirectPainting"); + QTest::newRow("With painter state protection, without indirect painting") << true << false; + QTest::newRow("Without painter state protection, without indirect painting") << false << false; + QTest::newRow("With painter state protectionm, with indirect painting") << true << true; + QTest::newRow("Without painter state protection, with indirect painting") << false << true; } void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() { QFETCH(bool, savePainter); + QFETCH(bool, indirectPainting); class MyScene : public QGraphicsScene { public: void drawBackground(QPainter *p, const QRectF &) - { transformInDrawBackground = p->worldTransform(); } + { transformInDrawBackground = p->worldTransform(); opacityInDrawBackground = p->opacity(); } void drawForeground(QPainter *p, const QRectF &) - { transformInDrawForeground = p->worldTransform(); } + { transformInDrawForeground = p->worldTransform(); opacityInDrawForeground = p->opacity(); } QTransform transformInDrawBackground; QTransform transformInDrawForeground; + qreal opacityInDrawBackground; + qreal opacityInDrawForeground; }; MyScene scene; @@ -2518,9 +2524,13 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() scene.addRect(0, 0, 20, 20)->setTransform(QTransform::fromScale(2, 2)); scene.addRect(50, 50, 20, 20)->setTransform(QTransform::fromTranslate(200, 200)); + foreach (QGraphicsItem *item, scene.items()) + item->setOpacity(0.6); + CustomView view(&scene); if (!savePainter) view.setOptimizationFlag(QGraphicsView::DontSavePainterState); + view.setOptimizationFlag(QGraphicsView::IndirectPainting, indirectPainting); view.rotate(45); view.scale(1.5, 1.5); view.show(); @@ -2534,10 +2544,38 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() QVERIFY(view.painted); // Make sure the painter's world transform is preserved after drawItems. - const QTransform expectedTransform = view.viewportTransform(); + QTransform expectedTransform = view.viewportTransform(); QVERIFY(!expectedTransform.isIdentity()); QCOMPARE(scene.transformInDrawForeground, expectedTransform); QCOMPARE(scene.transformInDrawBackground, expectedTransform); + + qreal expectedOpacity = 1.0; + QCOMPARE(scene.opacityInDrawBackground, expectedOpacity); + QCOMPARE(scene.opacityInDrawForeground, expectedOpacity); + + // Trigger more painting, this time from QGraphicsScene::render. + QImage image(scene.sceneRect().size().toSize(), QImage::Format_RGB32); + QPainter painter(&image); + scene.render(&painter); + painter.end(); + + expectedTransform = QTransform(); + QCOMPARE(scene.transformInDrawForeground, expectedTransform); + QCOMPARE(scene.transformInDrawBackground, expectedTransform); + QCOMPARE(scene.opacityInDrawBackground, expectedOpacity); + QCOMPARE(scene.opacityInDrawForeground, expectedOpacity); + + // Trigger more painting with another opacity on the painter. + painter.begin(&image); + painter.setOpacity(0.4); + expectedOpacity = 0.4; + scene.render(&painter); + painter.end(); + + QCOMPARE(scene.transformInDrawForeground, expectedTransform); + QCOMPARE(scene.transformInDrawBackground, expectedTransform); + QCOMPARE(scene.opacityInDrawBackground, expectedOpacity); + QCOMPARE(scene.opacityInDrawForeground, expectedOpacity); } class LodItem : public QGraphicsRectItem -- cgit v0.12 From 7412ac5b38d83b627a372a525f271c225f9c1f70 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Wed, 22 Sep 2010 19:58:18 +0200 Subject: Qmake: Fix wrong path in the breakpad post link step Reviewed-By: Oswald Buddenhagen --- mkspecs/features/default_post.prf | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 59a5e86..09c6587 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -45,32 +45,32 @@ breakpad { macx { equals(TEMPLATE, lib) { lib_bundle { - TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.framework/$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET}.framework/$${TARGET} } else { - TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET} !plugin { TEMP_VERSION = $$section(VERSION, ., 0, 0) isEmpty(TEMP_VERSION):TEMP_VERSION = 1 - TARGET_FILENAME = $${TARGET_FILENAME}.$${TEMP_VERSION} + TARGET_BASEPATH = $${TARGET_BASEPATH}.$${TEMP_VERSION} } - TARGET_FILENAME = $${TARGET_FILENAME}.$${QMAKE_EXTENSION_SHLIB} + TARGET_BASEPATH = $${TARGET_BASEPATH}.$${QMAKE_EXTENSION_SHLIB} } } else { app_bundle { - TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.app/Contents/MacOS/$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET}.app/Contents/MacOS/$${TARGET} } else { - TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET} } } - DEBUGFILENAME = $$TARGET_FILENAME + DEBUGFILENAME = $$TARGET_BASEPATH } else { equals(TEMPLATE, lib) { plugin { - TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so + TARGET_BASEPATH = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so } else { TEMP_VERSION = $$VERSION isEmpty(TEMP_VERSION):TEMP_VERSION = 1.0.0 - TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION} } } else { TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET} @@ -87,7 +87,6 @@ breakpad { !isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$quote($$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$QMAKE_STRIP \"$$DEBUGFILENAME\") unset(TARGET_BASEPATH) - unset(TARGET_FILENAME) unset(SYMBOLFILENAME) unset(TARGET_EXT) unset(TARGET_VERSION_EXT) -- cgit v0.12 From b750bb085029117497d26a24dcd590fbe34fe281 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 23 Sep 2010 08:50:21 +1000 Subject: Move includes after copyright block --- src/declarative/debugger/qdeclarativedebughelper.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp index ea621bf..207ad2b 100644 --- a/src/declarative/debugger/qdeclarativedebughelper.cpp +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -1,8 +1,3 @@ -#include "private/qdeclarativedebughelper_p.h" -#include "private/qdeclarativeengine_p.h" - -#include - /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). @@ -44,6 +39,8 @@ ** ****************************************************************************/ +#include + #include "private/qdeclarativedebughelper_p.h" #include -- cgit v0.12 From 51de46840d32f714faa4717ae54a1e8559a43eab Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 23 Sep 2010 09:54:03 +1000 Subject: Fix compile failure in QtMultimedia. QAudioFormat::sampleRate() and QAudioFormat::channelCount() weren't introduced until 4.7. Use frequency() and channels() instead. Reviewed-by: Justin McPherson --- src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp index 1909009..d3dfa5f 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp @@ -82,9 +82,9 @@ bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) con return format.isValid() && format.codec() == QString::fromLatin1("audio/pcm") - && self->supportedSampleRates().contains(format.sampleRate()) - && self->supportedChannelCounts().contains(format.channelCount()) - && self->supportedSampleSizes().contains(format.sampleSize()); + && self->frequencyList().contains(format.frequency()) + && self->channelsList().contains(format.channels()) + && self->sampleSizeList().contains(format.sampleSize()); } QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const -- cgit v0.12 From 24fe2f9f8e94e2a142bf0e17d7d03c5431eb0eab Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Sep 2010 08:54:39 +1000 Subject: Properly cleanup in QDeclarativeModulePlugin test. --- .../qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index 2081f0e..e1022e0 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -117,6 +117,7 @@ void tst_qdeclarativemoduleplugin::importsPlugin() QObject *object = component.create(); QVERIFY(object != 0); QCOMPARE(object->property("value").toInt(),123); + delete object; } QTEST_MAIN(tst_qdeclarativemoduleplugin) -- cgit v0.12 From cd5cd63750e39759b10b2edf85404db7173ac8ee Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Sep 2010 09:01:25 +1000 Subject: Remove dead code paths in declarative list model code. Reviewed-by: Bea Lam --- src/declarative/util/qdeclarativelistmodel.cpp | 37 ------------------------ src/declarative/util/qdeclarativelistmodel_p.h | 1 - src/declarative/util/qdeclarativelistmodel_p_p.h | 3 -- src/declarative/util/qlistmodelinterface_p.h | 3 -- 4 files changed, 44 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 3263238..93a38f4 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -310,14 +310,6 @@ QString QDeclarativeListModel::toString(int role) const return m_flat ? m_flat->toString(role) : m_nested->toString(role); } -QHash QDeclarativeListModel::data(int index, const QList &roles) const -{ - if (index >= count() || index < 0) - return QHash(); - - return m_flat ? m_flat->data(index, roles) : m_nested->data(index, roles); -} - QVariant QDeclarativeListModel::data(int index, int role) const { if (index >= count() || index < 0) @@ -920,19 +912,6 @@ FlatListModel::~FlatListModel() qDeleteAll(m_nodeData); } -QHash FlatListModel::data(int index, const QList &roles) const -{ - Q_ASSERT(index >= 0 && index < m_values.count()); - - QHash row; - for (int i=0; i= 0 && index < m_values.count()); @@ -972,11 +951,6 @@ void FlatListModel::remove(int index) removedNode(index); } -bool FlatListModel::append(const QScriptValue &value) -{ - return insert(m_values.count(), value); -} - bool FlatListModel::insert(int index, const QScriptValue &value) { Q_ASSERT(index >= 0 && index <= m_values.count()); @@ -1350,17 +1324,6 @@ void NestedListModel::move(int from, int to, int n) qdeclarativelistmodel_move(from, to, n, &_root->values); } -bool NestedListModel::append(const QScriptValue& valuemap) -{ - if (!_root) { - _root = new ModelNode(this); - m_ownsRoot = true; - } - - insert(count(), valuemap); - return true; -} - QScriptValue NestedListModel::get(int index) const { QDeclarativeEngine *eng = qmlEngine(m_listModel); diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index fe42ef6..e9673c8 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -76,7 +76,6 @@ public: virtual QList roles() const; virtual QString toString(int role) const; virtual int count() const; - virtual QHash data(int index, const QList &roles = (QList())) const; virtual QVariant data(int index, int role) const; Q_INVOKABLE void clear(); diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h index d2d40ee..43a0a9b 100644 --- a/src/declarative/util/qdeclarativelistmodel_p_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p_p.h @@ -79,7 +79,6 @@ public: FlatListModel(QDeclarativeListModel *base); ~FlatListModel(); - QHash data(int index, const QList &roles) const; QVariant data(int index, int role) const; QList roles() const; @@ -88,7 +87,6 @@ public: int count() const; void clear(); void remove(int index); - bool append(const QScriptValue&); bool insert(int index, const QScriptValue&); QScriptValue get(int index) const; void set(int index, const QScriptValue&, QList *roles); @@ -189,7 +187,6 @@ public: int count() const; void clear(); void remove(int index); - bool append(const QScriptValue&); bool insert(int index, const QScriptValue&); QScriptValue get(int index) const; void set(int index, const QScriptValue&, QList *roles); diff --git a/src/declarative/util/qlistmodelinterface_p.h b/src/declarative/util/qlistmodelinterface_p.h index 07592ad..8c8ebb3 100644 --- a/src/declarative/util/qlistmodelinterface_p.h +++ b/src/declarative/util/qlistmodelinterface_p.h @@ -59,10 +59,7 @@ class Q_DECLARATIVE_EXPORT QListModelInterface : public QObject virtual ~QListModelInterface() {} virtual int count() const = 0; - virtual QHash data(int index, const QList& roles = QList()) const = 0; virtual QVariant data(int index, int role) const = 0; - virtual bool setData(int index, const QHash& values) - { Q_UNUSED(index); Q_UNUSED(values); return false; } virtual QList roles() const = 0; virtual QString toString(int role) const = 0; -- cgit v0.12 From b1a5a49950b80469e4cd658f340f279a8fd75a27 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Sep 2010 10:17:48 +1000 Subject: Remove unused, unexported class. --- src/declarative/qml/qdeclarativeclassfactory.cpp | 50 ---------------- src/declarative/qml/qdeclarativeclassfactory_p.h | 74 ------------------------ src/declarative/qml/qdeclarativeengine_p.h | 1 - src/declarative/qml/qml.pri | 2 - 4 files changed, 127 deletions(-) delete mode 100644 src/declarative/qml/qdeclarativeclassfactory.cpp delete mode 100644 src/declarative/qml/qdeclarativeclassfactory_p.h diff --git a/src/declarative/qml/qdeclarativeclassfactory.cpp b/src/declarative/qml/qdeclarativeclassfactory.cpp deleted file mode 100644 index 798eacd..0000000 --- a/src/declarative/qml/qdeclarativeclassfactory.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative 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 "private/qdeclarativeclassfactory_p.h" - -QT_BEGIN_NAMESPACE - -QDeclarativeClassFactory::~QDeclarativeClassFactory() -{ -} - -QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeclassfactory_p.h b/src/declarative/qml/qdeclarativeclassfactory_p.h deleted file mode 100644 index 9f4a3de..0000000 --- a/src/declarative/qml/qdeclarativeclassfactory_p.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative 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 QDECLARATIVECLASSFACTORY_P_H -#define QDECLARATIVECLASSFACTORY_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeEngine; -class QByteArray; -class QUrl; -class QDeclarativeComponent; - -class QDeclarativeClassFactory -{ -public: - virtual ~QDeclarativeClassFactory(); - virtual QDeclarativeComponent *create(const QByteArray &, const QUrl& baseUrl, QDeclarativeEngine*) = 0; -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVECLASSFACTORY_P_H diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index dc7315d..8539fbf 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -55,7 +55,6 @@ #include "qdeclarativeengine.h" -#include "private/qdeclarativeclassfactory_p.h" #include "private/qdeclarativetypeloader_p.h" #include "private/qdeclarativeimport_p.h" #include "private/qpodvector_p.h" diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 687ff52..66b69f9 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -22,7 +22,6 @@ SOURCES += \ $$PWD/qdeclarativerefcount.cpp \ $$PWD/qdeclarativemetatype.cpp \ $$PWD/qdeclarativestringconverters.cpp \ - $$PWD/qdeclarativeclassfactory.cpp \ $$PWD/qdeclarativeparserstatus.cpp \ $$PWD/qdeclarativetypeloader.cpp \ $$PWD/qdeclarativeinfo.cpp \ @@ -89,7 +88,6 @@ HEADERS += \ $$PWD/qdeclarativecontext.h \ $$PWD/qdeclarativeexpression.h \ $$PWD/qdeclarativestringconverters_p.h \ - $$PWD/qdeclarativeclassfactory_p.h \ $$PWD/qdeclarativeinfo.h \ $$PWD/qdeclarativeproperty_p.h \ $$PWD/qdeclarativecontext_p.h \ -- cgit v0.12 From 688b17d6c89414e34150846203edfb9ed6de737a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Sep 2010 10:43:10 +1000 Subject: Doc fix. --- src/imports/gestures/qdeclarativegesturearea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp index 500c6bf..0d19ba9 100644 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ b/src/imports/gestures/qdeclarativegesturearea.cpp @@ -92,7 +92,7 @@ public: \e {This element is only functional on devices with touch input.} \qml - import Qt.labs.gestures 0.1 + import Qt.labs.gestures 1.0 GestureArea { anchors.fill: parent -- cgit v0.12 From b22994c3e1574716c8fc6a1da52251443d3c9cc6 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 23 Sep 2010 12:47:36 +1000 Subject: Improve docs for Qt.quit() --- src/declarative/qml/qdeclarativeengine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 80db230..26b3629 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1783,7 +1783,9 @@ void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const /*! \qmlmethod Qt::quit() This function causes the QDeclarativeEngine::quit() signal to be emitted. -Within the \l {QML Viewer}, this causes the launcher application to exit. +Within the \l {QML Viewer}, this causes the launcher application to exit; +to quit a C++ application when this method is called, connect the +QDeclarativeEngine::quit() signal to the QCoreApplication::quit() slot. */ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e) -- cgit v0.12 From 4bd27d5c8c1f2dd759e20e4a6b3ac224799e2318 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 23 Sep 2010 13:05:48 +1000 Subject: Fix ListModel::set() so the implementation and docs are consistent. If index == count() the item should be appended. Also, this should happen regardless of whether the list is empty. --- src/declarative/util/qdeclarativelistmodel.cpp | 5 +++-- .../declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 93a38f4..398480e 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -552,7 +552,8 @@ QScriptValue QDeclarativeListModel::get(int index) const fruitModel.set(3, {"cost": 5.95, "name":"Pizza"}) \endcode - The \a index must be an element in the list. + If \a index is equal to count() then a new item is appended to the + list. Otherwise, \a index must be an element in the list. \sa append() */ @@ -562,7 +563,7 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap) qmlInfo(this) << tr("set: value is not an object"); return; } - if (count() == 0 || index > count() || index < 0) { + if (index > count() || index < 0) { qmlInfo(this) << tr("set: index %1 out of range").arg(index); return; } diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 31cb545..69df90b 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -260,7 +260,7 @@ void tst_qdeclarativelistmodel::dynamic_data() QTest::newRow("set2") << "{append({'foo':123});set(0,{'foo':456});get(0).foo}" << 456 << ""; QTest::newRow("set3a") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).foo}" << 999 << ""; QTest::newRow("set3b") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).bar}" << 456 << ""; - QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << ": QML ListModel: set: index 0 out of range"; + QTest::newRow("set4a") << "{set(0,{'foo':456});count}" << 1 << ""; QTest::newRow("set4c") << "{set(-1,{'foo':456})}" << 0 << ": QML ListModel: set: index -1 out of range"; QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123);count}" << 1 << ": QML ListModel: set: value is not an object"; QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3]);count}" << 1 << ": QML ListModel: set: value is not an object"; -- cgit v0.12 From e8c36529d78b99ce651e26779e96986561f63646 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 23 Sep 2010 12:52:54 +1000 Subject: Update QtDeclarative def files --- src/s60installs/bwins/QtDeclarativeu.def | 6 ++++-- src/s60installs/eabi/QtDeclarativeu.def | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 43735a5..f417892 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -242,7 +242,7 @@ EXPORTS ?idString@QDeclarativeDebugObjectReference@@QBE?AVQString@@XZ @ 241 NONAME ; class QString QDeclarativeDebugObjectReference::idString(void) const ?customTypeData@QDeclarativeDomObject@@QBE?AVQByteArray@@XZ @ 242 NONAME ; class QByteArray QDeclarativeDomObject::customTypeData(void) const ?stop@QDeclarativeTransition@@QAEXXZ @ 243 NONAME ; void QDeclarativeTransition::stop(void) - ?data@QDeclarativeListModel@@UBE?AV?$QHash@HVQVariant@@@@HABV?$QList@H@@@Z @ 244 NONAME ; class QHash QDeclarativeListModel::data(int, class QList const &) const + ?data@QDeclarativeListModel@@UBE?AV?$QHash@HVQVariant@@@@HABV?$QList@H@@@Z @ 244 NONAME ABSENT ; class QHash QDeclarativeListModel::data(int, class QList const &) const ?verticalCenterOffset@QDeclarativeAnchors@@QBEMXZ @ 245 NONAME ; float QDeclarativeAnchors::verticalCenterOffset(void) const ?metaObject@QDeclarativeText@@UBEPBUQMetaObject@@XZ @ 246 NONAME ; struct QMetaObject const * QDeclarativeText::metaObject(void) const ??0QDeclarativeComponent@@QAE@PAVQDeclarativeEngine@@PAVQObject@@@Z @ 247 NONAME ; QDeclarativeComponent::QDeclarativeComponent(class QDeclarativeEngine *, class QObject *) @@ -608,7 +608,7 @@ EXPORTS ??_EQDeclarativeDebugObjectExpressionWatch@@UAE@I@Z @ 607 NONAME ; QDeclarativeDebugObjectExpressionWatch::~QDeclarativeDebugObjectExpressionWatch(unsigned int) ?computeTransformOrigin@QDeclarativeItemPrivate@@QBE?AVQPointF@@XZ @ 608 NONAME ; class QPointF QDeclarativeItemPrivate::computeTransformOrigin(void) const ??0QDeclarativeListReference@@QAE@PAVQObject@@PBDPAVQDeclarativeEngine@@@Z @ 609 NONAME ; QDeclarativeListReference::QDeclarativeListReference(class QObject *, char const *, class QDeclarativeEngine *) - ?setData@QListModelInterface@@UAE_NHABV?$QHash@HVQVariant@@@@@Z @ 610 NONAME ; bool QListModelInterface::setData(int, class QHash const &) + ?setData@QListModelInterface@@UAE_NHABV?$QHash@HVQVariant@@@@@Z @ 610 NONAME ABSENT ; bool QListModelInterface::setData(int, class QHash const &) ??0QDeclarativePen@@QAE@PAVQObject@@@Z @ 611 NONAME ; QDeclarativePen::QDeclarativePen(class QObject *) ?trUtf8@QPacketProtocol@@SA?AVQString@@PBD0H@Z @ 612 NONAME ; class QString QPacketProtocol::trUtf8(char const *, char const *, int) ?setContextObject@QDeclarativeContext@@QAEXPAVQObject@@@Z @ 613 NONAME ; void QDeclarativeContext::setContextObject(class QObject *) @@ -1798,4 +1798,6 @@ EXPORTS ?stop@QDeclarativeAbstractAnimation@@QAEXXZ @ 1797 NONAME ; void QDeclarativeAbstractAnimation::stop(void) ?start@QDeclarativeAbstractAnimation@@QAEXXZ @ 1798 NONAME ; void QDeclarativeAbstractAnimation::start(void) ?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1799 NONAME ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *) + ?getScriptEngine@QDeclarativeDebugHelper@@SAPAVQScriptEngine@@PAVQDeclarativeEngine@@@Z @ 1800 NONAME ; class QScriptEngine * QDeclarativeDebugHelper::getScriptEngine(class QDeclarativeEngine *) + ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1801 NONAME ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 8aefb2c..c4cd9b6 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1351,7 +1351,7 @@ EXPORTS _ZNK21QDeclarativeDomObject8propertyERK10QByteArray @ 1350 NONAME _ZNK21QDeclarativeListModel10metaObjectEv @ 1351 NONAME _ZNK21QDeclarativeListModel3getEi @ 1352 NONAME - _ZNK21QDeclarativeListModel4dataEiRK5QListIiE @ 1353 NONAME + _ZNK21QDeclarativeListModel4dataEiRK5QListIiE @ 1353 NONAME ABSENT _ZNK21QDeclarativeListModel4dataEii @ 1354 NONAME _ZNK21QDeclarativeListModel5countEv @ 1355 NONAME _ZNK21QDeclarativeListModel5rolesEv @ 1356 NONAME @@ -1831,4 +1831,6 @@ EXPORTS _ZThn8_N29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1830 NONAME _ZThn8_N29QDeclarativeAbstractAnimationD0Ev @ 1831 NONAME _ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1832 NONAME + _ZN23QDeclarativeDebugHelper15getScriptEngineEP18QDeclarativeEngine @ 1833 NONAME + _ZN23QDeclarativeDebugHelper26setAnimationSlowDownFactorEf @ 1834 NONAME -- cgit v0.12 From e1c895912a89824af6b8a826b6c28865ac13b392 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Sep 2010 14:07:33 +1000 Subject: Various declarative autotest additions. --- src/declarative/util/qdeclarativeview.cpp | 2 +- .../qdeclarativeconnection/data/error-object.qml | 7 +++++ .../qdeclarativeconnection/data/error-property.qml | 5 ++++ .../data/error-property2.qml | 5 ++++ .../qdeclarativeconnection/data/error-syntax.qml | 9 +++++++ .../tst_qdeclarativeconnection.cpp | 31 ++++++++++++++++++++++ .../tst_qdeclarativelistmodel.cpp | 16 +++++++++++ .../declarative/qdeclarativeview/data/error1.qml | 5 ++++ .../qdeclarativeview/tst_qdeclarativeview.cpp | 17 ++++++++++++ 9 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativeconnection/data/error-object.qml create mode 100644 tests/auto/declarative/qdeclarativeconnection/data/error-property.qml create mode 100644 tests/auto/declarative/qdeclarativeconnection/data/error-property2.qml create mode 100644 tests/auto/declarative/qdeclarativeconnection/data/error-syntax.qml create mode 100644 tests/auto/declarative/qdeclarativeview/data/error1.qml diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 8f06858..2381172 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -392,7 +392,7 @@ QDeclarativeView::Status QDeclarativeView::status() const /*! Return the list of errors that occurred during the last compile or create - operation. An empty list is returned if isError() is not set. + operation. When the status is not Error, an empty list is returned. */ QList QDeclarativeView::errors() const { diff --git a/tests/auto/declarative/qdeclarativeconnection/data/error-object.qml b/tests/auto/declarative/qdeclarativeconnection/data/error-object.qml new file mode 100644 index 0000000..a8127a4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/error-object.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +Item { + Connections { + onClicked: Item {} + } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/error-property.qml b/tests/auto/declarative/qdeclarativeconnection/data/error-property.qml new file mode 100644 index 0000000..2791f56 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/error-property.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +Item { + Connections { fakeProperty: {} } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/error-property2.qml b/tests/auto/declarative/qdeclarativeconnection/data/error-property2.qml new file mode 100644 index 0000000..0205c0a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/error-property2.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +Item { + Connections { onfakeProperty: {} } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/error-syntax.qml b/tests/auto/declarative/qdeclarativeconnection/data/error-syntax.qml new file mode 100644 index 0000000..867e4e2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/error-syntax.qml @@ -0,0 +1,9 @@ +import Qt 4.7 + +Item { + Connections { + onClicked { + onPressed: {} + } + } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp index d384372..a623e96 100644 --- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp +++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -66,6 +66,8 @@ private slots: void targetChanged(); void unknownSignals_data(); void unknownSignals(); + void errors_data(); + void errors(); private: QDeclarativeEngine engine; @@ -195,9 +197,38 @@ void tst_qdeclarativeconnection::unknownSignals() QDeclarativeConnections *connections = item->findChild("connections"); QVERIFY(connections); + if (file == "connection-unknownsignals-ignored.qml") + QVERIFY(connections->ignoreUnknownSignals()); + delete item; } +void tst_qdeclarativeconnection::errors_data() +{ + QTest::addColumn("file"); + QTest::addColumn("error"); + + QTest::newRow("no \"on\"") << "error-property.qml" << "Cannot assign to non-existent property \"fakeProperty\""; + QTest::newRow("3rd letter lowercase") << "error-property2.qml" << "Cannot assign to non-existent property \"onfakeProperty\""; + QTest::newRow("child object") << "error-object.qml" << "Connections: nested objects not allowed"; + QTest::newRow("grouped object") << "error-syntax.qml" << "Connections: syntax error"; +} + +void tst_qdeclarativeconnection::errors() +{ + QFETCH(QString, file); + QFETCH(QString, error); + + QUrl url = QUrl::fromLocalFile(SRCDIR "/data/" + file); + + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, url); + QVERIFY(c.isError() == true); + QList errors = c.errors(); + QVERIFY(errors.count() == 1); + QCOMPARE(errors.at(0).description(), error); +} + QTEST_MAIN(tst_qdeclarativeconnection) #include "tst_qdeclarativeconnection.moc" diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 69df90b..f8d2411 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -91,6 +91,7 @@ private slots: void enumerate(); void error_data(); void error(); + void syncError(); void set(); void get(); void get_data(); @@ -661,6 +662,21 @@ void tst_qdeclarativelistmodel::error() } } +void tst_qdeclarativelistmodel::syncError() +{ + QString qml = "import Qt 4.7\nListModel { id: lm; Component.onCompleted: lm.sync() }"; + QString error = "file:dummy.qml:2:1: QML ListModel: List sync() can only be called from a WorkerScript"; + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(qml.toUtf8(), + QUrl::fromLocalFile(QString("dummy.qml"))); + QTest::ignoreMessage(QtWarningMsg,error.toUtf8()); + QObject *obj = component.create(); + QVERIFY(obj); + delete obj; +} + /* Test model changes from set() are available to the view */ diff --git a/tests/auto/declarative/qdeclarativeview/data/error1.qml b/tests/auto/declarative/qdeclarativeview/data/error1.qml new file mode 100644 index 0000000..c154716 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeview/data/error1.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +Rectangle { + nonExistentProperty: 5 +} diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp index 6450e38..9ac79e4 100644 --- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -62,6 +62,7 @@ public: private slots: void resizemodedeclarativeitem(); void resizemodegraphicswidget(); + void errors(); private: template @@ -255,6 +256,22 @@ void tst_QDeclarativeView::resizemodegraphicswidget() delete canvas; } +static void silentErrorsMsgHandler(QtMsgType, const char *) +{ +} + +void tst_QDeclarativeView::errors() +{ + QDeclarativeView *canvas = new QDeclarativeView; + QVERIFY(canvas); + QtMsgHandler old = qInstallMsgHandler(silentErrorsMsgHandler); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/error1.qml")); + qInstallMsgHandler(old); + QVERIFY(canvas->status() == QDeclarativeView::Error); + QVERIFY(canvas->errors().count() == 1); + delete canvas; +} + template T *tst_QDeclarativeView::findItem(QGraphicsObject *parent, const QString &objectName) { -- cgit v0.12 From 9634e133db1bf50a55ed44b3fe01e49954c80d08 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 23 Sep 2010 09:30:38 +0200 Subject: Doc: maintainance - fixing grammar and spelling --- doc/src/declarative/examples.qdoc | 2 +- doc/src/getting-started/examples.qdoc | 50 ++++++++++++++--------------- tools/qdoc3/test/qt-html-templates.qdocconf | 4 +-- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 9929cfe..3f075bb 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -28,7 +28,7 @@ /*! \page qdeclarativeexamples.html \title QML Examples and Demos - \brief Building UI's with QML + \brief Building UIs with QML \ingroup all-examples diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index e8c85e6..a5f3446 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -273,7 +273,7 @@ \page examples-painting.html \ingroup all-examples \title Painting Examples - \brief How to use the Qt painting system + \brief How to use the Qt painting system. \image painting-examples.png @@ -303,7 +303,7 @@ \page examples-richtext.html \ingroup all-examples \title Rich Text Examples - \brief Using the document-oriented rich text engine + \brief Using the document-oriented rich text engine. \image richtext-examples.png @@ -324,7 +324,7 @@ \page examples-desktop.html \ingroup all-examples \title Desktop Examples - \brief Integrating your Qt application with your favorite desktop + \brief Integrating your Qt application with your favorite desktop. \image desktop-examples.png @@ -371,7 +371,7 @@ \page examples-threadandconcurrent.html \ingroup all-examples \title Threading and Concurrent Programming Examples - \brief Threading and concurrent programming in Qt + \brief Threading and concurrent programming in Qt. \image thread-examples.png @@ -409,7 +409,7 @@ \page examples.tools.html \ingroup all-examples \title Tools Examples - \brief Using Qt's containers, iterators, and other tool classes + \brief Using Qt's containers, iterators, and other tool classes. \image tool-examples.png @@ -445,7 +445,7 @@ \page examples-network.html \ingroup all-examples \title Network Examples - \brief How to do network programming in Qt + \brief How to do network programming in Qt. \image network-examples.png @@ -482,7 +482,7 @@ \page examples-ipc.html \ingroup all-examples \title IPC Examples - \brief Inter-Process Communication with Qt + \brief Inter-Process Communication with Qt. \image ipc-examples.png @@ -497,7 +497,7 @@ \page examples-opengl.html \ingroup all-examples \title OpenGL Examples - \brief Accessing OpenGL from Qt + \brief Accessing OpenGL from Qt. \image opengl-examples.png @@ -529,7 +529,7 @@ \page examples-openvg.html \ingroup all-examples \title OpenVG Examples - \brief Accessing OpenVG from Qt + \brief Accessing OpenVG from Qt. \image opengl-examples.png @@ -548,7 +548,7 @@ \page examples-multimedia.html \ingroup all-examples \title Multimedia Examples - \brief Audio, video, and Phonon with Qt + \brief Audio, video, and Phonon with Qt. \image phonon-examples.png @@ -595,7 +595,7 @@ \page examples-sql.html \ingroup all-examples \title SQL Examples - \brief Accessing your SQL database from Qt + \brief Accessing your SQL database from Qt. \image sql-examples.png @@ -623,7 +623,7 @@ \page examples-xml.html \ingroup all-examples \title XML Examples - \brief Using XML with Qt + \brief Using XML with Qt. \image xml-examples.png XML @@ -658,7 +658,7 @@ \page examples-designer.html \ingroup all-examples \title Qt Designer Examples - \brief Using Qt Designer to build your UI + \brief Using Qt Designer to build your UI. \image designer-examples.png QtDesigner @@ -681,7 +681,7 @@ \page examples-uitools.html \ingroup all-examples \title UiTools Examples - \brief Using the QtUiTools module + \brief Using the QtUiTools module. \image uitools-examples.png UiTools @@ -695,7 +695,7 @@ \page examples-linguist.html \ingroup all-examples \title Qt Linguist Examples - \brief Using Qt Linguist to internationalize your Qt application + \brief Using Qt Linguist to internationalize your Qt application. \image linguist-examples.png @@ -713,7 +713,7 @@ \page examples-script.html \ingroup all-examples \title Qt Script Examples - \brief Using the Qt scripting environment + \brief Using the Qt scripting environment. \image qtscript-examples.png QtScript @@ -740,7 +740,7 @@ \page examples-webkit.html \ingroup all-examples \title WebKit Examples - \brief Using WebKit in your Qt application + \brief Using WebKit in your Qt application. \image webkit-examples.png WebKit @@ -779,7 +779,7 @@ \page examples-helpsystem.html \ingroup all-examples \title Help System Examples - \brief Adding interactive help to your Qt application + \brief Adding interactive help to your Qt application. \image assistant-examples.png HelpSystem @@ -800,7 +800,7 @@ \page examples-statemachine.html \ingroup all-examples \title State Machine Examples - \brief Using Qt's finite state machine classes + \brief Using Qt's finite state machine classes. \image statemachine-examples.png StateMachine @@ -824,7 +824,7 @@ \page examples-animation.html \ingroup all-examples \title Animation Framework Examples - \brief Doing animations with Qt + \brief Doing animations with Qt. \image animation-examples.png Animation @@ -844,7 +844,7 @@ \page examples-touch.html \ingroup all-examples \title Touch Input Examples - \brief Using Qt's touch input capability + \brief Using Qt's touch input capability. Support for touch input makes it possible for developers to create extensible and intuitive user interfaces. @@ -861,7 +861,7 @@ \page examples-gestures.html \ingroup all-examples \title Gestures Examples - \brief Gesture programming examples + \brief Gesture programming examples. The API of the gesture framework is not yet finalized and still subject to change. @@ -875,7 +875,7 @@ \page examples-dbus.html \ingroup all-examples \title D-Bus Examples - \brief Using D-Bus from Qt applications + \brief Using D-Bus from Qt applications. \list \o \l{dbus/dbus-chat}{Chat} @@ -892,7 +892,7 @@ \page examples-embeddedlinux.html \ingroup all-examples \title Qt for Embedded Linux Examples - \brief Using Qt in Embedded Linux + \brief Using Qt in Embedded Linux. \image qt-embedded-examples.png QtEmbedded @@ -912,7 +912,7 @@ \page examples-activeqt.html \ingroup all-examples \title ActiveQt Examples - \brief Using ActiveX from Qt applications + \brief Using ActiveX from Qt applications. \image activeqt-examples.png ActiveQt diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index b716f7c..44aa918 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -40,7 +40,7 @@ HTML.postheader = "
\n" \ "
  • Qt Topics \n" \ "
      \n" \ "
    • Programming with Qt
    • \n" \ - "
    • Device UI's & Qt Quick
    • \n" \ + "
    • Device UIs & Qt Quick
    • \n" \ "
    • UI Design with Qt
    • \n" \ "
    • Cross-platform and Platform-specific
    • \n" \ "
    • Platform-specific info
    • \n" \ @@ -94,7 +94,7 @@ HTML.postheader = "
      \n" \ "
      \n" \ "
        \n" \ "
      • Programming with Qt
      • \n" \ - "
      • Device UI's & Qt Quick
      • \n" \ + "
      • Device UIs & Qt Quick
      • \n" \ "
      • UI Design with Qt
      • \n" \ "
      • Cross-platform and Platform-specific
      • \n" \ "
      • Platform-specific info
      • \n" \ -- cgit v0.12 From 0aad0d2043e061469b7139483c489dc6f823490b Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 22 Sep 2010 16:32:31 +0300 Subject: Improved Symbian4 platform detection Now returns correct value for Symbian4 platforms with QSysInfo::symbianVersion(). SYMBIAN_VERSION .pro file variable should also return correct value even if it doesn't get set in environment.prf. Task-number: QTBUG-13802 Reviewed-by: Shane Kearns Reviewed-by: Janne Anttila --- mkspecs/common/symbian/symbian.conf | 62 ++++++++++++++++------------ src/corelib/global/global.pri | 3 ++ src/corelib/global/qglobal.cpp | 81 ++++++++++++++++++++++++------------- src/corelib/global/qglobal.h | 4 +- 4 files changed, 93 insertions(+), 57 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 679731f..cc5b788 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -132,39 +132,49 @@ exists($${EPOCROOT}epoc32/tools/qt/mkspecs/features/environment.prf) { } # Try to detect SDK version if it wasn't set by environment.prf -isEmpty(S60_VERSION) { - # The Symbian^3 PDK does not necessarily contain the required sis files. - # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { - S60_VERSION = 5.2 +isEmpty(SYMBIAN_VERSION) { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/Symbianv4.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/Symbianv4.sis) { + SYMBIAN_VERSION = Symbian4 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { - S60_VERSION = 5.1 + # The Symbian^3 PDK does not necessarily contain the required sis files. + # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { + SYMBIAN_VERSION = Symbian3 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { - S60_VERSION = 5.0 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { + SYMBIAN_VERSION = Symbian2 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { - S60_VERSION = 3.2 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { + SYMBIAN_VERSION = 9.4 } else { - S60_VERSION = 3.1 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { + SYMBIAN_VERSION = 9.3 + } else { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.1.sis) { + SYMBIAN_VERSION = 9.2 + } else { + SYMBIAN_VERSION = Unknown + } + } } } } } } -isEmpty(SYMBIAN_VERSION) { - contains(S60_VERSION, "3\\.1") { - SYMBIAN_VERSION = 9.2 - } else:contains(S60_VERSION, "3\\.2") { - SYMBIAN_VERSION = 9.3 - } else:contains(S60_VERSION, "5\\.0") { - SYMBIAN_VERSION = 9.4 - } else:contains(S60_VERSION, "5\\.1") { - SYMBIAN_VERSION = Symbian2 - } else:contains(S60_VERSION, "5\\.2") { - SYMBIAN_VERSION = Symbian3 +isEmpty(S60_VERSION) { + contains(SYMBIAN_VERSION, "9\\.2") { + S60_VERSION = 3.1 + } else:contains(SYMBIAN_VERSION, "9\\.3") { + S60_VERSION = 3.2 + } else:contains(SYMBIAN_VERSION, "9\\.4") { + S60_VERSION = 5.0 + } else:contains(SYMBIAN_VERSION, "Symbian2") { + S60_VERSION = 5.1 + } else:contains(SYMBIAN_VERSION, "Symbian3") { + S60_VERSION = 5.2 + } else { + S60_VERSION = Unknown } } @@ -174,14 +184,14 @@ isEmpty(SYMBIAN_VERSION) { default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platform_dependencies -# Supports S60 3.0, 3.1, 3.2, 5.0 and Symbian^3 by default +# Supports S60 3.1, 3.2, 5.0, Symbian^3, and Symbian^4 by default pkg_platform_dependencies = \ "; Default HW/platform dependencies" \ - "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ "[0x1028315F],0,0,0,{\"S60ProductID\"}" \ - "[0x20022e6d],0,0,0,{\"S60ProductID\"}" \ + "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ + "[0x20032DE7],0,0,0,{\"S60ProductID\"}" \ " " DEPLOYMENT += default_deployment diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 260ed59..4800716 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -24,3 +24,6 @@ linux*:!static:!linux-armcc:!linux-gcce { prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" } + +# Compensate for lack of platform defines in Symbian3 and Symbian4 +symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 401af85..3291fe7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -86,7 +86,8 @@ # include "private/qcore_symbian_p.h" _LIT(qt_S60Filter, "Series60v?.*.sis"); -_LIT(qt_S60SystemInstallDir, "z:\\system\\install\\"); +_LIT(qt_symbianFilter, "Symbianv*.sis"); +_LIT(qt_symbianSystemInstallDir, "z:\\system\\install\\"); #endif QT_BEGIN_NAMESPACE @@ -1813,12 +1814,12 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() #endif #ifdef Q_OS_SYMBIAN -static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1); +static QSysInfo::SymbianVersion cachedSymbianVersion = QSysInfo::SymbianVersion(-1); -QSysInfo::S60Version QSysInfo::s60Version() +QSysInfo::SymbianVersion QSysInfo::symbianVersion() { - if (cachedS60Version != -1) - return cachedS60Version; + if (cachedSymbianVersion != -1) + return cachedSymbianVersion; // Use pure Symbian code, because if done using QDir, there will be a call back // to this method, resulting doing this expensive operation twice before the cache kicks in. @@ -1826,7 +1827,22 @@ QSysInfo::S60Version QSysInfo::s60Version() RFs rfs = qt_s60GetRFs(); TFindFile fileFinder(rfs); CDir* contents; - TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents); + + // Check for Symbian4 + TInt err = fileFinder.FindWildByDir(qt_symbianFilter, qt_symbianSystemInstallDir, contents); + if (err == KErrNone) { + QScopedPointer contentsDeleter(contents); + err = contents->Sort(EDescending|ESortByName); + if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 9) { + TInt major = (*contents)[0].iName[8] - '0'; + if (major == 4) { + return cachedSymbianVersion = SV_SF_4; + } + } + } + + // Check for S60 and Symbian3 platforms, which use older .sis naming scheme + err = fileFinder.FindWildByDir(qt_S60Filter, qt_symbianSystemInstallDir, contents); if (err == KErrNone) { QScopedPointer contentsDeleter(contents); err = contents->Sort(EDescending|ESortByName); @@ -1835,19 +1851,19 @@ QSysInfo::S60Version QSysInfo::s60Version() TInt minor = (*contents)[0].iName[11] - '0'; if (major == 3) { if (minor == 1) { - return cachedS60Version = SV_S60_3_1; + return cachedSymbianVersion = SV_9_2; } else if (minor == 2) { - return cachedS60Version = SV_S60_3_2; + return cachedSymbianVersion = SV_9_3; } } else if (major == 5) { if (minor == 0) { - return cachedS60Version = SV_S60_5_0; + return cachedSymbianVersion = SV_9_4; } else if (minor == 1) { - return cachedS60Version = SV_S60_5_1; + return cachedSymbianVersion = SV_SF_2; } else if (minor == 2) { - return cachedS60Version = SV_S60_5_2; + return cachedSymbianVersion = SV_SF_3; } } } @@ -1855,33 +1871,40 @@ QSysInfo::S60Version QSysInfo::s60Version() # ifdef Q_CC_NOKIAX86 // Some emulator environments may not contain the version specific .sis files, so - // simply hardcode the version on those environments. + // simply hardcode the version on those environments. Note that can't use + // SYMBIAN_VERSION_* defines for S60 3.x/5.0 platforms, as they do not define them + // right anyway in case .sis files are not found. # if defined(__SERIES60_31__) - return cachedS60Version = SV_S60_3_1; + return cachedSymbianVersion = SV_9_2; # elif defined(__S60_32__) - return cachedS60Version = SV_S60_3_2; + return cachedSymbianVersion = SV_9_3; # elif defined(__S60_50__) - return cachedS60Version = SV_S60_5_0; + return cachedSymbianVersion = SV_9_4; +# elif defined(SYMBIAN_VERSION_SYMBIAN3) + return cachedSymbianVersion = SV_SF_3; +# elif defined(SYMBIAN_VERSION_SYMBIAN4) + return cachedSymbianVersion = SV_SF_4; # endif # endif //If reaching here, it was not possible to determine the version - return cachedS60Version = SV_S60_Unknown; + return cachedSymbianVersion = SV_Unknown; } -QSysInfo::SymbianVersion QSysInfo::symbianVersion() + +QSysInfo::S60Version QSysInfo::s60Version() { - switch (s60Version()) { - case SV_S60_3_1: - return SV_9_2; - case SV_S60_3_2: - return SV_9_3; - case SV_S60_5_0: - return SV_9_4; - case SV_S60_5_1: - return SV_SF_2; - case SV_S60_5_2: - return SV_SF_3; + switch (symbianVersion()) { + case SV_9_2: + return SV_S60_3_1; + case SV_9_3: + return SV_S60_3_2; + case SV_9_4: + return SV_S60_5_0; + case SV_SF_2: + return SV_S60_5_1; + case SV_SF_3: + return SV_S60_5_2; default: - return SV_Unknown; + return SV_S60_Unknown; } } #endif // ifdef Q_OS_SYMBIAN diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index d04133b..6ef15d4 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1515,7 +1515,7 @@ public: #endif #ifdef Q_OS_SYMBIAN enum SymbianVersion { - SV_Unknown = 0x0000, + SV_Unknown = 1000000, // Assume unknown is something newer than what is supported //These are the Symbian Ltd versions 9.2-9.4 SV_9_2 = 10, SV_9_3 = 20, @@ -1529,7 +1529,7 @@ public: static SymbianVersion symbianVersion(); enum S60Version { SV_S60_None = 0, - SV_S60_Unknown = 1, + SV_S60_Unknown = SV_Unknown, SV_S60_3_1 = SV_9_2, SV_S60_3_2 = SV_9_3, SV_S60_5_0 = SV_9_4, -- cgit v0.12 From 77b9b5dc93662d505b2c69211d001e5672d8a2cb Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 23 Sep 2010 11:00:11 +0200 Subject: My Qt 4.7.1 changes --- dist/changes-4.7.1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index c8b26c2..fd5a9f2 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -40,6 +40,15 @@ QtCore QtGui ----- + - QGraphicsWidget + * [QTBUG-13188] Make sure a font that has propagated from a parent can + be set on a QPainter. + + + - QStaticText + * [QTBUG-12614] Fix crash with zero-width string. + * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. + QtDBus ------ -- cgit v0.12 From f2be9f394972edffa0eebc9c30fe00a4fce81abc Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 23 Sep 2010 11:15:45 +0200 Subject: my changes for 4.7.1 --- dist/changes-4.7.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index fd5a9f2..30c2efd 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -60,6 +60,10 @@ QtMultimedia QtNetwork --------- + - QSslConfiguration + * [QTBUG-13265] fix crash with empty configuration + - QSslCertificate + * [QTBUG-12489] support dates > 2049 QtOpenGL @@ -81,6 +85,12 @@ QtSql QtSvg ----- +QtXmlPatterns +------------- + - XML Schema internals: + * [QTBUG-11559] Only parse 3 digits of time fraction + + Qt Plugins ---------- -- cgit v0.12 From e449be1979d279066401c29771d60942bac5ff99 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 22 Sep 2010 12:19:31 +0200 Subject: fix build key generation for real Reviewed-by: danimo Task-number: QTBUG-13795 --- tools/configure/configureapp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 17bbadf..3808c4e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2421,7 +2421,7 @@ void Configure::generateBuildKey() + buildSymbianKey + "\"\n" "#else\n" // Debug builds - "# if (!QT_NO_DEBUG)\n" + "# if !defined(QT_NO_DEBUG)\n" "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n" + build64Key.arg("debug") + "\"\n" "# else\n" -- cgit v0.12 From 414b494cf83e84d86ab5dd80f32b47ce04622d00 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 22 Sep 2010 12:23:19 +0200 Subject: build configure.exe directly in source dir Reviewed-by: mariusSO --- tools/configure/configure.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 8a62fe1..810f006 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -1,5 +1,5 @@ TARGET = configure -DESTDIR = ../.. +DESTDIR = $$PWD/../.. # build directly in source dir CONFIG += console flat CONFIG -= moc qt -- cgit v0.12 From 3f90a835f43258b5c19f82da8a0f1e4d1b348e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 23 Sep 2010 11:35:02 +0200 Subject: Fixed QPixmap::resize() for X11 pixmap with masks. Regression from 4.6. Made the tst_QPixmap::resizePreserveMask() test fail. Reviewed-by: Samuel --- src/gui/image/qpixmap.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 1e502bd..6a13f49 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -664,14 +664,19 @@ void QPixmap::resize_helper(const QSize &s) #if defined(Q_WS_X11) if (x11Data && x11Data->x11_mask) { - QX11PixmapData *pmData = static_cast(pd); - pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(x11Data->xinfo.display(), - x11Data->xinfo.screen()), - w, h, 1); - GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); - XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, qMin(width(), w), qMin(height(), h), 0, 0); - XFreeGC(X11->display, gc); + QPixmapData *newPd = pm.pixmapData(); + QX11PixmapData *pmData = (newPd && newPd->classId() == QPixmapData::X11Class) + ? static_cast(newPd) : 0; + if (pmData) { + pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, + RootWindow(x11Data->xinfo.display(), + x11Data->xinfo.screen()), + w, h, 1); + GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); + XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, + qMin(width(), w), qMin(height(), h), 0, 0); + XFreeGC(X11->display, gc); + } } #endif *this = pm; @@ -836,7 +841,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers % HexString(info.size()) % HexString(data ? data->pixelType() : QPixmapData::PixmapType); - // Note: If no extension is provided, we try to match the + // Note: If no extension is provided, we try to match the // file against known plugin extensions if (!info.completeSuffix().isEmpty() && !info.exists()) return false; -- cgit v0.12 From 74f09c794d5fdcb8f4b547b1c55bcd512ef07b95 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 22 Sep 2010 15:41:40 +0200 Subject: Avoid OpenVG rendering errors when stroking an aliased path. Stroking a path can sometimes result in inconsistent rendering especially when combined with a clip. For example, if the logical edge of a clip rect coincides with the logical edge of a path then it can happen that the edge is not painted correctly because the stroke lies outside the bounds of the clip rect. To workaround this problem, we add the 'aliasedCoordinateDelta' such that the rounding will err on the side of caution. This improves the correctness when using the raster engine as a reference. Task-number: QTBUG-13165 Reviewed-by: Samuel --- src/openvg/qpaintengine_vg.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 3c2fd3d..74395a2 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -248,7 +248,11 @@ public: inline void ensurePathTransform() { if (!pathTransformSet) { - setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, pathTransform); + QTransform aliasedTransform = pathTransform; + if (renderingQuality == VG_RENDERING_QUALITY_NONANTIALIASED && currentPen != Qt::NoPen) + aliasedTransform = aliasedTransform + * QTransform::fromTranslate(aliasedCoordinateDelta, -aliasedCoordinateDelta); + setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, aliasedTransform); pathTransformSet = true; } } @@ -306,6 +310,7 @@ inline void QVGPaintEnginePrivate::setRenderingQuality(VGRenderingQuality mode) if (renderingQuality != mode) { vgSeti(VG_RENDERING_QUALITY, mode); renderingQuality = mode; + pathTransformSet = false; // need to tweak transform for aliased stroking } } -- cgit v0.12 From 9b20aac0ad83b917c46cc44b78dc90fb1d238fe8 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 13 Sep 2010 16:48:39 +0200 Subject: Fix text direction handling in QLabel For QLabel, text direction should be determined by actual text (if it's a simple text label) or the textDirection() property of the defaultTextOption of corresponding QTextDocument. Task-number: QTBUG-13552 Reviewed-by: Lars Knoll --- src/gui/widgets/qlabel.cpp | 27 ++++++++++++++++----------- src/gui/widgets/qlabel_p.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index bdbd0b0..42be03b 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -635,7 +635,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const br = movie->currentPixmap().rect(); #endif else if (isTextLabel) { - int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align)); + int align = QStyle::visualAlignment(textDirection(), QFlag(this->align)); // Add indentation int m = indent; @@ -1059,7 +1059,8 @@ void QLabel::paintEvent(QPaintEvent *) drawFrame(&painter); QRect cr = contentsRect(); cr.adjust(d->margin, d->margin, -d->margin, -d->margin); - int align = QStyle::visualAlignment(layoutDirection(), QFlag(d->align)); + int align = QStyle::visualAlignment(d->isTextLabel ? d->textDirection() + : layoutDirection(), QFlag(d->align)); #ifndef QT_NO_MOVIE if (d->movie) { @@ -1119,7 +1120,8 @@ void QLabel::paintEvent(QPaintEvent *) d->control->drawContents(&painter, QRectF(), this); painter.restore(); } else { - int flags = align; + int flags = align | (d->textDirection() == Qt::LeftToRight ? Qt::TextForceLeftToRight + : Qt::TextForceRightToLeft); if (d->hasShortcut) { flags |= Qt::TextShowMnemonic; if (!style->styleHint(QStyle::SH_UnderlineShortcut, &opt, this)) @@ -1447,10 +1449,6 @@ void QLabel::changeEvent(QEvent *ev) d->control->setPalette(palette()); } else if (ev->type() == QEvent::ContentsRectChange) { d->updateLabel(); - } else if (ev->type() == QEvent::LayoutDirectionChange) { - if (d->isTextLabel && d->control) { - d->sendControlEvent(ev); - } } QFrame::changeEvent(ev); } @@ -1486,6 +1484,15 @@ void QLabel::setScaledContents(bool enable) update(contentsRect()); } +Qt::LayoutDirection QLabelPrivate::textDirection() const +{ + if (control) { + QTextOption opt = control->document()->defaultTextOption(); + return opt.textDirection(); + } + + return text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; +} /*! \fn void QLabel::setAlignment(Qt::AlignmentFlag flag) @@ -1503,7 +1510,8 @@ QRect QLabelPrivate::documentRect() const Q_ASSERT_X(isTextLabel, "documentRect", "document rect called for label that is not a text label!"); QRect cr = q->contentsRect(); cr.adjust(margin, margin, -margin, -margin); - const int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align)); + const int align = QStyle::visualAlignment(isTextLabel ? textDirection() + : q->layoutDirection(), QFlag(this->align)); int m = indent; if (m < 0 && q->frameWidth()) // no indent, but we do have a frame m = q->fontMetrics().width(QLatin1Char('x')) / 2 - margin; @@ -1564,7 +1572,6 @@ void QLabelPrivate::ensureTextLayouted() const if (!textLayoutDirty) return; ensureTextPopulated(); - Q_Q(const QLabel); if (control) { QTextDocument *doc = control->document(); QTextOption opt = doc->defaultTextOption(); @@ -1576,8 +1583,6 @@ void QLabelPrivate::ensureTextLayouted() const else opt.setWrapMode(QTextOption::ManualWrap); - opt.setTextDirection(q->layoutDirection()); - doc->setDefaultTextOption(opt); QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h index fba7224..83624c7 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/gui/widgets/qlabel_p.h @@ -132,6 +132,7 @@ public: QRectF layoutRect() const; QRect documentRect() const; QPoint layoutPoint(const QPoint& p) const; + Qt::LayoutDirection textDirection() const; #ifndef QT_NO_CONTEXTMENU QMenu *createStandardContextMenu(const QPoint &pos); #endif -- cgit v0.12 From 6397e5bc49f11e20a9d1838d8d8df46dd9486263 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 22 Sep 2010 15:10:44 +0200 Subject: Fix text direction setting in QTextBlock layout QTextControl should no longer inherit the layout direction of parent widget as its default text direction. Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Lars Knoll --- src/gui/text/qtextcontrol.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 5fe0c0c..7f2c4e9 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -404,12 +404,6 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText Q_Q(QTextControl); setContent(format, text, document); - QWidget *parentWidget = qobject_cast(parent); - if (parentWidget) { - QTextOption opt = doc->defaultTextOption(); - opt.setTextDirection(parentWidget->layoutDirection()); - doc->setDefaultTextOption(opt); - } doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); q->setCursorWidth(-1); } -- cgit v0.12 From d1817df87461fc071527eb77d3c1259e713b94a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 23 Sep 2010 12:10:59 +0200 Subject: Compile on Symbian - rework the X11 mask patch a bit. Avoid adding a virtual QPixmapData::hasMask() function, we can do without it. Made QPixmap::hasAlpha() fast, so we can use that instead. Reviewed-by: Samuel --- src/gui/image/qpixmap.cpp | 20 +++++++++++++++++--- src/gui/image/qpixmap_x11.cpp | 10 ---------- src/gui/image/qpixmap_x11_p.h | 1 - src/gui/image/qpixmapdata.cpp | 5 ----- src/gui/image/qpixmapdata_p.h | 1 - .../gl2paintengineex/qpaintengineex_opengl2.cpp | 4 ++-- 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 6a13f49..64d8ed2 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1798,13 +1798,27 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) Returns true if this pixmap has an alpha channel, \e or has a mask, otherwise returns false. - \warning This is potentially an expensive operation. - \sa hasAlphaChannel(), mask() */ bool QPixmap::hasAlpha() const { - return data && (data->hasAlphaChannel() || !data->mask().isNull()); +#if defined(Q_WS_X11) + if (data && data->hasAlphaChannel()) + return true; + QPixmapData *pd = pixmapData(); + if (pd && pd->classId() == QPixmapData::X11Class) { + QX11PixmapData *x11Data = static_cast(pd); +#ifndef QT_NO_XRENDER + if (x11Data->picture && x11Data->d == 32) + return true; +#endif + if (x11Data->d == 1 || x11Data->x11_mask) + return true; + } + return false; +#else + return data && data->hasAlphaChannel(); +#endif } /*! diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 32676ba..01f2c11 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1321,16 +1321,6 @@ QBitmap QX11PixmapData::mask() const return mask; } -bool QX11PixmapData::hasMask() const -{ - return -#ifndef QT_NO_XRENDER - (picture && d == 32) || -#endif - (d == 1) || x11_mask; -} - - /*! Sets a mask bitmap. diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index fcad1a2..821fb69 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -82,7 +82,6 @@ public: void fill(const QColor &color); QBitmap mask() const; - bool hasMask() const; void setMask(const QBitmap &mask); bool hasAlphaChannel() const; void setAlphaChannel(const QPixmap &alphaChannel); diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 2813ed1..ef1f6c4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -239,11 +239,6 @@ QBitmap QPixmapData::mask() const return QBitmap::fromImage(mask); } -bool QPixmapData::hasMask() const -{ - return hasAlphaChannel(); -} - QPixmap QPixmapData::transformed(const QTransform &matrix, Qt::TransformationMode mode) const { diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index c341930..ec62b0b 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -99,7 +99,6 @@ public: virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; virtual void fill(const QColor &color) = 0; virtual QBitmap mask() const; - virtual bool hasMask() const; virtual void setMask(const QBitmap &mask); virtual bool hasAlphaChannel() const = 0; virtual QPixmap transformed(const QTransform &matrix, diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 6eb5a36..ee59830 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1314,7 +1314,7 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c QGLRect srcRect(src.left(), top, src.right(), bottom); bool isBitmap = pixmap.isQBitmap(); - bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel() && !pixmap.pixmapData()->hasMask(); + bool isOpaque = !isBitmap && !pixmap.hasAlpha(); d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); @@ -1765,7 +1765,7 @@ void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragmen transferMode(ImageArrayDrawingMode); bool isBitmap = pixmap.isQBitmap(); - bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QPainter::OpaqueHint)) && allOpaque; + bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque; updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); -- cgit v0.12 From 9c97aa4946a1d6b22bdcd8475f32b5ead7051976 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 23 Sep 2010 12:22:15 +0200 Subject: Update the changelog with the SSE work done for Qt 4.7.1 --- dist/changes-4.7.1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 30c2efd..d3ae280 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -26,6 +26,11 @@ Optimizations - Improved the benchmarking library's timing code * Uses a faster access to the system clock + - Introduction of SSSE3 for alpha blending of images. + + - On x86 and 86_64, the memory access has been improved for alpha blending + and for some composition functions. + * See list of Important Behavior Changes below @@ -107,7 +112,7 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - + - The configure script now detects all vector extensions of x86 and x86_64 Qt for Windows -------------- @@ -115,7 +120,7 @@ Qt for Windows Qt for Mac OS X --------------- - + - The configure script now detects all vector extensions of x86 and x86_64 Qt for Symbian -------------- -- cgit v0.12 From 992809f9ba91c50bc759508127b493172236c149 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 23 Sep 2010 12:36:42 +0200 Subject: Fixes gray_raster incorrectly reporting out of memory error. The bug caused a useless realloction everytime a path was rasterized with gray_raster. Task-number: QTBUG-13871 Reviewed-by: Samuel --- src/gui/painting/qgrayraster.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 94039fb..19cef49 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -324,6 +324,7 @@ { void* buffer; long buffer_size; + long buffer_allocated_size; int band_size; void* memory; PWorker worker; @@ -1767,7 +1768,7 @@ // If raster object and raster buffer are allocated, but // raster size isn't of the minimum size, indicate out of // memory. - if (raster && raster->buffer && raster->buffer_size < MINIMUM_POOL_SIZE ) + if (raster->buffer_allocated_size < MINIMUM_POOL_SIZE ) return ErrRaster_OutOfMemory; /* return immediately if the outline is empty */ @@ -1906,6 +1907,7 @@ rast->buffer_size = 0; rast->worker = NULL; } + rast->buffer_allocated_size = pool_size; } } -- cgit v0.12 From 7d878ba53909157cf1911c30ce973378589c2cc0 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 23 Sep 2010 13:43:26 +0200 Subject: Incorrect translations for application menu items on Mac OS X. This is a regression fron 4.6 release. Menu entries with some specific roles are automatically merged to the application menu. They are now translated based on the context "MAC_APPLICATION_MENU" instead of "QMenuBar" context. This patch eanbles the use for both contexts. Task-number: QTBUG-13878 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qapplication.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 43d5772..185af9a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2397,8 +2397,13 @@ static const char *application_menu_strings[] = { }; QString qt_mac_applicationmenu_string(int type) { - return qApp->translate("MAC_APPLICATION_MENU", - application_menu_strings[type]); + QString menuString = QString::fromLatin1(application_menu_strings[type]); + QString translated = qApp->translate("QMenuBar", application_menu_strings[type]); + if (translated != menuString) + return translated; + else + return qApp->translate("MAC_APPLICATION_MENU", + application_menu_strings[type]); } #endif #endif -- cgit v0.12 From 1dcef0480901ec736af70edc80d4b821e0c8ebe5 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 21 Sep 2010 11:39:32 +0200 Subject: Made posted events part of the round robin queue. That means that posted events will only be sent once per event queue iteration, just like timers. This helps prevent event starvation. RevBy: mread AutoTest: Included Task: QTBUG-13743 --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 6 ++++-- src/corelib/kernel/qeventdispatcher_symbian_p.h | 5 +---- tests/auto/qtimer/tst_qtimer.cpp | 27 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 5cc6ae3..4ac500f 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -178,8 +178,7 @@ void QActiveObject::reactivateAndComplete() } QWakeUpActiveObject::QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher) - : CActive(WAKE_UP_PRIORITY), - m_dispatcher(dispatcher) + : QActiveObject(WAKE_UP_PRIORITY, dispatcher) { CActiveScheduler::Add(this); iStatus = KRequestPending; @@ -201,6 +200,9 @@ void QWakeUpActiveObject::DoCancel() void QWakeUpActiveObject::RunL() { + if (!okToRun()) + return; + iStatus = KRequestPending; SetActive(); QT_TRYCATCH_LEAVING(m_dispatcher->wakeUpWasCalled()); diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index bc42753..53afebe 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -95,7 +95,7 @@ private: int m_iterationCount; }; -class QWakeUpActiveObject : public CActive +class QWakeUpActiveObject : public QActiveObject { public: QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher); @@ -106,9 +106,6 @@ public: protected: void DoCancel(); void RunL(); - -private: - QEventDispatcherSymbian *m_dispatcher; }; struct SymbianTimerInfo : public QSharedData diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index f23d065..102308e 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -89,6 +89,7 @@ private slots: void recurseOnTimeoutAndStopTimer(); void QTBUG13633_dontBlockEvents(); + void postedEventsShouldNotStarveTimers(); }; class TimerHelper : public QObject @@ -723,5 +724,31 @@ void tst_QTimer::QTBUG13633_dontBlockEvents() QVERIFY(t.total > 2); } +class SlotRepeater : public QObject { + Q_OBJECT +public: + SlotRepeater() {} + +public slots: + void repeatThisSlot() + { + QMetaObject::invokeMethod(this, "repeatThisSlot", Qt::QueuedConnection); + } +}; + +void tst_QTimer::postedEventsShouldNotStarveTimers() +{ + TimerHelper timerHelper; + QTimer timer; + connect(&timer, SIGNAL(timeout()), &timerHelper, SLOT(timeout())); + timer.setInterval(0); + timer.setSingleShot(false); + timer.start(); + SlotRepeater slotRepeater; + slotRepeater.repeatThisSlot(); + QTest::qWait(100); + QVERIFY(timerHelper.count > 5); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" -- cgit v0.12 From af847c5cc080c6b9730c022b29374841a68cf356 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 21 Sep 2010 13:19:14 +0200 Subject: Marked a test as XFAIL on Symbian. Task: QTBUG-13773 --- tests/auto/qtimer/tst_qtimer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 102308e..73179fd 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -719,6 +719,10 @@ void DontBlockEvents::paintEvent() void tst_QTimer::QTBUG13633_dontBlockEvents() { +#ifdef Q_OS_SYMBIAN + QEXPECT_FAIL("", "Expect failure because of QTBUG-13773", Abort); + QVERIFY2(false, "This test hangs on Symbian"); +#endif DontBlockEvents t; QTest::qWait(60); QVERIFY(t.total > 2); -- cgit v0.12 From 5c29d5be5197b265f16c4895776e9be97db845d6 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 21 Sep 2010 14:16:21 +0200 Subject: Fixed deployment when using shadow builds. --- tests/auto/qapplication/test/test.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro index 30eb751..2c54c37 100644 --- a/tests/auto/qapplication/test/test.pro +++ b/tests/auto/qapplication/test/test.pro @@ -12,7 +12,7 @@ wince* { } symbian: { - additional.sources = ../desktopsettingsaware/desktopsettingsaware.exe + additional.sources = $$OUT_PWD/../desktopsettingsaware/desktopsettingsaware.exe additional.path = desktopsettingsaware someTest.sources = test.pro someTest.path = test -- cgit v0.12 From 8d8d147f1dd5d2922a4c61c43d378c8784224f13 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 23 Sep 2010 13:38:04 +0200 Subject: Fixed event starvation on Symbian if timers were constantly recreated If a timer event occurred, and inside its handler a new timer was created that would also immediately occur, the events would execute over and over and starve other events. This happened because the code in Symbian that is supposed to detect when the same event happens more than once does not work if it is always a new timer which executes. The bug was fixed by introducing a state variable which signals whether we are currently inside the handler of a timer event, and then pretending that newly created timers inside this handler have already been executed once, thereby delaying their execution until the next iteration. Because we reset the state variable in processEvents, the behavior will be slightly different if run directly under CActiveScheduler::Start(). There, we have no way of resetting the state on the next iteration, so all timers inside such a handler (even if it recurses into a new CActiveScheduler::Start()) will be delayed by one event iteration. However, this is considered acceptable, since there is no real "iteration count" in the active scheduler; the event will simply be run after the deferred queue is reactivated (which will be immediately if there are no other events). This is the same as what would have happened for a real timer that executed once and then recursed into CActiveScheduler::Start() (it would also be delayed by one iteration). Task: QTBUG-13773 RevBy: mread AutoTest: Passed --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 16 ++++++++++++++++ src/corelib/kernel/qeventdispatcher_symbian_p.h | 1 + tests/auto/qtimer/tst_qtimer.cpp | 4 ---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 4ac500f..89012d1 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -724,6 +724,7 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_interrupt(false), m_wakeUpDone(0), m_iterationCount(0), + m_insideTimerEvent(false), m_noSocketEvents(false) { #ifdef QT_SYMBIAN_PRIORITY_DROP @@ -774,6 +775,9 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla { bool handledAnyEvent = false; bool oldNoSocketEventsValue = m_noSocketEvents; + bool oldInsideTimerEventValue = m_insideTimerEvent; + + m_insideTimerEvent = false; QT_TRY { Q_D(QAbstractEventDispatcher); @@ -864,6 +868,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } m_noSocketEvents = oldNoSocketEventsValue; + m_insideTimerEvent = oldInsideTimerEventValue; return handledAnyEvent; } @@ -884,10 +889,13 @@ void QEventDispatcherSymbian::timerFired(int timerId) } timerInfo->inTimerEvent = true; + bool oldInsideTimerEventValue = m_insideTimerEvent; + m_insideTimerEvent = true; QTimerEvent event(timerInfo->timerId); QCoreApplication::sendEvent(timerInfo->receiver, &event); + m_insideTimerEvent = oldInsideTimerEventValue; timerInfo->inTimerEvent = false; return; @@ -1054,6 +1062,14 @@ void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject m_timerList.insert(timerId, timer); timer->timerAO->Start(); + + if (m_insideTimerEvent) + // If we are inside a timer event, we need to prevent event starvation + // by preventing newly created timers from running in the same event processing + // iteration. Do this by calling the okToRun() function to "fake" that we have + // already run once. This will cause the next run to be added to the deferred + // queue instead. + timer->timerAO->okToRun(); } bool QEventDispatcherSymbian::unregisterTimer ( int timerId ) diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 53afebe..8e20d56 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -274,6 +274,7 @@ private: QAtomicInt m_wakeUpDone; unsigned char m_iterationCount; + bool m_insideTimerEvent; bool m_noSocketEvents; QList m_deferredSocketEvents; diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 73179fd..102308e 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -719,10 +719,6 @@ void DontBlockEvents::paintEvent() void tst_QTimer::QTBUG13633_dontBlockEvents() { -#ifdef Q_OS_SYMBIAN - QEXPECT_FAIL("", "Expect failure because of QTBUG-13773", Abort); - QVERIFY2(false, "This test hangs on Symbian"); -#endif DontBlockEvents t; QTest::qWait(60); QVERIFY(t.total > 2); -- cgit v0.12 From ecc7beca87bdfdad2e260f6b9621b77055cf313c Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 23 Sep 2010 14:20:13 +0200 Subject: Made it more clear what the okToRun function does by renaming it. Since it has the side effect of possibly adding the object to the deferred run queue, this name is more appropriate. AutoTest: Passed RevBy: mread --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 22 +++++++++++----------- src/corelib/kernel/qeventdispatcher_symbian_p.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 89012d1..d8cc344 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -127,9 +127,9 @@ private: * cannot change active objects that we do not own, but the active objects that Qt owns will use * this as a base class with convenience functions. * - * Here is how it works: On every RunL, the deriving class should call okToRun(). This will allow - * exactly one run of the active object, and mark it as such. If it is called again, it will return - * false, and add the object to a queue so it can be run later. + * Here is how it works: On every RunL, the deriving class should call maybeQueueForLater(). + * This will return whether the active object has been queued, or whether it should run immediately. + * Queued objects will run again after other events have been processed. * * The QCompleteDeferredAOs class is a special object that runs after all others, which will * reactivate the objects that were previously not run. @@ -149,7 +149,7 @@ QActiveObject::~QActiveObject() m_dispatcher->removeDeferredActiveObject(this); } -bool QActiveObject::okToRun() +bool QActiveObject::maybeQueueForLater() { Q_ASSERT(!m_hasRunAgain); @@ -157,12 +157,12 @@ bool QActiveObject::okToRun() // First occurrence of this event in this iteration. m_hasAlreadyRun = true; m_iterationCount = m_dispatcher->iterationCount(); - return true; + return false; } else { // The event has already occurred. m_dispatcher->addDeferredActiveObject(this); m_hasRunAgain = true; - return false; + return true; } } @@ -200,7 +200,7 @@ void QWakeUpActiveObject::DoCancel() void QWakeUpActiveObject::RunL() { - if (!okToRun()) + if (maybeQueueForLater()) return; iStatus = KRequestPending; @@ -272,7 +272,7 @@ void QTimerActiveObject::Run() return; } - if (!okToRun()) + if (maybeQueueForLater()) return; if (m_timerInfo->interval > 0) { @@ -632,7 +632,7 @@ void QSocketActiveObject::DoCancel() void QSocketActiveObject::RunL() { - if (!okToRun()) + if (maybeQueueForLater()) return; QT_TRYCATCH_LEAVING(m_dispatcher->socketFired(this)); @@ -1066,10 +1066,10 @@ void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject if (m_insideTimerEvent) // If we are inside a timer event, we need to prevent event starvation // by preventing newly created timers from running in the same event processing - // iteration. Do this by calling the okToRun() function to "fake" that we have + // iteration. Do this by calling the maybeQueueForLater() function to "fake" that we have // already run once. This will cause the next run to be added to the deferred // queue instead. - timer->timerAO->okToRun(); + timer->timerAO->maybeQueueForLater(); } bool QEventDispatcherSymbian::unregisterTimer ( int timerId ) diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 8e20d56..1486db5 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -82,7 +82,7 @@ public: QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher); ~QActiveObject(); - bool okToRun(); + bool maybeQueueForLater(); void reactivateAndComplete(); -- cgit v0.12 From 07c5429d5aacab932cd912e66287d66fb952e7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 23 Sep 2010 14:49:18 +0200 Subject: Don't try to use the texture_from_pixmap extension in GL on desktop/X11. There are far too many problems with this extension for it to be usable on desktop at the moment, so disable on desktop GL for now. It's still enabled for EGL, where it seems to have better driver support. Task-number: related to QTBUG-11158 Reviewed-by: Samuel --- src/opengl/qgl.cpp | 33 +++++++-------------------------- src/opengl/qgl_p.h | 3 --- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 15070d4..0d1a66e 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1689,9 +1689,6 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_brokenFBOReadBack = false; workaroundsCached = false; - workaround_brokenTextureFromPixmap = false; - workaround_brokenTextureFromPixmap_init = false; - for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } @@ -2577,34 +2574,18 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, } } -#if defined(Q_WS_X11) - // Try to use texture_from_pixmap +#if defined(Q_WS_X11) && !defined(QT_NO_EGL) + // Only try to use texture_from_pixmap under X11/EGL const QX11Info *xinfo = qt_x11Info(paintDevice); if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType && xinfo && xinfo->screen() == pixmap.x11Info().screen() && target == GL_TEXTURE_2D) { - if (!workaround_brokenTextureFromPixmap_init) { - workaround_brokenTextureFromPixmap_init = true; - - const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION))); - const int pos = versionString.indexOf("NVIDIA "); - - if (pos >= 0) { - const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA ")); - - if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256")) - workaround_brokenTextureFromPixmap = true; - } - } - - if (!workaround_brokenTextureFromPixmap) { - texture = bindTextureFromNativePixmap(const_cast(&pixmap), key, options); - if (texture) { - texture->options |= QGLContext::MemoryManagedBindOption; - texture->boundPixmap = pd; - boundPixmaps.insert(pd, QPixmap(pixmap)); - } + texture = bindTextureFromNativePixmap(const_cast(&pixmap), key, options); + if (texture) { + texture->options |= QGLContext::MemoryManagedBindOption; + texture->boundPixmap = pd; + boundPixmaps.insert(pd, QPixmap(pixmap)); } } #endif diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 623eeaf..6323ce2 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -401,9 +401,6 @@ public: uint workaround_brokenFBOReadBack : 1; uint workaroundsCached : 1; - uint workaround_brokenTextureFromPixmap : 1; - uint workaround_brokenTextureFromPixmap_init : 1; - QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; -- cgit v0.12 From 7c673a4cf64ba043bb27f90287517bdcdd7a21db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 20 Sep 2010 14:54:30 +0200 Subject: Fixed scaled point drawing with square cap in raster paint engine. With a large pen width and a small scale, due to the hacky way we draw points (stroking a line from (x, y) to (x + tiny_amount, y)), we some times end up snapping these two points to the same in rasterizeLine(). If we instead apply the SquareCap before we do clipping / snapping we don't get this problem. Task-number: QTBUG-13429 Reviewed-by: Trond --- src/gui/painting/qrasterizer.cpp | 41 +++++++++++++++--------------------- tests/auto/qpainter/tst_qpainter.cpp | 22 +++++++++++++++++++ 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index f8f8afb..61ed12e 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -718,17 +718,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, QPointF pa = a; QPointF pb = b; - QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; - if (squareCap) - offs += QPointF(offs.y(), offs.x()); + if (squareCap) { + QPointF delta = pb - pa; + pa -= (0.5f * width) * delta; + pb += (0.5f * width) * delta; + } + + QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs); - if (!clip.contains(a) || !clip.contains(b)) { + if (!clip.contains(pa) || !clip.contains(pb)) { qreal t1 = 0; qreal t2 = 1; - const qreal o[2] = { a.x(), a.y() }; - const qreal d[2] = { b.x() - a.x(), b.y() - a.y() }; + const qreal o[2] = { pa.x(), pa.y() }; + const qreal d[2] = { pb.x() - pa.x(), pb.y() - pa.y() }; const qreal low[2] = { clip.left(), clip.top() }; const qreal high[2] = { clip.right(), clip.bottom() }; @@ -751,8 +755,12 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (t1 >= t2) return; } - pa = a + (b - a) * t1; - pb = a + (b - a) * t2; + + QPointF npa = pa + (pb - pa) * t1; + QPointF npb = pa + (pb - pa) * t2; + + pa = npa; + pb = npb; } if (!d->antialiased) { @@ -799,12 +807,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, pa = QPointF(x, y - dy); pb = QPointF(x, y + dy); - if (squareCap) - width = 1 / width + 1.0f; - else - width = 1 / width; - - squareCap = false; + width = 1 / width; } if (q16Dot16Compare(pa.x(), pb.x())) { @@ -814,11 +817,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const qreal dy = pb.y() - pa.y(); const qreal halfWidth = 0.5f * width * dy; - if (squareCap) { - pa.ry() -= halfWidth; - pb.ry() += halfWidth; - } - qreal left = pa.x() - halfWidth; qreal right = pa.x() + halfWidth; @@ -899,11 +897,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, delta *= 0.5f * width; const QPointF perp(delta.y(), -delta.x()); - if (squareCap) { - pa -= delta; - pb += delta; - } - QPointF top; QPointF left; QPointF right; diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index f358681..a94c300 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -252,6 +252,8 @@ private slots: void QTBUG5939_attachPainterPrivate(); + void drawPointScaled(); + private: void fillData(); void setPenColor(QPainter& p); @@ -4522,6 +4524,26 @@ void tst_QPainter::QTBUG5939_attachPainterPrivate() QCOMPARE(widget->deviceTransform, proxy->deviceTransform); } +void tst_QPainter::drawPointScaled() +{ + QImage image(32, 32, QImage::Format_RGB32); + image.fill(0xffffffff); + + QPainter p(&image); + + p.scale(0.1, 0.1); + + QPen pen; + pen.setWidth(1000); + pen.setColor(Qt::red); + + p.setPen(pen); + p.drawPoint(0, 0); + p.end(); + + QCOMPARE(image.pixel(16, 16), 0xffff0000); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v0.12 From 93199a5b7082fd484b7f21ad4825d71693ecead2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 23 Sep 2010 10:04:39 +0200 Subject: Fixed floating point overflow issues in QRasterizer::rasterizeLine Change 7c673a4cf64ba04 introduced some autotest failures in the fpe_steepSlopes test in QPainter. Since the other rasterizers all deal in a 26.6 fixed point coordinate space we should snap the line vertices to this to prevent floating point overflows due to very steep slopes. This also necessitates keeping track of four different slope / inverse slope increments for each of the four edges. This also fixes a previously QEXPECT_FAIL'ed test case. Task-number: QTBUG-13429 Reviewed-by: Trond --- src/gui/painting/qrasterizer.cpp | 139 ++++++++++++++++++++--------------- tests/auto/qpainter/tst_qpainter.cpp | 1 - 2 files changed, 79 insertions(+), 61 deletions(-) diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 61ed12e..4fded1f 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -65,6 +65,12 @@ typedef int Q16Dot16; #define COORD_ROUNDING 1 // 0: round up, 1: round down #define COORD_OFFSET 32 // 26.6, 32 is half a pixel +static inline QT_FT_Vector PointToVector(const QPointF &p) +{ + QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; + return result; +} + class QSpanBuffer { public: QSpanBuffer(ProcessSpans blend, void *data, const QRect &clipRect) @@ -693,9 +699,9 @@ static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 } } -static inline bool q16Dot16Compare(qreal p1, qreal p2) +static inline bool q26Dot6Compare(qreal p1, qreal p2) { - return FloatToQ16Dot16(p2 - p1) == 0; + return int((p2 - p1) * 64.) == 0; } static inline qreal qFloorF(qreal v) @@ -708,6 +714,12 @@ static inline qreal qFloorF(qreal v) return floor(v); } +static inline QPointF snapTo26Dot6Grid(const QPointF &p) +{ + return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)), + qFloorF(p.y() * 64) * (1 / qreal(64))); +} + void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) { if (a == b || width == 0 || d->clipRect.isEmpty()) @@ -771,15 +783,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, } { - const qreal gridResolution = 64; - const qreal reciprocal = 1 / gridResolution; - - // snap to grid to prevent large slopes - pa.rx() = qFloorF(pa.rx() * gridResolution) * reciprocal; - pa.ry() = qFloorF(pa.ry() * gridResolution) * reciprocal; - pb.rx() = qFloorF(pb.rx() * gridResolution) * reciprocal; - pb.ry() = qFloorF(pb.ry() * gridResolution) * reciprocal; - // old delta const QPointF d0 = a - b; const qreal w0 = d0.x() * d0.x() + d0.y() * d0.y(); @@ -797,7 +800,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, QSpanBuffer buffer(d->blend, d->data, d->clipRect); - if (q16Dot16Compare(pa.y(), pb.y())) { + if (q26Dot6Compare(pa.y(), pb.y())) { const qreal x = (pa.x() + pb.x()) * 0.5f; const qreal dx = qAbs(pb.x() - pa.x()) * 0.5f; @@ -810,7 +813,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, width = 1 / width; } - if (q16Dot16Compare(pa.x(), pb.x())) { + if (q26Dot6Compare(pa.x(), pb.x())) { if (pa.y() > pb.y()) qSwap(pa, pb); @@ -826,7 +829,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, pa.ry() = qBound(qreal(d->clipRect.top()), pa.y(), qreal(d->clipRect.bottom() + 1)); pb.ry() = qBound(qreal(d->clipRect.top()), pb.y(), qreal(d->clipRect.bottom() + 1)); - if (q16Dot16Compare(left, right) || q16Dot16Compare(pa.y(), pb.y())) + if (q26Dot6Compare(left, right) || q26Dot6Compare(pa.y(), pb.y())) return; if (d->antialiased) { @@ -914,14 +917,36 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bottom = pb + perp; } + top = snapTo26Dot6Grid(top); + bottom = snapTo26Dot6Grid(bottom); + left = snapTo26Dot6Grid(left); + right = snapTo26Dot6Grid(right); + const qreal topBound = qBound(qreal(d->clipRect.top()), top.y(), qreal(d->clipRect.bottom())); const qreal bottomBound = qBound(qreal(d->clipRect.top()), bottom.y(), qreal(d->clipRect.bottom())); - const qreal leftSlope = (left.x() - top.x()) / (left.y() - top.y()); - const qreal rightSlope = -1.0f / leftSlope; + const QPointF topLeftEdge = left - top; + const QPointF topRightEdge = right - top; + const QPointF bottomLeftEdge = bottom - left; + const QPointF bottomRightEdge = bottom - right; - const Q16Dot16 leftSlopeFP = FloatToQ16Dot16(leftSlope); - const Q16Dot16 rightSlopeFP = FloatToQ16Dot16(rightSlope); + const qreal topLeftSlope = topLeftEdge.x() / topLeftEdge.y(); + const qreal bottomLeftSlope = bottomLeftEdge.x() / bottomLeftEdge.y(); + + const qreal topRightSlope = topRightEdge.x() / topRightEdge.y(); + const qreal bottomRightSlope = bottomRightEdge.x() / bottomRightEdge.y(); + + const Q16Dot16 topLeftSlopeFP = FloatToQ16Dot16(topLeftSlope); + const Q16Dot16 topRightSlopeFP = FloatToQ16Dot16(topRightSlope); + + const Q16Dot16 bottomLeftSlopeFP = FloatToQ16Dot16(bottomLeftSlope); + const Q16Dot16 bottomRightSlopeFP = FloatToQ16Dot16(bottomRightSlope); + + const Q16Dot16 invTopLeftSlopeFP = FloatToQ16Dot16(1 / topLeftSlope); + const Q16Dot16 invTopRightSlopeFP = FloatToQ16Dot16(1 / topRightSlope); + + const Q16Dot16 invBottomLeftSlopeFP = FloatToQ16Dot16(1 / bottomLeftSlope); + const Q16Dot16 invBottomRightSlopeFP = FloatToQ16Dot16(1 / bottomRightSlope); if (d->antialiased) { const Q16Dot16 iTopFP = IntToQ16Dot16(int(topBound)); @@ -929,16 +954,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const Q16Dot16 iRightFP = IntToQ16Dot16(int(right.y())); const Q16Dot16 iBottomFP = IntToQ16Dot16(int(bottomBound)); - Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * leftSlope); - Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * rightSlope); + Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope); + Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope); Q16Dot16 leftIntersectBf = 0; Q16Dot16 rightIntersectBf = 0; if (iLeftFP < iTopFP) - leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * rightSlope); + leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope); if (iRightFP < iTopFP) - rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * leftSlope); + rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope); Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom; Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf; @@ -953,9 +978,9 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, rowTop = qMax(iTopFP, yTopFP); topLeftIntersectAf = leftIntersectAf + - Q16Dot16Multiply(leftSlopeFP, rowTop - iTopFP); + Q16Dot16Multiply(topLeftSlopeFP, rowTop - iTopFP); topRightIntersectAf = rightIntersectAf + - Q16Dot16Multiply(rightSlopeFP, rowTop - iTopFP); + Q16Dot16Multiply(topRightSlopeFP, rowTop - iTopFP); Q16Dot16 yFP = iTopFP; while (yFP <= iBottomFP) { @@ -967,30 +992,30 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP == iLeftFP) { const int y = Q16Dot16ToInt(yFP); - leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * rightSlope); - topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowTopLeft - yFP); - bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(leftSlopeFP, rowBottomLeft - yFP); + leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope); + topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowTopLeft - yFP); + bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(topLeftSlopeFP, rowBottomLeft - yFP); } else { topLeftIntersectBf = leftIntersectBf; - bottomLeftIntersectAf = leftIntersectAf + leftSlopeFP; + bottomLeftIntersectAf = leftIntersectAf + topLeftSlopeFP; } if (yFP == iRightFP) { const int y = Q16Dot16ToInt(yFP); - rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * leftSlope); - topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowTopRight - yFP); - bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(rightSlopeFP, rowBottomRight - yFP); + rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope); + topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowTopRight - yFP); + bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(topRightSlopeFP, rowBottomRight - yFP); } else { topRightIntersectBf = rightIntersectBf; - bottomRightIntersectAf = rightIntersectAf + rightSlopeFP; + bottomRightIntersectAf = rightIntersectAf + topRightSlopeFP; } if (yFP == iBottomFP) { - bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowBottom - yFP); - bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowBottom - yFP); + bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowBottom - yFP); + bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowBottom - yFP); } else { - bottomLeftIntersectBf = leftIntersectBf + rightSlopeFP; - bottomRightIntersectBf = rightIntersectBf + leftSlopeFP; + bottomLeftIntersectBf = leftIntersectBf + bottomLeftSlopeFP; + bottomRightIntersectBf = rightIntersectBf + bottomRightSlopeFP; } if (yFP < iLeftFP) { @@ -1035,21 +1060,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP <= iLeftFP) excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, - leftSlopeFP, -rightSlopeFP); + topLeftSlopeFP, invTopLeftSlopeFP); if (yFP >= iLeftFP) excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, - rightSlopeFP, -leftSlopeFP); + bottomLeftSlopeFP, invBottomLeftSlopeFP); if (x >= rightMin) { if (yFP <= iRightFP) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, - rightSlopeFP, -leftSlopeFP); + topRightSlopeFP, invTopRightSlopeFP); if (yFP >= iRightFP) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, - leftSlopeFP, -rightSlopeFP); + bottomRightSlopeFP, invBottomRightSlopeFP); } Q16Dot16 coverage = rowHeight - excluded; @@ -1067,11 +1092,11 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP <= iRightFP) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, - rightSlopeFP, -leftSlopeFP); + topRightSlopeFP, invTopRightSlopeFP); if (yFP >= iRightFP) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, - leftSlopeFP, -rightSlopeFP); + bottomRightSlopeFP, invBottomRightSlopeFP); Q16Dot16 coverage = rowHeight - excluded; buffer.addSpan(x, 1, Q16Dot16ToInt(yFP), @@ -1079,10 +1104,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, ++x; } - leftIntersectAf += leftSlopeFP; - leftIntersectBf += rightSlopeFP; - rightIntersectAf += rightSlopeFP; - rightIntersectBf += leftSlopeFP; + leftIntersectAf += topLeftSlopeFP; + leftIntersectBf += bottomLeftSlopeFP; + rightIntersectAf += topRightSlopeFP; + rightIntersectBf += bottomRightSlopeFP; topLeftIntersectAf = leftIntersectAf; topRightIntersectAf = rightIntersectAf; @@ -1096,10 +1121,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, int iBottom = bottom.y() < 0.5f? -1 : int(bottom.y() - 0.5f); int iMiddle = qMin(iLeft, iRight); - Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * leftSlope); - Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * rightSlope); - Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * rightSlope); - Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * leftSlope); + Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope); + Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope); + Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope); + Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope); int ny; int y = iTop; @@ -1121,10 +1146,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, ri += rs; \ } - DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, leftSlopeFP, rightSlopeFP) - DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, rightSlopeFP, rightSlopeFP) - DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, leftSlopeFP, leftSlopeFP) - DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, rightSlopeFP, leftSlopeFP) + DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, topLeftSlopeFP, topRightSlopeFP) + DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, bottomLeftSlopeFP, topRightSlopeFP) + DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, topLeftSlopeFP, bottomRightSlopeFP); + DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, bottomLeftSlopeFP, bottomRightSlopeFP); #undef DO_SEGMENT } } @@ -1176,12 +1201,6 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule) d->scanConverter.end(); } -static inline QT_FT_Vector PointToVector(const QPointF &p) -{ - QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; - return result; -} - void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule) { if (path.isEmpty()) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index a94c300..45f5c3e 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -3172,7 +3172,6 @@ void fpe_steepSlopes() p.setRenderHint(QPainter::Antialiasing, antialiased); p.setTransform(transform); - QEXPECT_FAIL("steep line 3 aa", "needs to be fixed", Continue); p.drawLine(line); } -- cgit v0.12 From f160e04ebe2926d09c20ef3960def1388a566db7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Sep 2010 15:49:46 +0200 Subject: Changelog: 4.7.1 (uic/Designer). --- dist/changes-4.7.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index d3ae280..7676368 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -134,6 +134,7 @@ Qt for Symbian - Designer - uic + * Improve warnings and error reports **************************************************************************** * Important Behavior Changes * -- cgit v0.12 From 6041c6c6c1e46f9ffb69c5bd3692037f4b340728 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Sep 2010 15:50:35 +0200 Subject: Designer: Minor BT issue: '-' button in Signal/Slot editor not updated. Reviewed-by: Carlos Manuel Duclos Vergara --- .../designer/src/components/signalsloteditor/signalsloteditorwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index 5547761..794722e 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -724,7 +724,7 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor | QAbstractItemView::EditKeyPressed); m_view->setRootIsDecorated(false); m_view->setTextElideMode (Qt::ElideMiddle); - connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(updateUi())); + connect(m_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateUi())); connect(m_view->header(), SIGNAL(sectionDoubleClicked(int)), m_view, SLOT(resizeColumnToContents(int))); QVBoxLayout *layout = new QVBoxLayout(this); -- cgit v0.12 From 222a21187c3e3fe4ab6f436f30bde1b1dc0b2212 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 24 Sep 2010 00:22:05 +1000 Subject: Invalidate QStaticText coord cache when texture size changes If the glyph cache texture changes size, the texture coordinate array must be regenerated to point to the correct texture locations. Reviewed-By: Gunnar Sletta --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2347e66..0426ffd 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1470,7 +1470,7 @@ namespace { { public: QOpenGLStaticTextUserData() - : QStaticTextUserData(OpenGLUserData) + : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0) { } @@ -1478,6 +1478,7 @@ namespace { { } + QSize cacheSize; QGL2PEXVertexArray vertexCoordinateArray; QGL2PEXVertexArray textureCoordinateArray; }; @@ -1542,6 +1543,12 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp // Use cache if backend optimizations is turned on vertexCoordinates = &userData->vertexCoordinateArray; textureCoordinates = &userData->textureCoordinateArray; + + QSize size(cache->width(), cache->height()); + if (userData->cacheSize != size) { + recreateVertexArrays = true; + userData->cacheSize = size; + } } -- cgit v0.12 From 88d5561aba739c315775c47debf1623738f712ad Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 23 Sep 2010 16:57:46 +0300 Subject: Disallow patching capabilities of executables All of the assigned capabilities of executables are likely to be actually needed unlike those of dlls, so do not create a patched sis for an application with non-self-signable capabilities. Similarly block creation of a patched package if any executable has a protected range SID, as installer will refuse to install such a package anyway. Task-number: QTBUG-13886 Reviewed-by: Janne Koskinen --- bin/createpackage.pl | 24 ++++++++++++------------ bin/patch_capabilities.pl | 26 +++++++++++++++++++++----- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index cce0b54..85be5d3 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -212,21 +212,21 @@ my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60inst # Check some pre-conditions and print error messages if needed. unless (length($templatepkg)) { - print "\nError: Template PKG filename is not defined!\n"; + print "\nERROR: Template PKG filename is not defined!\n"; Usage(); } # Check template exist stat($templatepkg); unless( -e _ ) { - print "\nError: Package description file '$templatepkg' does not exist!\n"; + print "\nERROR: Package description file '$templatepkg' does not exist!\n"; Usage(); } # Check certifcate preconditions and set default certificate variables if needed if (length($certificate)) { unless(length($key)) { - print "\nError: Custom certificate key file parameter missing.!\n"; + print "\nERROR: Custom certificate key file parameter missing.!\n"; Usage(); } } else { @@ -261,7 +261,7 @@ if (length($certfile)) { # Do some validation unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) { - print "\nError: $certfile line '$_' does not contain valid information!\n"; + print "\nERROR: $certfile line '$_' does not contain valid information!\n"; Usage(); } @@ -280,14 +280,14 @@ if (!$preservePkgOutput) { local $/; # read template file -open( TEMPLATE, $templatepkg) or die "Error '$templatepkg': $!\n"; +open( TEMPLATE, $templatepkg) or die "ERROR: '$templatepkg': $!"; $_=