From 6d28410756ab29277807d2026b4cbd8e1c707714 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 2 Jun 2009 13:59:46 +0200 Subject: Compilation fix on MSVC Reviewed-by: alexis --- src/declarative/qml/qmlprivate.h | 46 +++++++--------------------------------- src/gui/text/qtextcontrol_p.h | 2 +- 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index 62524aa..3f41fb7 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -123,43 +123,13 @@ namespace QmlPrivate } }; - template - class has_attachedPropertiesMember - { - typedef int yes_type; - typedef char no_type; - template - struct Selector {}; - - template - static yes_type test(Selector*); - - template - static no_type test(...); - - public: - static bool const value = sizeof(test(0)) == sizeof(yes_type); - }; - - template - class has_attachedPropertiesMethod + template + struct has_qmlAttachedProperties { - typedef int yes_type; - typedef char no_type; - - template - static yes_type check(ReturnType *(*)(QObject *)); - static no_type check(...); - - public: - static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); - }; - - template - class has_attachedPropertiesMethod - { - public: - static bool const value = false; + template struct type_check; + template static char check(type_check *); + template static int check(...); + static bool const value = sizeof(check(0)) == sizeof(char); }; template @@ -191,13 +161,13 @@ namespace QmlPrivate template inline QmlAttachedPropertiesFunc attachedPropertiesFunc() { - return AttachedPropertySelector::value>::value>::func(); + return AttachedPropertySelector::value >::func(); } template inline const QMetaObject *attachedPropertiesMetaObject() { - return AttachedPropertySelector::value>::value>::metaObject(); + return AttachedPropertySelector::value >::metaObject(); } struct MetaTypeIds { diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index 4dac4f7..e50540a 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -83,7 +83,7 @@ class QAbstractScrollArea; class QEvent; class QTimerEvent; -class Q_AUTOTEST_EXPORT QTextControl : public QObject +class Q_GUI_EXPORT QTextControl : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QTextControl) -- cgit v0.12 From b78b4593410a876e0664c01ce7afade64bf37660 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 2 Jun 2009 14:47:29 +0200 Subject: fix MSVC warnings --- src/declarative/canvas/qsimplecanvasdebugplugin.cpp | 5 +++-- src/declarative/debugger/qmldebugger.cpp | 3 ++- src/declarative/debugger/qmlpropertyview.cpp | 2 +- src/declarative/qml/qmlcompiler_p.h | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp index 0fd0f81..12088c1 100644 --- a/src/declarative/canvas/qsimplecanvasdebugplugin.cpp +++ b/src/declarative/canvas/qsimplecanvasdebugplugin.cpp @@ -58,6 +58,7 @@ public: virtual int duration() const { return -1; } virtual void updateCurrentTime(int msecs) { + Q_UNUSED(msecs); server->frameBreak(); } @@ -66,7 +67,7 @@ private: }; QSimpleCanvasDebugPlugin::QSimpleCanvasDebugPlugin(QObject *parent) -: QmlDebugServerPlugin("CanvasFrameRate", parent), _breaks(0) +: QmlDebugServerPlugin(QLatin1String("CanvasFrameRate"), parent), _breaks(0) { _time.start(); new FrameBreakAnimation(this); @@ -95,7 +96,7 @@ void QSimpleCanvasDebugPlugin::frameBreak() } QSimpleCanvasSceneDebugPlugin::QSimpleCanvasSceneDebugPlugin(QSimpleCanvas *parent) -: QmlDebugServerPlugin("CanvasScene", parent), m_canvas(parent) +: QmlDebugServerPlugin(QLatin1String("CanvasScene"), parent), m_canvas(parent) { } diff --git a/src/declarative/debugger/qmldebugger.cpp b/src/declarative/debugger/qmldebugger.cpp index c925148..9ab3247 100644 --- a/src/declarative/debugger/qmldebugger.cpp +++ b/src/declarative/debugger/qmldebugger.cpp @@ -282,7 +282,7 @@ bool QmlDebugger::makeItem(QObject *obj, QmlDebuggerItem *item) if(!toolTipString.isEmpty()) toolTipString.prepend(QLatin1Char('\n')); toolTipString.prepend(tr("Root type: ") + text); - text = p->typeName; + text = QString::fromAscii(p->typeName); } if(!toolTipString.isEmpty()) @@ -333,6 +333,7 @@ bool operator<(const QPair > &lhs, void QmlDebugger::setCanvas(QSimpleCanvas *c) { + Q_UNUSED(c); } void QmlDebugger::setDebugObject(QObject *obj) diff --git a/src/declarative/debugger/qmlpropertyview.cpp b/src/declarative/debugger/qmlpropertyview.cpp index 0d34fd9..abe1902 100644 --- a/src/declarative/debugger/qmlpropertyview.cpp +++ b/src/declarative/debugger/qmlpropertyview.cpp @@ -210,7 +210,7 @@ void QmlPropertyView::setObject(QObject *object) ++iter) { QTreeWidgetItem *item = new QTreeWidgetItem(m_tree); - item->setText(0, iter.key()); + item->setText(0, QString::fromAscii(iter.key())); item->setForeground(0, Qt::blue); item->setText(1, iter.value()); } diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index eb24b91..6b6e1e2 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -162,7 +162,7 @@ private: int ctxt); void finalizeComponent(int patch); - class BindingReference; + struct BindingReference; void finalizeBinding(const BindingReference &); struct IdReference { -- cgit v0.12 From bb30e5e9e3d46c4e532d397db80ff90384b8b453 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Jun 2009 09:06:56 +1000 Subject: Handle double clicks in TextEdit. --- src/declarative/fx/qfxtextedit.cpp | 12 ++++++++++++ src/declarative/fx/qfxtextedit.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index c7a7700..79e1a3f 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -772,6 +772,18 @@ void QFxTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) \overload Handles the given mouse \a event. */ +void QFxTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QFxTextEdit); + d->control->processEvent(event, QPointF(0, 0)); + if (!event->isAccepted()) + QFxPaintedItem::mouseDoubleClickEvent(event); +} + +/*! +\overload +Handles the given mouse \a event. +*/ void QFxTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxTextEdit); diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index e30b9ed..b761a1b 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -190,6 +190,7 @@ protected: // mouse filter? void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void inputMethodEvent(QInputMethodEvent *e); -- cgit v0.12 From 5ee5a67cfb74a3b6d0e1fc781352302e7216cbef Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Jun 2009 12:05:59 +1000 Subject: Resize TextEdit as text changes if no explicit width has been set. --- src/declarative/fx/qfxtextedit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 79e1a3f..5492aaa 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -871,9 +871,13 @@ void QFxTextEditPrivate::init() void QFxTextEdit::q_textChanged() { + if (!widthValid()) + updateSize(); //### optimize: we get 3 calls to updateSize every time a letter is typed emit textChanged(text()); } +//### we should perhaps be a bit smarter here -- depending on what has changed, we shouldn't +// need to do all the calculations each time void QFxTextEdit::updateSize() { Q_D(QFxTextEdit); -- cgit v0.12