From 445e8af844ef6f120a5e406271dbeabad34ed47a Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 9 Nov 2009 13:46:37 +0100 Subject: Fix warnings Reviewed-by: Trust Me --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 2 +- src/gui/kernel/qgesturemanager.cpp | 1 + src/gui/painting/qbrush.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 182594e..594a205 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -903,7 +903,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP QStack > stack; stack.push(qMakePair(static_cast(0), layoutFirstVertex[orientation])); QVector candidates; - bool candidatesForward; + bool candidatesForward = true; // Walk depth-first, in the stack we store start of the candidate sequence (beforeSequence) // and the vertex to be visited. diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index abd2128..dfa5e52 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -599,6 +599,7 @@ void QGestureManager::deliverEvents(const QSet &gestures, Qt::GestureType gestureType = gesture->gestureType(); Q_ASSERT(gestureType != Qt::CustomGesture); + Q_UNUSED(gestureType); if (target) { if (gesture->state() == Qt::GestureStarted) { diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 6f5d892..7273c35 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -970,7 +970,7 @@ bool QBrush::operator==(const QBrush &b) const QDebug operator<<(QDebug dbg, const QBrush &b) { #ifndef Q_BROKEN_DEBUG_STREAM - char *BRUSH_STYLES[] = { + static const char *BRUSH_STYLES[] = { "NoBrush", "SolidPattern", "Dense1Pattern", -- cgit v0.12 From 0d2f1562d63cf51d254a5761bf37ce36120cfcfd Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 9 Nov 2009 15:26:45 +0100 Subject: QPlastiqueStyle: Fix painting QTreeView with gradient When setting a gradian brush as a base for a QTreeWidget (with stylesheet), the branch decoration would be plain black. This is because the color() of a gradient brush is always black. Fix it by using the base brush itself to paint the decoration if the brush is not solid color. Task-number: QTBUG-3816 Reviewed-by: Thierry --- src/gui/styles/qplastiquestyle.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index f880351..be4fff2 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -1094,8 +1094,6 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption QColor borderColor = option->palette.background().color().darker(178); QColor gradientStartColor = option->palette.button().color().lighter(104); QColor gradientStopColor = option->palette.button().color().darker(105); - QColor baseGradientStartColor = option->palette.base().color().darker(101); - QColor baseGradientStopColor = option->palette.base().color().darker(106); QColor highlightedGradientStartColor = option->palette.button().color().lighter(101); QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85); QColor highlightedBaseGradientStartColor = option->palette.base().color(); @@ -1978,7 +1976,13 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption QRect gradientRect(adjustedRect.left() + 1, adjustedRect.top() + 1, adjustedRect.right() - adjustedRect.left() - 1, adjustedRect.bottom() - adjustedRect.top() - 1); - qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor); + if (option->palette.base().style() == Qt::SolidPattern) { + QColor baseGradientStartColor = option->palette.base().color().darker(101); + QColor baseGradientStopColor = option->palette.base().color().darker(106); + qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor); + } else { + painter->fillRect(gradientRect, option->palette.base()); + } // draw "+" or "-" painter->setPen(alphaTextColor); painter->drawLine(center.x() - 2, center.y(), center.x() + 2, center.y()); -- cgit v0.12 From 0b7a5ebb7c4a65a931d2c69b9d3780cdc6ece893 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 9 Nov 2009 16:41:18 +0100 Subject: Now looking for the closer dock area for toolbutton Previously, we were looking for the 1st one that fit or was not too far (ie 80px) away. Now we really take the closest one. Task-number: QTBUG-2598 Reviewed-by: ogoffart --- src/gui/widgets/qtoolbararealayout.cpp | 50 ++++++++++++++++------------------ src/gui/widgets/qtoolbararealayout_p.h | 6 ++-- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index de11625..39d5c66 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -480,7 +480,7 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) } -QList QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos) const +QList QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos, int *minDistance) const { int p = pick(o, pos); @@ -509,12 +509,19 @@ QList QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos) const QList result; result << j << k; + *minDistance = 0; //we found a perfect match + return result; + } + } else { + const int dist = distance(pos); + //it will only return a path if the minDistance is higher than the current distance + if (*minDistance > dist) { + *minDistance = dist; + + QList result; + result << lines.count() << 0; return result; } - } else if (appendLineDropRect().contains(pos)) { - QList result; - result << lines.count() << 0; - return result; } return QList(); @@ -587,32 +594,20 @@ QRect QToolBarAreaLayoutInfo::itemRect(const QList &path) const return result; } -QRect QToolBarAreaLayoutInfo::appendLineDropRect() const +int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const { - QRect result; - switch (dockPos) { case QInternal::LeftDock: - result = QRect(rect.right(), rect.top(), - EmptyDockAreaSize, rect.height()); - break; + return pos.x() - rect.right(); case QInternal::RightDock: - result = QRect(rect.left() - EmptyDockAreaSize, rect.top(), - EmptyDockAreaSize, rect.height()); - break; + return rect.left() - pos.x(); case QInternal::TopDock: - result = QRect(rect.left(), rect.bottom() + 1, - rect.width(), EmptyDockAreaSize); - break; + return pos.y() - rect.bottom(); case QInternal::BottomDock: - result = QRect(rect.left(), rect.top() - EmptyDockAreaSize, - rect.width(), EmptyDockAreaSize); - break; + return rect.top() - pos.y(); default: - break; + return -1; } - - return result; } /****************************************************************************** @@ -1022,21 +1017,24 @@ QList QToolBarAreaLayout::indexOf(QWidget *toolBar) const return result; } +//this functions returns the path to the possible gapindex for the position pos QList QToolBarAreaLayout::gapIndex(const QPoint &pos) const { Qt::LayoutDirection dir = mainWindow->layoutDirection(); + int minDistance = 80; // when a dock area is empty, how "wide" is it? + QList ret; //return value for (int i = 0; i < QInternal::DockCount; ++i) { QPoint p = pos; if (docks[i].o == Qt::Horizontal) p = QStyle::visualPos(dir, docks[i].rect, p); - QList result = docks[i].gapIndex(p); + QList result = docks[i].gapIndex(p, &minDistance); if (!result.isEmpty()) { result.prepend(i); - return result; + ret = result; } } - return QList(); + return ret; } QList QToolBarAreaLayout::currentGapIndex() const diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h index 1e113b7..f0ab80c 100644 --- a/src/gui/widgets/qtoolbararealayout_p.h +++ b/src/gui/widgets/qtoolbararealayout_p.h @@ -155,8 +155,6 @@ public: class QToolBarAreaLayoutInfo { public: - enum { EmptyDockAreaSize = 80 }; // when a dock area is empty, how "wide" is it? - QToolBarAreaLayoutInfo(QInternal::DockPosition pos = QInternal::TopDock); QList lines; @@ -173,11 +171,11 @@ public: void removeToolBarBreak(QToolBar *before); void moveToolBar(QToolBar *toolbar, int pos); - QList gapIndex(const QPoint &pos) const; + QList gapIndex(const QPoint &pos, int *maxDistance) const; bool insertGap(const QList &path, QLayoutItem *item); void clear(); QRect itemRect(const QList &path) const; - QRect appendLineDropRect() const; + int distance(const QPoint &pos) const; QRect rect; Qt::Orientation o; -- cgit v0.12 From 963d42fbf1fb68c2bd09b12dedbad000d8001b94 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 9 Nov 2009 17:25:49 +0100 Subject: Make sure the dock widget is updated when changing closable property Task-number: QTBUG-1665 Reviewed-by: ogoffart --- src/gui/widgets/qdockwidget.cpp | 5 +++++ tests/auto/qdockwidget/tst_qdockwidget.cpp | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index a8e2a37..9cf6af1 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -1225,6 +1225,7 @@ void QDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features) features &= DockWidgetFeatureMask; if (d->features == features) return; + const bool closableChanged = (d->features ^ features) & DockWidgetClosable; d->features = features; QDockWidgetLayout *layout = qobject_cast(this->layout()); @@ -1233,6 +1234,10 @@ void QDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features) d->toggleViewAction->setEnabled((d->features & DockWidgetClosable) == DockWidgetClosable); emit featuresChanged(d->features); update(); + if (closableChanged && layout->nativeWindowDeco()) { + //this ensures the native decoration is drawn + d->setWindowState(true /*floating*/, true /*unplug*/); + } } QDockWidget::DockWidgetFeatures QDockWidget::features() const diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index e62ba8c..eb3f641 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -93,6 +93,7 @@ private slots: void task237438_setFloatingCrash(); void task248604_infiniteResize(); void task258459_visibilityChanged(); + void taskQTBUG_1665_closableChanged(); }; // Testing get/set functions @@ -834,5 +835,22 @@ void tst_QDockWidget::task258459_visibilityChanged() QCOMPARE(spy2.first().first().toBool(), true); //dock1 is visible } +void tst_QDockWidget::taskQTBUG_1665_closableChanged() +{ + QDockWidget dock; + dock.show(); + QTest::qWaitForWindowShown(&dock); + + if (dock.windowFlags() & Qt::FramelessWindowHint) + QSKIP("this machine doesn't support native dock widget", SkipAll); + + QVERIFY(dock.windowFlags() & Qt::WindowCloseButtonHint); + + //now let's remove the closable attribute + dock.setFeatures(dock.features() ^ QDockWidget::DockWidgetClosable); + QVERIFY(!(dock.windowFlags() & Qt::WindowCloseButtonHint)); +} + + QTEST_MAIN(tst_QDockWidget) #include "tst_qdockwidget.moc" -- cgit v0.12 From ecdecf7a628aa1c9eb953984c89fc65ffa767a24 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 9 Nov 2009 17:44:54 +0100 Subject: Fix docs for animation api All animation api code snippets should use references instead of local variables. Task-number: QTBUG-5616 Reviewed-by: thierry --- src/corelib/animation/qpropertyanimation.cpp | 10 +++++----- src/corelib/animation/qsequentialanimationgroup.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 3065083..013ff7f 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -58,12 +58,12 @@ an example: \code - QPropertyAnimation animation(myWidget, "geometry"); - animation.setDuration(10000); - animation.setStartValue(QRect(0, 0, 100, 30)); - animation.setEndValue(QRect(250, 250, 100, 30)); + QPropertyAnimation *animation = new QPropertyAnimation(myWidget, "geometry"); + animation->setDuration(10000); + animation->setStartValue(QRect(0, 0, 100, 30)); + animation->setEndValue(QRect(250, 250, 100, 30)); - animation.start(); + animation->start(); \endcode The property name and the QObject instance of which property diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 861e26e..5dbb8c3 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -63,12 +63,12 @@ pause to a sequential animation group. \code - QSequentialAnimationGroup group; + QSequentialAnimationGroup *group = new QSequentialAnimationGroup; - group.addAnimation(anim1); - group.addAnimation(anim2); + group->addAnimation(anim1); + group->addAnimation(anim2); - group.start(); + group->start(); \endcode In this example, \c anim1 and \c anim2 are two already set up -- cgit v0.12 From 327ef9127aba3aa6bf2238c0aa779613f8edf0b1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 9 Nov 2009 18:20:51 +0100 Subject: QGraphicsTextItem: update when changing the color. Task-number: QTBUG-5418 Reviewed-by: Gabriel --- src/gui/graphicsview/qgraphicsitem.cpp | 1 + tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 58 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 723e496..87ed5b7 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -9606,6 +9606,7 @@ void QGraphicsTextItem::setDefaultTextColor(const QColor &col) QPalette pal = c->palette(); pal.setColor(QPalette::Text, col); c->setPalette(pal); + update(); } /*! diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index d65c6ec..27c6809 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -413,6 +413,7 @@ private slots: void task243707_addChildBeforeParent(); void task197802_childrenVisibility(); void QTBUG_4233_updateCachedWithSceneRect(); + void QTBUG_5418_textItemSetDefaultColor(); private: QList paintedItems; @@ -9751,5 +9752,62 @@ void tst_QGraphicsItem::scenePosChange() QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); } +void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() +{ + struct Item : public QGraphicsTextItem + { + bool painted; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *opt, QWidget *wid) + { + painted = true; + QGraphicsTextItem::paint(painter, opt, wid); + } + }; + + Item *i = new Item; + i->painted = false; + i->setPlainText("I AM A TROLL"); + + QGraphicsScene scene; + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + scene.addItem(i); + QApplication::processEvents(); + QTRY_VERIFY(i->painted); + QApplication::processEvents(); + + i->painted = false; + QColor col(Qt::red); + i->setDefaultTextColor(col); + QApplication::processEvents(); + QTRY_VERIFY(i->painted); //check that changing the color force an update + + i->painted = false; + QImage image(400, 200, QImage::Format_RGB32); + image.fill(0); + QPainter painter(&image); + scene.render(&painter); + painter.end(); + QVERIFY(i->painted); + + int numRedPixel = 0; + QRgb rgb = col.rgb(); + for (int y = 0; y < image.height(); ++y) { + for (int x = 0; x < image.width(); ++x) { + // Because of antialiasing we allow a certain range of errors here. + QRgb pixel = image.pixel(x, y); + if (qAbs((int)(pixel & 0xff) - (int)(rgb & 0xff)) + + qAbs((int)((pixel & 0xff00) >> 8) - (int)((rgb & 0xff00) >> 8)) + + qAbs((int)((pixel & 0xff0000) >> 16) - (int)((rgb & 0xff0000) >> 16)) <= 50) { + if (++numRedPixel >= 10) { + return; + } + } + } + } + QCOMPARE(numRedPixel, -1); //color not found, FAIL! +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From d845505fd57ad4b06499b5b125703e80bbae692a Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 10 Nov 2009 10:48:11 +0100 Subject: Avoid XSync-related runtime crashes on HP-UX due to C++ mangling. HP-UX is missing the extern "C" wrapper for its XSync function declarations. This caused applications to _build_ but not _run_ (i.e., all GUI apps crashed). Adding the wrapper should be harmless on all X11 platforms. Task-number: QTBUG-5524 Reviewed-by: Thiago --- config.tests/x11/xsync/xsync.cpp | 6 +++++- src/gui/kernel/qt_x11_p.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config.tests/x11/xsync/xsync.cpp b/config.tests/x11/xsync/xsync.cpp index a7175de..8eea850 100644 --- a/config.tests/x11/xsync/xsync.cpp +++ b/config.tests/x11/xsync/xsync.cpp @@ -41,12 +41,16 @@ #include #include +extern "C" { #include +} int main(int, char **) { XSyncValue value; (void*)&XSyncIntToValue; (void*)&XSyncCreateCounter; - return 0; + int a, b; + Status ret = XSyncInitialize(NULL, &a, &b); + return ret; } diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 9f08dc6..9e4cf60 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -163,7 +163,9 @@ extern "C" { #endif // QT_NO_XRENDER #ifndef QT_NO_XSYNC +extern "C" { # include "X11/extensions/sync.h" +} #endif // #define QT_NO_XKB -- cgit v0.12 From 6d4acbe94c71f7c0049cd08944855c23a716bee3 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 10 Nov 2009 12:05:36 +0100 Subject: Make the new examples for effects use the Qt Animation Framework Task-number: QTBUG-5640 Reviewed-by: Leo --- examples/effects/blurpicker/blurpicker.cpp | 53 ++++++++++++++++------------ examples/effects/blurpicker/blurpicker.h | 12 +++---- examples/effects/customshader/blurpicker.cpp | 53 ++++++++++++++++------------ examples/effects/customshader/blurpicker.h | 12 +++---- examples/effects/fademessage/fademessage.cpp | 18 +++++----- examples/effects/fademessage/fademessage.h | 5 ++- 6 files changed, 84 insertions(+), 69 deletions(-) diff --git a/examples/effects/blurpicker/blurpicker.cpp b/examples/effects/blurpicker/blurpicker.cpp index 1f46444..4911c73 100644 --- a/examples/effects/blurpicker/blurpicker.cpp +++ b/examples/effects/blurpicker/blurpicker.cpp @@ -49,24 +49,29 @@ #define M_PI 3.14159265358979323846 #endif -BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0) +BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0), m_animation(this, "index") { setBackgroundBrush(QPixmap(":/images/background.jpg")); - setScene(&m_scene); + setScene(new QGraphicsScene(this)); setupScene(); - updateIconPositions(); + setIndex(0); - connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions())); - m_timeLine.setDuration(400); + m_animation.setDuration(400); + m_animation.setEasingCurve(QEasingCurve::InOutSine); setRenderHint(QPainter::Antialiasing, true); setFrameStyle(QFrame::NoFrame); } -void BlurPicker::updateIconPositions() +qreal BlurPicker::index() const { - m_index = m_timeLine.currentFrame() / 1000.0; + return m_index; +} + +void BlurPicker::setIndex(qreal index) +{ + m_index = index; qreal baseline = 0; for (int i = 0; i < m_icons.count(); ++i) { @@ -82,12 +87,12 @@ void BlurPicker::updateIconPositions() static_cast(icon->graphicsEffect())->setBaseLine(baseline); } - m_scene.update(); + scene()->update(); } void BlurPicker::setupScene() { - m_scene.setSceneRect(-200, -120, 400, 240); + scene()->setSceneRect(-200, -120, 400, 240); QStringList names; names << ":/images/accessories-calculator.png"; @@ -101,32 +106,34 @@ void BlurPicker::setupScene() for (int i = 0; i < names.count(); i++) { QPixmap pixmap(names[i]); - QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap); + QGraphicsPixmapItem *icon = scene()->addPixmap(pixmap); icon->setZValue(1); icon->setGraphicsEffect(new BlurEffect(icon)); m_icons << icon; } - QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg")); + QGraphicsPixmapItem *bg = scene()->addPixmap(QPixmap(":/images/background.jpg")); bg->setZValue(0); bg->setPos(-200, -150); } void BlurPicker::keyPressEvent(QKeyEvent *event) { - if (event->key() == Qt::Key_Left) { - if (m_timeLine.state() == QTimeLine::NotRunning) { - m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000); - m_timeLine.start(); - event->accept(); - } + int delta = 0; + switch (event->key()) + { + case Qt::Key_Left: + delta = -1; + break; + case Qt::Key_Right: + delta = 1; + break; + default: + break; } - - if (event->key() == Qt::Key_Right) { - if (m_timeLine.state() == QTimeLine::NotRunning) { - m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000); - m_timeLine.start(); + if (m_animation.state() == QAbstractAnimation::Stopped && delta) { + m_animation.setEndValue(m_index + delta); + m_animation.start(); event->accept(); - } } } diff --git a/examples/effects/blurpicker/blurpicker.h b/examples/effects/blurpicker/blurpicker.h index b460df4..b302db4 100644 --- a/examples/effects/blurpicker/blurpicker.h +++ b/examples/effects/blurpicker/blurpicker.h @@ -44,31 +44,31 @@ #include #include -#include +#include #include "blureffect.h" class BlurPicker: public QGraphicsView { Q_OBJECT + Q_PROPERTY(qreal index READ index WRITE setIndex); public: BlurPicker(QWidget *parent = 0); + qreal index() const; + void setIndex(qreal); + protected: void keyPressEvent(QKeyEvent *event); -private slots: - void updateIconPositions(); - private: void setupScene(); private: qreal m_index; - QGraphicsScene m_scene; QList m_icons; - QTimeLine m_timeLine; + QPropertyAnimation m_animation; }; #endif // BLURPICKER_H diff --git a/examples/effects/customshader/blurpicker.cpp b/examples/effects/customshader/blurpicker.cpp index 6cda711..d38d99b 100644 --- a/examples/effects/customshader/blurpicker.cpp +++ b/examples/effects/customshader/blurpicker.cpp @@ -50,24 +50,29 @@ #define M_PI 3.14159265358979323846 #endif -BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0) +BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0), m_animation(this, "index") { setBackgroundBrush(QPixmap(":/images/background.jpg")); - setScene(&m_scene); + setScene(new QGraphicsScene(this)); setupScene(); - updateIconPositions(); + setIndex(0); - connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions())); - m_timeLine.setDuration(400); + m_animation.setDuration(400); + m_animation.setEasingCurve(QEasingCurve::InOutSine); setRenderHint(QPainter::Antialiasing, true); setFrameStyle(QFrame::NoFrame); } -void BlurPicker::updateIconPositions() +qreal BlurPicker::index() const { - m_index = m_timeLine.currentFrame() / 1000.0; + return m_index; +} + +void BlurPicker::setIndex(qreal index) +{ + m_index = index; qreal baseline = 0; for (int i = 0; i < m_icons.count(); ++i) { @@ -84,12 +89,12 @@ void BlurPicker::updateIconPositions() static_cast(icon->graphicsEffect())->setBaseLine(baseline); } - m_scene.update(); + scene()->update(); } void BlurPicker::setupScene() { - m_scene.setSceneRect(-200, -120, 400, 240); + scene()->setSceneRect(-200, -120, 400, 240); QStringList names; names << ":/images/accessories-calculator.png"; @@ -103,7 +108,7 @@ void BlurPicker::setupScene() for (int i = 0; i < names.count(); i++) { QPixmap pixmap(names[i]); - QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap); + QGraphicsPixmapItem *icon = scene()->addPixmap(pixmap); icon->setZValue(1); if (i == 3) icon->setGraphicsEffect(new CustomShaderEffect()); @@ -112,26 +117,28 @@ void BlurPicker::setupScene() m_icons << icon; } - QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg")); + QGraphicsPixmapItem *bg = scene()->addPixmap(QPixmap(":/images/background.jpg")); bg->setZValue(0); bg->setPos(-200, -150); } void BlurPicker::keyPressEvent(QKeyEvent *event) { - if (event->key() == Qt::Key_Left) { - if (m_timeLine.state() == QTimeLine::NotRunning) { - m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000); - m_timeLine.start(); - event->accept(); - } + int delta = 0; + switch (event->key()) + { + case Qt::Key_Left: + delta = -1; + break; + case Qt::Key_Right: + delta = 1; + break; + default: + break; } - - if (event->key() == Qt::Key_Right) { - if (m_timeLine.state() == QTimeLine::NotRunning) { - m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000); - m_timeLine.start(); + if (m_animation.state() == QAbstractAnimation::Stopped && delta) { + m_animation.setEndValue(m_index + delta); + m_animation.start(); event->accept(); - } } } diff --git a/examples/effects/customshader/blurpicker.h b/examples/effects/customshader/blurpicker.h index b460df4..b302db4 100644 --- a/examples/effects/customshader/blurpicker.h +++ b/examples/effects/customshader/blurpicker.h @@ -44,31 +44,31 @@ #include #include -#include +#include #include "blureffect.h" class BlurPicker: public QGraphicsView { Q_OBJECT + Q_PROPERTY(qreal index READ index WRITE setIndex); public: BlurPicker(QWidget *parent = 0); + qreal index() const; + void setIndex(qreal); + protected: void keyPressEvent(QKeyEvent *event); -private slots: - void updateIconPositions(); - private: void setupScene(); private: qreal m_index; - QGraphicsScene m_scene; QList m_icons; - QTimeLine m_timeLine; + QPropertyAnimation m_animation; }; #endif // BLURPICKER_H diff --git a/examples/effects/fademessage/fademessage.cpp b/examples/effects/fademessage/fademessage.cpp index 818d00f..a65c748 100644 --- a/examples/effects/fademessage/fademessage.cpp +++ b/examples/effects/fademessage/fademessage.cpp @@ -43,7 +43,7 @@ #include -FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0) +FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent) { setScene(&m_scene); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -51,9 +51,12 @@ FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0) setupScene(); - m_timeLine = new QTimeLine(500, this); - m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve); - connect(m_timeLine, SIGNAL(valueChanged(qreal)), m_effect, SLOT(setStrength(qreal))); + m_animation = new QPropertyAnimation(m_effect, "strength", this); + m_animation->setDuration(500); + m_animation->setEasingCurve(QEasingCurve::InOutSine); + m_animation->setStartValue(0); + m_animation->setEndValue(1); + setRenderHint(QPainter::Antialiasing, true); setFrameStyle(QFrame::NoFrame); @@ -63,13 +66,12 @@ void FadeMessage::togglePopup() { if (m_message->isVisible()) { m_message->setVisible(false); - m_timeLine->setDirection(QTimeLine::Backward); - m_timeLine->start(); + m_animation->setDirection(QAbstractAnimation::Backward); } else { m_message->setVisible(true); - m_timeLine->setDirection(QTimeLine::Forward); - m_timeLine->start(); + m_animation->setDirection(QAbstractAnimation::Forward); } + m_animation->start(); } void FadeMessage::setupScene() diff --git a/examples/effects/fademessage/fademessage.h b/examples/effects/fademessage/fademessage.h index 34e2fb8..e73ef6b 100644 --- a/examples/effects/fademessage/fademessage.h +++ b/examples/effects/fademessage/fademessage.h @@ -44,7 +44,7 @@ #include #include -#include +#include #include "fademessage.h" @@ -62,11 +62,10 @@ private slots: void togglePopup(); private: - qreal m_index; QGraphicsScene m_scene; QGraphicsColorizeEffect *m_effect; QGraphicsItem *m_message; - QTimeLine *m_timeLine; + QPropertyAnimation *m_animation; }; #endif // FADEMESSAGE_H -- cgit v0.12 From 7429ff911e05c05fbdd986a5932545571ee4beef Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 10 Nov 2009 13:17:29 +0100 Subject: Make the toolbar extension animated according to the main window Previously it would be always animated. Task-number: QTBUG-5623 Reviewed-by: Gabriel --- src/gui/widgets/qtoolbar.cpp | 2 +- src/gui/widgets/qtoolbarlayout.cpp | 5 ++--- src/gui/widgets/qtoolbarlayout_p.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index 5596ca4..58a3d28 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -396,7 +396,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) void QToolBarPrivate::unplug(const QRect &_r) { Q_Q(QToolBar); - layout->setExpanded(false, false); + layout->setExpanded(false); QRect r = _r; r.moveTopLeft(q->mapToGlobal(QPoint(0, 0))); setWindowState(true, true, r); diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index 7dc1e01..0afe5d8 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -642,7 +642,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const return result; } -void QToolBarLayout::setExpanded(bool exp, bool animated) +void QToolBarLayout::setExpanded(bool exp) { if (exp == expanded) return; @@ -654,7 +654,6 @@ void QToolBarLayout::setExpanded(bool exp, bool animated) if (!tb) return; if (QMainWindow *win = qobject_cast(tb->parentWidget())) { - animating = true; QMainWindowLayout *layout = qobject_cast(win->layout()); if (expanded) { tb->raise(); @@ -665,7 +664,7 @@ void QToolBarLayout::setExpanded(bool exp, bool animated) layoutActions(rect.size()); } } - layout->layoutState.toolBarAreaLayout.apply(animated); + layout->layoutState.toolBarAreaLayout.apply(win->isAnimated()); } } diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h index d49a5df..afd0227 100644 --- a/src/gui/widgets/qtoolbarlayout_p.h +++ b/src/gui/widgets/qtoolbarlayout_p.h @@ -112,7 +112,7 @@ public: bool hasExpandFlag() const; public Q_SLOTS: - void setExpanded(bool b, bool animated = true); + void setExpanded(bool b); private: QList items; -- cgit v0.12 From 2a0c11e13ff1cba30f3be324dadd14f8d0a1baa6 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 10 Nov 2009 12:56:23 +0100 Subject: PlatformPlugin: Do not load the plugin if there is no GUI Otherwise valgrind might complain we use uninitialized value (when using the X11 structure) Reviewed-by: Gabriel --- src/gui/kernel/qapplication.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 987aa26..4b8f6a0 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -791,7 +791,8 @@ void QApplicationPrivate::construct( } //make sure the plugin is loaded - qt_guiPlatformPlugin(); + if (qt_is_gui_used) + qt_guiPlatformPlugin(); #endif } -- cgit v0.12 From b7ae1d97301dcb42997e09f996b103f3701b2139 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 10 Nov 2009 13:44:28 +0100 Subject: Make sure that the toolbar is in the mainwinow rect for docking Task-number: QTBUG-2598 Reviewed-by: ogoffart --- src/gui/widgets/qtoolbararealayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index 39d5c66..b7e985c 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -515,7 +515,7 @@ QList QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos, int *minDistance) } else { const int dist = distance(pos); //it will only return a path if the minDistance is higher than the current distance - if (*minDistance > dist) { + if (dist >= 0 && *minDistance > dist) { *minDistance = dist; QList result; -- cgit v0.12 From 479e183a2c56eaf65a9734dcd134c534ce5e6642 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 10 Nov 2009 14:04:52 +0100 Subject: Fixes sub-attaq demo, unfreeze boat after launching new game when on pause Task-number: QTBUG-5526 Reviewed-by: thierry --- demos/sub-attaq/boat.cpp | 6 +++--- demos/sub-attaq/graphicsscene.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp index 0ad31b1..6fed9a9 100644 --- a/demos/sub-attaq/boat.cpp +++ b/demos/sub-attaq/boat.cpp @@ -62,7 +62,7 @@ static QAbstractAnimation *setupDestroyAnimation(Boat *boat) for (int i = 1; i <= 4; i++) { PixmapItem *step = new PixmapItem(QString("explosion/boat/step%1").arg(i),GraphicsScene::Big, boat); step->setZValue(6); - step->setOpacity(0); + step->setOpacity(0); //fade-in QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity"); @@ -92,10 +92,10 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big), //The movement animation used to animate the boat movementAnimation = new QPropertyAnimation(this, "pos"); - //The movement animation used to animate the boat + //The destroy animation used to explode the boat destroyAnimation = setupDestroyAnimation(this); - //We setup the state machien of the boat + //We setup the state machine of the boat machine = new QStateMachine(this); QState *moving = new QState(machine); StopState *stopState = new StopState(this, moving); diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp index e29095e..71d4fe7 100644 --- a/demos/sub-attaq/graphicsscene.cpp +++ b/demos/sub-attaq/graphicsscene.cpp @@ -278,4 +278,5 @@ void GraphicsScene::clearScene() boat->stop(); boat->hide(); + boat->setEnabled(true); } -- cgit v0.12 From 75f264cc6c47493f26ee81c783d1f9b64310c1d6 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 10 Nov 2009 14:12:59 +0100 Subject: Fixes sub-attaq segfault when pausing The sub-attaq's animation manager was accessing a deleted animation. Task-number: QTBUG-5646 Reviewed-by: thierry --- demos/sub-attaq/animationmanager.cpp | 7 +++++++ demos/sub-attaq/animationmanager.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/demos/sub-attaq/animationmanager.cpp b/demos/sub-attaq/animationmanager.cpp index eb5a125..b3fc8e1 100644 --- a/demos/sub-attaq/animationmanager.cpp +++ b/demos/sub-attaq/animationmanager.cpp @@ -62,11 +62,18 @@ AnimationManager *AnimationManager::self() void AnimationManager::registerAnimation(QAbstractAnimation *anim) { + QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); animations.append(anim); } +void AnimationManager::unregisterAnimation_helper(QObject *obj) +{ + unregisterAnimation(static_cast(obj)); +} + void AnimationManager::unregisterAnimation(QAbstractAnimation *anim) { + QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); animations.removeAll(anim); } diff --git a/demos/sub-attaq/animationmanager.h b/demos/sub-attaq/animationmanager.h index 8db13eb..48d84d1 100644 --- a/demos/sub-attaq/animationmanager.h +++ b/demos/sub-attaq/animationmanager.h @@ -62,6 +62,9 @@ public slots: void pauseAll(); void resumeAll(); +private slots: + void unregisterAnimation_helper(QObject *obj); + private: static AnimationManager *instance; QList animations; -- cgit v0.12 From b6be1c595fa67ec034f04c8a93e57e593ceb97aa Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 10 Nov 2009 14:43:19 +0100 Subject: Make sure the context menus also clear the status tip when needed Task-number: QTBUG-2700 Reviewed-by: ogoffart --- src/gui/kernel/qaction.cpp | 26 ++++++++++++++++---------- src/gui/kernel/qaction_p.h | 2 ++ src/gui/widgets/qmenu.cpp | 44 ++++++++++++++++++-------------------------- src/gui/widgets/qmenu_p.h | 1 + 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 6f3cbaf..3eaf2e1 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -100,6 +100,21 @@ QActionPrivate::~QActionPrivate() { } +bool QActionPrivate::showStatusText(QWidget *widget, const QString &str) +{ +#ifdef QT_NO_STATUSTIP + Q_UNUSED(widget); + Q_UNUSED(str); +#else + if(QObject *object = widget ? widget : parent) { + QStatusTipEvent tip(str); + QApplication::sendEvent(object, &tip); + return true; + } +#endif + return false; +} + void QActionPrivate::sendDataChanged() { Q_Q(QAction); @@ -1206,16 +1221,7 @@ QAction::setData(const QVariant &data) bool QAction::showStatusText(QWidget *widget) { -#ifdef QT_NO_STATUSTIP - Q_UNUSED(widget); -#else - if(QObject *object = widget ? widget : parent()) { - QStatusTipEvent tip(statusTip()); - QApplication::sendEvent(object, &tip); - return true; - } -#endif - return false; + return d_func()->showStatusText(widget, statusTip()); } /*! diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h index 2527a02..f7b035b 100644 --- a/src/gui/kernel/qaction_p.h +++ b/src/gui/kernel/qaction_p.h @@ -75,6 +75,8 @@ public: QActionPrivate(); ~QActionPrivate(); + bool showStatusText(QWidget *w, const QString &str); + QPointer group; QString text; QString iconText; diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index cc39b7f..54d1612 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -602,14 +602,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } #ifndef QT_NO_STATUSTIP } else if (previousAction) { - QWidget *w = causedPopup.widget; - while (QMenu *m = qobject_cast(w)) - w = m->d_func()->causedPopup.widget; - if (w) { - QString empty; - QStatusTipEvent tip(empty); - QApplication::sendEvent(w, &tip); - } + previousAction->d_func()->showStatusText(topCausedWidget(), QString()); #endif } if (hideActiveMenu) { @@ -623,6 +616,15 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } } +//return the top causedPopup.widget that is not a QMenu +QWidget *QMenuPrivate::topCausedWidget() const +{ + QWidget* top = causedPopup.widget; + while (QMenu* m = qobject_cast(top)) + top = m->d_func()->causedPopup.widget; + return top; +} + QAction *QMenuPrivate::actionAt(QPoint p) const { if (!q_func()->rect().contains(p)) //sanity check @@ -1094,10 +1096,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e QAccessible::updateAccessibility(q, actionIndex, QAccessible::Selection); } #endif - QWidget *w = causedPopup.widget; - while (QMenu *m = qobject_cast(w)) - w = m->d_func()->causedPopup.widget; - action->showStatusText(w); + action->showStatusText(topCausedWidget()); } else { actionAboutToTrigger = 0; } @@ -1801,10 +1800,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) #ifndef QT_NO_MENUBAR // if this menu is part of a chain attached to a QMenuBar, set the // _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type - QWidget* top = this; - while (QMenu* m = qobject_cast(top)) - top = m->d_func()->causedPopup.widget; - setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast(top) != 0); + setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast(d->topCausedWidget()) != 0); #endif ensurePolished(); // Get the right font @@ -2752,18 +2748,14 @@ void QMenu::keyPressEvent(QKeyEvent *e) } } if (!key_consumed) { - if (QWidget *caused = d->causedPopup.widget) { - while(QMenu *m = qobject_cast(caused)) - caused = m->d_func()->causedPopup.widget; #ifndef QT_NO_MENUBAR - if (QMenuBar *mb = qobject_cast(caused)) { - QAction *oldAct = mb->d_func()->currentAction; - QApplication::sendEvent(mb, e); - if (mb->d_func()->currentAction != oldAct) - key_consumed = true; - } -#endif + if (QMenuBar *mb = qobject_cast(d->topCausedWidget())) { + QAction *oldAct = mb->d_func()->currentAction; + QApplication::sendEvent(mb, e); + if (mb->d_func()->currentAction != oldAct) + key_consumed = true; } +#endif } #ifdef Q_OS_WIN32 diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index a5bde7c..c021063 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -215,6 +215,7 @@ public: SelectedFromKeyboard, SelectedFromElsewhere }; + QWidget *topCausedWidget() const; QAction *actionAt(QPoint p) const; void setFirstActionActive(); void setCurrentAction(QAction *, int popup = -1, SelectionReason reason = SelectedFromElsewhere, bool activateFirst = false); -- cgit v0.12 From 56077c71a771e0e92ead2244df51a85669529274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 10 Nov 2009 14:45:23 +0100 Subject: processEvents() does not always process *all* events in the queue. This was a small behaviour change introduced by Brad that caused the autotest to fail (not every time). Our workaround is to call sendPostedEvents(). --- tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 546f92d..d3087dc 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -664,16 +664,16 @@ void tst_QGraphicsLinearLayout::invalidate() widget->show(); layout.setContentsMargins(1, 2, 3, 4); - qApp->processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(layout.layoutRequest, 1); layout.setOrientation(Qt::Vertical); - qApp->processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(layout.layoutRequest, 2); for (int i = 0; i < count; ++i) layout.invalidate(); // Event is compressed, should only get one layoutrequest - qApp->processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(layout.layoutRequest, count ? 3 : 2); delete widget; } -- cgit v0.12 From 9792ee15c60a4b8a849d5a098047482d192185ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 10 Nov 2009 15:10:27 +0100 Subject: Replace most processEvents() with sendPostedEvents(). After a change Brad did to the event dispatcher we are no longer guaranteed that processEvents will process *all* events in the event queue. (most of the time _it_will_ process all events) I only replaced processEvents for the tests that fail. --- tests/auto/qgridlayout/tst_qgridlayout.cpp | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp index 46e2a03..313dc95 100644 --- a/tests/auto/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp @@ -268,7 +268,7 @@ void tst_QGridLayout::setMinAndMaxSize() leftChild.setMinimumSize(100, 100); leftChild.setMaximumSize(200, 200); layout.addWidget(&leftChild, 0, 0); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumSize(), leftChild.minimumSize()); QCOMPARE(widget.maximumSize(), leftChild.maximumSize()); @@ -277,7 +277,7 @@ void tst_QGridLayout::setMinAndMaxSize() rightChild.setMinimumSize(100, 100); rightChild.setMaximumSize(200, 200); layout.addWidget(&rightChild, 0, 2); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumWidth(), leftChild.minimumWidth() + rightChild.minimumWidth()); @@ -293,7 +293,7 @@ void tst_QGridLayout::setMinAndMaxSize() layout.setColumnMinimumWidth(1, colMin); QCOMPARE(layout.columnMinimumWidth(1), colMin); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumWidth(), leftChild.minimumWidth() + rightChild.minimumWidth() + colMin); QCOMPARE(widget.maximumWidth(), @@ -306,7 +306,7 @@ void tst_QGridLayout::setMinAndMaxSize() layout.setColumnStretch(1,1); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumWidth(), leftChild.minimumWidth() + rightChild.minimumWidth() + colMin); QCOMPARE(widget.maximumWidth(), QLAYOUTSIZE_MAX); @@ -318,7 +318,7 @@ void tst_QGridLayout::setMinAndMaxSize() layout.setColumnStretch(1,0); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumWidth(), leftChild.minimumWidth() + rightChild.minimumWidth() + colMin); QCOMPARE(widget.maximumWidth(), @@ -335,7 +335,7 @@ void tst_QGridLayout::setMinAndMaxSize() static const int spacerS = 250; QSpacerItem *spacer = new QSpacerItem(spacerS, spacerS); layout.addItem(spacer, 0, 1); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumWidth(), leftChild.minimumWidth() + rightChild.minimumWidth() + spacerS); @@ -348,7 +348,7 @@ void tst_QGridLayout::setMinAndMaxSize() spacer->changeSize(spacerS, spacerS, QSizePolicy::Fixed, QSizePolicy::Minimum); layout.invalidate(); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumWidth(), leftChild.minimumWidth() + rightChild.minimumWidth() + spacerS); QCOMPARE(widget.maximumWidth(), @@ -358,13 +358,13 @@ void tst_QGridLayout::setMinAndMaxSize() layout.removeItem(spacer); rightChild.hide(); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumSize(), leftChild.minimumSize()); QCOMPARE(widget.maximumSize(), leftChild.maximumSize()); rightChild.show(); layout.removeWidget(&rightChild); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumSize(), leftChild.minimumSize()); QCOMPARE(widget.maximumSize(), leftChild.maximumSize()); @@ -373,7 +373,7 @@ void tst_QGridLayout::setMinAndMaxSize() bottomChild.setMinimumSize(100, 100); bottomChild.setMaximumSize(200, 200); layout.addWidget(&bottomChild, 1, 0); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumHeight(), leftChild.minimumHeight() + bottomChild.minimumHeight()); @@ -385,13 +385,13 @@ void tst_QGridLayout::setMinAndMaxSize() qMax(leftChild.maximumWidth(), bottomChild.maximumWidth())); bottomChild.hide(); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumSize(), leftChild.minimumSize()); QCOMPARE(widget.maximumSize(), leftChild.maximumSize()); bottomChild.show(); layout.removeWidget(&bottomChild); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.minimumSize(), leftChild.minimumSize()); QCOMPARE(widget.maximumSize(), leftChild.maximumSize()); } @@ -423,7 +423,7 @@ void tst_QGridLayout::spacingAndSpacers() SizeHinter leftChild(100,100); leftChild.setPalette(QPalette(Qt::red)); layout.addWidget(&leftChild, 0, 0); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); expectedSizeHint = leftChild.sizeHint(); QCOMPARE(widget.sizeHint(), expectedSizeHint); @@ -431,7 +431,7 @@ void tst_QGridLayout::spacingAndSpacers() SizeHinter rightChild(200,100); rightChild.setPalette(QPalette(Qt::green)); layout.addWidget(&rightChild, 0, 2); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(rightChild.sizeHint(), QSize(200,100)); expectedSizeHint += QSize(rightChild.sizeHint().width(), 0); @@ -440,11 +440,11 @@ void tst_QGridLayout::spacingAndSpacers() layout.setColumnMinimumWidth(1, 100); widget.adjustSize(); expectedSizeHint += QSize(100,0); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.sizeHint(), expectedSizeHint); rightChild.hide(); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); expectedSizeHint -= QSize(rightChild.sizeHint().width(), 0); QCOMPARE(widget.sizeHint(), expectedSizeHint); @@ -459,12 +459,12 @@ void tst_QGridLayout::spacingAndSpacers() leftChild.setMaximumWidth(200); rightChild.setMaximumWidth(200); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.maximumWidth(), leftChild.maximumWidth() + rightChild.maximumWidth()); #endif layout.removeWidget(&rightChild); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); QCOMPARE(widget.sizeHint(), expectedSizeHint); -- cgit v0.12 From 6789c06291febb20987d669d0e0e58913eeb9bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 10 Nov 2009 15:30:24 +0100 Subject: Replace most processEvents() with sendPostedEvents(). After a change Brad did to the event dispatcher we are no longer guaranteed that processEvents will process *all* events in the event queue. (most of the time _it_will_ process all events) I only replaced processEvents for the tests that failed. --- .../auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index e33c7b6..cd1eedd 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -399,7 +399,7 @@ void tst_QGraphicsGridLayout::columnAlignment() widget->resize(widget->effectiveSizeHint(Qt::MaximumSize)); view.show(); widget->show(); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); // Check default QCOMPARE(layout->columnAlignment(0), 0); QCOMPARE(layout->columnAlignment(1), 0); @@ -414,7 +414,7 @@ void tst_QGraphicsGridLayout::columnAlignment() layout->setAlignment(layout->itemAt(1,1), Qt::AlignRight); layout->setAlignment(layout->itemAt(1,2), Qt::AlignLeft); - QApplication::processEvents(); // process LayoutRequest + QApplication::sendPostedEvents(0, 0); // process LayoutRequest /* +----------+------------+---------+ | Left | HCenter | Right | @@ -846,7 +846,7 @@ void tst_QGraphicsGridLayout::rowAlignment() widget->resize(300, 400); view.show(); widget->show(); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); // Check default QCOMPARE(layout->rowAlignment(0), 0); QCOMPARE(layout->rowAlignment(1), 0); @@ -869,7 +869,7 @@ void tst_QGraphicsGridLayout::rowAlignment() layout->setAlignment(layout->itemAt(1,0), Qt::AlignTop); layout->setAlignment(layout->itemAt(2,0), Qt::AlignHCenter); - QApplication::processEvents(); // process LayoutRequest + QApplication::sendPostedEvents(0, 0); // process LayoutRequest QCOMPARE(layout->alignment(layout->itemAt(0,0)), Qt::AlignRight); //Qt::AlignRight | Qt::AlignBottom QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(50, 50, 50, 50)); @@ -1834,7 +1834,7 @@ void tst_QGraphicsGridLayout::defaultStretchFactors() desc.apply(layout, item); } - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); widget->show(); view.show(); @@ -1842,7 +1842,7 @@ void tst_QGraphicsGridLayout::defaultStretchFactors() if (newSize.isValid()) widget->resize(newSize); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); for (i = 0; i < expectedSizes.count(); ++i) { QSizeF itemSize = layout->itemAt(i)->geometry().size(); QCOMPARE(itemSize, expectedSizes.at(i)); @@ -1994,7 +1994,7 @@ void tst_QGraphicsGridLayout::alignment2() desc.apply(layout, item); } - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); widget->show(); view.resize(400,300); @@ -2002,7 +2002,7 @@ void tst_QGraphicsGridLayout::alignment2() if (newSize.isValid()) widget->resize(newSize); - QApplication::processEvents(); + QApplication::sendPostedEvents(0, 0); for (i = 0; i < expectedGeometries.count(); ++i) { QRectF itemRect = layout->itemAt(i)->geometry(); QCOMPARE(itemRect, expectedGeometries.at(i)); -- cgit v0.12 From 642b0f063df1339bcef6e8f23d84536230131573 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 10 Nov 2009 16:21:36 +0100 Subject: Menubars in dual screen mode now popup the menus on the correct screen If an item is split then its menu appears on the screen which contains most of it. Task-number: QTBUG-773 Reviewed-by: ogoffart --- src/gui/widgets/qmenubar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 689d2e1..b1ff662 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -332,7 +332,9 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) QPoint pos(q->mapToGlobal(QPoint(adjustedActionRect.left(), adjustedActionRect.bottom() + 1))); QSize popup_size = activeMenu->sizeHint(); - QRect screenRect = QApplication::desktop()->screenGeometry(pos); + //we put the popup menu on the screen containing the bottom-center of the action rect + QRect screenRect = QApplication::desktop()->screenGeometry(pos + QPoint(adjustedActionRect.width() / 2, 0)); + pos = QPoint(qMax(pos.x(), screenRect.x()), qMax(pos.y(), screenRect.y())); const bool fitUp = (q->mapToGlobal(adjustedActionRect.topLeft()).y() >= popup_size.height()); const bool fitDown = (pos.y() + popup_size.height() <= screenRect.bottom()); -- cgit v0.12 From 6e6803540d50f14a2c4a6e1ee551310fa96d0cb6 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 10 Nov 2009 17:17:44 +0100 Subject: Fixed: Stylesheet and background image issue in ScrollArea When using background-image and background-attachement: scroll and background-repeat: no-repeat The rectangle used to draw the image was not correctly computed. Reviewed-by: Thierry Task-number: QTBUG-3783 --- src/gui/styles/qstylesheetstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index ce73fd8..59210c3 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -1180,7 +1180,7 @@ void QRenderRule::drawBackgroundImage(QPainter *p, const QRect &rect, QPoint off QRect r = originRect(rect, background()->origin); QRect aligned = QStyle::alignedRect(Qt::LeftToRight, background()->position, bgp.size(), r); - QRect inter = aligned.intersected(r); + QRect inter = aligned.translated(-off).intersected(r); switch (background()->repeat) { case Repeat_Y: -- cgit v0.12 From 2321e8636d7436b70a8afcde16828f00c4b8590e Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 10 Nov 2009 17:55:14 +0100 Subject: Make it possible for QMainWindow to restore the geom of undocked widget Task-number: QTBUG-5663 Reviewed-by: ogoffart --- src/gui/widgets/qdockarealayout.cpp | 6 +++--- tests/auto/qdockwidget/tst_qdockwidget.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index dffec11..27e145f 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1933,6 +1933,9 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList item_list.append(item); } else { QDockAreaLayoutItem item(new QDockWidgetItem(widget)); + if (!testing) { + item_list.append(item); + } if (flags & StateFlagFloating) { bool drawer = false; #ifdef Q_WS_MAC // drawer support @@ -1980,9 +1983,6 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList } } - if (!testing) { - item_list.append(item); - } } } else if (nextMarker == SequenceMarker) { int dummy; diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index eb3f641..e04ed18 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -87,6 +87,7 @@ private slots: void dockLocationChanged(); void setTitleBarWidget(); void titleBarDoubleClick(); + void restoreStateOfFloating(); // task specific tests: void task165177_deleteFocusWidget(); void task169808_setFloating(); @@ -715,6 +716,21 @@ void tst_QDockWidget::titleBarDoubleClick() QCOMPARE(win.dockWidgetArea(&dock), Qt::TopDockWidgetArea); } +void tst_QDockWidget::restoreStateOfFloating() +{ + QMainWindow mw; + QDockWidget dock; + dock.setObjectName("dock1"); + mw.addDockWidget(Qt::TopDockWidgetArea, &dock); + QVERIFY(!dock.isFloating()); + QByteArray ba = mw.saveState(); + dock.setFloating(true); + QVERIFY(dock.isFloating()); + QVERIFY(mw.restoreState(ba)); + QVERIFY(!dock.isFloating()); +} + + void tst_QDockWidget::task165177_deleteFocusWidget() { QMainWindow mw; -- cgit v0.12 From ba5fea372219000050715ecfac8fba9a6fd1b638 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 10 Nov 2009 18:01:27 +0100 Subject: QDockWidget also emits dockLocationChanged when the state is restored ...on the main window. Task-number: QTBUG-1304 Reviewed-by: ogoffart --- src/gui/widgets/qdockarealayout.cpp | 3 +-- tests/auto/qdockwidget/tst_qdockwidget.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 27e145f..953edab 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1841,7 +1841,6 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const } } -#ifdef Q_WS_MAC static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) { switch (pos) { @@ -1853,7 +1852,6 @@ static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) } return Qt::NoDockWidgetArea; } -#endif static QRect constrainedRect(QRect rect, const QRect &desktop) { @@ -1980,6 +1978,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList if (!testing) { widget->setFloating(false); widget->setVisible(flags & StateFlagVisible); + emit widget->dockLocationChanged(toDockWidgetArea(dockPos)); } } diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index e04ed18..c9a7f1c 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -614,6 +614,7 @@ void tst_QDockWidget::dockLocationChanged() QMainWindow mw; QDockWidget dw; + dw.setObjectName("dock1"); QSignalSpy spy(&dw, SIGNAL(dockLocationChanged(Qt::DockWidgetArea))); mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); @@ -638,6 +639,7 @@ void tst_QDockWidget::dockLocationChanged() QCOMPARE(spy.count(), 0); QDockWidget dw2; + dw2.setObjectName("dock2"); mw.addDockWidget(Qt::TopDockWidgetArea, &dw2); mw.tabifyDockWidget(&dw2, &dw); QCOMPARE(spy.count(), 1); @@ -659,6 +661,12 @@ void tst_QDockWidget::dockLocationChanged() QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); + + QByteArray ba = mw.saveState(); + mw.restoreState(ba); + QCOMPARE(spy.count(), 1); + QCOMPARE(qvariant_cast(spy.at(0).at(0)), + Qt::TopDockWidgetArea); } void tst_QDockWidget::featuresChanged() -- cgit v0.12 From 5e3f81237aae96181c9315b8e7c6c5368629a000 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Wed, 11 Nov 2009 07:09:07 +0100 Subject: Revert "Always set a clip on the painter in QGraphicsView." This reverts commit 4bf7f90a27377f439e86d6175e5e3cdebd131be0. The change is already reverted in kinetic-declarativeui. Reviewed-by: Warwick Allison Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsview.cpp | 3 -- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 72 -------------------------- 2 files changed, 75 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 27fd09e..3ef311c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3275,13 +3275,10 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Determine the exposed region d->exposedRegion = event->region(); - if (d->exposedRegion.isEmpty()) - d->exposedRegion = viewport()->rect(); QRectF exposedSceneRect = mapToScene(d->exposedRegion.boundingRect()).boundingRect(); // Set up the painter QPainter painter(viewport()); - painter.setClipRect(event->rect(), Qt::IntersectClip); #ifndef QT_NO_RUBBERBAND if (d->rubberBanding && !d->rubberBandRect.isEmpty()) painter.save(); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 9c6aa39..f07453c 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -217,7 +217,6 @@ private slots: void update(); void inputMethodSensitivity(); void inputContextReset(); - void defaultClipIntersectToView(); // task specific tests below me void task172231_untransformableItems(); @@ -3693,77 +3692,6 @@ void tst_QGraphicsView::inputContextReset() QCOMPARE(inputContext.resets, 0); } -class ViewClipTester : public QGraphicsView -{ -public: - ViewClipTester(QGraphicsScene *scene = 0) - : QGraphicsView(scene) - { } - QRegion clipRegion; - -protected: - void drawBackground(QPainter *painter, const QRectF &rect) - { - clipRegion = painter->clipRegion(); - } -}; - -class ItemClipTester : public QGraphicsRectItem -{ -public: - ItemClipTester() : QGraphicsRectItem(0, 0, 20, 20) - { - setBrush(Qt::blue); - } - QRegion clipRegion; - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) - { - clipRegion = painter->clipRegion(); - QGraphicsRectItem::paint(painter, option, widget); - } -}; - -void tst_QGraphicsView::defaultClipIntersectToView() -{ - QGraphicsScene scene; - ItemClipTester *tester = new ItemClipTester; - scene.addItem(tester); - - ViewClipTester view(&scene); - view.setAlignment(Qt::AlignTop | Qt::AlignLeft); - view.setFrameStyle(0); - view.resize(200, 200); - view.show(); - QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); - - QRect viewRect(0, 0, 200, 200); - QCOMPARE(view.clipRegion, QRegion(viewRect)); - QCOMPARE(tester->clipRegion, QRegion(viewRect)); - - view.viewport()->update(0, 0, 5, 5); - view.viewport()->update(10, 10, 5, 5); - qApp->processEvents(); - viewRect = QRect(0, 0, 15, 15); - QCOMPARE(view.clipRegion, QRegion(viewRect)); - QCOMPARE(tester->clipRegion, QRegion(viewRect)); - - view.scale(2, 2); - qApp->processEvents(); - - viewRect.moveTop(-viewRect.height()); - viewRect = QRect(0, 0, 100, 100); - QCOMPARE(view.clipRegion, QRegion(viewRect)); - QCOMPARE(tester->clipRegion, QRegion(viewRect)); - - view.viewport()->update(0, 0, 5, 5); - view.viewport()->update(10, 10, 5, 5); - qApp->processEvents(); - viewRect = QRect(0, 0, 8, 8); - QCOMPARE(view.clipRegion, QRegion(viewRect)); - QCOMPARE(tester->clipRegion, QRegion(viewRect)); -} - void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() { QGraphicsView view; -- cgit v0.12 From 2d97f299f5f25888656696c6dad0924b243ce4fd Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 11 Nov 2009 11:42:27 +0100 Subject: QKeySequence::mnemonic: add a warning if the text contains severals '&' Task-number: QTBUG-5667 Reviewed-by: Gabriel --- src/gui/kernel/qkeysequence.cpp | 20 ++++++++++--- tests/auto/qkeysequence/tst_qkeysequence.cpp | 45 ++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 1a76083..89c18fb 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1014,9 +1014,12 @@ bool QKeySequence::isEmpty() const */ QKeySequence QKeySequence::mnemonic(const QString &text) { + QKeySequence ret; + if(qt_sequence_no_mnemonics) - return QKeySequence(); + return ret; + bool found = false; int p = 0; while (p >= 0) { p = text.indexOf(QLatin1Char('&'), p) + 1; @@ -1025,13 +1028,22 @@ QKeySequence QKeySequence::mnemonic(const QString &text) if (text.at(p) != QLatin1Char('&')) { QChar c = text.at(p); if (c.isPrint()) { - c = c.toUpper(); - return QKeySequence(c.unicode() + Qt::ALT); + if (!found) { + c = c.toUpper(); + ret = QKeySequence(c.unicode() + Qt::ALT); +#ifdef QT_NO_DEBUG + return ret; +#else + found = true; + } else { + qWarning(qPrintable(QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurences of '&'").arg(text))); +#endif + } } } p++; } - return QKeySequence(); + return ret; } /*! diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp index 1c257bf..bc9ae6c 100644 --- a/tests/auto/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp @@ -119,6 +119,7 @@ private slots: void symetricConstructors_data(); void symetricConstructors(); void checkMultipleNames(); + void mnemonic_data(); void mnemonic(); void toString_data(); void toString(); @@ -133,6 +134,7 @@ private slots: void translated_data(); void translated(); + void initTestCase(); private: QTranslator *ourTranslator; @@ -299,7 +301,7 @@ void tst_QKeySequence::standardKeys_data() QTest::newRow("findNext") << (int)QKeySequence::FindNext<< QString("F3"); QTest::newRow("findPrevious") << (int)QKeySequence::FindPrevious << QString("SHIFT+F3"); QTest::newRow("close") << (int)QKeySequence::Close<< QString("CTRL+F4"); - QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H"); + QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H"); #endif QTest::newRow("bold") << (int)QKeySequence::Bold << QString("CTRL+B"); QTest::newRow("italic") << (int)QKeySequence::Italic << QString("CTRL+I"); @@ -357,17 +359,50 @@ void tst_QKeySequence::keyBindings() } + +void tst_QKeySequence::mnemonic_data() +{ + QTest::addColumn("string"); + QTest::addColumn("key"); + QTest::addColumn("warning"); + + QTest::newRow("1") << QString::fromLatin1("&bonjour") << QString::fromLatin1("ALT+B") << false; + QTest::newRow("2") << QString::fromLatin1("&&bonjour") << QString() << false; + QTest::newRow("3") << QString::fromLatin1("&&bon&jour") << QString::fromLatin1("ALT+J") << false; + QTest::newRow("4") << QString::fromLatin1("&&bon&jo&ur") << QString::fromLatin1("ALT+J") << true; + QTest::newRow("5") << QString::fromLatin1("b&on&&jour") << QString::fromLatin1("ALT+O") << false; + QTest::newRow("6") << QString::fromLatin1("bonjour") << QString() << false; + QTest::newRow("7") << QString::fromLatin1("&&&bonjour") << QString::fromLatin1("ALT+B") << false; + QTest::newRow("8") << QString::fromLatin1("bonjour&&&") << QString() << false; + QTest::newRow("9") << QString::fromLatin1("bo&&nj&o&&u&r") << QString::fromLatin1("ALT+O") << true; + QTest::newRow("10") << QString::fromLatin1("BON&JOUR") << QString::fromLatin1("ALT+J") << false; + QTest::newRow("11") << QString::fromUtf8("bonjour") << QString() << false; +} + void tst_QKeySequence::mnemonic() { #ifdef Q_WS_MAC QSKIP("mnemonics are not used on Mac OS X", SkipAll); #endif - QKeySequence k = QKeySequence::mnemonic("&Foo"); - QVERIFY(k == QKeySequence("ALT+F")); - k = QKeySequence::mnemonic("&& &x"); - QVERIFY(k == QKeySequence("ALT+X")); + QFETCH(QString, string); + QFETCH(QString, key); + QFETCH(bool, warning); + +#ifndef QT_NO_DEBUG + if (warning) { + QString str = QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurences of '&'").arg(string); + QTest::ignoreMessage(QtWarningMsg, qPrintable(str)); + // qWarning(qPrintable(str)); + } +#endif + QKeySequence seq = QKeySequence::mnemonic(string); + QKeySequence res = QKeySequence(key); + + QCOMPARE(seq, res); } + + void tst_QKeySequence::toString_data() { QTest::addColumn("strSequence"); -- cgit v0.12 From ad5f41c02daa0278902d0e8273c8cd34efd2d6da Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 11 Nov 2009 12:43:46 +0100 Subject: Fix Font combobox: one can set the current font without it being changed Task-number: QTBUG-5693 Reviewed-by: ogoffart --- src/gui/widgets/qfontcombobox.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp index 806db59..a66657d 100644 --- a/src/gui/widgets/qfontcombobox.cpp +++ b/src/gui/widgets/qfontcombobox.cpp @@ -247,7 +247,14 @@ void QFontComboBoxPrivate::_q_updateModel() } list = result; + //we need to block the signals so that the model doesn't emit reset + //this prevents the current index from changing + //it will be updated just after this + ///TODO: we should finda way to avoid blocking signals and have a real update of the model + const bool old = m->blockSignals(true); m->setStringList(list); + m->blockSignals(old); + if (list.isEmpty()) { if (currentFont != QFont()) { currentFont = QFont(); -- cgit v0.12 From ea80fc7a97c39deeca6bb51d8441d755af1e0591 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 11 Nov 2009 13:09:58 +0100 Subject: Validate the translation of Qt_help by Pierre --- translations/qt_help_fr.ts | 134 ++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/translations/qt_help_fr.ts b/translations/qt_help_fr.ts index 632561a..3835d10 100644 --- a/translations/qt_help_fr.ts +++ b/translations/qt_help_fr.ts @@ -6,27 +6,27 @@ Search Results - Résultats de la recherche + Résultats de la recherche Note: - Note : + Note : The search results may not be complete since the documentation is still being indexed! - Les résultats de la recherche risquent d'être incomplets car l'indexation de la documentation est en cours ! + Les résultats de la recherche risquent d'être incomplets car l'indexation de la documentation est en cours ! Your search did not match any documents. - Votre recherche ne correspond à aucun document. + Votre recherche ne correspond à aucun document. (The reason for this might be that the documentation is still being indexed.) - (Il est possible que cela soit dû au fait que la documentation est en cours d'indexation.) + (Il est possible que cela soit dû au fait que la documentation est en cours d'indexation.) @@ -34,80 +34,80 @@ The collection file '%1' is not set up yet! - Le fichier de collection '%1' n'est pas encore paramétré ! + Le fichier de collection '%1' n'est pas encore chargé ! Cannot load sqlite database driver! driver ? - Chargement du pilote de base de donnée sqlite impossible ! + Chargement du pilote de base de données sqlite impossible ! Cannot open collection file: %1 collection ? - Impossible d'ouvrir le fichier collection : %1 + Impossible d'ouvrir le fichier collection : %1 Cannot create tables in file %1! - Impossible de créer les tables dans le fichier : %1! + Impossible de créer les tables dans le fichier : %1 ! The collection file '%1' already exists! - Le fichier collection '%1' existe déjà ! + Le fichier collection '%1' existe déjà ! Cannot create directory: %1 - Impossible de créer le répertoire : %1 + Impossible de créer le répertoire : %1 Cannot copy collection file: %1 - Impossible de copier le fichier collection : %1 + Impossible de copier le fichier collection : %1 Unknown filter '%1'! - Filtre '%1' inconnu ! + Filtre '%1' inconnu ! Cannot register filter %1! - Impossible d'enregistrer le filtre %1 ! + Impossible d'enregistrer le filtre %1 ! Cannot open documentation file %1! - Impossible d'ouvrir le fichier de documentation %1 ! + Impossible d'ouvrir le fichier de documentation %1 ! Invalid documentation file '%1'! - fichier de documentation invalide : '%1' ! + Fichier de documentation invalide : '%1' ! The namespace %1 was not registered! - L'espace de noms '%1' n'est pas référencé ! + L'espace de noms '%1' n'était pas référencé ! Namespace %1 already exists! - L'espace de noms %1 existe déjà ! + L'espace de noms %1 existe déjà ! Cannot register namespace '%1'! - Impossible d'enregistrer l'espace de noms '%1' ! + Impossible d'enregistrer l'espace de noms '%1' ! Cannot open database '%1' to optimize! - Impossible d'ouvrir la base de données à optimiser '%1' ! + Impossible d'ouvrir la base de données à optimiser '%1' ! @@ -116,7 +116,7 @@ Cannot open database '%1' '%2': %3 The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string - Impossible d'ouvrir la base de données '%1' '%2' : %3 + Impossible d'ouvrir la base de données '%1' '%2' : %3 @@ -124,7 +124,7 @@ The specified namespace does not exist! - L'espace de noms spécifié n'existe pas ! + L'espace de noms spécifié n'existe pas ! @@ -132,7 +132,7 @@ Cannot open documentation file %1: %2! - Impossible d'ouvrir le fichier de documentation %1 : %2 ! + Impossible d'ouvrir le fichier de documentation %1 : %2 ! @@ -140,113 +140,113 @@ Invalid help data! - Données d'aide invalides ! + Données d'aide invalides ! No output file name specified! - Aucun nom de fichier de sortie spécifié ! + Aucun nom de fichier de sortie spécifié ! The file %1 cannot be overwritten! - Le fichier %1 ne peut être écrasé ! + Le fichier %1 ne peut être écrasé ! Building up file structure... - Construction de la structure de fichiers en cours… + Construction de la structure de fichiers en cours… Cannot open data base file %1! - Impossible d'ouvrir le fichier de base de données %1 ! + Impossible d'ouvrir le fichier de base de données %1 ! Cannot register namespace %1! - Impossible d'enregistrer l'espace de noms %1 ! + Impossible d'enregistrer l'espace de noms %1 ! Insert custom filters... - Insérer des filtres personnalisés… + Insértion des filtres personnalisés… Insert help data for filter section (%1 of %2)... ??? - Insertion des données d'aide pour la section filtre (%1 de %2)… + Insertion des données d'aide pour la section filtre (%1 de %2)… Documentation successfully generated. - Documentation générée. + Documentation générée avec succès. Some tables already exist! - Certaines tables existent déjà ! + Certaines tables existent déjà ! Cannot create tables! - Impossible de créer les tables ! + Impossible de créer les tables ! Cannot register virtual folder! - Impossible d'enregistrer le dossier virtuel ! + Impossible d'enregistrer le dossier virtuel ! Insert files... - Insertion des fichiers... + Insertion des fichiers... The referenced file %1 must be inside or within a subdirectory of (%2). Skipping it. - Le fichier référencé %1 doit être dans le dossier (%2) ou un de ses sous-dossiers. Fichier non pris en compte. + Le fichier référencé %1 doit être dans le dossier (%2) ou un de ses sous-dossiers. Fichier non pris en compte. The file %1 does not exist! Skipping it. - Le fichier %1 n'existe pas ! Fichier non pris en compte. + Le fichier %1 n'existe pas ! Fichier non pris en compte. Cannot open file %1! Skipping it. - Impossible d'ouvrir le fichier %1 ! Fichier non pris en compte. + Impossible d'ouvrir le fichier %1 ! Fichier non pris en compte. The filter %1 is already registered! - Le filtre %1 est déjà enregistré ! + Le filtre %1 est déjà enregistré ! Cannot register filter %1! - Impossible d'enregistrer le filtre %1 ! + Impossible d'enregistrer le filtre %1 ! Insert indices... - Insertion des index… + Insertion des index… Insert contents... - insertion des contenus… + insertion du contenu… Cannot insert contents! - Impossible d'insérer les contenus ! + Impossible d'insérer le contenu ! Cannot register contents! - Impossible de référencer les contenus ! + Impossible de référencer le contenu ! @@ -254,52 +254,52 @@ Search for: - Rechercher : + Rechercher : Previous search - Recherche précédente + Recherche précédente Next search - Recherche suivante + Recherche suivante Search - Recherche + Recherche Advanced search - Recherche avancée + Recherche avancée words <B>similar</B> to: - mots <B>semblables</B> à : + mots <B>semblables</B> à : <B>without</B> the words: - <B>Sans</B> les mots : + <B>sans</B> les mots : with <B>exact phrase</B>: - avec la <B>phrase exacte</B> : + avec la <B>phrase exacte</B> : with <B>all</B> of the words: - Avec <B>tous</B> les mots : + avec <B>tous</B> les mots : with <B>at least one</B> of the words: - avec <B>au moins un</B> des mots : + avec <B>au moins un</B> des mots : @@ -307,7 +307,7 @@ 0 - 0 of 0 Hits - 0 - 0 de 0 résultats + 0 - 0 de 0 résultats @@ -315,7 +315,7 @@ %1 - %2 of %3 Hits - %1 - %2 de %3 résultats + %1 - %2 de %3 résultats @@ -323,53 +323,53 @@ Untitled - Sans titre + Sans titre Unknown token. contexte peu clair... - Identificateur inconnu. + Identificateur inconnu. Unknown token. Expected "QtHelpProject"! - Identificateur inconnu. "QtHelpProject" attendu ! + Identificateur inconnu. "QtHelpProject" attendu ! Error in line %1: %2 - Erreur à la ligne %1 : %2 + Erreur à la ligne %1 : %2 A virtual folder must not contain a '/' character! - Un dossier virtuel ne doit pas contenir le caractère '/' ! + Un dossier virtuel ne doit pas contenir le caractère '/' ! A namespace must not contain a '/' character! - Un espace de noms ne doit pas contenir le caractère '/' ! + Un espace de noms ne doit pas contenir le caractère '/' ! Missing namespace in QtHelpProject. - Espace de noms manquant dans QtHelpProject. + Espace de noms manquant dans QtHelpProject. Missing virtual folder in QtHelpProject - Dossier virtuel manquant dans QtHelpProject + Dossier virtuel manquant dans QtHelpProject Missing attribute in keyword at line %1. - Attribut manquant pour le mot clé à la ligne %1. + Attribut manquant pour le mot clé à la ligne %1. The input file %1 could not be opened! - Le fichier source %1 n'a pas pu être ouvert ! + Le fichier source %1 n'a pas pu être ouvert ! -- cgit v0.12 From 500e71ab649a5053667ff3f9dc7d87730b565756 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 11 Nov 2009 13:37:15 +0100 Subject: Add tr() to strings of Assistant that need to be translated --- tools/assistant/tools/assistant/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index c56e7e4..01c4f75 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -451,7 +451,7 @@ void MainWindow::setupActions() m_findAction = menu->addAction(tr("&Find in Text..."), m_centralWidget, SLOT(showTextSearch())); - m_findAction->setIconText("&Find"); + m_findAction->setIconText(tr("&Find")); m_findAction->setIcon(QIcon(resourcePath + QLatin1String("/find.png"))); m_findAction->setShortcuts(QKeySequence::Find); @@ -515,7 +515,7 @@ void MainWindow::setupActions() m_syncAction = menu->addAction(tr("Sync with Table of Contents"), this, SLOT(syncContents())); - m_syncAction->setIconText("Sync"); + m_syncAction->setIconText(tr("Sync")); m_syncAction->setIcon(QIcon(resourcePath + QLatin1String("/synctoc.png"))); menu->addSeparator(); -- cgit v0.12 From 385ef0b086d0736d1dd8ef03ced73c73e61dcb43 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 5 Nov 2009 14:09:16 +0100 Subject: qdoc3: Fixed a linking problem for qml methods. Note the Invalid Syntax errors for some uses of \qmlmethod and \qmlsignal. A syntactically correct signature is now required as the argument. --- tools/qdoc3/cppcodemarker.cpp | 8 ++-- tools/qdoc3/cppcodeparser.cpp | 70 ++++++++++++++++++++++++-------- tools/qdoc3/cppcodeparser.h | 14 ++++++- tools/qdoc3/htmlgenerator.cpp | 4 +- tools/qdoc3/node.cpp | 92 ++++++++++++++++++++++++++++++------------- tools/qdoc3/node.h | 39 +++++------------- tools/qdoc3/tree.cpp | 13 +++--- 7 files changed, 152 insertions(+), 88 deletions(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index c07be8b..f3188bd 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -1154,14 +1154,14 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, } } else if ((*c)->type() == Node::QmlSignal) { - const QmlSignalNode* sn = static_cast(*c); + const FunctionNode* sn = static_cast(*c); if (sn->isAttached()) insert(qmlattachedsignals,*c,style,Okay); else insert(qmlsignals,*c,style,Okay); } else if ((*c)->type() == Node::QmlMethod) { - const QmlMethodNode* mn = static_cast(*c); + const FunctionNode* mn = static_cast(*c); if (mn->isAttached()) insert(qmlattachedmethods,*c,style,Okay); else @@ -1193,14 +1193,14 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, insert(qmlproperties,*c,style,Okay); } else if ((*c)->type() == Node::QmlSignal) { - const QmlSignalNode* sn = static_cast(*c); + const FunctionNode* sn = static_cast(*c); if (sn->isAttached()) insert(qmlattachedsignals,*c,style,Okay); else insert(qmlsignals,*c,style,Okay); } else if ((*c)->type() == Node::QmlMethod) { - const QmlMethodNode* mn = static_cast(*c); + const FunctionNode* mn = static_cast(*c); if (mn->isAttached()) insert(qmlattachedmethods,*c,style,Okay); else diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index cabbe38..90d83ca 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -693,13 +693,13 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, if (n && n->subType() == Node::QmlClass) { qmlClass = static_cast(n); if (command == COMMAND_QMLSIGNAL) - return new QmlSignalNode(qmlClass,name,false); + return makeFunctionNode(doc,arg,qmlClass,Node::QmlSignal,false,COMMAND_QMLSIGNAL); else if (command == COMMAND_QMLATTACHEDSIGNAL) - return new QmlSignalNode(qmlClass,name,true); + return makeFunctionNode(doc,arg,qmlClass,Node::QmlSignal,true,COMMAND_QMLATTACHEDSIGNAL); else if (command == COMMAND_QMLMETHOD) - return new QmlMethodNode(qmlClass,name,false); + return makeFunctionNode(doc,arg,qmlClass,Node::QmlMethod,false,COMMAND_QMLMETHOD); else if (command == COMMAND_QMLATTACHEDMETHOD) - return new QmlMethodNode(qmlClass,name,true); + return makeFunctionNode(doc,arg,qmlClass,Node::QmlMethod,true,COMMAND_QMLATTACHEDMETHOD); else return 0; // never get here. } @@ -1265,7 +1265,9 @@ bool CppCodeParser::matchParameter(FunctionNode *func) bool CppCodeParser::matchFunctionDecl(InnerNode *parent, QStringList *parentPathPtr, FunctionNode **funcPtr, - const QString &templateStuff) + const QString &templateStuff, + Node::Type type, + bool attached) { CodeChunk returnType; QStringList parentPath; @@ -1295,8 +1297,9 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, if (tokenizer->parsingFnOrMacro() && (match(Tok_Q_DECLARE_FLAGS) || match(Tok_Q_PROPERTY))) returnType = CodeChunk(previousLexeme()); - else + else { return false; + } } if (returnType.toString() == "QBool") @@ -1326,8 +1329,9 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, readToken(); } } - if (tok != Tok_LeftParen) + if (tok != Tok_LeftParen) { return false; + } } else if (tok == Tok_LeftParen) { // constructor or destructor @@ -1373,8 +1377,9 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, returnType.append(lexeme()); readToken(); } - if (tok != Tok_Semicolon) + if (tok != Tok_Semicolon) { return false; + } } else if (tok == Tok_Colon) { returnType.appendHotspot(); @@ -1383,8 +1388,9 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, returnType.append(lexeme()); readToken(); } - if (tok != Tok_Semicolon) + if (tok != Tok_Semicolon) { return false; + } } VariableNode *var = new VariableNode(parent, name); @@ -1397,12 +1403,13 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, var->setStatic(sta); return false; } - if (tok != Tok_LeftParen) + if (tok != Tok_LeftParen) { return false; + } } readToken(); - FunctionNode *func = new FunctionNode(parent, name); + FunctionNode *func = new FunctionNode(type, parent, name, attached); func->setAccess(access); func->setLocation(location()); func->setReturnType(returnType.toString()); @@ -1423,12 +1430,14 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, if (tok != Tok_RightParen) { do { - if (!matchParameter(func)) + if (!matchParameter(func)) { return false; + } } while (match(Tok_Comma)); } - if (!match(Tok_RightParen)) + if (!match(Tok_RightParen)) { return false; + } func->setConst(match(Tok_const)); @@ -1444,8 +1453,9 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, if (!match(Tok_Semicolon) && tok != Tok_Eoi) { int braceDepth0 = tokenizer->braceDepth(); - if (!match(Tok_LeftBrace)) + if (!match(Tok_LeftBrace)) { return false; + } while (tokenizer->braceDepth() >= braceDepth0 && tok != Tok_Eoi) readToken(); match(Tok_RightBrace); @@ -2092,7 +2102,9 @@ bool CppCodeParser::matchDocsAndStuff() bool CppCodeParser::makeFunctionNode(const QString& synopsis, QStringList *parentPathPtr, FunctionNode **funcPtr, - InnerNode *root) + InnerNode *root, + Node::Type type, + bool attached) { Tokenizer *outerTokenizer = tokenizer; int outerTok = tok; @@ -2104,15 +2116,39 @@ bool CppCodeParser::makeFunctionNode(const QString& synopsis, tokenizer = &stringTokenizer; readToken(); - bool ok = matchFunctionDecl(root, parentPathPtr, funcPtr); + bool ok = matchFunctionDecl(root, parentPathPtr, funcPtr, QString(), type, attached); // potential memory leak with funcPtr tokenizer = outerTokenizer; tok = outerTok; - return ok; } +/*! + Create a new FunctionNode for a QML method or signal, as + specified by \a type, as a child of \a parent. \a sig is + the complete signature, and if \a attached is true, the + method or signal is "attached". \a qdoctag is the text of + the \a type. + */ +FunctionNode* CppCodeParser::makeFunctionNode(const Doc& doc, + const QString& sig, + InnerNode* parent, + Node::Type type, + bool attached, + QString qdoctag) +{ + QStringList pp; + FunctionNode* fn = 0; + if (!makeFunctionNode(sig,&pp,&fn,parent,type,attached) && + !makeFunctionNode("void "+sig,&pp,&fn,parent,type,attached)) { + doc.location().warning(tr("Invalid syntax in '\\%1'").arg(qdoctag)); + } + if (fn) + return fn; + return 0; +} + void CppCodeParser::parseQiteratorDotH(const Location &location, const QString &filePath) { diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h index 233ac09..87c1b69 100644 --- a/tools/qdoc3/cppcodeparser.h +++ b/tools/qdoc3/cppcodeparser.h @@ -127,7 +127,9 @@ class CppCodeParser : public CodeParser bool matchFunctionDecl(InnerNode *parent, QStringList *parentPathPtr = 0, FunctionNode **funcPtr = 0, - const QString &templateStuff = QString()); + const QString &templateStuff = QString(), + Node::Type type = Node::Function, + bool attached = false); bool matchBaseSpecifier(ClassNode *classe, bool isClass); bool matchBaseList(ClassNode *classe, bool isClass); bool matchClassDecl(InnerNode *parent, @@ -143,7 +145,15 @@ class CppCodeParser : public CodeParser bool makeFunctionNode(const QString &synopsis, QStringList *parentPathPtr, FunctionNode **funcPtr, - InnerNode *root = 0); + InnerNode *root = 0, + Node::Type type = Node::Function, + bool attached = false); + FunctionNode* makeFunctionNode(const Doc& doc, + const QString& sig, + InnerNode* parent, + Node::Type type, + bool attached, + QString qdoctag); void parseQiteratorDotH(const Location &location, const QString &filePath); void instantiateIteratorMacro(const QString &container, const QString &includeFile, diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index afd1e74..ae47fc0 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4219,7 +4219,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; } else if (node->type() == Node::QmlSignal) { - const QmlSignalNode* qsn = static_cast(node); + const FunctionNode* qsn = static_cast(node); out() << "
"; out() << ""; out() << "
"; @@ -4230,7 +4230,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; } else if (node->type() == Node::QmlMethod) { - const QmlMethodNode* qmn = static_cast(node); + const FunctionNode* qmn = static_cast(node); out() << "
"; out() << ""; out() << "
"; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index ecb4a44..1217042 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -218,6 +218,7 @@ Node *InnerNode::findNode(const QString& name, Type type) } /*! + Find the function node in this node for the function named \a name. */ FunctionNode *InnerNode::findFunctionNode(const QString& name) { @@ -225,6 +226,7 @@ FunctionNode *InnerNode::findFunctionNode(const QString& name) } /*! + Find the function node in this node that has the same name as \a clone. */ FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) { @@ -248,6 +250,34 @@ FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) } /*! + Returns the list of keys from the primary function map. + */ +QStringList InnerNode::primaryKeys() +{ + QStringList t; + QMap::iterator i = primaryFunctionMap.begin(); + while (i != primaryFunctionMap.end()) { + t.append(i.key()); + ++i; + } + return t; +} + +/*! + Returns the list of keys from the secondary function map. + */ +QStringList InnerNode::secondaryKeys() +{ + QStringList t; + QMap::iterator i = secondaryFunctionMap.begin(); + while (i != secondaryFunctionMap.end()) { + t.append(i.key()); + ++i; + } + return t; +} + +/*! */ void InnerNode::setOverload(const FunctionNode *func, bool overlode) { @@ -392,6 +422,7 @@ const Node *InnerNode::findNode(const QString& name, Type type) const } /*! + Find the function node in this node that has the given \a name. */ const FunctionNode *InnerNode::findFunctionNode(const QString& name) const { @@ -400,9 +431,9 @@ const FunctionNode *InnerNode::findFunctionNode(const QString& name) const } /*! + Find the function node in this node that has the same name as \a clone. */ -const FunctionNode *InnerNode::findFunctionNode( - const FunctionNode *clone) const +const FunctionNode *InnerNode::findFunctionNode(const FunctionNode *clone) const { InnerNode *that = (InnerNode *) this; return that->findFunctionNode(clone); @@ -520,7 +551,7 @@ bool InnerNode::isSameSignature(const FunctionNode *f1, const FunctionNode *f2) void InnerNode::addChild(Node *child) { children.append(child); - if (child->type() == Function) { + if ((child->type() == Function) || (child->type() == QmlMethod)) { FunctionNode *func = (FunctionNode *) child; if (!primaryFunctionMap.contains(func->name())) { primaryFunctionMap.insert(func->name(), func); @@ -896,11 +927,40 @@ QString Parameter::reconstruct(bool value) const */ /*! + Construct a function node for a C++ function. It's parent + is \a parent, and it's name is \a name. */ FunctionNode::FunctionNode(InnerNode *parent, const QString& name) - : LeafNode(Function, parent, name), met(Plain), vir(NonVirtual), - con(false), sta(false), ove(false), rf(0), ap(0) + : LeafNode(Function, parent, name), + met(Plain), + vir(NonVirtual), + con(false), + sta(false), + ove(false), + att(false), + rf(0), + ap(0) +{ + // nothing. +} + +/*! + Construct a function node for a QML method or signal, specified + by \a type. It's parent is \a parent, and it's name is \a name. + If \a attached is true, it is an attached method or signal. + */ +FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bool attached) + : LeafNode(type, parent, name), + met(Plain), + vir(NonVirtual), + con(false), + sta(false), + ove(false), + att(attached), + rf(0), + ap(0) { + // nothing. } /*! @@ -1208,28 +1268,6 @@ bool QmlPropertyNode::fromTrool(Trool troolean, bool defaultValue) return defaultValue; } } - -/*! - Constructor for the QML signal node. - */ -QmlSignalNode::QmlSignalNode(QmlClassNode *parent, - const QString& name, - bool attached) - : LeafNode(QmlSignal, parent, name), att(attached) -{ - // nothing. -} - -/*! - Constructor for the QML method node. - */ -QmlMethodNode::QmlMethodNode(QmlClassNode *parent, - const QString& name, - bool attached) - : LeafNode(QmlMethod, parent, name), att(attached) -{ - // nothing. -} #endif QT_END_NAMESPACE diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 5712879..3f5be6c 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -151,6 +151,7 @@ class Node virtual bool isInnerNode() const = 0; virtual bool isReimp() const { return false; } + virtual bool isFunction() const { return false; } Type type() const { return typ; } virtual SubType subType() const { return NoSubType; } InnerNode *parent() const { return par; } @@ -239,6 +240,9 @@ class InnerNode : public Node NodeList overloads(const QString &funcName) const; const QStringList& includes() const { return inc; } + QStringList primaryKeys(); + QStringList secondaryKeys(); + protected: InnerNode(Type type, InnerNode *parent, const QString& name); @@ -421,36 +425,6 @@ class QmlPropertyNode : public LeafNode Trool wri; bool att; }; - -class QmlSignalNode : public LeafNode -{ - public: - QmlSignalNode(QmlClassNode* parent, - const QString& name, - bool attached); - virtual ~QmlSignalNode() { } - - const QString& element() const { return parent()->name(); } - bool isAttached() const { return att; } - - private: - bool att; -}; - -class QmlMethodNode : public LeafNode -{ - public: - QmlMethodNode(QmlClassNode* parent, - const QString& name, - bool attached); - virtual ~QmlMethodNode() { } - - const QString& element() const { return parent()->name(); } - bool isAttached() const { return att; } - - private: - bool att; -}; #endif class EnumItem @@ -564,6 +538,7 @@ class FunctionNode : public LeafNode enum Virtualness { NonVirtual, ImpureVirtual, PureVirtual }; FunctionNode(InnerNode *parent, const QString &name); + FunctionNode(Type type, InnerNode *parent, const QString &name, bool attached); virtual ~FunctionNode() { } void setReturnType(const QString& returnType) { rt = returnType; } @@ -589,6 +564,7 @@ class FunctionNode : public LeafNode bool isStatic() const { return sta; } bool isOverload() const { return ove; } bool isReimp() const { return reimp; } + bool isFunction() const { return true; } int overloadNumber() const; int numOverloads() const; const QList& parameters() const { return params; } @@ -600,6 +576,8 @@ class FunctionNode : public LeafNode QStringList reconstructParams(bool values = false) const; QString signature(bool values = false) const; + const QString& element() const { return parent()->name(); } + bool isAttached() const { return att; } private: void setAssociatedProperty(PropertyNode *property); @@ -620,6 +598,7 @@ class FunctionNode : public LeafNode bool sta : 1; bool ove : 1; bool reimp: 1; + bool att: 1; QList params; const FunctionNode *rf; const PropertyNode *ap; diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index bcd9709..4d401de 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -225,6 +225,7 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path, { if (!relative) relative = root(); + do { const Node *node = relative; int i; @@ -244,8 +245,7 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path, NodeList baseClasses = allBaseClasses(static_cast(node)); foreach (const Node *baseClass, baseClasses) { if (i == path.size() - 1) - next = static_cast(baseClass)-> - findFunctionNode(path.at(i)); + next = static_cast(baseClass)->findFunctionNode(path.at(i)); else next = static_cast(baseClass)->findNode(path.at(i)); @@ -256,11 +256,10 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path, node = next; } - if (node && i == path.size() && node->type() == Node::Function) { + if (node && i == path.size() && node->isFunction()) { // CppCodeParser::processOtherMetaCommand ensures that reimplemented // functions are private. const FunctionNode *func = static_cast(node); - while (func->access() == Node::Private) { const FunctionNode *from = func->reimplementedFrom(); if (from != 0) { @@ -268,7 +267,8 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path, return from; else func = from; - } else + } + else break; } return func; @@ -303,7 +303,8 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &parentPath, const Node *parent = findNode(parentPath, relative, findFlags); if (parent == 0 || !parent->isInnerNode()) { return 0; - } else { + } + else { return ((InnerNode *)parent)->findFunctionNode(clone); } } -- cgit v0.12 From 37de9752d214b581dea3896676663d6815a932c1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 6 Nov 2009 14:18:42 +0100 Subject: qdoc3: Output the full signature for QML signals and methods In the Method Documentation and Signal Documentation sections. --- tools/qdoc3/cppcodemarker.cpp | 2 ++ tools/qdoc3/htmlgenerator.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index f3188bd..a8f6a02 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -194,6 +194,8 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, synopsis = "class " + name; break; case Node::Function: + case Node::QmlSignal: + case Node::QmlMethod: func = (const FunctionNode *) node; if (style != SeparateList && !func->returnType().isEmpty()) synopsis = typified(func->returnType()) + " "; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index ae47fc0..f0ddade 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4224,7 +4224,8 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; out() << ""; out() << "
"; out() << ""; - generateQmlItem(qsn,relative,marker,false); + generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); + //generateQmlItem(qsn,relative,marker,false); out() << "
"; out() << ""; @@ -4235,7 +4236,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; out() << ""; out() << "
"; out() << ""; - generateQmlItem(qmn,relative,marker,false); + generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); out() << "
"; out() << ""; -- cgit v0.12 From 001d2291bb887139597be5d42753227267f49394 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 10 Nov 2009 13:38:13 +0100 Subject: qdoc3: Allow the full signature for QML signals and methods ...in the \qmlmethod and \qmlsignal commands, and the corresponding "attached" ones. Previously, the type was not allowed, but it really should be there, which means the \qmlmethod and \qmlsignal commands should be updated throughout. --- tools/qdoc3/cppcodeparser.cpp | 47 +++++++++++++++++++++++++------------------ tools/qdoc3/cppcodeparser.h | 10 ++++----- tools/qdoc3/node.cpp | 7 +++++++ tools/qdoc3/node.h | 2 ++ 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 90d83ca..ce71e51 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -686,9 +686,9 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, (command == COMMAND_QMLATTACHEDSIGNAL) || (command == COMMAND_QMLATTACHEDMETHOD)) { QString element; - QString name; + QString type; QmlClassNode* qmlClass = 0; - if (splitQmlArg(doc,arg,element,name)) { + if (splitQmlMethodArg(doc,arg,type,element)) { Node* n = tre->findNode(QStringList(element),Node::Fake); if (n && n->subType() == Node::QmlClass) { qmlClass = static_cast(n); @@ -717,15 +717,15 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, :: This function splits the argument into those three - parts, sets \a type, \a element, and \a property, + parts, sets \a type, \a element, and \a name, and returns true. If any of the parts isn't found, - a debug message is output and false is returned. + a qdoc warning is output and false is returned. */ bool CppCodeParser::splitQmlPropertyArg(const Doc& doc, const QString& arg, QString& type, QString& element, - QString& property) + QString& name) { QStringList blankSplit = arg.split(" "); if (blankSplit.size() > 1) { @@ -733,40 +733,47 @@ bool CppCodeParser::splitQmlPropertyArg(const Doc& doc, QStringList colonSplit(blankSplit[1].split("::")); if (colonSplit.size() > 1) { element = colonSplit[0]; - property = colonSplit[1]; + name = colonSplit[1]; return true; } else - doc.location().warning(tr("Missing QML element name or property name")); + doc.location().warning(tr("Missing parent QML element name")); } else - doc.location().warning(tr("Missing QML property type or property path")); + doc.location().warning(tr("Missing property type")); return false; } /*! A QML signal or method argument has the form... - :: + ::(, , ...) This function splits the argument into those two parts, sets \a element, and \a name, and returns true. If either of the parts isn't found, a debug message is output and false is returned. */ -bool CppCodeParser::splitQmlArg(const Doc& doc, - const QString& arg, - QString& element, - QString& name) +bool CppCodeParser::splitQmlMethodArg(const Doc& doc, + const QString& arg, + QString& type, + QString& element) { QStringList colonSplit(arg.split("::")); if (colonSplit.size() > 1) { - element = colonSplit[0]; - name = colonSplit[1]; + QStringList blankSplit = colonSplit[0].split(" "); + if (blankSplit.size() > 1) { + type = blankSplit[0]; + element = blankSplit[1]; + } + else { + type = QString(""); + element = colonSplit[0]; + } return true; } else - doc.location().warning(tr("Missing QML element name or signal/method name")); + doc.location().warning(tr("Missing parent QML element or method signature")); return false; } @@ -811,10 +818,10 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, ++arg; while (arg != args.end()) { if (splitQmlPropertyArg(doc,(*arg),type,element,property)) { - QmlPropertyNode * qmlPropNode = new QmlPropertyNode(qmlPropGroup, - property, - type, - attached); + QmlPropertyNode* qmlPropNode = new QmlPropertyNode(qmlPropGroup, + property, + type, + attached); if (correspondingProperty) { bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); qmlPropNode->setWritable(writableList || correspondingProperty->isWritable()); diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h index 87c1b69..e2e9d55 100644 --- a/tools/qdoc3/cppcodeparser.h +++ b/tools/qdoc3/cppcodeparser.h @@ -99,11 +99,11 @@ class CppCodeParser : public CodeParser const QString& arg, QString& type, QString& element, - QString& property); - bool splitQmlArg(const Doc& doc, - const QString& arg, - QString& element, - QString& name); + QString& name); + bool splitQmlMethodArg(const Doc& doc, + const QString& arg, + QString& type, + QString& element); #endif virtual QSet otherMetaCommands(); virtual void processOtherMetaCommand(const Doc& doc, diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 1217042..373002c 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1094,6 +1094,13 @@ QString FunctionNode::signature(bool values) const return s; } +/*! + Print some debugging stuff. + */ +void FunctionNode::debug() const +{ + qDebug() << "QML METHOD" << name() << "rt" << rt << "pp" << pp; +} /*! \class PropertyNode diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 3f5be6c..dbdc174 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -579,6 +579,8 @@ class FunctionNode : public LeafNode const QString& element() const { return parent()->name(); } bool isAttached() const { return att; } + void debug() const; + private: void setAssociatedProperty(PropertyNode *property); -- cgit v0.12 From 0ea518de58cfb91f8aaea80c8297a677c527824a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 11 Nov 2009 13:42:52 +0100 Subject: Fixing warnings in QScopedPointer test case --- tests/auto/qscopedpointer/tst_qscopedpointer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp index ddd5579..b99760e 100644 --- a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp +++ b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp @@ -321,7 +321,7 @@ struct RefCounted instanceCount.ref(); } - RefCounted(RefCounted const &other) + RefCounted(RefCounted const &) : ref(0) { instanceCount.ref(); @@ -335,6 +335,7 @@ struct RefCounted RefCounted &operator=(RefCounted const &) { + return *this; } QAtomicInt ref; -- cgit v0.12 From fb2652f6fb3b0a79daef346a85e50ed0e8e0c2cf Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 11 Nov 2009 13:54:06 +0100 Subject: Update the translations of Qt Assistant Add the new translations for the string added by 500e71ab649a5053667ff3f9dc7d87730b565756 Update some translations --- translations/assistant_fr.ts | 451 ++++++++++++++++++++++--------------------- 1 file changed, 230 insertions(+), 221 deletions(-) diff --git a/translations/assistant_fr.ts b/translations/assistant_fr.ts index 91fcc1a..9c5d651 100644 --- a/translations/assistant_fr.ts +++ b/translations/assistant_fr.ts @@ -4,7 +4,7 @@ AboutDialog - + &Close &Fermer @@ -12,19 +12,19 @@ AboutLabel - + Warning Avertissement - + Unable to launch external application. Impossible d'ouvrir l'application externe. - + OK OK @@ -32,46 +32,46 @@ BookmarkDialog - + Add Bookmark Ajouter un signet - + Bookmark: Signet : - + Add in Folder: Ajouter dans le dossier : - + + + - + New Folder Nouveau dossier - - - - - + + + + + Bookmarks Signets - + Delete Folder Supprimer le dossier - + Rename Folder Renommer le dossier @@ -79,23 +79,23 @@ BookmarkManager - + Bookmarks Signets - + Remove Suppression - + You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? Vous allez supprimer un dossier, ceci va aussi<br>supprimer son contenu. Voulez-vous continuer? - - + + New Folder Nouveau dossier @@ -103,47 +103,47 @@ BookmarkWidget - + Delete Folder Supprimer le dossier - + Rename Folder Renommer le dossier - + Show Bookmark Afficher le signet - + Show Bookmark in New Tab Afficher le signet dans un nouvel onglet - + Delete Bookmark Supprimer le signet - + Rename Bookmark Renommer le signet - + Filter: Filtre : - + Add Ajouter - + Remove Retirer @@ -151,48 +151,48 @@ CentralWidget - + Add new page Créer une nouvelle page - + Close current page Fermer la page courante - + Print Document Imprimer le document - - + + unknown inconnu - + Add New Page Créer une nouvelle page - + Close This Page Fermer cette page - + Close Other Pages Fermer les autres pages - + Add Bookmark for this Page... Ajouter un signet pour cette page... - + Search Recherche @@ -200,12 +200,12 @@ ContentWindow - + Open Link Ouvrir le lien - + Open Link in New Tab Ouvrir le lien dans un nouvel onglet @@ -213,12 +213,12 @@ FilterNameDialogClass - + Add Filter Name Ajouter un filtre - + Filter Name: Nom du filtre : @@ -226,27 +226,27 @@ FindWidget - + Previous Précédent - + Next Suivant - + Case Sensitive Sensible à la casse - + Whole words Mots complets - + <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Recherche à partir du début @@ -254,27 +254,27 @@ FontPanel - + Font Police - + &Writing system &Système d'écriture - + &Family &Famille - + &Style &Style - + &Point size &Taille en points @@ -282,39 +282,39 @@ HelpViewer - + Open Link in New Tab Ouvrir le lien dans un nouvel onglet - + <title>Error 404...</title><div align="center"><br><br><h1>The page could not be found</h1><br><h3>'%1'</h3></div> <title>Erreur 404...</title><div align="center"><br><br><h1>La page n'a pas pu être trouvée</h1><br><h3>'%1'</h3></div> - + Help Aide - + Unable to launch external application. Impossible de lancer l'application externe. - + OK OK - + Copy &Link Location Copier l'&adresse cible - + Open Link in New Tab Ctrl+LMB LMB? ← ouais exactement pareil... Ouvrir dans un nouvel onglet Ctrl+clic gauche @@ -323,17 +323,17 @@ IndexWindow - + &Look for: &Rechercher : - + Open Link Ouvrir le lien - + Open Link in New Tab Ouvrir le lien dans un nouvel onglet @@ -341,97 +341,97 @@ InstallDialog - - + + Install Documentation Installer la documentation - + Available Documentation: Documentation disponible : - + Install Installer - + Cancel Annuler - + Close Fermer - + Installation Path: Chemin d'installation : - + ... - + Downloading documentation info... Téléchargement des informations de la documentation… - + Download canceled. Téléchargement annulé. - - - + + + Done. Terminé. - + The file %1 already exists. Do you want to overwrite it? Le fichier %1 existe déjà. Voulez-vous l'écraser? - + Unable to save the file %1: %2. Impossible de sauver le fichier %1 : %2. - + Downloading %1... Téléchargement de %1 en cours… - - - + + + Download failed: %1. Échec du téléchargement : %1. - + Documentation info file is corrupt! Le fichier d'information de documentation est corrompu! - + Download failed: Downloaded file is corrupted. Échec du téléchargement : le fichier téléchargé est corrompu. - + Installing documentation %1... Installation de la documentation %1… - + Error while installing documentation: %1 Erreur durant l'installation de la documentation : @@ -441,294 +441,304 @@ MainWindow - - + + Index Index - - + + Contents Sommaire - - + + Bookmarks Signets - - - + + + Qt Assistant Qt Assistant - - + + Unfiltered Non-filtré - + Looking for Qt Documentation... Recherche la documentation de Qt… - + &File &Fichier - + Page Set&up... &Mise en page… - + Print Preview... Aperçu avant impression… - + &Print... &Imprimer… - + New &Tab Nouvel ongle&t - + &Close Tab &Fermer l'onglet - + &Quit &Quitter - + &Edit &Édition - + &Copy selected Text &Copier le texte selectionné - + &Find in Text... - &Trouver dans le texte… + &Rechercher dans le texte… - + + &Find + &Rechercher + + + Find &Next Rechercher le suiva&nt - + Find &Previous Rechercher le &précédent - + Preferences... Préférences… - + &View &Affichage - + Zoom &in Zoom &avant - + Zoom &out Zoom a&rrière - + Normal &Size &Taille normale - + Ctrl+0 Ctrl+0 - + ALT+C ALT+C - + ALT+I ALT+I - + ALT+O ALT+O - + Search Recherche - + ALT+S ALT+S - + &Go &Aller - + &Home &Accueil - + ALT+Home ALT+Home - + &Back &Précédent - + &Forward &Suivant - + Sync with Table of Contents Synchroniser la table des matières - + + Sync + Rafraîchir + + + Next Page Page suivante - + Ctrl+Alt+Right Ctrl+Alt+Right - + Previous Page Page précédente - + Ctrl+Alt+Left Ctrl+Alt+Left - + &Bookmarks &Signets - + Add Bookmark... Ajouter un signet… - + CTRL+D CTRL+D - + &Help &Aide - + About... À propos… - + Navigation Toolbar Barre d'outils de navigation - + &Window &Fenêtre - + Zoom Zoom - + Minimize Minimiser - + Ctrl+M Ctrl+M - + Toolbars Barres d'outils - + Filter Toolbar Barre d'outils de filtrage - + Filtered by: - Filtré par : + Filtre : - + Address Toolbar Barre d'outils d'adresse - + Address: Adresse : - + Could not find the associated content item. what is item in this context? ← same question here Impossible de trouver l'élément de contenu associé. - + About %1 À propos de %1 - + Updating search index Mise à jour de l'index de recherche @@ -736,48 +746,48 @@ PreferencesDialog - - + + Add Documentation Ajouter de la documentation - + Qt Compressed Help Files (*.qch) Fichiers d'aide Qt compressés (*.qch) - + The namespace %1 is already registered! L'espace de nom %1 existe déjà! - + The specified file is not a valid Qt Help File! Le fichier spécifié n'est pas un fichier d'aide Qt valide! - + Remove Documentation Supprimer la documentation - + Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents. Certains documents ouverts dans Assistant ont des références vers la documentation que vous allez supprimer. Supprimer la documentation fermera ces documents. - + Cancel Annuler - + OK OK - + Use custom settings Utiliser des paramètres personnalisés @@ -785,119 +795,118 @@ PreferencesDialogClass - + Preferences Préférences - + Fonts Polices - + Font settings: Configuration des polices : - + Browser Navigateur - + Application Application - + Filters Filtres - + Filter: Filtre : - + Attributes: Attributs : - + 1 1 - + Add Ajouter - - + Remove Supprimer - + Documentation Documentation - + Registered Documentation: documentation enregistrée ? ← je préfère référencée pour les deux... Documentation référencée : - + Add... Ajouter… - + Options Options - + On help start: Au démarrage : - + Show my home page Afficher ma page d'accueil - + Show a blank page Afficher une page blanche - + Show my tabs from last session Afficher mes onglets de la dernière session - + Homepage Page d'accueil - + Current Page Page courante - + Blank Page Page blanche - + Restore to default Restaurer les valeurs par défaut @@ -905,69 +914,69 @@ QObject - + The specified collection file does not exist! Le fichier de collection spécifié n'existe pas! - + Missing collection file! Fichier de collection manquant! - + Invalid URL! URL invalide! - + Missing URL! URL manquante! - - - + + + Unknown widget: %1 Widget inconnu : %1 - - - + + + Missing widget! Widget manquant! - - + + The specified Qt help file does not exist! Le fichier d'aide Qt spécifié n'existe pas! - - + + Missing help file! Fichier d'aide manquant! - + Missing filter argument! Argument de filtre manquant! - + Unknown option: %1 Option inconnue : %1 - - + + Qt Assistant Qt Assistant - + Could not register documentation file %1 @@ -980,17 +989,17 @@ Raison : %2 - + Documentation successfully registered. Documentation enregistrée avec succès. - + Documentation successfully unregistered. Documentation retirée avec succès. - + Could not unregister documentation file %1 @@ -1003,12 +1012,12 @@ Raison : %2 - + Cannot load sqlite database driver! Impossible de charger le driver de la base de données sqlite! - + The specified collection file could not be read! Le fichier de collection spécifié ne peut pas être lu! @@ -1016,12 +1025,12 @@ Raison : RemoteControl - + Debugging Remote Control Débogage du contrôle à distance - + Received Command: %1 %2 Commande reçue : %1 %2 @@ -1029,22 +1038,22 @@ Raison : SearchWidget - + &Copy &Copier - + Copy &Link Location Copier &l'adresse du lien - + Open Link in New Tab Ouvrir le lien dans un nouvel onglet - + Select All Sélectionner tout @@ -1052,27 +1061,27 @@ Raison : TopicChooser - + Choose Topic Choisir le domaine - + &Topics &Domaines - + &Display &Afficher - + &Close &Fermer - + Choose a topic for <b>%1</b>: Choisir le domaine pour <b>%1</b> : -- cgit v0.12 From 0f82f5552830485151424b974f282a63892a077d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 11 Nov 2009 14:49:02 +0100 Subject: doc: Fixed some qdoc errors, numXxx() to xxxCount(), etc. --- src/gui/image/qimage.cpp | 2 +- src/gui/widgets/qlcdnumber.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6d96d7a..ec8dd88 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2073,7 +2073,7 @@ void QImage::setNumColors(int numColors) have entries for all the pixel/index values present in the image, otherwise the results are undefined. - \sa colorsCount(), colorTable(), setColor(), {QImage#Image + \sa colorCount(), colorTable(), setColor(), {QImage#Image Transformations}{Image Transformations} */ diff --git a/src/gui/widgets/qlcdnumber.cpp b/src/gui/widgets/qlcdnumber.cpp index f33a98f..3497eba 100644 --- a/src/gui/widgets/qlcdnumber.cpp +++ b/src/gui/widgets/qlcdnumber.cpp @@ -444,7 +444,7 @@ QLCDNumber::~QLCDNumber() \obsolete \property QLCDNumber::numDigits \brief the current number of digits displayed - \sa setDigitCount + \sa setDigitCount() */ void QLCDNumber::setNumDigits(int numDigits) @@ -466,6 +466,10 @@ void QLCDNumber::setNumDigits(int numDigits) \sa smallDecimalPoint */ +/*! + Sets the current number of digits to \a numDigits. Must + be in the range 0..99. + */ void QLCDNumber::setDigitCount(int numDigits) { Q_D(QLCDNumber); @@ -483,7 +487,7 @@ void QLCDNumber::setDigitCount(int numDigits) d->ndigits = numDigits; d->digitStr.fill(QLatin1Char(' '), d->ndigits); d->points.fill(0, d->ndigits); - d->digitStr[d->ndigits - 1] = QLatin1Char('0'); // "0" is the default number + d->digitStr[d->ndigits - 1] = QLatin1Char('0'); // "0" is the default number } else { bool doDisplay = d->ndigits == 0; if (numDigits == d->ndigits) // no change @@ -521,6 +525,9 @@ int QLCDNumber::numDigits() const return d->ndigits; } +/*! + Returns the current number of digits. + */ int QLCDNumber::digitCount() const { Q_D(const QLCDNumber); -- cgit v0.12 From d1d6769da76a9ff83fd56e12bd331c5e4858ccca Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 11 Nov 2009 15:16:04 +0100 Subject: Changes file updated --- dist/changes-4.6.0 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 12803b8..69a0821 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -69,6 +69,8 @@ Third party components - Updated sqlite to version 3.6.19. + - Updated libpng to version 1.2.40 + **************************************************************************** * Library * -- cgit v0.12 From 2b6fd0a7bdac686a41d7fbbe47ad3ded9e1d77b5 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 11 Nov 2009 15:57:11 +0100 Subject: Small caps font variant wouldn't be used when defined through style sheets The font comparison (operator==) didn't check the capital attribute, which is the one responsible for this variant. Now it does. Auto-test updated. Reviewed-by: Samuel Reviewed-by: Olivier --- src/gui/text/qfont.cpp | 4 +++- tests/auto/qfont/tst_qfont.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 447087c..f1cd6bb 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1613,7 +1613,8 @@ bool QFont::operator==(const QFont &f) const && f.d->underline == d->underline && f.d->overline == d->overline && f.d->strikeOut == d->strikeOut - && f.d->kerning == d->kerning)); + && f.d->kerning == d->kerning + && f.d->capital == d->capital)); } @@ -1645,6 +1646,7 @@ bool QFont::operator<(const QFont &f) const #ifdef Q_WS_X11 if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle; #endif // Q_WS_X11 + if (f.d->capital != d->capital) return f.d->capital < d->capital; int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning; int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning; diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp index fa76e44..5622e10 100644 --- a/tests/auto/qfont/tst_qfont.cpp +++ b/tests/auto/qfont/tst_qfont.cpp @@ -395,6 +395,13 @@ void tst_QFont::compare() font.setOverline(false); QVERIFY( font == font2 ); QVERIFY(!(font < font2)); + + font.setCapitalization(QFont::SmallCaps); + QVERIFY( font != font2 ); + QCOMPARE(font < font2,!(font2 < font)); + font.setCapitalization(QFont::MixedCase); + QVERIFY( font == font2 ); + QVERIFY(!(font < font2)); } #if defined(Q_WS_X11) -- cgit v0.12 From 46a3e518b3070cf7cb4cbbb2cb58254454cf169d Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 11 Nov 2009 16:28:24 +0100 Subject: QAbstractScrollArea: Wheel over a scrollarea that has only one horizontal scrollbar If the vertical scrollbar is hidden, scroll using the other scrollbar. Reviewed-by: Thierry Task-number: QTBUG-1760 --- src/gui/widgets/qabstractscrollarea.cpp | 11 ++- src/gui/widgets/qabstractslider.cpp | 2 - .../tst_qabstractscrollarea.cpp | 97 +++++++++++++++++++++- 3 files changed, 102 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 48099ef..c186645 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -1130,10 +1130,13 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) void QAbstractScrollArea::wheelEvent(QWheelEvent *e) { Q_D(QAbstractScrollArea); - if (static_cast(e)->orientation() == Qt::Horizontal) - QApplication::sendEvent(d->hbar, e); - else - QApplication::sendEvent(d->vbar, e); + QScrollBar *const bars[2] = { d->hbar, d->vbar }; + int idx = (e->orientation() == Qt::Vertical) ? 1 : 0; + int other = (idx + 1) % 2; + if (!bars[idx]->isVisible() && bars[other]->isVisible()) + idx = other; // If the scrollbar of the event orientation is hidden, fallback to the other. + + QApplication::sendEvent(bars[idx], e); } #endif diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index fec9fab..e0db9c2 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -690,8 +690,6 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) { Q_D(QAbstractSlider); e->ignore(); - if (e->orientation() != d->orientation && !rect().contains(e->pos())) - return; int stepsToScroll = 0; qreal offset = qreal(e->delta()) / 120; diff --git a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp index 5033a50..99a263b 100644 --- a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -71,6 +71,8 @@ private slots: void viewportCrash(); void task214488_layoutDirection_data(); void task214488_layoutDirection(); + void wheelEvent_data(); + void wheelEvent(); }; tst_QAbstractScrollArea::tst_QAbstractScrollArea() @@ -296,10 +298,10 @@ public: setAttribute(Qt::WA_DropSiteRegistered, true); - startTimer(2000); + startTimer(200); } - void timerEvent(QTimerEvent *event) + void timerEvent(QTimerEvent *) { // should not crash. (void)new QScrollArea(this); @@ -385,5 +387,96 @@ void tst_QAbstractScrollArea::patternBackground() QCOMPARE(image.pixel(QPoint(20,20)) , QColor(Qt::red).rgb()); } +Q_DECLARE_METATYPE(QWheelEvent *); + +void tst_QAbstractScrollArea::wheelEvent_data() +{ + QTest::addColumn("widgetSize"); + QTest::addColumn("initialOffset"); + QTest::addColumn("event"); + QTest::addColumn("movedX"); // -1 , 0 , or 1 + QTest::addColumn("movedY"); + + QPoint pos(100,100); + int delta =-120; + + QTest::newRow("1") << QSize(600,600) << QPoint(50,50) + << new QWheelEvent(pos, delta, 0, 0, Qt::Horizontal) << 1 << 0; + + QTest::newRow("2") << QSize(600,600) << QPoint(50,50) + << new QWheelEvent(pos, delta, 0, 0, Qt::Vertical) << 0 << 1; + + QTest::newRow("3") << QSize(600,600) << QPoint(50,50) + << new QWheelEvent(pos, -delta, 0, 0, Qt::Horizontal) << -1 << 0; + + QTest::newRow("4") << QSize(600,600) << QPoint(50,50) + << new QWheelEvent(pos, -delta, 0, 0, Qt::Vertical) << 0 << -1; + + QTest::newRow("5") << QSize(20,600) << QPoint(0,50) + << new QWheelEvent(pos, delta, 0, 0, Qt::Horizontal) << 0 << 1; + + QTest::newRow("6") << QSize(20,600) << QPoint(0,50) + << new QWheelEvent(pos, delta, 0, 0, Qt::Vertical) << 0 << 1; + + QTest::newRow("7") << QSize(20,600) << QPoint(0,50) + << new QWheelEvent(pos, -delta, 0, 0, Qt::Horizontal) << 0 << -1; + + QTest::newRow("8") << QSize(20,600) << QPoint(0,50) + << new QWheelEvent(pos, -delta, 0, 0, Qt::Vertical) << 0 << -1; + + QTest::newRow("9") << QSize(600,20) << QPoint(50,0) + << new QWheelEvent(pos, delta, 0, 0, Qt::Horizontal) << 1 << 0; + + QTest::newRow("a") << QSize(600,20) << QPoint(50,0) + << new QWheelEvent(pos, delta, 0, 0, Qt::Vertical) << 1 << 0; + + QTest::newRow("b") << QSize(600,20) << QPoint(50,0) + << new QWheelEvent(pos, -delta, 0, 0, Qt::Horizontal) << -1 << 0; + + QTest::newRow("c") << QSize(600,20) << QPoint(50,0) + << new QWheelEvent(pos, -delta, 0, 0, Qt::Vertical) << -1 << 0; +} + + + + +void tst_QAbstractScrollArea::wheelEvent() +{ + QFETCH(QSize, widgetSize); + QFETCH(QPoint, initialOffset); + QFETCH(QWheelEvent *, event); + QFETCH(int, movedX); + QFETCH(int, movedY); + + QScrollArea scrollArea; + scrollArea.resize(200, 200); + QLabel widget("H e l l o"); + widget.resize(widgetSize); + scrollArea.setWidget(&widget); + scrollArea.show(); + QTest::qWait(20); + + scrollArea.verticalScrollBar()->setValue(initialOffset.y()); + scrollArea.horizontalScrollBar()->setValue(initialOffset.x()); + + QCOMPARE(scrollArea.verticalScrollBar()->value(), initialOffset.y()); + QCOMPARE(scrollArea.horizontalScrollBar()->value(), initialOffset.x()); + + QApplication::sendEvent(scrollArea.viewport(), event); + + if(movedX == 0) + QCOMPARE(scrollArea.horizontalScrollBar()->value(), initialOffset.x()); + else + QVERIFY(movedX * scrollArea.horizontalScrollBar()->value() > movedX * initialOffset.x()); + + if(movedY == 0) + QCOMPARE(scrollArea.verticalScrollBar()->value(), initialOffset.y()); + else + QVERIFY(movedY * scrollArea.verticalScrollBar()->value() > movedY * initialOffset.y()); + + delete event; +} + + QTEST_MAIN(tst_QAbstractScrollArea) #include "tst_qabstractscrollarea.moc" -- cgit v0.12 From 2d63f8fe5b77747014e1c5807c9d457611bd9304 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 11 Nov 2009 17:30:54 +0100 Subject: Fixed: QFontComboBox emits the currentFontChanged() signal twice Task-number: QTBUG-2438 Reviewed-by: Thierry --- src/gui/widgets/qfontcombobox.cpp | 4 +++- tests/auto/qfontcombobox/tst_qfontcombobox.cpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp index a66657d..d601f81 100644 --- a/src/gui/widgets/qfontcombobox.cpp +++ b/src/gui/widgets/qfontcombobox.cpp @@ -427,8 +427,10 @@ void QFontComboBox::setCurrentFont(const QFont &font) Q_D(QFontComboBox); if (font != d->currentFont) { d->currentFont = font; - emit currentFontChanged(d->currentFont); d->_q_updateModel(); + if (d->currentFont == font) { //else the signal has already be emitted by _q_updateModel + emit currentFontChanged(d->currentFont); + } } } diff --git a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp index 7045c19..b974ecab 100644 --- a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp @@ -153,7 +153,7 @@ void tst_QFontComboBox::currentFont() if (oldCurrentFont != box.currentFont()) { //the signal may be emit twice if there is a foundry into brackets - QVERIFY(spy0.count() >= 1); + QCOMPARE(spy0.count(),1); } } @@ -286,6 +286,10 @@ void tst_QFontComboBox::currentFontChanged() if (box.model()->rowCount() > 2) { QTest::keyPress(&box, Qt::Key_Down); QCOMPARE(spy0.count(), 1); + + QFont f( "Sans Serif" ); + box.setCurrentFont(f); + QCOMPARE(spy0.count(), 2); } else qWarning("Not enough fonts installed on test system. Consider adding some"); } -- cgit v0.12 From de76200652e05de34d99f111c64a051a49911034 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 11 Nov 2009 17:37:48 +0100 Subject: Doc: Link to the public bug tracker. --- doc/src/bughowto.qdoc | 26 +++++++++++++++++--------- doc/src/qt-webpages.qdoc | 9 +++++++-- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/doc/src/bughowto.qdoc b/doc/src/bughowto.qdoc index 971634a..e9ae965 100644 --- a/doc/src/bughowto.qdoc +++ b/doc/src/bughowto.qdoc @@ -48,24 +48,32 @@ about it so that we can fix it. Before reporting a bug, please check the \l{FAQs}, \l{Platform - Notes}, and the \l{Task Tracker} on the Qt website to see + Notes}, and the \l{Qt Bug Tracker} on the Qt website to see if the issue is already known. - If you have found a new bug, please submit a bug report using - the \l{Bug Report Form}. Always include the following information - in your bug report: + The first thing you should do is to sign up for an account for + the \l{Qt Bug Tracker}, if you do not already have one. Once you + have done that you can submit and track your bug reports and they + will be publicly available from the moment you submit them. + + Always include the following information in your bug report: \list 1 \o The name and version number of your compiler \o The name and version number of your operating system \o The version of Qt you are using, and what configure options it was - compiled with. + compiled with + \o Reliable and clear description on how to reproduce the problem \endlist + + If possible, please provide a test written using the QtTest module + as this will improve the procedure of reproducing your problem and + allow the developers to address the issue in a more efficient way. - If the problem you are reporting is only visible at run-time, try to - create a small test program that shows the problem when run. Often, - such a program can be created with some minor changes to one - of the many example programs in Qt's \c examples directory. + Otherwise, if the problem you are reporting is only visible at run-time, + try to create a small test program that shows the problem when run. + Often, such a program can be created with some minor changes to one of + the many example programs in Qt's examples directory. If you have implemented a bug fix and want to contribute your fix directly, then you can do so through the \l{Public Qt Repository}. diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 1eee805..41f1350 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -50,7 +50,12 @@ */ /*! - \externalpage http://qt.nokia.com/bugreport-form + \externalpage http://bugreports.qt.nokia.com + \title Qt Bug Tracker +*/ + +/*! + \externalpage http://bugreports.qt.nokia.com \title Bug Report Form */ @@ -175,7 +180,7 @@ */ /*! - \externalpage http://qt.nokia.com/developer/task-tracker + \externalpage http://bugreports.qt.nokia.com \title Task Tracker */ -- cgit v0.12 From 4f2dcef95299f2da628b30607021e8deb1d868b6 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 12 Nov 2009 11:47:11 +0100 Subject: Fixed a crash when configuring an audio effect with the Phonon dialog Task-number: QTBUG-5731 Reviewed-by: jan-arve --- src/3rdparty/phonon/phonon/effectwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp index fb9cf6e..f8341e5 100644 --- a/src/3rdparty/phonon/phonon/effectwidget.cpp +++ b/src/3rdparty/phonon/phonon/effectwidget.cpp @@ -97,8 +97,9 @@ void EffectWidgetPrivate::autogenerateUi() Q_Q(EffectWidget); QVBoxLayout *mainLayout = new QVBoxLayout(q); mainLayout->setMargin(0); - for (int i = 0; i < effect->parameters().count(); ++i) { - const EffectParameter ¶ = effect->parameters().at(i); + const QList parameters = effect->parameters(); + for (int i = 0; i < parameters.count(); ++i) { + const EffectParameter ¶ = parameters.at(i); QVariant value = effect->parameterValue(para); QHBoxLayout *pLayout = new QHBoxLayout; mainLayout->addLayout(pLayout); -- cgit v0.12 From 65f38e884f40f02be6497819c876013750cce4ea Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 12 Nov 2009 14:32:52 +0100 Subject: Fixa regression that could make a dockwidget disappear if unfloatable Task-number: QTBUG-5740 Reviewed-by: ogoffart --- src/gui/widgets/qmainwindowlayout.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 027a5d6..fa6f7a1 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1641,6 +1641,9 @@ void QMainWindowLayout::animationFinished(QWidget *widget) savedState.clear(); currentGapPos.clear(); pluggingWidget = 0; + //applying the state will make sure that the currentGap is updated correctly + //and all the geometries (especially the one from the central widget) is correct + layoutState.apply(false); } if (!widgetAnimator.animating()) { -- cgit v0.12 From 037c1c3b3e1abc07f0570336bd7958121f32848a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 12 Nov 2009 14:34:01 +0100 Subject: QLabel: Fixed text underlined when te label has a control and the text contains & We need to search for '&' in the text each time the QTextControl's document is updated. Also make sure not to match && Task-number: QTBUG-4154 Reviewed-by: Thierry --- src/gui/widgets/qlabel.cpp | 38 +++++++++++++++++------------- src/gui/widgets/qlabel_p.h | 2 +- tests/auto/qlabel/tst_qlabel.cpp | 51 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 17 deletions(-) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 3d908a1..ea711e8 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -1170,22 +1170,10 @@ void QLabelPrivate::updateShortcut() // But then we do want to hide the ampersands, so we can't use shortcutId. hasShortcut = false; - if (control) { - ensureTextPopulated(); - // Underline the first character that follows an ampersand - shortcutCursor = control->document()->find(QLatin1String("&")); - if (shortcutCursor.isNull()) - return; - hasShortcut = true; - shortcutId = q->grabShortcut(QKeySequence::mnemonic(text)); - shortcutCursor.deleteChar(); // remove the ampersand - shortcutCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); - } else { - if (!text.contains(QLatin1Char('&'))) - return; - hasShortcut = true; - shortcutId = q->grabShortcut(QKeySequence::mnemonic(text)); - } + if (!text.contains(QLatin1Char('&'))) + return; + hasShortcut = true; + shortcutId = q->grabShortcut(QKeySequence::mnemonic(text)); } #endif // QT_NO_SHORTCUT @@ -1456,6 +1444,24 @@ void QLabelPrivate::ensureTextPopulated() const doc->setPlainText(text); #endif doc->setUndoRedoEnabled(false); + +#ifndef QT_NO_SHORTCUT + if (hasShortcut) { + // Underline the first character that follows an ampersand (and remove the others ampersands) + int from = 0; + bool found = false; + QTextCursor cursor; + while (!(cursor = control->document()->find((QLatin1String("&")), from)).isNull()) { + cursor.deleteChar(); // remove the ampersand + cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); + from = cursor.position(); + if (!found && cursor.selectedText() != QLatin1String("&")) { //not a second & + found = true; + shortcutCursor = cursor; + } + } + } +#endif } } textDirty = false; diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h index c5a74e2..ca17a35 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/gui/widgets/qlabel_p.h @@ -113,7 +113,7 @@ public: mutable uint hasShortcut : 1; Qt::TextFormat textformat; mutable QTextControl *control; - QTextCursor shortcutCursor; + mutable QTextCursor shortcutCursor; Qt::TextInteractionFlags textInteractionFlags; inline bool needTextControl() const { diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 9d957a5..6b7e106 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -51,6 +51,7 @@ #include #include #include +#include //TESTED_CLASS= //TESTED_FILES= @@ -116,6 +117,9 @@ private slots: void unicodeText_data(); void unicodeText(); + void mnemonic_data(); + void mnemonic(); + private: QLabel *testWidget; QPointer test_box; @@ -224,6 +228,7 @@ void tst_QLabel::setBuddy() QVERIFY( !test_edit->hasFocus() ); QTest::keyClick( test_box, 't', Qt::AltModifier ); QVERIFY( test_edit->hasFocus() ); + delete test_box; } void tst_QLabel::text() @@ -245,6 +250,7 @@ void tst_QLabel::setText_data() QTest::newRow( QString(prefix + "data1").toLatin1() ) << QString("This is the first line\nThis is the second line") << QString("Courier"); QTest::newRow( QString(prefix + "data2").toLatin1() ) << QString("This is the first line\nThis is the second line\nThis is the third line") << QString("Helvetica"); QTest::newRow( QString(prefix + "data3").toLatin1() ) << QString("This is bold richtext") << QString("Courier"); + QTest::newRow( QString(prefix + "data4").toLatin1() ) << QString("I Have a &shortcut") << QString("Helvetica"); } void tst_QLabel::setText() @@ -509,5 +515,50 @@ void tst_QLabel::unicodeText() testWidget->show(); } +void tst_QLabel::mnemonic_data() +{ + QTest::addColumn("text"); + QTest::addColumn("expectedDocText"); + QTest::addColumn("expectedShortcutCursor"); + + QTest::newRow("1") << QString("Normal") << QString("Normal") << QString(); + QTest::newRow("2") << QString("&Simple") << QString("Simple") << QString("S"); + QTest::newRow("3") << QString("Also &simple") << QString("Also simple") << QString("s"); + QTest::newRow("4") << QString("&&With &Double &&") << QString("&With Double &") << QString("D"); + QTest::newRow("5") << QString("Hep&&Hop") << QString("Hep&Hop") << QString(""); + QTest::newRow("6") << QString("Hep&&&Hop") << QString("Hep&Hop") << QString("H"); +} + + +void tst_QLabel::mnemonic() +{ + // this test that the mnemonics appears correctly when the label has a text control. + + QFETCH(QString, text); + QFETCH(QString, expectedDocText); + QFETCH(QString, expectedShortcutCursor); + + QWidget w; + QHBoxLayout *hbox = new QHBoxLayout; + QLabel *lab = new QLabel(text); + //lab->setText("plop &plop"); + QLineEdit *lineedit = new QLineEdit; + lab->setBuddy(lineedit); + lab->setTextInteractionFlags(Qt::TextSelectableByMouse); + + hbox->addWidget(lab); + hbox->addWidget(lineedit); + hbox->addWidget(new QLineEdit); + w.setLayout(hbox); + w.show(); + QTest::qWaitForWindowShown(&w); + + QLabelPrivate *d = static_cast(QObjectPrivate::get(lab)); + QVERIFY(d->control); + QCOMPARE(d->control->document()->toPlainText(), expectedDocText); + QCOMPARE(d->shortcutCursor.selectedText(), expectedShortcutCursor); +} + + QTEST_MAIN(tst_QLabel) #include "tst_qlabel.moc" -- cgit v0.12 From fbf5e7b103626bb07fbb43449eaf014bdd299939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 10 Nov 2009 09:56:29 +0100 Subject: Fix QT_NO_PHONON_SETTINGSGROUP Reviewed-by: paul --- src/3rdparty/phonon/phonon/audiooutput.cpp | 6 ++++++ src/3rdparty/phonon/phonon/backendcapabilities.cpp | 2 ++ src/3rdparty/phonon/phonon/globalconfig.cpp | 10 ++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/phonon/phonon/audiooutput.cpp b/src/3rdparty/phonon/phonon/audiooutput.cpp index 00b2ebd..962f828 100644 --- a/src/3rdparty/phonon/phonon/audiooutput.cpp +++ b/src/3rdparty/phonon/phonon/audiooutput.cpp @@ -257,6 +257,7 @@ void AudioOutputPrivate::setupBackendObject() // set up attributes pINTERFACE_CALL(setVolume(pow(volume, VOLTAGE_TO_LOUDNESS_EXPONENT))); +#ifndef QT_NO_PHONON_SETTINGSGROUP // if the output device is not available and the device was not explicitly set if (!callSetOutputDevice(this, device) && !outputDeviceOverridden) { // fall back in the preference list of output devices @@ -276,6 +277,7 @@ void AudioOutputPrivate::setupBackendObject() callSetOutputDevice(this, none); handleAutomaticDeviceChange(none, FallbackChange); } +#endif //QT_NO_PHONON_SETTINGSGROUP } void AudioOutputPrivate::_k_volumeChanged(qreal newVolume) @@ -305,6 +307,7 @@ void AudioOutputPrivate::_k_audioDeviceFailed() pDebug() << Q_FUNC_INFO; // outputDeviceIndex identifies a failing device // fall back in the preference list of output devices +#ifndef QT_NO_PHONON_SETTINGSGROUP const QList deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices); for (int i = 0; i < deviceList.count(); ++i) { const int devIndex = deviceList.at(i); @@ -317,6 +320,7 @@ void AudioOutputPrivate::_k_audioDeviceFailed() } } } +#endif //QT_NO_PHONON_SETTINGSGROUP // if we get here there is no working output device. Tell the backend. const AudioOutputDevice none; callSetOutputDevice(this, none); @@ -326,6 +330,7 @@ void AudioOutputPrivate::_k_audioDeviceFailed() void AudioOutputPrivate::_k_deviceListChanged() { pDebug() << Q_FUNC_INFO; +#ifndef QT_NO_PHONON_SETTINGSGROUP // let's see if there's a usable device higher in the preference list const QList deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings); DeviceChangeType changeType = HigherPreferenceChange; @@ -351,6 +356,7 @@ void AudioOutputPrivate::_k_deviceListChanged() break; // found one with higher preference that works } } +#endif //QT_NO_PHONON_SETTINGSGROUP } static struct diff --git a/src/3rdparty/phonon/phonon/backendcapabilities.cpp b/src/3rdparty/phonon/phonon/backendcapabilities.cpp index 62c9cc9..5defe09 100644 --- a/src/3rdparty/phonon/phonon/backendcapabilities.cpp +++ b/src/3rdparty/phonon/phonon/backendcapabilities.cpp @@ -75,10 +75,12 @@ bool BackendCapabilities::isMimeTypeAvailable(const QString &mimeType) QList BackendCapabilities::availableAudioOutputDevices() { QList ret; +#ifndef QT_NO_PHONON_SETTINGSGROUP const QList deviceIndexes = GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory); for (int i = 0; i < deviceIndexes.count(); ++i) { ret.append(AudioOutputDevice::fromIndex(deviceIndexes.at(i))); } +#endif //QT_NO_PHONON_SETTINGSGROUP return ret; } diff --git a/src/3rdparty/phonon/phonon/globalconfig.cpp b/src/3rdparty/phonon/phonon/globalconfig.cpp index 3718c6a..429a29f 100644 --- a/src/3rdparty/phonon/phonon/globalconfig.cpp +++ b/src/3rdparty/phonon/phonon/globalconfig.cpp @@ -178,13 +178,15 @@ QList GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int return listSortedByConfig(backendConfig, category, defaultList); } -#endif //QT_NO_SETTINGSGROUPS +#endif //QT_NO_PHONON_SETTINGSGROUP int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) const { +#ifndef QT_NO_PHONON_SETTINGSGROUP QList ret = audioOutputDeviceListFor(category, override); - if (ret.isEmpty()) - return -1; - return ret.first(); + if (!ret.isEmpty()) + return ret.first(); +#endif //QT_NO_PHONON_SETTINGSGROUP + return -1; } #ifndef QT_NO_PHONON_AUDIOCAPTURE -- cgit v0.12 From c3b06980e96a809709c08e5b8ca98c6d7acbc9e5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 10 Nov 2009 13:23:52 +0100 Subject: Make the render() test pass when pixmaps aren't 32 bit. Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp index 117393a..bbb676b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp @@ -971,7 +971,10 @@ void tst_QWebElement::render() QImage testImage(resource.width(), resource.height(), QImage::Format_ARGB32); QPainter painter0(&testImage); painter0.fillRect(imageRect, Qt::white); - painter0.drawImage(0, 0, resource); + //render() uses pixmaps internally, and pixmaps might have bit depths + // other than 32, giving different pixel values due to rounding. + QPixmap pix = QPixmap::fromImage(resource); + painter0.drawPixmap(0, 0, pix); painter0.end(); QImage image1(resource.width(), resource.height(), QImage::Format_ARGB32); -- cgit v0.12 From e6558e8b25897ba9ac0a553509a0056915b0eb5c Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 12 Nov 2009 16:21:25 +0100 Subject: QTreeWidget visualRect now returns the rect for all columns The autotest will follow Task-number: QTBUG-2844 Reviewed-by: ogoffart --- src/gui/itemviews/qtreewidget.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 040c498..c133ae4 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -2851,7 +2851,14 @@ QTreeWidgetItem *QTreeWidget::itemAt(const QPoint &p) const QRect QTreeWidget::visualItemRect(const QTreeWidgetItem *item) const { Q_D(const QTreeWidget); - return visualRect(d->index(item)); + //the visual rect for an item is across all columns. So we need to determine + //what is the first and last column and get their visual index rects + QModelIndex base = d->index(item); + const int firstVisiblesection = header()->logicalIndexAt(- header()->offset()); + const int lastVisibleSection = header()->logicalIndexAt(header()->length() - header()->offset() - 1); + QModelIndex first = base.sibling(base.row(), header()->logicalIndex(firstVisiblesection)); + QModelIndex last = base.sibling(base.row(), header()->logicalIndex(lastVisibleSection)); + return visualRect(first) | visualRect(last); } /*! -- cgit v0.12 From 185655f01ffa288bed5cbb433843b6db26cdb632 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 12 Nov 2009 15:59:12 +0100 Subject: Removed unused variable. RevBy: Trust me --- src/gui/inputmethod/qcoefepinputcontext_p.h | 3 +-- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 6aee669..d0b488e 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -84,7 +84,7 @@ public: bool filterEvent(const QEvent *event); void mouseHandler( int x, QMouseEvent *event); - bool isComposing() const { return m_isEditing; } + bool isComposing() const { return !m_preeditString.isEmpty(); } void setFocusWidget(QWidget * w); void widgetDestroyed(QWidget *w); @@ -140,7 +140,6 @@ private: QString m_preeditString; Qt::InputMethodHints m_lastImHints; TUint m_textCapabilities; - bool m_isEditing; bool m_inDestruction; bool m_pendingInputCapabilitiesChanged; int m_cursorVisibility; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 0ed3cc0..806df07 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -65,7 +65,6 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new m_lastImHints(Qt::ImhNone), m_textCapabilities(TCoeInputCapabilities::EAllText), - m_isEditing(false), m_inDestruction(false), m_pendingInputCapabilitiesChanged(false), m_cursorVisibility(1), @@ -245,7 +244,6 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) { - Q_ASSERT(m_isEditing); Q_ASSERT(focusWidget()); if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) { @@ -488,8 +486,6 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, if (!w) return; - m_isEditing = true; - m_cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); QList attributes; @@ -555,8 +551,6 @@ void QCoeFepInputContext::CancelFepInlineEdit() event.setCommitString(QLatin1String(""), 0, 0); m_preeditString.clear(); sendEvent(event); - - m_isEditing = false; } TInt QCoeFepInputContext::DocumentLengthForFep() const @@ -711,7 +705,6 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) sendEvent(event); m_longPress = 0; - m_isEditing = false; if (!triggeredBySymbian) { CCoeFep* fep = CCoeEnv::Static()->Fep(); -- cgit v0.12 From 5bc53cb71f22d74cf13bef7e8cae25833b40d0b4 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 12 Nov 2009 16:20:48 +0100 Subject: Made the select button commit the T9 word rather than exit widget. Task: QTBUG-5661 RevBy: Janne Koskinen --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 28 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 806df07..08d86d7 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -203,14 +203,26 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { const QKeyEvent *keyEvent = static_cast(event); - Q_ASSERT(m_lastImHints == focusWidget()->inputMethodHints()); - if (keyEvent->key() == Qt::Key_F20 && m_lastImHints & Qt::ImhHiddenText) { - // Special case in Symbian. On editors with secret text, F20 is for some reason - // considered to be a backspace. - QKeyEvent modifiedEvent(keyEvent->type(), Qt::Key_Backspace, keyEvent->modifiers(), - keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count()); - QApplication::sendEvent(focusWidget(), &modifiedEvent); - return true; + switch (keyEvent->key()) { + case Qt::Key_F20: + Q_ASSERT(m_lastImHints == focusWidget()->inputMethodHints()); + if (m_lastImHints & Qt::ImhHiddenText) { + // Special case in Symbian. On editors with secret text, F20 is for some reason + // considered to be a backspace. + QKeyEvent modifiedEvent(keyEvent->type(), Qt::Key_Backspace, keyEvent->modifiers(), + keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count()); + QApplication::sendEvent(focusWidget(), &modifiedEvent); + return true; + } + break; + case Qt::Key_Select: + if (!m_preeditString.isEmpty()) { + commitCurrentString(false); + return true; + } + break; + default: + break; } } -- cgit v0.12