summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp6
-rw-r--r--src/corelib/tools/qscopedpointer.cpp4
-rw-r--r--src/dbus/qdbusinterface.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp6
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp2
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp57
-rw-r--r--src/gui/text/qfontengine_s60.cpp25
-rw-r--r--src/gui/text/qfontengine_s60_p.h4
-rw-r--r--src/gui/text/qtextdocument.cpp9
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp8
-rw-r--r--tests/auto/qdbusinterface/tst_qdbusinterface.cpp22
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp26
-rw-r--r--tests/auto/selftests/tst_selftests.cpp4
15 files changed, 111 insertions, 68 deletions
diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp
index 77a0964..f49e898 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.cpp
+++ b/src/3rdparty/phonon/mmf/audioplayer.cpp
@@ -99,7 +99,7 @@ int MMF::AudioPlayer::setDeviceVolume(int mmfVolume)
* stack by doing a runtime check of the SDK version. */
#if !defined(__SERIES60_31__)
const int err = m_player->SetVolume(mmfVolume);
- if (QSysInfo::s60Version() >= QSysInfo::SV_S60_5_0)
+ if (QSysInfo::s60Version() >= QSysInfo::SV_S60_3_2)
return err;
else
return KErrNone;
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index 4566ec0..a6d486e 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -642,8 +642,8 @@ public:
QIdleDetectorThread()
: m_state(STATE_RUN), m_stop(false)
{
- qt_symbian_throwIfError(m_lock.CreateLocal());
- TInt err = m_idleDetectorThread.Create(KNullDesC(), &idleDetectorThreadFunc, 1024, &User::Allocator(), this);
+ qt_symbian_throwIfError(m_lock.CreateLocal(0));
+ TInt err = m_idleDetectorThread.Create(KNullDesC(), &idleDetectorThreadFunc, 1024, NULL, this);
if (err != KErrNone)
m_lock.Close();
qt_symbian_throwIfError(err);
@@ -694,7 +694,7 @@ private:
enum IdleStates {STATE_KICKED, STATE_RUN} m_state;
bool m_stop;
RThread m_idleDetectorThread;
- RFastLock m_lock;
+ RSemaphore m_lock;
};
Q_GLOBAL_STATIC(QIdleDetectorThread, idleDetectorThread);
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index e7dd769..b06112d 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
called resource acquisition is initialization(RAII).
QScopedPointer guarantees that the object pointed to will get deleted when
- the current scope dissapears.
+ the current scope disappears.
Consider this function which does heap allocations, and have various exit points:
@@ -227,7 +227,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QScopedArrayPointer
-
+
\brief The QScopedArrayPointer class stores a pointer to a
dynamically allocated array of objects, and deletes it upon
destruction.
diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp
index 7cc43ed..b989cab 100644
--- a/src/dbus/qdbusinterface.cpp
+++ b/src/dbus/qdbusinterface.cpp
@@ -260,7 +260,7 @@ void *QDBusInterface::qt_metacast(const char *_clname)
int QDBusInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDBusAbstractInterface::qt_metacall(_c, _id, _a);
- if (_id < 0 || !d_func()->isValid)
+ if (_id < 0 || !d_func()->isValid || !d_func()->metaObject)
return _id;
return d_func()->metacall(_c, _id, _a);
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index bd0f0d8..8cee021 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -820,13 +820,13 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
#endif //QT_NO_IM
}
- if (item) {
+ if (item)
focusItem = item;
+ updateInputMethodSensitivityInViews();
+ if (item) {
QFocusEvent event(QEvent::FocusIn, focusReason);
sendEvent(item, &event);
}
-
- updateInputMethodSensitivityInViews();
}
/*!
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index b42e0ab..610ac3c 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -87,7 +87,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_fepState->SetDefaultInputMode( EAknEditorTextInputMode );
m_fepState->SetPermittedInputModes( EAknEditorAllInputModes );
m_fepState->SetDefaultCase( EAknEditorLowerCase );
- m_fepState->SetPermittedCases( EAknEditorLowerCase|EAknEditorUpperCase );
+ m_fepState->SetPermittedCases( EAknEditorAllCaseModes );
m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
m_fepState->SetNumericKeymap( EAknEditorStandardNumberModeKeymap );
}
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 5f7813b..f4c7304 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -440,7 +440,7 @@ void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent
state |= Qt::TouchPointPrimary;
touchPoint.setState(state);
- QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY);
+ QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY));
touchPoint.setScreenPos(screenPos);
touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
screenPos.y() / screenGeometry.height()));
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 3ad0806..95774f9 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -98,18 +98,26 @@ public:
QSymbianFontDatabaseExtrasImplementation();
~QSymbianFontDatabaseExtrasImplementation();
- const QSymbianTypeFaceExtras *extras(const QString &typeface) const;
+ const QSymbianTypeFaceExtras *extras(const QString &typeface, bool bold, bool italic) const;
private:
RHeap* m_heap;
CFontStore *m_store;
COpenFontRasterizer *m_rasterizer;
- mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extras;
+ mutable QList<const QSymbianTypeFaceExtras *> m_extras;
+ mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extrasHash;
};
QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementation()
{
- m_heap = User::ChunkHeap(NULL, 0x1000, 0x100000);
+ QStringList filters;
+ filters.append(QLatin1String("*.ttf"));
+ filters.append(QLatin1String("*.ccc"));
+ const QFileInfoList fontFiles = alternativeFilePaths(QLatin1String("resource\\Fonts"), filters);
+
+ const TInt heapMinLength = 0x1000;
+ const TInt heapMaxLength = qMax(0x20000 * fontFiles.count(), heapMinLength);
+ m_heap = User::ChunkHeap(NULL, heapMinLength, heapMaxLength);
QT_TRAP_THROWING(
m_store = CFontStore::NewL(m_heap);
m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E));
@@ -117,19 +125,16 @@ QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementati
m_store->InstallRasterizerL(m_rasterizer);
CleanupStack::Pop(m_rasterizer););
- QStringList filters;
- filters.append(QString::fromLatin1("*.ttf"));
- filters.append(QString::fromLatin1("*.ccc"));
- const QFileInfoList fontFiles = alternativeFilePaths(QString::fromLatin1("resource\\Fonts"), filters);
foreach (const QFileInfo &fontFileInfo, fontFiles) {
const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath());
TPtrC fontFilePtr(qt_QString2TPtrC(fontFile));
QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr));
}
}
+
QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation()
{
- typedef QHash<QString, const QSymbianTypeFaceExtras *>::iterator iterator;
+ typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator;
for (iterator p = m_extras.begin(); p != m_extras.end(); ++p) {
m_store->ReleaseFont((*p)->fontOwner());
delete *p;
@@ -156,13 +161,18 @@ COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont)
}
#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
-const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &typeface) const
+const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &typeface,
+ bool bold, bool italic) const
{
- if (!m_extras.contains(typeface)) {
+ const QString searchKey = typeface + QString::number(int(bold)) + QString::number(int(italic));
+ if (!m_extrasHash.contains(searchKey)) {
CFont* font = NULL;
- TFontSpec spec(qt_QString2TPtrC(typeface), 1);
- spec.iHeight = 1;
- const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, spec);
+ TFontSpec searchSpec(qt_QString2TPtrC(typeface), 1);
+ if (bold)
+ searchSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+ if (italic)
+ searchSpec.iFontStyle.SetPosture(EPostureItalic);
+ const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, searchSpec);
Q_ASSERT(err == KErrNone && font);
const CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font);
COpenFont *openFont =
@@ -171,9 +181,20 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c
#else
OpenFontFromBitmapFont(bitmapFont);
#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
- m_extras.insert(typeface, new QSymbianTypeFaceExtras(font, openFont));
+ const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib();
+ const QString foundKey =
+ QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length());
+ if (!m_extrasHash.contains(foundKey)) {
+ QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont);
+ m_extras.append(extras);
+ m_extrasHash.insert(searchKey, extras);
+ m_extrasHash.insert(foundKey, extras);
+ } else {
+ m_store->ReleaseFont(font);
+ m_extrasHash.insert(searchKey, m_extrasHash.value(foundKey));
+ }
}
- return m_extras.value(typeface);
+ return m_extrasHash.value(searchKey);
}
#else
class QFontEngineFTS60 : public QFontEngineFT
@@ -273,7 +294,8 @@ static void initializeDb()
style->smoothScalable = typefaceSupport.iIsScalable;
style->pixelSize(0, true);
- const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(familyName);
+ const QSymbianTypeFaceExtras *typeFaceExtras =
+ dbExtras->extras(familyName, faceAttrib.IsBold(), faceAttrib.IsItalic());
const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
const unsigned char* data = reinterpret_cast<const unsigned char*>(os2Table.constData());
const unsigned char* ulUnicodeRange = data + 42;
@@ -396,7 +418,8 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo
#if defined(QT_NO_FREETYPE)
const QSymbianFontDatabaseExtrasImplementation *dbExtras =
static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(fontFamily);
+ const QSymbianTypeFaceExtras *typeFaceExtras =
+ dbExtras->extras(fontFamily, request.weight > QFont::Normal, request.style != QFont::StyleNormal);
fe = new QFontEngineS60(request, typeFaceExtras);
#else
QFontEngine::FaceId faceId;
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index a9960e4..93f02ff 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -59,13 +59,10 @@ QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font
, m_symbolCMap(false)
, m_fontOwner(fontOwner)
{
- TAny *shapingExtension = NULL;
- m_font->ExtendedInterface(KUidOpenFontShapingExtension, shapingExtension);
- m_shapingExtension = static_cast<MOpenFontShapingExtension*>(shapingExtension);
TAny *trueTypeExtension = NULL;
m_font->ExtendedInterface(KUidOpenFontTrueTypeExtension, trueTypeExtension);
m_trueTypeExtension = static_cast<MOpenFontTrueTypeExtension*>(trueTypeExtension);
- Q_ASSERT(m_shapingExtension && m_trueTypeExtension);
+ Q_ASSERT(m_trueTypeExtension);
}
QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const
@@ -114,26 +111,6 @@ const unsigned char *QSymbianTypeFaceExtras::cmap() const
return m_cmap;
}
-QPainterPath QSymbianTypeFaceExtras::glyphOutline(glyph_t glyph) const
-{
- QPainterPath result;
- QPolygonF polygon;
- TInt glyphIndex = glyph;
- TInt pointNumber = 0;
- TInt x, y;
- while (m_shapingExtension->GlyphPointInFontUnits(glyphIndex, pointNumber++, x, y)) {
- const QPointF point(qreal(x) / 0xffff, qreal(y) / 0xffff);
- if (polygon.contains(point)) {
- result.addPolygon(polygon);
- result.closeSubpath();
- polygon.clear();
- } else {
- polygon.append(point);
- }
- }
- return result;
-}
-
CFont *QSymbianTypeFaceExtras::fontOwner() const
{
return m_fontOwner;
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index b6b117f..6883730 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -62,7 +62,7 @@ class CFont;
QT_BEGIN_NAMESPACE
-// ..gives us access to truetype tables, UTF-16<->GlyphID mapping, and glyph outlines
+// ..gives us access to truetype tables
class QSymbianTypeFaceExtras
{
public:
@@ -71,12 +71,10 @@ public:
QByteArray getSfntTable(uint tag) const;
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
const unsigned char *cmap() const;
- QPainterPath glyphOutline(glyph_t glyph) const;
CFont *fontOwner() const;
private:
COpenFont *m_font;
- const MOpenFontShapingExtension *m_shapingExtension;
mutable MOpenFontTrueTypeExtension *m_trueTypeExtension;
mutable const unsigned char *m_cmap;
mutable bool m_symbolCMap;
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 3e556a7..afba678 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1704,7 +1704,7 @@ void QTextDocument::print(QPrinter *printer) const
return;
const QTextDocument *doc = this;
- QTextDocument *clonedDoc = 0;
+ QScopedPointer<QTextDocument> clonedDoc;
(void)doc->documentLayout(); // make sure that there is a layout
QRectF body = QRectF(QPointF(0, 0), d->pageSize);
@@ -1737,7 +1737,7 @@ void QTextDocument::print(QPrinter *printer) const
printerPageSize.height() / scaledPageSize.height());
} else {
doc = clone(const_cast<QTextDocument *>(this));
- clonedDoc = const_cast<QTextDocument *>(doc);
+ clonedDoc.reset(const_cast<QTextDocument *>(doc));
for (QTextBlock srcBlock = firstBlock(), dstBlock = clonedDoc->firstBlock();
srcBlock.isValid() && dstBlock.isValid();
@@ -1812,7 +1812,7 @@ void QTextDocument::print(QPrinter *printer) const
for (int j = 0; j < pageCopies; ++j) {
if (printer->printerState() == QPrinter::Aborted
|| printer->printerState() == QPrinter::Error)
- goto UserCanceled;
+ return;
printPage(page, &p, doc, body, pageNumberPos);
if (j < pageCopies - 1)
printer->newPage();
@@ -1832,9 +1832,6 @@ void QTextDocument::print(QPrinter *printer) const
if ( i < docCopies - 1)
printer->newPage();
}
-
-UserCanceled:
- delete clonedDoc;
}
#endif
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index 4a9cfed..ab2bdea 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -149,8 +149,12 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMe
"Too many menu actions");
const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut);
- QString iconText = action->action->iconText();
- TPtrC menuItemText = qt_QString2TPtrC( underlineShortCut ? action->action->text() : iconText);
+ QString actionText;
+ if (underlineShortCut)
+ actionText = action->action->text().left(CEikMenuPaneItem::SData::ENominalTextLength);
+ else
+ actionText = action->action->iconText().left(CEikMenuPaneItem::SData::ENominalTextLength);
+ TPtrC menuItemText = qt_QString2TPtrC(actionText);
if (action->action->menu()) {
SymbianMenuItem* menuItem = new SymbianMenuItem();
menuItem->menuItemData.iCascadeId = action->command;
diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
index 826bd70..d8ff2d3 100644
--- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
@@ -157,6 +157,18 @@ public slots:
}
};
+class DerivedFromQDBusInterface: public QDBusInterface
+{
+ Q_OBJECT
+public:
+ DerivedFromQDBusInterface()
+ : QDBusInterface("com.example.Test", "/")
+ {}
+
+public slots:
+ void method() {}
+};
+
// helper function
void emitSignal(const QString &interface, const QString &name, const QString &arg)
{
@@ -183,6 +195,7 @@ private slots:
void notConnected();
void notValid();
+ void notValidDerived();
void invalidAfterServiceOwnerChanged();
void introspect();
void callMethod();
@@ -219,6 +232,7 @@ void tst_QDBusInterface::notConnected()
connection);
QVERIFY(!interface.isValid());
+ QVERIFY(!QMetaObject::invokeMethod(&interface, "ListNames", Qt::DirectConnection));
}
void tst_QDBusInterface::notValid()
@@ -230,6 +244,14 @@ void tst_QDBusInterface::notValid()
connection);
QVERIFY(!interface.isValid());
+ QVERIFY(!QMetaObject::invokeMethod(&interface, "ListNames", Qt::DirectConnection));
+}
+
+void tst_QDBusInterface::notValidDerived()
+{
+ DerivedFromQDBusInterface c;
+ QVERIFY(!c.isValid());
+ QMetaObject::invokeMethod(&c, "method", Qt::DirectConnection);
}
void tst_QDBusInterface::invalidAfterServiceOwnerChanged()
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 5e889f4..d0752af 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -3665,6 +3665,22 @@ void tst_QGraphicsView::update()
#endif
}
+class FocusItem : public QGraphicsRectItem
+{
+public:
+ FocusItem() : QGraphicsRectItem(0, 0, 20, 20) {
+ m_viewHasIMEnabledInFocusInEvent = false;
+ }
+
+ void focusInEvent(QFocusEvent *event)
+ {
+ QGraphicsView *view = scene()->views().first();
+ m_viewHasIMEnabledInFocusInEvent = view->testAttribute(Qt::WA_InputMethodEnabled);
+ }
+
+ bool m_viewHasIMEnabledInFocusInEvent;
+};
+
void tst_QGraphicsView::inputMethodSensitivity()
{
QGraphicsScene scene;
@@ -3674,7 +3690,7 @@ void tst_QGraphicsView::inputMethodSensitivity()
QApplication::setActiveWindow(&view);
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
- QGraphicsRectItem *item = new QGraphicsRectItem;
+ FocusItem *item = new FocusItem;
view.setAttribute(Qt::WA_InputMethodEnabled, true);
@@ -3703,6 +3719,7 @@ void tst_QGraphicsView::inputMethodSensitivity()
scene.setFocusItem(item);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
+ QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true);
item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
@@ -3711,15 +3728,17 @@ void tst_QGraphicsView::inputMethodSensitivity()
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
// introduce another item that is focusable but does not accept input methods
- QGraphicsRectItem *item2 = new QGraphicsRectItem;
+ FocusItem *item2 = new FocusItem;
item2->setFlag(QGraphicsItem::ItemIsFocusable);
scene.addItem(item2);
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
+ QCOMPARE(item2->m_viewHasIMEnabledInFocusInEvent, false);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
scene.setFocusItem(item);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
+ QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(0);
@@ -3728,10 +3747,12 @@ void tst_QGraphicsView::inputMethodSensitivity()
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
+ QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
+ QCOMPARE(item2->m_viewHasIMEnabledInFocusInEvent, false);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
view.setScene(0);
@@ -3744,6 +3765,7 @@ void tst_QGraphicsView::inputMethodSensitivity()
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
+ QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
}
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 0cff2fd..0818b4c 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -131,11 +131,11 @@ static QList<QByteArray> splitLines(QByteArray ba)
if (index == -1) {
continue;
}
- int end = line.indexOf('"', index + strlen(markers[j][0]) + 1);
+ int end = line.indexOf('"', index + strlen(markers[j][0]));
if (end == -1) {
continue;
}
- line.replace(index, end-index, markers[j][1]);
+ line.replace(index, end-index + 1, markers[j][1]);
}
}