From da7b5677262254aada234ac2c71d54d8fee3c711 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 4 Jun 2009 15:49:06 +0200 Subject: Implement a dummy QColorMap for Symbian. It seems that this class has been completely forgotten until now, but this never causes any problems because apparently no one uses it. Provide a quick little implementation to get things linking. Implementation brought to you courtesy of Qt/Mac. --- src/gui/painting/painting.pri | 3 +- src/gui/painting/qcolormap_s60.cpp | 112 +++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/gui/painting/qcolormap_s60.cpp diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 33d53e4..693e506 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -190,7 +190,8 @@ embedded { symbian { SOURCES += \ painting/qpaintdevice_s60.cpp \ - painting/qregion_s60.cpp + painting/qregion_s60.cpp \ + painting/qcolormap_s60.cpp } x11|embedded { diff --git a/src/gui/painting/qcolormap_s60.cpp b/src/gui/painting/qcolormap_s60.cpp new file mode 100644 index 0000000..c21eba9 --- /dev/null +++ b/src/gui/painting/qcolormap_s60.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcolormap.h" +#include "qcolor.h" + +QT_BEGIN_NAMESPACE + +class QColormapPrivate +{ +public: + inline QColormapPrivate() + : ref(1) + { } + + QAtomicInt ref; +}; +static QColormap *qt_symbian_color_map = 0; + +void QColormap::initialize() +{ + qt_symbian_color_map = new QColormap; +} + +void QColormap::cleanup() +{ + delete qt_symbian_color_map; + qt_symbian_color_map = 0; +} + +QColormap QColormap::instance(int) +{ + return *qt_symbian_color_map; +} + +QColormap::QColormap() : d(new QColormapPrivate) +{} + +QColormap::QColormap(const QColormap &colormap) :d (colormap.d) +{ d->ref.ref(); } + +QColormap::~QColormap() +{ + if (!d->ref.deref()) + delete d; +} + +QColormap::Mode QColormap::mode() const +{ return QColormap::Direct; } + +int QColormap::depth() const +{ + return 32; +} + +int QColormap::size() const +{ + return -1; +} + +uint QColormap::pixel(const QColor &color) const +{ return color.rgba(); } + +const QColor QColormap::colorAt(uint pixel) const +{ return QColor(pixel); } + +const QVector QColormap::colormap() const +{ return QVector(); } + +QColormap &QColormap::operator=(const QColormap &colormap) +{ qAtomicAssign(d, colormap.d); return *this; } + +QT_END_NAMESPACE + -- cgit v0.12 From 7b9b55e3a0deb69a6ff04ee9b76840a5f8d11545 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 4 Jun 2009 18:31:49 +0200 Subject: Fix up the display mode conversion function. Few things here: - Add support for EGray2 and EGray256 - Change the define to disable EColor16MAP for old SDKs - Make the default case return Invalid instead of a fatal error - Fix indentation, tabs -> spaces --- src/gui/kernel/qt_s60_p.h | 65 +++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index aed8241..d2fa5da 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -242,37 +242,40 @@ static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec) static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode) { - QImage::Format format; - switch(mode) { - case EColor256: - // TODO: is the correct? - format = QImage::Format_Indexed8; - break; - case EColor4K: - format = QImage::Format_RGB444; - break; - case EColor64K: - format = QImage::Format_RGB16; - break; - case EColor16M: - format = QImage::Format_RGB666; - break; - case EColor16MU: - format = QImage::Format_RGB32; - break; - case EColor16MA: - format = QImage::Format_ARGB32; - break; -#ifdef __S60_50__ - case EColor16MAP: - format = QImage::Format_ARGB32_Premultiplied; - break; -#endif - default: - qFatal("Screen format not supported"); - break; - } - return format; + QImage::Format format; + switch(mode) { + case EGray2: + format = QImage::Format_MonoLSB; + break; + case EColor256: + case EGray256: + format = QImage::Format_Indexed8; + break; + case EColor4K: + format = QImage::Format_RGB444; + break; + case EColor64K: + format = QImage::Format_RGB16; + break; + case EColor16M: + format = QImage::Format_RGB666; + break; + case EColor16MU: + format = QImage::Format_RGB32; + break; + case EColor16MA: + format = QImage::Format_ARGB32; + break; +#if !defined(__SERIES60_31__) && !defined(__S60_32__) + case EColor16MAP: + format = QImage::Format_ARGB32_Premultiplied; + break; +#endif + default: + format = QImage::Format_Invalid; + break; + } + return format; } -- cgit v0.12 From 04b4e2254e59fcb8776044d5d627e7f0d8daeacf Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 5 Jun 2009 10:14:12 +0200 Subject: Turned off input methods on X11 when using certain hints. If any of those hints are present, complex input is not possible, so input methods should be turned off on X11. --- src/gui/inputmethod/qximinputcontext_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp index c320fb4..60ea15b 100644 --- a/src/gui/inputmethod/qximinputcontext_x11.cpp +++ b/src/gui/inputmethod/qximinputcontext_x11.cpp @@ -610,7 +610,7 @@ void QXIMInputContext::setFocusWidget(QWidget *w) QInputContext::setFocusWidget(w); - if (!w) + if (!w || w->inputMethodHints() & Qt::ImhExclusiveInputMask) return; ICData *data = ximData.value(w->effectiveWinId()); -- cgit v0.12 From fd6e80b7cc36ebc111d062301ba8bfca5e6e6f50 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Thu, 4 Jun 2009 18:41:47 +0200 Subject: Introduce Symbian CFbsBitmap <-> QPixmap conversion functions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce functions for converting to and from a CFbsBitmap on Symbian. Currently these functions unfortunately have to copy the data to the internal QImage stored in the raster pixmap data backend :( Hopefully we can improve this with a native Symbian pixmap backend in the future. The autotest generates both small and large CFbsBitmaps of different formats and then verifies that the color makes it into the QPixmap. Currently the indexed image formats don't seem to work, but this is most likely because we don't set a palette for them. The semi-trans bitmaps seem to work fine (verified visually), but the current QCOMPARE doesn't consider the fact that the color was alpha blended. Reviewed-by: Sami Merilä --- src/gui/image/qpixmap.h | 9 +++ src/gui/image/qpixmap_s60.cpp | 140 +++++++++++++++++++++++++++++++++++-- tests/auto/qpixmap/qpixmap.pro | 19 ++--- tests/auto/qpixmap/tst_qpixmap.cpp | 101 ++++++++++++++++++++++++++ 4 files changed, 251 insertions(+), 18 deletions(-) diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 1863273..9ef5347 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -62,6 +62,10 @@ class QX11Info; class QPixmapData; +#if defined(Q_OS_SYMBIAN) +class CFbsBitmap; +#endif + class Q_GUI_EXPORT QPixmap : public QPaintDevice { public: @@ -152,6 +156,11 @@ public: static QPixmap fromMacCGImageRef(CGImageRef image); #endif +#if defined(Q_OS_SYMBIAN) + CFbsBitmap *toSymbianCFbsBitmap() const; + static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap); +#endif + inline QPixmap copy(int x, int y, int width, int height) const; QPixmap copy(const QRect &rect = QRect()) const; diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 52e2fe7..879c980 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -91,14 +91,142 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) return QPixmap(); } - QImage::Format format = qt_TDisplayMode2Format( displayMode ); - int bytesPerLine = CFbsBitmap::ScanLineLength(temporary->SizeInPixels().iWidth,displayMode); - temporary->LockHeap(); - QImage image = QImage((uchar*)temporary->DataAddress(), srcRect.Width(), srcRect.Height(), bytesPerLine, format); - QPixmap pixmap = QPixmap::fromImage(image.copy()); - temporary->UnlockHeap(); + QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(temporary); CBase::Delete(temporary); return pixmap; +} + +/*! +\since 4.6 + +Returns a \c CFbsBitmap that is equivalent to the QPixmap by copying the data. + +It is the caller's responsibility to delete the \c CFbsBitmap after use. + +\warning This function is only available on Symbian OS. + +\sa fromSymbianCFbsBitmap() +*/ + +CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const +{ + if (isNull()) + return 0; + + TDisplayMode mode; + const QImage img = toImage(); + QImage::Format destFormat = img.format(); + switch (img.format()) { + case QImage::Format_Mono: + destFormat = QImage::Format_MonoLSB; + // Fall through intended + case QImage::Format_MonoLSB: + mode = EGray2; + break; + case QImage::Format_Indexed8: + if (img.isGrayscale()) + mode = EGray256; + else + mode = EColor256; + break; + case QImage::Format_RGB32: + mode = EColor16MU; + break; + case QImage::Format_ARGB6666_Premultiplied: + case QImage::Format_ARGB8565_Premultiplied: + case QImage::Format_ARGB8555_Premultiplied: + destFormat = QImage::Format_ARGB32_Premultiplied; + // Fall through intended + case QImage::Format_ARGB32_Premultiplied: +#if !defined(__SERIES60_31__) && !defined(__S60_32__) + // ### TODO: Add runtime detection as well? + mode = EColor16MAP: + break; +#endif + destFormat = QImage::Format_ARGB32; + // Fall through intended + case QImage::Format_ARGB32: + mode = EColor16MA; + break; + case QImage::Format_RGB555: + destFormat = QImage::Format_RGB16; + // Fall through intended + case QImage::Format_RGB16: + mode = EColor64K; + break; + case QImage::Format_RGB666: + destFormat = QImage::Format_RGB888; + // Fall through intended + case QImage::Format_RGB888: + mode = EColor16M; + break; + case QImage::Format_RGB444: + mode = EColor4K; + break; + case QImage::Format_Invalid: + return 0; + default: + qWarning("Image format not supported: %d", img.format()); + return 0; + } + + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); + TSize size(width(), height()); + if (bitmap->Create(size, mode) != KErrNone) { + CBase::Delete(bitmap); + return 0; + } + + const QImage converted = img.convertToFormat(destFormat); + bitmap->LockHeap(); + const uchar *sptr = converted.bits(); + uchar *dptr = (uchar*)bitmap->DataAddress(); + Mem::Copy(dptr, sptr, converted.numBytes()); + bitmap->UnlockHeap(); + return bitmap; } + +/*! +\since 4.6 + +Returns a QPixmap that is equivalent to the \c CFbsBitmap by copying the data. +If the CFbsBitmap is not valid or is compressed in memory, this function will +return a null QPixmap. + +\warning This function is only available on Symbian OS. + +\sa toSymbianCFbsBitmap(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} +*/ + +QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) +{ + int width = bitmap->SizeInPixels().iWidth; + int height = bitmap->SizeInPixels().iHeight; + + if (!bitmap || width <= 0 || height <= 0 || bitmap->IsCompressedInRAM()) + return QPixmap(); + + TDisplayMode displayMode = bitmap->DisplayMode(); + QImage::Format format = qt_TDisplayMode2Format(displayMode); + int bytesPerLine = CFbsBitmap::ScanLineLength(width, displayMode); + bitmap->LockHeap(); + QImage image = QImage((const uchar*)bitmap->DataAddress(), width, height, bytesPerLine, format); + if (displayMode == EGray2) { + image.setNumColors(2); + image.setColor(0, QColor(Qt::color0).rgba()); + image.setColor(1, QColor(Qt::color1).rgba()); + } else if (displayMode == EGray256) { + for (int i=0; i < 256; ++i) + image.setColor(i, qRgb(i, i, i)); + }else if (displayMode == EColor256) { + const TColor256Util *palette = TColor256Util::Default(); + for (int i=0; i < 256; ++i) + image.setColor(i, (QRgb)(palette->Color256(i).Value())); + } + QPixmap pixmap = QPixmap::fromImage(image.copy()); + bitmap->UnlockHeap(); + return pixmap; +} + QT_END_NAMESPACE diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/qpixmap/qpixmap.pro index aa767aa..c992f6e 100644 --- a/tests/auto/qpixmap/qpixmap.pro +++ b/tests/auto/qpixmap/qpixmap.pro @@ -1,26 +1,21 @@ load(qttest_p4) SOURCES += tst_qpixmap.cpp contains(QT_CONFIG, qt3support): QT += qt3support -wince*: { +wince*|symbian*: { task31722_0.sources = convertFromImage/task31722_0/* task31722_0.path = convertFromImage/task31722_0 task31722_1.sources = convertFromImage/task31722_1/* task31722_1.path = convertFromImage/task31722_1 DEPLOYMENT += task31722_0 task31722_1 - DEFINES += SRCDIR=\\\".\\\" } -symbian*:{ - task31722_0.sources = convertFromImage/task31722_0/* - task31722_0.path = convertFromImage/task31722_0 - task31722_1.sources = convertFromImage/task31722_1/* - task31722_1.path = convertFromImage/task31722_1 - DEPLOYMENT += task31722_0 task31722_1 + +wince*: { + DEFINES += SRCDIR=\\\".\\\" +} symbian*: { DEPLOYMENT_PLUGIN += qmng -} -else { + LIBS += -lfbscli.lib -lbitgdi.lib -lgdi.lib +} else { DEFINES += SRCDIR=\\\"$$PWD\\\" win32:LIBS += -lgdi32 -luser32 } - - diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 493333b..9f73e34 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -58,6 +58,14 @@ #include #endif +#ifdef Q_OS_SYMBIAN +#include +#include +#include +#include +#endif + + //TESTED_CLASS= //TESTED_FILES= #if defined(Q_OS_SYMBIAN) @@ -120,6 +128,11 @@ private slots: void fromWinHBITMAP(); #endif +#if defined(Q_WS_S60) + void fromSymbianCFbsBitmap_data(); + void fromSymbianCFbsBitmap(); +#endif + void onlyNullPixmapsOutsideGuiThread(); void refUnref(); @@ -798,6 +811,94 @@ void tst_QPixmap::fromWinHBITMAP() #endif +#if defined(Q_WS_S60) +Q_DECLARE_METATYPE(TDisplayMode) + +void tst_QPixmap::fromSymbianCFbsBitmap_data() +{ + QTest::addColumn("format"); + QTest::addColumn("width"); + QTest::addColumn("height"); + QTest::addColumn("color"); + + const int smallWidth = 20; + const int smallHeight = 20; + const int largeWidth = 240; + const int largeHeight = 320; + + // Indexed Color Formats - Disabled since images seem to be blank -> no palette? +// QTest::newRow("EGray2 small") << EGray2 << smallWidth << smallHeight << QColor(Qt::black); +// QTest::newRow("EGray2 big") << EGray2 << largeWidth << largeHeight << QColor(Qt::black); +// QTest::newRow("EGray256 small") << EGray256 << smallWidth << smallHeight << QColor(Qt::blue); +// QTest::newRow("EGray256 big") << EGray256 << largeWidth << largeHeight << QColor(Qt::blue); +// QTest::newRow("EColor256 small") << EColor256 << smallWidth << smallHeight << QColor(Qt::red); +// QTest::newRow("EColor256 big") << EColor256 << largeWidth << largeHeight << QColor(Qt::red); + + // Direct Color Formats + QTest::newRow("EColor4K small") << EColor4K << smallWidth << smallHeight << QColor(Qt::red); + QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red); + QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green); + QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green); + QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red); + QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red); + QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0); + QTest::newRow("EColor16MA big opaque") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0); + + // Semi-transparent Colors - Disabled for now, since the QCOMPARE fails, but visually confirmed to work +// QTest::newRow("EColor16MA small semi") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 127); +// QTest::newRow("EColor16MA big semi") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 127); +// QTest::newRow("EColor16MA small trans") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 0); +// QTest::newRow("EColor16MA big trans") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 0); + +#if !defined(__SERIES60_31__) && !defined(__S60_32__) + QTest::newRow("EColor16MAP small") << EColor16MAP << smallWidth << smallHeight << QColor(Qt::red); + QTest::newRow("EColor16MAP big") << EColor16MAP << largeWidth << largeHeight << QColor(Qt::red); +#endif +} + +void tst_QPixmap::fromSymbianCFbsBitmap() +{ + QFETCH(TDisplayMode, format); + QFETCH(int, width); + QFETCH(int, height); + QFETCH(QColor, color); + int expectedDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(format); + + CFbsBitmap *nativeBitmap = 0; + CFbsBitmapDevice *bitmapDevice = 0; + CBitmapContext *bitmapContext = 0; + + nativeBitmap = new (ELeave) CFbsBitmap(); + TInt err = nativeBitmap->Create(TSize(width, height), format); + CleanupStack::PushL(nativeBitmap); + QVERIFY(err == KErrNone); + bitmapDevice = CFbsBitmapDevice::NewL(nativeBitmap); + CleanupStack::PushL(bitmapDevice); + + err = bitmapDevice->CreateBitmapContext(bitmapContext); + CleanupStack::PushL(bitmapContext); + QVERIFY(err == KErrNone); + TRgb symbianColor = TRgb(color.red(), color.green(), color.blue(), color.alpha()); + bitmapContext->SetBrushColor(symbianColor); + bitmapContext->Clear(); + + __UHEAP_MARK; + { // Test the normal case + QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(nativeBitmap); +// QCOMPARE(pixmap.depth(), expectedDepth); // Depth is not preserved now + QCOMPARE(pixmap.width(), width); + QCOMPARE(pixmap.height(), height); + QImage image = pixmap.toImage(); + + QColor actualColor(image.pixel(1, 1)); + QCOMPARE(actualColor, color); + } + __UHEAP_MARKEND; + + CleanupStack::PopAndDestroy(3); +} +#endif + void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() { #if !defined(Q_WS_WIN) -- cgit v0.12 From ec4fd914b3b34ae14b996fd525f3f6f9b68ddd9e Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 5 Jun 2009 10:30:46 +0200 Subject: Make QColormap::instance() not crash. This doesn't really need a static instance lying around and this current implementation crashes since we never call the constructor. Just recreate it on the fly when instance() is called which apparently is never. --- src/gui/painting/qcolormap_s60.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gui/painting/qcolormap_s60.cpp b/src/gui/painting/qcolormap_s60.cpp index c21eba9..1b58598 100644 --- a/src/gui/painting/qcolormap_s60.cpp +++ b/src/gui/painting/qcolormap_s60.cpp @@ -53,22 +53,18 @@ public: QAtomicInt ref; }; -static QColormap *qt_symbian_color_map = 0; void QColormap::initialize() { - qt_symbian_color_map = new QColormap; } void QColormap::cleanup() { - delete qt_symbian_color_map; - qt_symbian_color_map = 0; } QColormap QColormap::instance(int) { - return *qt_symbian_color_map; + return QColormap(); } QColormap::QColormap() : d(new QColormapPrivate) -- cgit v0.12 From 800b7e087f90e6253e4c496e816721c63b366e02 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 5 Jun 2009 11:12:04 +0200 Subject: Enabling QGraphicsTextItem to handle input method events. On S60 one should get virtual keyboard. --- src/gui/graphicsview/qgraphicsitem.cpp | 129 ++++++++++++++++++++++++++++++++- 1 file changed, 128 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e8ace65..ed1891c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -515,6 +515,7 @@ #include #include #include +#include #include #include @@ -7609,7 +7610,7 @@ class QGraphicsTextItemPrivate { public: QGraphicsTextItemPrivate() - : control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false) + : control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0) { } mutable QTextControl *control; @@ -7630,6 +7631,8 @@ public: bool useDefaultImpl; bool tabChangesFocus; + uint clickCausedFocus : 1; + QGraphicsTextItem *qq; }; @@ -7956,7 +7959,13 @@ void QGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) dd->useDefaultImpl = false; return; } + dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -7968,7 +7977,13 @@ void QGraphicsTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QGraphicsItem::mouseMoveEvent(event); return; } + dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -7988,7 +8003,23 @@ void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } return; } + + if (event->button() == Qt::LeftButton && qApp->autoSipEnabled() + && (!dd->clickCausedFocus || qApp->autoSipOnMouseFocus())) { + QEvent _event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(event->widget(), &_event); + } else { + QGraphicsItem::mouseReleaseEvent(event); + } + dd->clickCausedFocus = 0; + dd->sendControlEvent(event); + + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8007,6 +8038,11 @@ void QGraphicsTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) } dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8015,6 +8051,11 @@ void QGraphicsTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) void QGraphicsTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8023,6 +8064,18 @@ void QGraphicsTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void QGraphicsTextItem::keyPressEvent(QKeyEvent *event) { dd->sendControlEvent(event); + QList views = scene()->views(); + for (int i = 0; i < views.size(); ++i) { + QGraphicsView *view = views.at(i); + Q_ASSERT(view->viewport()); + if(view->viewport()->hasFocus()) { + QInputContext *qic = view->viewport()->inputContext(); + if(qic){ + qic->update(); + } + break; + } + } } /*! @@ -8031,6 +8084,18 @@ void QGraphicsTextItem::keyPressEvent(QKeyEvent *event) void QGraphicsTextItem::keyReleaseEvent(QKeyEvent *event) { dd->sendControlEvent(event); + QList views = scene()->views(); + for (int i = 0; i < views.size(); ++i) { + QGraphicsView *view = views.at(i); + Q_ASSERT(view->viewport()); + if(view->viewport()->hasFocus()) { + QInputContext *qic = view->viewport()->inputContext(); + if(qic){ + qic->update(); + } + break; + } + } } /*! @@ -8039,7 +8104,22 @@ void QGraphicsTextItem::keyReleaseEvent(QKeyEvent *event) void QGraphicsTextItem::focusInEvent(QFocusEvent *event) { dd->sendControlEvent(event); + if (event->reason() == Qt::MouseFocusReason) { + dd->clickCausedFocus = 1; + } update(); + QList views = scene()->views(); + for (int i = 0; i < views.size(); ++i) { + QGraphicsView *view = views.at(i); + Q_ASSERT(view->viewport()); + if(view->viewport()->hasFocus()) { + QInputContext *qic = view->viewport()->inputContext(); + if(qic){ + qic->reset(); + } + break; + } + } } /*! @@ -8049,6 +8129,18 @@ void QGraphicsTextItem::focusOutEvent(QFocusEvent *event) { dd->sendControlEvent(event); update(); + QList views = scene()->views(); + for (int i = 0; i < views.size(); ++i) { + QGraphicsView *view = views.at(i); + Q_ASSERT(view->viewport()); + if(view->viewport()->hasFocus()) { + QInputContext *qic = view->viewport()->inputContext(); + if(qic){ + qic->reset(); + } + break; + } + } } /*! @@ -8057,6 +8149,11 @@ void QGraphicsTextItem::focusOutEvent(QFocusEvent *event) void QGraphicsTextItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8065,6 +8162,11 @@ void QGraphicsTextItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) void QGraphicsTextItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8073,6 +8175,11 @@ void QGraphicsTextItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) void QGraphicsTextItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8081,6 +8188,11 @@ void QGraphicsTextItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event) void QGraphicsTextItem::dropEvent(QGraphicsSceneDragDropEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8097,6 +8209,11 @@ void QGraphicsTextItem::inputMethodEvent(QInputMethodEvent *event) void QGraphicsTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8105,6 +8222,11 @@ void QGraphicsTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void QGraphicsTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! @@ -8113,6 +8235,11 @@ void QGraphicsTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void QGraphicsTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { dd->sendControlEvent(event); + Q_ASSERT(event->widget()); + QInputContext *qic = event->widget()->inputContext(); + if(qic) { + qic->update(); + } } /*! -- cgit v0.12 From ed0156a4269cd5c4ee13368b8c366bb7af2f489f Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 5 Jun 2009 11:35:34 +0200 Subject: Compile on newer SDKs >= S60 5.0. Semi-colons, colons, they all look the same to me. --- src/gui/image/qpixmap_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 879c980..3ea50ff 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -140,7 +140,7 @@ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const case QImage::Format_ARGB32_Premultiplied: #if !defined(__SERIES60_31__) && !defined(__S60_32__) // ### TODO: Add runtime detection as well? - mode = EColor16MAP: + mode = EColor16MAP; break; #endif destFormat = QImage::Format_ARGB32; -- cgit v0.12