summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-arabic.c2
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gpos.c6
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c3
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp117
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-open.c2
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shape.h2
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.h41
-rw-r--r--src/3rdparty/harfbuzz/tests/shaping/main.cpp76
-rwxr-xr-xsrc/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp88
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp4
-rw-r--r--src/corelib/arch/qatomic_symbian.h12
-rw-r--r--src/corelib/global/qglobal.cpp22
-rw-r--r--src/corelib/global/qglobal.h17
-rw-r--r--src/corelib/global/qnamespace.h11
-rw-r--r--src/corelib/global/qnamespace.qdoc36
-rw-r--r--src/gui/dialogs/qfiledialog.cpp10
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm10
-rw-r--r--src/gui/egl/egl.pri10
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp23
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h3
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp109
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h1
-rw-r--r--src/gui/image/qimage.cpp3
-rw-r--r--src/gui/image/qpixmap_s60.cpp24
-rw-r--r--src/gui/image/qpixmap_x11.cpp4
-rw-r--r--src/gui/itemviews/qabstractitemview.h1
-rw-r--r--src/gui/kernel/qapplication.cpp58
-rw-r--r--src/gui/kernel/qapplication.h4
-rw-r--r--src/gui/kernel/qapplication_p.h3
-rw-r--r--src/gui/kernel/qapplication_s60.cpp29
-rw-r--r--src/gui/kernel/qapplication_win.cpp36
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm23
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac_p.h2
-rw-r--r--src/gui/kernel/qevent.cpp27
-rw-r--r--src/gui/kernel/qevent.h4
-rw-r--r--src/gui/kernel/qgesture.cpp91
-rw-r--r--src/gui/kernel/qgesture.h22
-rw-r--r--src/gui/kernel/qgesture_p.h15
-rw-r--r--src/gui/kernel/qgesturemanager.cpp96
-rw-r--r--src/gui/kernel/qgesturemanager_p.h5
-rw-r--r--src/gui/kernel/qgesturerecognizer.cpp86
-rw-r--r--src/gui/kernel/qgesturerecognizer.h25
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac.mm57
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac_p.h13
-rw-r--r--src/gui/kernel/qsound_s60.cpp94
-rw-r--r--src/gui/kernel/qstandardgestures.cpp216
-rw-r--r--src/gui/kernel/qstandardgestures_p.h14
-rw-r--r--src/gui/kernel/qwidget.cpp13
-rw-r--r--src/gui/kernel/qwidget.h2
-rw-r--r--src/gui/kernel/qwidget_mac.mm9
-rw-r--r--src/gui/kernel/qwidget_p.h2
-rw-r--r--src/gui/kernel/qwidget_win.cpp15
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win.cpp29
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h5
-rw-r--r--src/gui/s60framework/s60framework.pri11
-rw-r--r--src/gui/s60framework/s60main.rss (renamed from src/s60main/s60main.rss)0
-rw-r--r--src/gui/styles/qcommonstyle.cpp183
-rw-r--r--src/gui/styles/qs60style.cpp113
-rw-r--r--src/gui/styles/qs60style_s60.cpp14
-rw-r--r--src/gui/styles/qs60style_simulated.cpp2
-rw-r--r--src/gui/text/qtextcontrol.cpp3
-rw-r--r--src/gui/util/qdesktopservices.cpp9
-rw-r--r--src/gui/util/qdesktopservices_mac.cpp9
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp55
-rw-r--r--src/gui/widgets/qlinecontrol.cpp3
-rw-r--r--src/gui/widgets/qplaintextedit.cpp53
-rw-r--r--src/gui/widgets/qtextedit.cpp6
-rw-r--r--src/opengl/opengl.pro25
-rw-r--r--src/opengl/qglpixmapfilter.cpp2
-rw-r--r--src/opengl/qglshaderprogram.cpp50
-rw-r--r--src/opengl/qglshaderprogram.h11
-rw-r--r--src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro6
-rw-r--r--src/s60installs/s60installs.pro26
-rw-r--r--src/s60main/qts60main_mcrt0.cpp8
-rw-r--r--src/s60main/s60main.pro20
-rw-r--r--src/xmlpatterns/acceltree/qacceltree_p.h2
-rw-r--r--src/xmlpatterns/acceltree/qcompressedwhitespace_p.h2
81 files changed, 1368 insertions, 887 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
index 0609232..4d85c19 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
@@ -1009,7 +1009,7 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok)
++l;
++properties;
}
- if (f + l < item->stringLength) {
+ if (f + l + item->item.pos < item->stringLength) {
++l;
}
getArabicProperties(uc+f, l, props);
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
index c932ec2..356dc01 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c
@@ -2059,15 +2059,17 @@ static void Free_BaseArray( HB_BaseArray* ba,
HB_BaseRecord *br;
HB_Anchor *bans;
- HB_UNUSED(num_classes);
-
if ( ba->BaseRecord )
{
br = ba->BaseRecord;
if ( ba->BaseCount )
{
+ HB_UShort i, count;
+ count = num_classes * ba->BaseCount;
bans = br[0].BaseAnchor;
+ for (i = 0; i < count; i++)
+ Free_Anchor (&bans[i]);
FREE( bans );
}
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c
index 533a063..2bda386 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c
@@ -56,6 +56,8 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item)
assert(shaper_item->item.script == HB_Script_Hebrew);
+ HB_HeuristicSetGlyphAttributes(shaper_item);
+
#ifndef NO_OPENTYPE
if (HB_SelectScript(shaper_item, hebrew_features)) {
@@ -64,7 +66,6 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item)
return FALSE;
- HB_HeuristicSetGlyphAttributes(shaper_item);
HB_OpenTypeShape(shaper_item, /*properties*/0);
return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE);
}
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
index 7104d2a..48f4f90 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
@@ -419,7 +419,7 @@ static const unsigned char indicForms[0xe00-0x900] = {
Matra, Halant, Invalid, Invalid,
Invalid, Invalid, Invalid, Invalid,
- Invalid, Invalid, Invalid, LengthMark,
+ Invalid, Invalid, Invalid, Matra,
Invalid, Invalid, Invalid, Invalid,
Invalid, Invalid, Invalid, Invalid,
@@ -1050,62 +1050,59 @@ static const IndicOrdering * const indic_order[] = {
// vowel matras that have to be split into two parts.
static const unsigned short split_matras[] = {
- // matra, split1, split2
+ // matra, split1, split2, split3
// bengalis
- 0x9cb, 0x9c7, 0x9be,
- 0x9cc, 0x9c7, 0x9d7,
+ 0x9cb, 0x9c7, 0x9be, 0x0,
+ 0x9cc, 0x9c7, 0x9d7, 0x0,
// oriya
- 0xb48, 0xb47, 0xb56,
- 0xb4b, 0xb47, 0xb3e,
- 0xb4c, 0xb47, 0xb57,
+ 0xb48, 0xb47, 0xb56, 0x0,
+ 0xb4b, 0xb47, 0xb3e, 0x0,
+ 0xb4c, 0xb47, 0xb57, 0x0,
// tamil
- 0xbca, 0xbc6, 0xbbe,
- 0xbcb, 0xbc7, 0xbbe,
- 0xbcc, 0xbc6, 0xbd7,
+ 0xbca, 0xbc6, 0xbbe, 0x0,
+ 0xbcb, 0xbc7, 0xbbe, 0x0,
+ 0xbcc, 0xbc6, 0xbd7, 0x0,
// telugu
- 0xc48, 0xc46, 0xc56,
+ 0xc48, 0xc46, 0xc56, 0x0,
// kannada
- 0xcc0, 0xcbf, 0xcd5,
- 0xcc7, 0xcc6, 0xcd5,
- 0xcc8, 0xcc6, 0xcd6,
- 0xcca, 0xcc6, 0xcc2,
- 0xccb, 0xcca, 0xcd5,
+ 0xcc0, 0xcbf, 0xcd5, 0x0,
+ 0xcc7, 0xcc6, 0xcd5, 0x0,
+ 0xcc8, 0xcc6, 0xcd6, 0x0,
+ 0xcca, 0xcc6, 0xcc2, 0x0,
+ 0xccb, 0xcc6, 0xcc2, 0xcd5,
// malayalam
- 0xd4a, 0xd46, 0xd3e,
- 0xd4b, 0xd47, 0xd3e,
- 0xd4c, 0xd46, 0xd57,
+ 0xd4a, 0xd46, 0xd3e, 0x0,
+ 0xd4b, 0xd47, 0xd3e, 0x0,
+ 0xd4c, 0xd46, 0xd57, 0x0,
// sinhala
- 0xdda, 0xdd9, 0xdca,
- 0xddc, 0xdd9, 0xdcf,
- 0xddd, 0xddc, 0xdca,
- 0xdde, 0xdd9, 0xddf,
+ 0xdda, 0xdd9, 0xdca, 0x0,
+ 0xddc, 0xdd9, 0xdcf, 0x0,
+ 0xddd, 0xdd9, 0xdcf, 0xdca,
+ 0xdde, 0xdd9, 0xddf, 0x0,
0xffff
};
-static inline void splitMatra(unsigned short *reordered, int matra, int &len, int &base)
+static inline void splitMatra(unsigned short *reordered, int matra, int &len)
{
unsigned short matra_uc = reordered[matra];
//qDebug("matra=%d, reordered[matra]=%x", matra, reordered[matra]);
const unsigned short *split = split_matras;
while (split[0] < matra_uc)
- split += 3;
+ split += 4;
assert(*split == matra_uc);
++split;
- if (indic_position(*split) == Pre) {
- reordered[matra] = split[1];
- memmove(reordered + 1, reordered, len*sizeof(unsigned short));
- reordered[0] = split[0];
- base++;
- } else {
- memmove(reordered + matra + 1, reordered + matra, (len-matra)*sizeof(unsigned short));
- reordered[matra] = split[0];
- reordered[matra+1] = split[1];
- }
- len++;
+ int added_chars = split[2] == 0x0 ? 1 : 2;
+
+ memmove(reordered + matra + added_chars, reordered + matra, (len-matra)*sizeof(unsigned short));
+ reordered[matra] = split[0];
+ reordered[matra+1] = split[1];
+ if(added_chars == 2)
+ reordered[matra+2] = split[2];
+ len += added_chars;
}
#ifndef NO_OPENTYPE
@@ -1130,12 +1127,23 @@ static const HB_OpenTypeFeature indic_features[] = {
// #define INDIC_DEBUG
#ifdef INDIC_DEBUG
-#define IDEBUG qDebug
+#define IDEBUG hb_debug
+#include <stdarg.h>
+
+static void hb_debug(const char *msg, ...)
+{
+ va_list ap;
+ va_start(ap, msg); // use variable arg list
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+}
+
#else
#define IDEBUG if(0) printf
#endif
-#ifdef INDIC_DEBUG
+#if 0 //def INDIC_DEBUG
static QString propertiesToString(int properties)
{
QString res;
@@ -1386,12 +1394,12 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv
// to be at the beginning of the syllable, so we just move
// them there now.
if (matra_position == Split) {
- splitMatra(uc, matra, len, base);
+ splitMatra(uc, matra, len);
// Handle three-part matras (0xccb in Kannada)
matra_position = indic_position(uc[matra]);
- if (matra_position == Split)
- splitMatra(uc, matra, len, base);
- } else if (matra_position == Pre) {
+ }
+
+ if (matra_position == Pre) {
unsigned short m = uc[matra];
while (matra--)
uc[matra+1] = uc[matra];
@@ -1609,11 +1617,11 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv
// halant always applies
#ifdef INDIC_DEBUG
- {
- IDEBUG("OT properties:");
- for (int i = 0; i < len; ++i)
- qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data());
- }
+// {
+// IDEBUG("OT properties:");
+// for (int i = 0; i < len; ++i)
+// qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data());
+// }
#endif
// initialize
@@ -1731,6 +1739,11 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int
if (script == HB_Script_Bengali && pos == 1 &&
(uc[0] == 0x0985 || uc[0] == 0x098f))
break;
+ // Sinhala uses the Halant as a component of certain matras. Allow these, but keep the state on Matra.
+ if (script == HB_Script_Sinhala && state == Matra) {
+ ++pos;
+ continue;
+ }
goto finish;
case Nukta:
if (state == Consonant)
@@ -1741,12 +1754,16 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int
break;
// fall through
case VowelMark:
- if (state == Matra || state == IndependentVowel)
+ if (state == Matra || state == LengthMark || state == IndependentVowel)
break;
// fall through
case Matra:
if (state == Consonant || state == Nukta)
break;
+ if (state == Matra) {
+ // ### needs proper testing for correct two/three part matras
+ break;
+ }
// ### not sure if this is correct. If it is, does it apply only to Bengali or should
// it work for all Indic languages?
// the combination Independent_A + Vowel Sign AA is allowed.
@@ -1762,6 +1779,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int
goto finish;
case LengthMark:
+ if (state == Matra) {
+ // ### needs proper testing for correct two/three part matras
+ break;
+ }
case IndependentVowel:
case Invalid:
case Other:
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c
index cde5465..0fe1e4d 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c
@@ -1114,6 +1114,8 @@ _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd )
if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) )
return error;
+ cd->loaded = TRUE;
+
return HB_Err_Ok;
}
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h
index 4f714a3..e4b5f9a 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h
@@ -161,7 +161,7 @@ typedef enum {
/*
* Buffer for output
*/
-typedef struct _HB_GlyphBufer HB_GlyphBuffer;
+typedef struct _HB_GlyphBuffer HB_GlyphBuffer;
struct _HB_GlyphBuffer {
int glyph_item_size;
int total_glyphs;
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
index e8f5513..d2357f43 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
@@ -242,27 +242,30 @@ typedef struct HB_Font_ {
void *userData;
} HB_FontRec;
-typedef struct {
- const HB_UChar16 *string;
- hb_uint32 stringLength;
- HB_ScriptItem item;
- HB_Font font;
- HB_Face face;
- int shaperFlags; /* HB_ShaperFlags */
-
- HB_Bool glyphIndicesPresent; /* set to true if the glyph indicies are already setup in the glyphs array */
- hb_uint32 initialGlyphCount;
-
- hb_uint32 num_glyphs; /* in: available glyphs out: glyphs used/needed */
- HB_Glyph *glyphs; /* out parameter */
- HB_GlyphAttributes *attributes; /* out */
- HB_Fixed *advances; /* out */
- HB_FixedPoint *offsets; /* out */
- unsigned short *log_clusters; /* out */
+typedef struct HB_ShaperItem_ HB_ShaperItem;
+
+struct HB_ShaperItem_ {
+ const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */
+ hb_uint32 stringLength; /* input: the length of the input in 16-bit words */
+ HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of <string> */
+ HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */
+ HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */
+ int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */
+ HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array contains glyph indices ready to be shaped */
+ hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */
+
+ hb_uint32 num_glyphs; /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */
+ /* output: required capacity (may be larger than actual capacity) */
+
+ HB_Glyph *glyphs; /* output: <num_glyphs> indices of shaped glyphs */
+ HB_GlyphAttributes *attributes; /* output: <num_glyphs> glyph attributes */
+ HB_Fixed *advances; /* output: <num_glyphs> advances */
+ HB_FixedPoint *offsets; /* output: <num_glyphs> offsets */
+ unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */
/* internal */
- HB_Bool kerning_applied; /* out: kerning applied by shaper */
-} HB_ShaperItem;
+ HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */
+};
HB_Bool HB_ShapeItem(HB_ShaperItem *item);
diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp
index 1a3ef4f..a7ea417 100644
--- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp
+++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp
@@ -178,7 +178,7 @@ private slots:
void telugu();
void kannada();
void malayalam();
- // sinhala missing
+ void sinhala();
void khmer();
void linearB();
@@ -510,6 +510,11 @@ void tst_QScriptEngine::bengali()
{ 0x151, 0x276, 0x172, 0x143, 0x0 } },
{ { 0x9b0, 0x9cd, 0x995, 0x9be, 0x983, 0x0 },
{ 0x151, 0x276, 0x172, 0x144, 0x0 } },
+ // test decomposed two parts matras
+ { { 0x995, 0x9c7, 0x9be, 0x0 },
+ { 0x179, 0x151, 0x172, 0x0 } },
+ { { 0x995, 0x9c7, 0x9d7, 0x0 },
+ { 0x179, 0x151, 0x17e, 0x0 } },
{ {0}, {0} }
};
@@ -638,15 +643,15 @@ void tst_QScriptEngine::bengali()
if (face) {
const ShapeTable shape_table [] = {
{ { 0x09a8, 0x09cd, 0x09af, 0x0 },
- { 0x0192, 0x0 } },
+ { 0x01ca, 0x0 } },
{ { 0x09b8, 0x09cd, 0x09af, 0x0 },
- { 0x01d6, 0x0 } },
+ { 0x020e, 0x0 } },
{ { 0x09b6, 0x09cd, 0x09af, 0x0 },
- { 0x01bc, 0x0 } },
+ { 0x01f4, 0x0 } },
{ { 0x09b7, 0x09cd, 0x09af, 0x0 },
- { 0x01c6, 0x0 } },
+ { 0x01fe, 0x0 } },
{ { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 },
- { 0xd3, 0x12f, 0x0 } },
+ { 0x10b, 0x167, 0x0 } },
{ {0}, {0} }
};
@@ -823,8 +828,9 @@ void tst_QScriptEngine::telugu()
{ 0xe6, 0xb3, 0x83, 0x0 } },
{ { 0xc15, 0xc4d, 0xc30, 0xc48, 0x0 },
{ 0xe6, 0xb3, 0x9f, 0x0 } },
- { {0}, {0} }
-
+ { { 0xc15, 0xc46, 0xc56, 0x0 },
+ { 0xe6, 0xb3, 0x0 } },
+ { {0}, {0} }
};
const ShapeTable *s = shape_table;
@@ -867,7 +873,6 @@ void tst_QScriptEngine::kannada()
{ 0x0036, 0x00c1, 0x0 } },
{ { 0x0cb0, 0x0ccd, 0x200d, 0x0c95, 0x0 },
{ 0x0050, 0x00a7, 0x0 } },
-
{ {0}, {0} }
};
@@ -891,6 +896,17 @@ void tst_QScriptEngine::kannada()
{ 0x00b0, 0x006c, 0x0 } },
{ { 0x0cb7, 0x0ccd, 0x0 },
{ 0x0163, 0x0 } },
+ { { 0xc95, 0xcbf, 0xcd5, 0x0 },
+ { 0x114, 0x73, 0x0 } },
+ { { 0xc95, 0xcc6, 0xcd5, 0x0 },
+ { 0x90, 0x6c, 0x73, 0x0 } },
+ { { 0xc95, 0xcc6, 0xcd6, 0x0 },
+ { 0x90, 0x6c, 0x74, 0x0 } },
+ { { 0xc95, 0xcc6, 0xcc2, 0x0 },
+ { 0x90, 0x6c, 0x69, 0x0 } },
+ { { 0xc95, 0xcca, 0xcd5, 0x0 },
+ { 0x90, 0x6c, 0x69, 0x73, 0x0 } },
+
{ {0}, {0} }
};
@@ -943,7 +959,14 @@ void tst_QScriptEngine::malayalam()
{ 0x009e, 0x0 } },
{ { 0x0d30, 0x0d4d, 0x200d, 0x0 },
{ 0x009e, 0x0 } },
-
+ { { 0xd15, 0xd46, 0xd3e, 0x0 },
+ { 0x5e, 0x34, 0x58, 0x0 } },
+ { { 0xd15, 0xd47, 0xd3e, 0x0 },
+ { 0x5f, 0x34, 0x58, 0x0 } },
+ { { 0xd15, 0xd46, 0xd57, 0x0 },
+ { 0x5e, 0x34, 0x65, 0x0 } },
+ { { 0xd15, 0xd57, 0x0 },
+ { 0x34, 0x65, 0x0 } },
{ {0}, {0} }
};
@@ -962,6 +985,39 @@ void tst_QScriptEngine::malayalam()
}
}
+void tst_QScriptEngine::sinhala()
+{
+ {
+ FT_Face face = loadFace("FM-MalithiUW46.ttf");
+ if (face) {
+ const ShapeTable shape_table [] = {
+ { { 0xd9a, 0xdd9, 0xdcf, 0x0 },
+ { 0x4a, 0x61, 0x42, 0x0 } },
+ { { 0xd9a, 0xdd9, 0xddf, 0x0 },
+ { 0x4a, 0x61, 0x50, 0x0 } },
+ { { 0xd9a, 0xdd9, 0xdca, 0x0 },
+ { 0x4a, 0x62, 0x0 } },
+ { { 0xd9a, 0xddc, 0xdca, 0x0 },
+ { 0x4a, 0x61, 0x42, 0x41, 0x0 } },
+ { { 0xd9a, 0xdda, 0x0 },
+ { 0x4a, 0x62, 0x0 } },
+ { { 0xd9a, 0xddd, 0x0 },
+ { 0x4a, 0x61, 0x42, 0x41, 0x0 } },
+ { {0}, {0} }
+ };
+
+ const ShapeTable *s = shape_table;
+ while (s->unicode[0]) {
+ QVERIFY( shaping(face, s, HB_Script_Sinhala) );
+ ++s;
+ }
+
+ FT_Done_Face(face);
+ } else {
+ QSKIP("couln't find FM-MalithiUW46.ttf", SkipAll);
+ }
+ }
+}
void tst_QScriptEngine::khmer()
diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp
index 04124bd..83cf5d0 100755
--- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp
+++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp
@@ -1,44 +1,44 @@
-/*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
-
-#include <AccessibilityARIAGrid.cpp>
-#include <AccessibilityARIAGridCell.cpp>
-#include <AccessibilityARIAGridRow.cpp>
-#include <AccessibilityImageMapLink.cpp>
-#include <AccessibilityList.cpp>
-#include <AccessibilityListBox.cpp>
-#include <AccessibilityListBoxOption.cpp>
-#include <AccessibilityMediaControls.cpp>
-#include <AccessibilityObject.cpp>
-#include <AccessibilityRenderObject.cpp>
-#include <AccessibilitySlider.cpp>
-#include <AccessibilityTable.cpp>
-#include <AccessibilityTableCell.cpp>
-#include <AccessibilityTableColumn.cpp>
-#include <AccessibilityTableHeaderContainer.cpp>
-#include <AccessibilityTableRow.cpp>
-#include <AXObjectCache.cpp>
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
+
+#include <AccessibilityARIAGrid.cpp>
+#include <AccessibilityARIAGridCell.cpp>
+#include <AccessibilityARIAGridRow.cpp>
+#include <AccessibilityImageMapLink.cpp>
+#include <AccessibilityList.cpp>
+#include <AccessibilityListBox.cpp>
+#include <AccessibilityListBoxOption.cpp>
+#include <AccessibilityMediaControls.cpp>
+#include <AccessibilityObject.cpp>
+#include <AccessibilityRenderObject.cpp>
+#include <AccessibilitySlider.cpp>
+#include <AccessibilityTable.cpp>
+#include <AccessibilityTableCell.cpp>
+#include <AccessibilityTableColumn.cpp>
+#include <AccessibilityTableHeaderContainer.cpp>
+#include <AccessibilityTableRow.cpp>
+#include <AXObjectCache.cpp>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro
index 0e540e5..b8734cd 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qwebframe.cpp
RESOURCES += qwebframe.qrc
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-DEFINES += SRCDIR=\\\"$$PWD/resources\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\"
symbian {
TARGET.UID3 = 0xA000E53D
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 5445ce8..d304d3e 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -38,6 +38,10 @@
#endif
#include "../util.h"
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
//TESTED_CLASS=
//TESTED_FILES=
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro
index 6b28efd..7853b28 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro
@@ -5,7 +5,7 @@ SOURCES += tst_qwebpage.cpp
RESOURCES += tst_qwebpage.qrc
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\"
symbian {
TARGET.UID3 = 0xA000E53E
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 0cf85ee..8373e04 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -37,6 +37,10 @@
#include <QPushButton>
#include <QDir>
+#if defined(Q_OS_SYMBIAN)
+# define SRCDIR ""
+#endif
+
// Will try to wait for the condition while allowing event processing
#define QTRY_COMPARE(__expr, __expected) \
do { \
diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h
index 5880120..3721aca 100644
--- a/src/corelib/arch/qatomic_symbian.h
+++ b/src/corelib/arch/qatomic_symbian.h
@@ -42,8 +42,6 @@
#ifndef QATOMIC_SYMBIAN_H
#define QATOMIC_SYMBIAN_H
-QT_BEGIN_HEADER
-
#if defined(Q_CC_RVCT)
# define QT_NO_ARM_EABI
# include <QtCore/qatomic_arm.h>
@@ -51,6 +49,16 @@ QT_BEGIN_HEADER
# include <QtCore/qatomic_generic.h>
#endif
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+// Empty, but needed to avoid warnings
+
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif // QATOMIC_SYMBIAN_H
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 33c6a34..5578091 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -960,7 +960,7 @@ QT_BEGIN_NAMESPACE
\relates <QtGlobal>
Turns the major, minor and patch numbers of a version into an
- integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can
+ integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can
be compared with another similarly processed version id.
\sa QT_VERSION
@@ -1795,7 +1795,7 @@ QSysInfo::S60Version QSysInfo::s60Version()
TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents);
if (err == KErrNone) {
err = contents->Sort(EDescending|ESortByName);
- if (err == KErrNone) {
+ if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) {
TInt major = (*contents)[0].iName[9] - '0';
TInt minor = (*contents)[0].iName[11] - '0';
if (major == 3) {
@@ -1808,6 +1808,12 @@ QSysInfo::S60Version QSysInfo::s60Version()
if (minor == 0) {
return cachedS60Version = SV_S60_5_0;
}
+ else if (minor == 1) {
+ return cachedS60Version = SV_S60_5_1;
+ }
+ else if (minor == 2) {
+ return cachedS60Version = SV_S60_5_2;
+ }
}
}
delete contents;
@@ -1822,12 +1828,10 @@ QSysInfo::S60Version QSysInfo::s60Version()
return cachedS60Version = SV_S60_3_2;
# elif defined(__S60_50__)
return cachedS60Version = SV_S60_5_0;
-# else
- return cachedS60Version = SV_S60_Unknown;
# endif
-# else
- return cachedS60Version = SV_S60_Unknown;
# endif
+ //If reaching here, it was not possible to determine the version
+ return cachedS60Version = SV_S60_Unknown;
}
QSysInfo::SymbianVersion QSysInfo::symbianVersion()
{
@@ -1838,6 +1842,10 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion()
return SV_9_3;
case SV_S60_5_0:
return SV_9_4;
+ case SV_S60_5_1:
+ return SV_9_4;
+ case SV_S60_5_2:
+ return SV_9_4;
default:
return SV_Unknown;
}
@@ -2572,7 +2580,7 @@ void qsrand()
seed = GetTickCount();
srand(seed);
-#else
+#else
// Symbian?
#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 1dbdc6d..d113e02 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1486,17 +1486,26 @@ public:
#ifdef Q_OS_SYMBIAN
enum SymbianVersion {
SV_Unknown = 0x0000,
+ //These are the Symbian Ltd versions 9.2-9.4
SV_9_2 = 10,
SV_9_3 = 20,
- SV_9_4 = 30
+ SV_9_4 = 30,
+ //Following values are the symbian foundation versions, i.e. Symbian^1 == SV_SF_1
+ SV_SF_1 = SV_9_4,
+ SV_SF_2 = 40,
+ SV_SF_3 = 50,
+ SV_SF_4 = 60
};
static SymbianVersion symbianVersion();
enum S60Version {
SV_S60_None = 0,
SV_S60_Unknown = 1,
- SV_S60_3_1 = 10,
- SV_S60_3_2 = 20,
- SV_S60_5_0 = 30
+ SV_S60_3_1 = SV_9_2,
+ SV_S60_3_2 = SV_9_3,
+ SV_S60_5_0 = SV_9_4,
+ //versions beyond 5.0 are to be confirmed - it is better to use symbian version
+ SV_S60_5_1 = SV_SF_2,
+ SV_S60_5_2 = SV_SF_3
};
static S60Version s60Version();
#endif
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index b198276..0ee9cd2 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1715,14 +1715,12 @@ public:
LastGestureType = ~0u
};
- enum GestureContext
+ enum GestureFlag
{
- WidgetGesture = 0,
- WidgetWithChildrenGesture = 3,
-
- ItemGesture = WidgetGesture,
- ItemWithChildrenGesture = WidgetWithChildrenGesture
+ DontStartGestureOnChildren = 0x01,
+ ReceivePartialGestures = 0x02
};
+ Q_DECLARE_FLAGS(GestureFlags, GestureFlag)
enum NavigationMode
{
@@ -1752,6 +1750,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureFlags)
typedef bool (*qInternalCallback)(void **);
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index c6f32d2..5ac3675 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2910,34 +2910,36 @@
\value PanGesture A Pan gesture.
\value PinchGesture A Pinch gesture.
\value SwipeGesture A Swipe gesture.
- \value CustomGesture User-defined gesture ID.
- \value LastGestureType Last user gesture ID.
+ \value CustomGesture A flag that can be used to test if the gesture is a
+ user-defined gesture ID.
+ \omitvalue LastGestureType
User-defined gestures are registered with the
- QApplication::registerGestureRecognizer() function which generates a custom gesture ID
- in the range of values from CustomGesture to LastGestureType.
+ QGestureRecognizer::registerRecognizer() function which generates a custom
+ gesture ID with the Qt::CustomGesture flag set.
- \sa QGesture, QWidget::grabGesture()
+ \sa QGesture, QWidget::grabGesture(), QGraphicsObject::grabGesture()
*/
/*!
- \enum Qt::GestureContext
+ \enum Qt::GestureFlag
\since 4.6
- This enum type describes the context of a gesture.
+ This enum type describes additional flags that can be used when subscribing
+ to a gesture.
- For a QGesture to trigger, the gesture recognizer should filter events for
- a widget tree. This enum describes for which widget the gesture recognizer
- should filter events:
+ \value DontStartGestureOnChildren By default gestures can start on the
+ widget or over any of its children. Use this flag to disable this and allow
+ a gesture to start on the widget only.
- \value WidgetGesture Gestures can only start over the widget itself.
- \value WidgetWithChildrenGesture Gestures can start on the widget or over
- any of its children.
- \value ItemGesture Gestures can only start over the item itself.
- \value ItemWithChildrenGesture Gestures can start on the item or over
- any of its children.
+ \value ReceivePartialGestures Allows any ignored gesture events to be
+ propagated to parent widgets which have specified this hint. By default
+ only gestures that are in the Qt::GestureStarted state are propagated and
+ the widget always gets the full gesture sequence starting with a gesture in
+ the Qt::GestureStarted state and ending with a gesture in the
+ Qt::GestureFinished or Qt::GestureCanceled states.
- \sa QWidget::grabGesture()
+ \sa QWidget::grabGesture(), QGraphicsObject::grabGesture()
*/
/*!
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index c6b4a77..6bc6b76 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -3187,7 +3187,17 @@ void QFileDialogTreeView::keyPressEvent(QKeyEvent *e)
if (!d_ptr->itemViewKeyboardEvent(e)) {
QTreeView::keyPressEvent(e);
}
+#ifdef QT_KEYPAD_NAVIGATION
+ else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
+ || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional)
+ && !hasEditFocus()) {
+ e->ignore();
+ } else {
+ e->accept();
+ }
+#else
e->accept();
+#endif
}
QSize QFileDialogTreeView::sizeHint() const
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index d9bec27..4af5688 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -399,9 +399,13 @@ QT_USE_NAMESPACE
- (void)panelSelectionDidChange:(id)sender
{
Q_UNUSED(sender);
- *mCurrentSelection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename]));
- if (mPriv)
- mPriv->QNSOpenSavePanelDelegate_selectionChanged(*mCurrentSelection);
+ if (mPriv) {
+ QString selection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename]));
+ if (selection != mCurrentSelection) {
+ *mCurrentSelection = selection;
+ mPriv->QNSOpenSavePanelDelegate_selectionChanged(selection);
+ }
+ }
}
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri
index 627d511..669d311 100644
--- a/src/gui/egl/egl.pri
+++ b/src/gui/egl/egl.pri
@@ -1,3 +1,5 @@
+CONFIG += egl
+
HEADERS += \
egl/qegl_p.h \
egl/qeglproperties_p.h
@@ -19,11 +21,3 @@ unix {
}
}
}
-
-for(p, QMAKE_LIBDIR_EGL) {
- exists($$p):LIBS_PRIVATE += -L$$p
-}
-
-!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
-!isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL
-!isEmpty(QMAKE_LFLAGS_EGL): LIBS += $$QMAKE_LFLAGS_EGL
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index d70b039..2fd499d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7343,19 +7343,32 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
}
/*!
- Subscribes the graphics object to the given \a gesture for the specified \a context.
+ Subscribes the graphics object to the given \a gesture with specific \a flags.
- \sa QGestureEvent
+ \sa ungrabGesture(), QGestureEvent
*/
-
-void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext context)
+void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags)
{
QGraphicsItemPrivate * const d = QGraphicsItem::d_func();
- d->gestureContext.insert(gesture, context);
+ d->gestureContext.insert(gesture, flags);
(void)QGestureManager::instance(); // create a gesture manager
}
/*!
+ Unsubscribes the graphics object from the given \a gesture.
+
+ \sa grabGesture(), QGestureEvent
+*/
+void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)
+{
+ QGraphicsItemPrivate * const d = QGraphicsItem::d_func();
+ if (d->gestureContext.remove(gesture)) {
+ QGestureManager *manager = QGestureManager::instance();
+ manager->cleanupCachedGestures(this, gesture);
+ }
+}
+
+/*!
\property QGraphicsObject::parent
\brief the parent of the item
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index f3fe99c..f091e34 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -555,7 +555,8 @@ public:
using QObject::children;
#endif
- void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture);
+ void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
+ void ungrabGesture(Qt::GestureType type);
Q_SIGNALS:
void parentChanged();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index ca56c18..51d2ffd 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -453,7 +453,7 @@ public:
QGraphicsItem *focusScopeItem;
Qt::InputMethodHints imHints;
QGraphicsItem::PanelModality panelModality;
- QMap<Qt::GestureType, Qt::GestureContext> gestureContext;
+ QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
// Packed 32 bits
quint32 acceptedMouseButtons : 5;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index f982f4b..dc036f8 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -1064,9 +1064,8 @@ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event)
bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event)
{
if (QGraphicsObject *object = item->toGraphicsObject()) {
- QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
- if (qAppPriv->gestureManager) {
- if (qAppPriv->gestureManager->filterEvent(object, event))
+ if (qt_gestureManager) {
+ if (qt_gestureManager->filterEvent(object, event))
return true;
}
}
@@ -5765,7 +5764,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
QWidget *viewport = event->widget();
if (!viewport)
return;
- QList<QGesture *> allGestures = event->allGestures();
+ QList<QGesture *> allGestures = event->gestures();
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
<< "Delivering gestures:" << allGestures;
@@ -5904,7 +5903,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func();
foreach(QGesture *g, alreadyIgnoredGestures) {
- if (gid->gestureContext.contains(g->gestureType()))
+ QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit =
+ gid->gestureContext.find(g->gestureType());
+ bool deliver = contextit != gid->gestureContext.end() &&
+ (g->state() == Qt::GestureStarted ||
+ (contextit.value() & Qt::ReceivePartialGestures));
+ if (deliver)
gestures += g;
}
if (gestures.isEmpty())
@@ -5917,8 +5921,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
sendEvent(item, &ev);
QSet<QGesture *> ignoredGestures;
foreach (QGesture *g, gestures) {
- if (!ev.isAccepted() && !ev.isAccepted(g))
+ if (!ev.isAccepted() && !ev.isAccepted(g)) {
ignoredGestures.insert(g);
+ } else {
+ if (g->state() == Qt::GestureStarted)
+ gestureTargets[g] = item;
+ }
}
if (!ignoredGestures.isEmpty()) {
// get a list of items under the (current) hotspot of each ignored
@@ -5945,6 +5953,13 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
continue;
}
}
+ foreach (QGesture *g, startedGestures) {
+ if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) {
+ DEBUG() << "lets try to cancel some";
+ // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them
+ cancelGesturesForChildren(g, event->widget());
+ }
+ }
// forget about targets for gestures that have ended
foreach (QGesture *g, allGestures) {
@@ -5959,6 +5974,88 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
}
}
+void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidget *viewport)
+{
+ Q_ASSERT(original);
+ QGraphicsItem *originalItem = gestureTargets.value(original);
+ Q_ASSERT(originalItem);
+
+ // iterate over all active gestures and for each find the owner
+ // if the owner is part of our sub-hierarchy, cancel it.
+
+ QSet<QGesture *> canceledGestures;
+ QHash<QGesture *, QGraphicsObject *>::Iterator iter = gestureTargets.begin();
+ while (iter != gestureTargets.end()) {
+ QGraphicsObject *item = iter.value();
+ // note that we don't touch the gestures for our originalItem
+ if (item != originalItem && originalItem->isAncestorOf(item)) {
+ DEBUG() << " found a gesture to cancel" << iter.key();
+ iter.key()->d_func()->state = Qt::GestureCanceled;
+ canceledGestures << iter.key();
+ }
+ ++iter;
+ }
+
+ // sort them per target item by cherry picking from almostCanceledGestures and delivering
+ QSet<QGesture *> almostCanceledGestures = canceledGestures;
+ QSet<QGesture *>::Iterator setIter;
+ while (!almostCanceledGestures.isEmpty()) {
+ QGraphicsObject *target = 0;
+ QSet<QGesture*> gestures;
+ setIter = almostCanceledGestures.begin();
+ // sort per target item
+ while (setIter != almostCanceledGestures.end()) {
+ QGraphicsObject *item = gestureTargets.value(*setIter);
+ if (target == 0)
+ target = item;
+ if (target == item) {
+ gestures << *setIter;
+ setIter = almostCanceledGestures.erase(setIter);
+ } else {
+ ++setIter;
+ }
+ }
+ Q_ASSERT(target);
+
+ QList<QGesture *> list = gestures.toList();
+ QGestureEvent ev(list);
+ sendEvent(target, &ev);
+
+ foreach (QGesture *g, list) {
+ if (ev.isAccepted() || ev.isAccepted(g))
+ gestures.remove(g);
+ }
+
+ foreach (QGesture *g, gestures) {
+ if (!g->hasHotSpot())
+ continue;
+
+ QPoint screenPos = g->hotSpot().toPoint();
+ QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport);
+ for (int j = 0; j < items.size(); ++j) {
+ QGraphicsObject *item = items.at(j)->toGraphicsObject();
+ if (!item)
+ continue;
+ QGraphicsItemPrivate *d = item->QGraphicsItem::d_func();
+ if (d->gestureContext.contains(g->gestureType())) {
+ QList<QGesture *> list;
+ list << g;
+ QGestureEvent ev(list);
+ sendEvent(item, &ev);
+ if (ev.isAccepted() || ev.isAccepted(g))
+ break; // successfully delivered
+ }
+ }
+ }
+ }
+
+ Q_ASSERT(qt_gestureManager); // it would be very odd if we got called without a manager.
+ for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) {
+ qt_gestureManager->recycle(*setIter);
+ gestureTargets.remove(*setIter);
+ }
+}
+
QT_END_NAMESPACE
#include "moc_qgraphicsscene.cpp"
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index cd20fd0..f8db084 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -288,6 +288,7 @@ public:
QMap<Qt::GestureType, QGesture *> *conflictedGestures,
QList<QList<QGraphicsObject *> > *conflictedItems,
QHash<QGesture *, QGraphicsObject *> *normalGestures);
+ void cancelGesturesForChildren(QGesture *original, QWidget *viewport);
void updateInputMethodSensitivityInViews();
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 571ef9d..21ca1e3 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4083,7 +4083,8 @@ QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const
}
QImage mask(d->width, d->height, Format_MonoLSB);
- dither_to_Mono(mask.d, d, flags, true);
+ if (!mask.isNull())
+ dither_to_Mono(mask.d, d, flags, true);
return mask;
}
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 7f0a504..cd8a4d4 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -73,27 +73,27 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
used to lock the global bitmap heap. Only used in
S60 v3.1 and S60 v3.2.
*/
+_LIT(KFBSERVLargeBitmapAccessName,"FbsLargeBitmapAccess");
class QSymbianFbsClient
{
public:
- QSymbianFbsClient() : heapLock(0), heapLocked(false)
+ QSymbianFbsClient() : heapLocked(false)
{
- QT_TRAP_THROWING(heapLock = new(ELeave) CFbsBitmap);
- heapLock->Create(TSize(0,0), S60->screenDevice()->DisplayMode());
+ heapLock.OpenGlobal(KFBSERVLargeBitmapAccessName);
}
~QSymbianFbsClient()
{
- delete heapLock;
+ heapLock.Close();
}
bool lockHeap()
{
bool wasLocked = heapLocked;
- if (heapLock && !heapLocked) {
- heapLock->LockHeap(ETrue);
+ if (heapLock.Handle() && !heapLocked) {
+ heapLock.Wait();
heapLocked = true;
}
@@ -104,8 +104,8 @@ public:
{
bool wasLocked = heapLocked;
- if (heapLock && heapLocked) {
- heapLock->UnlockHeap(ETrue);
+ if (heapLock.Handle() && heapLocked) {
+ heapLock.Signal();
heapLocked = false;
}
@@ -115,7 +115,7 @@ public:
private:
- CFbsBitmap *heapLock;
+ RMutex heapLock;
bool heapLocked;
};
@@ -169,7 +169,7 @@ public:
inline void beginDataAccess(CFbsBitmap *bitmap)
{
- if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3)
+ if (symbianVersion == QSysInfo::SV_9_2)
heapWasLocked = qt_symbianFbsClient()->lockHeap();
else
bitmap->LockHeap(ETrue);
@@ -177,7 +177,7 @@ public:
inline void endDataAccess(CFbsBitmap *bitmap)
{
- if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) {
+ if (symbianVersion == QSysInfo::SV_9_2) {
if (!heapWasLocked)
qt_symbianFbsClient()->unlockHeap();
} else {
@@ -753,7 +753,7 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage)
return QPixmap();
QScopedPointer<QS60PixmapData> data(new QS60PixmapData(QPixmapData::PixmapType));
- data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::SgImage);
+ data->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage);
QPixmap pixmap(data.take());
return pixmap;
}
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 8a0120a..c735031 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1916,8 +1916,8 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform,
free(dptr);
return bm;
} else { // color pixmap
- QPixmap pm;
- QX11PixmapData *x11Data = static_cast<QX11PixmapData*>(pm.data.data());
+ QX11PixmapData *x11Data = new QX11PixmapData(QPixmapData::PixmapType);
+ QPixmap pm(x11Data);
x11Data->flags &= ~QX11PixmapData::Uninitialized;
x11Data->xinfo = xinfo;
x11Data->d = d;
diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h
index 7a0509b..ea5d259 100644
--- a/src/gui/itemviews/qabstractitemview.h
+++ b/src/gui/itemviews/qabstractitemview.h
@@ -363,6 +363,7 @@ private:
friend class QTreeViewPrivate; // needed to compile with MSVC
friend class QAccessibleItemRow;
friend class QListModeViewBase;
+ friend class QListViewPrivate; // needed to compile for Symbian emulator
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemView::EditTriggers)
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 1694434..987aa26 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -154,14 +154,6 @@ bool QApplicationPrivate::autoSipEnabled = false;
bool QApplicationPrivate::autoSipEnabled = true;
#endif
-QGestureManager* QGestureManager::instance()
-{
- QApplicationPrivate *d = qApp->d_func();
- if (!d->gestureManager)
- d->gestureManager = new QGestureManager(qApp);
- return d->gestureManager;
-}
-
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type)
: QCoreApplicationPrivate(argc, argv)
{
@@ -185,7 +177,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
directPainters = 0;
#endif
- gestureManager = 0;
+ gestureWidget = 0;
if (!self)
self = this;
@@ -3634,12 +3626,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
// walk through parents and check for gestures
- if (d->gestureManager) {
+ if (qt_gestureManager) {
if (receiver->isWidgetType()) {
- if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
+ if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
return true;
} else if (QGesture *gesture = qobject_cast<QGesture *>(receiver)) {
- if (d->gestureManager->filterEvent(gesture, e))
+ if (qt_gestureManager->filterEvent(gesture, e))
return true;
}
}
@@ -4152,7 +4144,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
if (receiver->isWidgetType()) {
QWidget *w = static_cast<QWidget *>(receiver);
QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(e);
- QList<QGesture *> allGestures = gestureEvent->allGestures();
+ QList<QGesture *> allGestures = gestureEvent->gestures();
bool eventAccepted = gestureEvent->isAccepted();
bool wasAccepted = eventAccepted;
@@ -4163,7 +4155,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
for (int i = 0; i < allGestures.size();) {
QGesture *g = allGestures.at(i);
Qt::GestureType type = g->gestureType();
- if (wd->gestureContext.contains(type)) {
+ QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit =
+ wd->gestureContext.find(type);
+ bool deliver = contextit != wd->gestureContext.end() &&
+ (g->state() == Qt::GestureStarted || w == receiver ||
+ (contextit.value() & Qt::ReceivePartialGestures));
+ if (deliver) {
allGestures.removeAt(i);
gestures.append(g);
} else {
@@ -5613,39 +5610,6 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
}
-/*!
- \since 4.6
-
- Registers the given \a recognizer in the gesture framework and returns a gesture ID
- for it.
-
- The application takes ownership of the \a recognizer and returns the gesture type
- ID associated with it. For gesture recognizers which handle custom QGesture
- objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType()
- function) the return value is a gesture ID between Qt::CustomGesture and
- Qt::LastGestureType, inclusive.
-
- \sa unregisterGestureRecognizer(), QGestureRecognizer::createGesture(), QGesture
-*/
-Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *recognizer)
-{
- return QGestureManager::instance()->registerGestureRecognizer(recognizer);
-}
-
-/*!
- \since 4.6
-
- Unregisters all gesture recognizers of the specified \a type.
-
- \sa registerGestureRecognizer()
-*/
-void QApplication::unregisterGestureRecognizer(Qt::GestureType type)
-{
- QApplicationPrivate *d = qApp->d_func();
- if (d->gestureManager)
- d->gestureManager->unregisterGestureRecognizer(type);
-}
-
QT_END_NAMESPACE
#include "moc_qapplication.cpp"
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 5877ba4..e8c1281 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -86,7 +86,6 @@ class QSymbianEvent;
class QApplication;
class QApplicationPrivate;
-class QGestureRecognizer;
#if defined(qApp)
#undef qApp
#endif
@@ -288,9 +287,6 @@ public:
static Qt::NavigationMode navigationMode();
#endif
- static Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer);
- static void unregisterGestureRecognizer(Qt::GestureType type);
-
Q_SIGNALS:
void lastWindowClosed();
void focusChanged(QWidget *old, QWidget *now);
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 0fa7269..8df4d08 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -84,7 +84,6 @@ class QInputContext;
class QObject;
class QWidget;
class QSocketNotifier;
-class QGestureManager;
extern bool qt_is_gui_used;
#ifndef QT_NO_CLIPBOARD
@@ -510,7 +509,7 @@ public:
void sendSyntheticEnterLeave(QWidget *widget);
#endif
- QGestureManager *gestureManager;
+ QWidget *gestureWidget;
QMap<int, QWidget *> widgetForTouchPointId;
QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 30bf99a..1b0659a 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -836,7 +836,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const
if (qwidget->d_func()->isOpaque)
gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect);
- }
+ }
} else {
surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint());
}
@@ -910,9 +910,9 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
CEikStatusPane* statusPane = S60->statusPane();
CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
- if (statusPane && (statusPane->IsVisible() == isFullscreen))
+ if (statusPane && (bool)statusPane->IsVisible() == isFullscreen)
statusPane->MakeVisible(!isFullscreen);
- if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen))
+ if (buttonGroup && (bool)buttonGroup->IsVisible() == isFullscreen)
buttonGroup->MakeVisible(!isFullscreen);
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
@@ -925,6 +925,12 @@ void QSymbianControl::HandleResourceChange(int resourceType)
{
switch (resourceType) {
case KInternalStatusPaneChange:
+ if (qwidget->isFullScreen()) {
+ SetExtentToWholeScreen();
+ } else if (qwidget->isMaximized()) {
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ SetExtent(r.iTl, r.Size());
+ }
qwidget->d_func()->setWindowIcon_sys(true);
break;
case KUidValueCoeFontChangeEvent:
@@ -1046,8 +1052,17 @@ void qt_init(QApplicationPrivate * /* priv */, int)
// After this construction, CEikonEnv will be available from CEikonEnv::Static().
// (much like our qApp).
CEikonEnv* coe = new CEikonEnv;
- QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine));
+ //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there.
+ if(err == KErrNone)
+ TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine));
delete commandLine;
+ if(err != KErrNone) {
+ qWarning() << "qt_init: Eikon application construct failed ("
+ << err
+ << "), maybe missing resource file on S60 3.1?";
+ delete coe;
+ qt_symbian_throwIfError(err);
+ }
S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler);
@@ -1080,9 +1095,9 @@ void qt_init(QApplicationPrivate * /* priv */, int)
// enable focus events - used to re-enable mouse after focus changed between mouse and non mouse app,
// and for dimming behind modal windows
- S60->windowGroup().EnableFocusChangeEvents();
+ S60->windowGroup().EnableFocusChangeEvents();
- //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this)
+ //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this)
const TInt KMachineUidSamsungI8510 = 0x2000C51E;
// HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95).
// But we know that S60 systems below 5.0 did not support touch.
@@ -1560,7 +1575,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
}
#endif
break;
- default:
+ default:
break;
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index d98ecbb..387c29b 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2499,24 +2499,24 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
if (qAppPriv->GetGestureInfo)
bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi);
if (bResult) {
-// if (gi.dwID == GID_BEGIN) {
-// // find the alien widget for the gesture position.
-// // This might not be accurate as the position is the center
-// // point of two fingers for multi-finger gestures.
-// QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y);
-// QWidget *w = widget->childAt(widget->mapFromGlobal(pt));
-// qAppPriv->gestureWidget = w ? w : widget;
-// }
-// if (qAppPriv->gestureWidget)
-// static_cast<QETWidget*>(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi);
-// if (qAppPriv->CloseGestureInfoHandle)
-// qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
-// if (gi.dwID == GID_END)
-// qAppPriv->gestureWidget = 0;
-// } else {
-// DWORD dwErr = GetLastError();
-// if (dwErr > 0)
-// qWarning() << "translateGestureEvent: error = " << dwErr;
+ if (gi.dwID == GID_BEGIN) {
+ // find the alien widget for the gesture position.
+ // This might not be accurate as the position is the center
+ // point of two fingers for multi-finger gestures.
+ QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y);
+ QWidget *w = widget->childAt(widget->mapFromGlobal(pt));
+ qAppPriv->gestureWidget = w ? w : widget;
+ }
+ if (qAppPriv->gestureWidget)
+ static_cast<QETWidget*>(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi);
+ if (qAppPriv->CloseGestureInfoHandle)
+ qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
+ if (gi.dwID == GID_END)
+ qAppPriv->gestureWidget = 0;
+ } else {
+ DWORD dwErr = GetLastError();
+ if (dwErr > 0)
+ qWarning() << "translateGestureEvent: error = " << dwErr;
}
result = true;
break;
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 95c89e5..803a1b1 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -346,5 +346,28 @@ static void cleanupCocoaWindowDelegate()
m_drawerHash->remove(drawer);
}
+- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
+{
+ Q_UNUSED(menu);
+ QWidget *qwidget = m_windowHash->value(window);
+ if (qwidget && !qwidget->windowFilePath().isEmpty()) {
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event
+ from:(NSPoint)dragImageLocation
+ withPasteboard:(NSPasteboard *)pasteboard
+{
+ Q_UNUSED(event);
+ Q_UNUSED(dragImageLocation);
+ Q_UNUSED(pasteboard);
+ QWidget *qwidget = m_windowHash->value(window);
+ if (qwidget && !qwidget->windowFilePath().isEmpty()) {
+ return YES;
+ }
+ return NO;
+}
@end
#endif// QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
index a06c516..3728002 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h
+++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
@@ -76,6 +76,8 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData)
- (void)windowDidResignMain:(NSNotification*)notification;
- (void)windowDidBecomeKey:(NSNotification*)notification;
- (void)windowDidResignKey:(NSNotification*)notification;
+- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu;
+- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard;
@end
@protocol NSDrawerDelegate <NSObject>
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 55a329c..bcebe06 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -4202,7 +4202,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
\brief The QGestureEvent class provides the description of triggered gestures.
The QGestureEvent class contains a list of gestures, which can be obtained using the
- allGestures() function.
+ gestures() function.
The gestures are either active or canceled. A list of those that are currently being
executed can be obtained using the activeGestures() function. A list of those which
@@ -4211,10 +4211,11 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
focus, for example, or because of a timeout, or for other reasons.
If the event handler does not accept the event by calling the generic
- QEvent::accept() function, all individual QGesture object that were not accepted
- will be propagated up the parent widget chain until a widget accepts them
- individually, by calling QGestureEvent::accept() for each of them, or an event
- filter consumes the event.
+ QEvent::accept() function, all individual QGesture object that were not
+ accepted and in the Qt::GestureStarted state will be propagated up the
+ parent widget chain until a widget accepts them individually, by calling
+ QGestureEvent::accept() for each of them, or an event filter consumes the
+ event.
\sa QGesture, QGestureRecognizer,
QWidget::grabGesture(), QGraphicsObject::grabGesture()
@@ -4240,7 +4241,7 @@ QGestureEvent::~QGestureEvent()
/*!
Returns all gestures that are delivered in the event.
*/
-QList<QGesture *> QGestureEvent::allGestures() const
+QList<QGesture *> QGestureEvent::gestures() const
{
return d_func()->gestures;
}
@@ -4344,8 +4345,9 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const
Sets the accept flag of the given \a gestureType object to the specified
\a value.
- Setting the accept flag indicates that the event receiver wants the \a gesture.
- Unwanted gestures may be propagated to the parent widget.
+ Setting the accept flag indicates that the event receiver wants the gesture
+ of type \a gestureType. Unwanted gestures may be propagated to the parent
+ widget.
By default, gestures in events of type QEvent::Gesture are accepted, and
gestures in QEvent::GestureOverride events are ignored.
@@ -4417,11 +4419,16 @@ QWidget *QGestureEvent::widget() const
#ifndef QT_NO_GRAPHICSVIEW
/*!
- Returns the scene-local coordinates if the \a gesturePoint is inside a graphics view.
+ Returns the scene-local coordinates if the \a gesturePoint is inside a
+ graphics view.
+
+ This functional might be useful when the gesture event is delivered to a
+ QGraphicsObject to translate a point in screen coordinates to scene-local
+ coordinates.
\sa QPointF::isNull().
*/
-QPointF QGestureEvent::mapToScene(const QPointF &gesturePoint) const
+QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const
{
QWidget *w = widget();
if (w) // we get the viewport as widget, not the graphics view
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 141ccad..b9512fa 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -827,7 +827,7 @@ public:
QGestureEvent(const QList<QGesture *> &gestures);
~QGestureEvent();
- QList<QGesture *> allGestures() const;
+ QList<QGesture *> gestures() const;
QGesture *gesture(Qt::GestureType type) const;
QList<QGesture *> activeGestures() const;
@@ -860,7 +860,7 @@ public:
QWidget *widget() const;
#ifndef QT_NO_GRAPHICSVIEW
- QPointF mapToScene(const QPointF &gesturePoint) const;
+ QPointF mapToGraphicsScene(const QPointF &gesturePoint) const;
#endif
private:
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index 850f22c..e322af2 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
Gesture objects are not constructed directly by developers. They are created by
the QGestureRecognizer object that is registered with the application; see
- QApplication::registerGestureRecognizer().
+ QGestureRecognizer::registerRecognizer().
\section1 Gesture Properties
@@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE
destroy particular instances of them and create new ones to replace them.
The registered gesture recognizer monitors the input events for the target
- object via its \l{QGestureRecognizer::}{filterEvent()} function, updating the
+ object via its \l{QGestureRecognizer::}{recognize()} function, updating the
properties of the gesture object as required.
The gesture object may be delivered to the target object in a QGestureEvent if
@@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE
Constructs a new gesture object with the given \a parent.
QGesture objects are created by gesture recognizers in the
- QGestureRecognizer::createGesture() function.
+ QGestureRecognizer::create() function.
*/
QGesture::QGesture(QObject *parent)
: QObject(*new QGesturePrivate, parent)
@@ -129,7 +129,7 @@ QGesture::~QGesture()
\brief The point that is used to find the receiver for the gesture event.
The hot-spot is a point in the global coordinate system, use
- QWidget::mapFromGlobal() or QGestureEvent::mapToScene() to get a
+ QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a
local hot-spot.
The hot-spot should be set by the gesture recognizer to allow gesture event
@@ -180,8 +180,10 @@ void QGesture::unsetHotSpot()
automatically.
\value CancelNone On accepting this gesture no other gestures will be affected.
- \value CancelAllInContext On accepting this gesture all gestures that are active
- in the context (Qt::GestureContext) will be cancelled.
+
+ \value CancelAllInContext On accepting this gesture all gestures that are
+ active in the context (respecting the Qt::GestureFlag that were specified
+ when subscribed to the gesture) will be cancelled.
*/
void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy)
@@ -208,16 +210,7 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const
*/
/*!
- \property QPanGesture::totalOffset
- \brief the total offset from the first input position to the current input
- position
-
- The total offset measures the total change in position of the user's input
- covered by the gesture on the input device.
-*/
-
-/*!
- \property QGesture::GestureCancelPolicy
+ \property QGesture::gestureCancelPolicy
\brief the policy for deciding what happens on accepting a gesture
On accepting one gesture Qt can automatically cancel other gestures
@@ -241,11 +234,19 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const
/*!
\property QPanGesture::offset
- \brief the offset from the previous input position to the current input
+ \brief the total offset from the first input position to the current input
position
- The offset measures the change in position of the user's input on the
- input device.
+ The offset measures the total change in position of the user's input
+ covered by the gesture on the input device.
+*/
+
+/*!
+ \property QPanGesture::delta
+ \brief the offset from the previous input position to the current input
+
+ This is essentially the same as the difference between offset() and
+ lastOffset().
*/
/*!
@@ -261,10 +262,6 @@ QPanGesture::QPanGesture(QObject *parent)
d_func()->gestureType = Qt::PanGesture;
}
-QPointF QPanGesture::totalOffset() const
-{
- return d_func()->totalOffset;
-}
QPointF QPanGesture::lastOffset() const
{
@@ -276,15 +273,15 @@ QPointF QPanGesture::offset() const
return d_func()->offset;
}
-qreal QPanGesture::acceleration() const
+QPointF QPanGesture::delta() const
{
- return d_func()->acceleration;
+ Q_D(const QPanGesture);
+ return d->offset - d->lastOffset;
}
-
-void QPanGesture::setTotalOffset(const QPointF &value)
+qreal QPanGesture::acceleration() const
{
- d_func()->totalOffset = value;
+ return d_func()->acceleration;
}
void QPanGesture::setLastOffset(const QPointF &value)
@@ -326,7 +323,7 @@ void QPanGesture::setAcceleration(qreal value)
*/
/*!
- \enum QPinchGesture::WhatChange
+ \enum QPinchGesture::ChangeFlag
This enum describes the changes that can occur to the properties of
the gesture object.
@@ -335,19 +332,30 @@ void QPanGesture::setAcceleration(qreal value)
\value RotationAngleChanged The rotation angle held by rotationAngle changed.
\value CenterPointChanged The center point held by centerPoint changed.
- \sa whatChanged
+ \sa changeFlags, totalChangeFlags
+*/
+
+/*!
+ \property QPinchGesture::totalChangeFlags
+ \brief the property of the gesture that has change
+
+ This property indicates which of the other properties has changed since the
+ gesture has started. You can use this information to determine which aspect
+ of your user interface needs to be updated.
+
+ \sa changeFlags, scaleFactor, rotationAngle, centerPoint
*/
/*!
- \property QPinchGesture::whatChanged
- \brief the property of the gesture that has changed
+ \property QPinchGesture::changeFlags
+ \brief the property of the gesture that has changed in the current step
This property indicates which of the other properties has changed since
the previous gesture event included information about this gesture. You
can use this information to determine which aspect of your user interface
needs to be updated.
- \sa scaleFactor, rotationAngle, centerPoint
+ \sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint
*/
/*!
@@ -441,16 +449,25 @@ QPinchGesture::QPinchGesture(QObject *parent)
d_func()->gestureType = Qt::PinchGesture;
}
-QPinchGesture::WhatChanged QPinchGesture::whatChanged() const
+QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const
+{
+ return d_func()->totalChangeFlags;
+}
+
+void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value)
{
- return d_func()->whatChanged;
+ d_func()->totalChangeFlags = value;
}
-void QPinchGesture::setWhatChanged(QPinchGesture::WhatChanged value)
+QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const
{
- d_func()->whatChanged = value;
+ return d_func()->changeFlags;
}
+void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value)
+{
+ d_func()->changeFlags = value;
+}
QPointF QPinchGesture::startCenterPoint() const
{
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 524d26e..dd322ad 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -97,6 +97,7 @@ private:
friend class QGestureEvent;
friend class QGestureRecognizer;
friend class QGestureManager;
+ friend class QGraphicsScenePrivate;
};
class QPanGesturePrivate;
@@ -105,20 +106,19 @@ class Q_GUI_EXPORT QPanGesture : public QGesture
Q_OBJECT
Q_DECLARE_PRIVATE(QPanGesture)
- Q_PROPERTY(QPointF totalOffset READ totalOffset WRITE setTotalOffset)
Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset)
Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
+ Q_PROPERTY(QPointF delta READ delta STORED false)
Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration)
public:
QPanGesture(QObject *parent = 0);
- QPointF totalOffset() const;
QPointF lastOffset() const;
QPointF offset() const;
+ QPointF delta() const;
qreal acceleration() const;
- void setTotalOffset(const QPointF &value);
void setLastOffset(const QPointF &value);
void setOffset(const QPointF &value);
void setAcceleration(qreal value);
@@ -134,14 +134,15 @@ class Q_GUI_EXPORT QPinchGesture : public QGesture
Q_DECLARE_PRIVATE(QPinchGesture)
public:
- enum WhatChange {
+ enum ChangeFlag {
ScaleFactorChanged = 0x1,
RotationAngleChanged = 0x2,
CenterPointChanged = 0x4
};
- Q_DECLARE_FLAGS(WhatChanged, WhatChange)
+ Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag)
- Q_PROPERTY(WhatChanged whatChanged READ whatChanged WRITE setWhatChanged)
+ Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags)
+ Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags)
Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor)
Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor)
@@ -158,8 +159,11 @@ public:
public:
QPinchGesture(QObject *parent = 0);
- WhatChanged whatChanged() const;
- void setWhatChanged(WhatChanged value);
+ ChangeFlags totalChangeFlags() const;
+ void setTotalChangeFlags(ChangeFlags value);
+
+ ChangeFlags changeFlags() const;
+ void setChangeFlags(ChangeFlags value);
QPointF startCenterPoint() const;
QPointF lastCenterPoint() const;
@@ -187,7 +191,7 @@ public:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QPinchGesture::WhatChanged)
+Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags)
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index 34fbb26..ae2e287 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -90,10 +90,9 @@ public:
{
}
- QPointF totalOffset;
QPointF lastOffset;
QPointF offset;
- QPoint lastPosition;
+ QPoint startPosition;
qreal acceleration;
};
@@ -103,12 +102,15 @@ class QPinchGesturePrivate : public QGesturePrivate
public:
QPinchGesturePrivate()
- : whatChanged(0), totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0),
- totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0)
+ : totalChangeFlags(0), changeFlags(0),
+ totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0),
+ totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0),
+ isNewSequence(true)
{
}
- QPinchGesture::WhatChanged whatChanged;
+ QPinchGesture::ChangeFlags totalChangeFlags;
+ QPinchGesture::ChangeFlags changeFlags;
QPointF startCenterPoint;
QPointF lastCenterPoint;
@@ -121,6 +123,9 @@ public:
qreal totalRotationAngle;
qreal lastRotationAngle;
qreal rotationAngle;
+
+ bool isNewSequence;
+ QPointF startPosition[2];
};
class QSwipeGesturePrivate : public QGesturePrivate
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 0a88a24..628892d 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -52,6 +52,9 @@
#ifdef Q_WS_MAC
#include "qmacgesturerecognizer_mac_p.h"
#endif
+#if defined(Q_OS_WIN)
+#include "qwinnativepangesturerecognizer_win_p.h"
+#endif
#include "qdebug.h"
@@ -64,6 +67,15 @@
QT_BEGIN_NAMESPACE
+QGestureManager *qt_gestureManager = 0;
+
+QGestureManager* QGestureManager::instance()
+{
+ if (!qt_gestureManager)
+ qt_gestureManager = new QGestureManager(qApp);
+ return qt_gestureManager;
+}
+
QGestureManager::QGestureManager(QObject *parent)
: QObject(parent), state(NotGesture), m_lastCustomGestureId(0)
{
@@ -77,6 +89,10 @@ QGestureManager::QGestureManager(QObject *parent)
#endif
#else
registerGestureRecognizer(new QPanGestureRecognizer);
+ registerGestureRecognizer(new QPinchGestureRecognizer);
+#if defined(Q_OS_WIN)
+ registerGestureRecognizer(new QWinNativePanGestureRecognizer);
+#endif
#endif
}
@@ -92,7 +108,7 @@ QGestureManager::~QGestureManager()
Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer)
{
- QGesture *dummy = recognizer->createGesture(0);
+ QGesture *dummy = recognizer->create(0);
if (!dummy) {
qWarning("QGestureManager::registerGestureRecognizer: "
"the recognizer fails to create a gesture object, skipping registration.");
@@ -172,7 +188,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
}
Q_ASSERT(recognizer);
- QGesture *state = recognizer->createGesture(object);
+ QGesture *state = recognizer->create(object);
if (!state)
return 0;
state->setParent(this);
@@ -219,18 +235,19 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
QGesture *state = getState(target, recognizer, gestureType);
if (!state)
continue;
- QGestureRecognizer::Result result = recognizer->filterEvent(state, target, event);
+ QGestureRecognizer::Result result = recognizer->recognize(state, target, event);
QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask;
- if (type == QGestureRecognizer::GestureTriggered) {
+ result &= QGestureRecognizer::ResultHint_Mask;
+ if (type == QGestureRecognizer::TriggerGesture) {
DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state;
triggeredGestures << state;
- } else if (type == QGestureRecognizer::GestureFinished) {
+ } else if (type == QGestureRecognizer::FinishGesture) {
DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state;
finishedGestures << state;
- } else if (type == QGestureRecognizer::MaybeGesture) {
+ } else if (type == QGestureRecognizer::MayBeGesture) {
DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state;
newMaybeGestures << state;
- } else if (type == QGestureRecognizer::NotGesture) {
+ } else if (type == QGestureRecognizer::CancelGesture) {
DEBUG() << "QGestureManager:Recognizer: not gesture: " << state;
notGestures << state;
} else if (type == QGestureRecognizer::Ignore) {
@@ -346,12 +363,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
QSet<QGesture *> endedGestures =
finishedGestures + canceledGestures + undeliveredGestures;
foreach (QGesture *gesture, endedGestures) {
- if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0)) {
- gesture->setGestureCancelPolicy(QGesture::CancelNone);
- recognizer->reset(gesture);
- } else {
- cleanupGesturesForRemovedRecognizer(gesture);
- }
+ recycle(gesture);
m_gestureTargets.remove(gesture);
}
return ret;
@@ -409,15 +421,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original)
deliverEvents(gestures, &undeliveredGestures);
}
- for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) {
- QGestureRecognizer *recognizer = m_gestureToRecognizer.value(*iter, 0);
- if (recognizer) {
- (*iter)->setGestureCancelPolicy(QGesture::CancelNone);
- recognizer->reset(*iter);
- } else {
- cleanupGesturesForRemovedRecognizer(*iter);
- }
- }
+ for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter)
+ recycle(*iter);
}
void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture)
@@ -439,7 +444,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
QSet<Qt::GestureType> types;
QMultiHash<QObject *, Qt::GestureType> contexts;
QWidget *w = receiver;
- typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator;
+ typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
if (!w->d_func()->gestureContext.isEmpty()) {
for(ContextIterator it = w->d_func()->gestureContext.begin(),
e = w->d_func()->gestureContext.end(); it != e; ++it) {
@@ -453,7 +458,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
{
for (ContextIterator it = w->d_func()->gestureContext.begin(),
e = w->d_func()->gestureContext.end(); it != e; ++it) {
- if (it.value() == Qt::WidgetWithChildrenGesture) {
+ if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
types.insert(it.key());
contexts.insertMulti(w, it.key());
@@ -474,7 +479,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
QMultiHash<QObject *, Qt::GestureType> contexts;
QGraphicsObject *item = receiver;
if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
- typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator;
+ typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
types.insert(it.key());
@@ -485,10 +490,10 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
item = item->parentObject();
while (item)
{
- typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator;
+ typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
- if (it.value() == Qt::ItemWithChildrenGesture) {
+ if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
types.insert(it.key());
contexts.insertMulti(item, it.key());
@@ -528,12 +533,12 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
foreach (QWidget *widget, gestures.keys()) {
QWidget *w = widget->parentWidget();
while (w) {
- QMap<Qt::GestureType, Qt::GestureContext>::const_iterator it
+ QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it
= w->d_func()->gestureContext.find(type);
if (it != w->d_func()->gestureContext.end()) {
// i.e. 'w' listens to gesture 'type'
- Qt::GestureContext context = it.value();
- if (context == Qt::WidgetWithChildrenGesture && w != widget) {
+ Qt::GestureFlags flags = it.value();
+ if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) {
// conflicting gesture!
(*conflicts)[widget].append(gestures[widget]);
break;
@@ -627,7 +632,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
QApplication::sendEvent(receiver, &event);
bool eventAccepted = event.isAccepted();
- foreach(QGesture *gesture, event.allGestures()) {
+ foreach(QGesture *gesture, event.gestures()) {
if (eventAccepted || event.isAccepted(gesture)) {
QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
Q_ASSERT(w);
@@ -652,6 +657,16 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
<< "gestures:" << it.value();
QGestureEvent event(it.value());
QApplication::sendEvent(it.key(), &event);
+ bool eventAccepted = event.isAccepted();
+ foreach (QGesture *gesture, event.gestures()) {
+ if (gesture->state() == Qt::GestureStarted &&
+ (eventAccepted || event.isAccepted(gesture))) {
+ QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
+ Q_ASSERT(w);
+ DEBUG() << "started gesture was delivered and accepted by" << w;
+ m_gestureTargets[gesture] = w;
+ }
+ }
}
}
}
@@ -669,19 +684,24 @@ void QGestureManager::timerEvent(QTimerEvent *event)
it = m_maybeGestures.erase(it);
DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:"
<< gesture;
- QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0);
- if (recognizer) {
- gesture->setGestureCancelPolicy(QGesture::CancelNone);
- recognizer->reset(gesture);
- } else {
- cleanupGesturesForRemovedRecognizer(gesture);
- }
+ recycle(gesture);
} else {
++it;
}
}
}
+void QGestureManager::recycle(QGesture *gesture)
+{
+ QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0);
+ if (recognizer) {
+ gesture->setGestureCancelPolicy(QGesture::CancelNone);
+ recognizer->reset(gesture);
+ } else {
+ cleanupGesturesForRemovedRecognizer(gesture);
+ }
+}
+
QT_END_NAMESPACE
#include "moc_qgesturemanager_p.cpp"
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index 1e0734b..4efa10b 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -78,11 +78,12 @@ public:
bool filterEvent(QGraphicsObject *receiver, QEvent *event);
#endif //QT_NO_GRAPHICSVIEW
- // declared in qapplication.cpp
static QGestureManager* instance();
void cleanupCachedGestures(QObject *target, Qt::GestureType type);
+ void recycle(QGesture *gesture);
+
protected:
void timerEvent(QTimerEvent *event);
bool filterEventThroughContexts(const QMultiHash<QObject *, Qt::GestureType> &contexts,
@@ -141,6 +142,8 @@ private:
void cancelGesturesForChildren(QGesture *originatingGesture);
};
+extern QGestureManager *qt_gestureManager;
+
QT_END_NAMESPACE
#endif // QGESTUREMANAGER_P_H
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp
index 2673be3..ed0bdcc 100644
--- a/src/gui/kernel/qgesturerecognizer.cpp
+++ b/src/gui/kernel/qgesturerecognizer.cpp
@@ -42,6 +42,7 @@
#include "qgesturerecognizer.h"
#include "private/qgesture_p.h"
+#include "private/qgesturemanager_p.h"
QT_BEGIN_NAMESPACE
@@ -65,12 +66,12 @@ QT_BEGIN_NAMESPACE
objects, and modifying the associated QGesture objects to include relevant information
about the user's input.
- Gestures are created when the framework calls createGesture() to handle user input
+ Gestures are created when the framework calls create() to handle user input
for a particular instance of a QWidget or QGraphicsObject subclass. A QGesture object
is created for each widget or item that is configured to use gestures.
Once a QGesture has been created for a target object, the gesture recognizer will
- receive events for it in its filterEvent() handler function.
+ receive events for it in its recognize() handler function.
When a gesture is canceled, the reset() function is called, giving the recognizer the
chance to update the appropriate properties in the corresponding QGesture object.
@@ -79,20 +80,22 @@ QT_BEGIN_NAMESPACE
To add support for new gestures, you need to derive from QGestureRecognizer to create
a custom recognizer class, construct an instance of this class, and register it with
- the application by calling QApplication::registerGestureRecognizer(). You can also
+ the application by calling QGestureRecognizer::registerRecognizer(). You can also
subclass QGesture to create a custom gesture class, or rely on dynamic properties
to express specific details of the gesture you want to handle.
- Your custom QGestureRecognizer subclass needs to reimplement the filterEvent() function
- to handle and filter the incoming input events for QWidget and QGraphicsObject subclasses.
- Although the logic for gesture recognition is implemented in this function, you can
- store persistent information about the state of the recognition process in the QGesture
- object supplied. The filterEvent() function must return a value of Qt::GestureState that
- indicates the state of recognition for a given gesture and target object. This determines
- whether or not a gesture event will be delivered to a target object.
+ Your custom QGestureRecognizer subclass needs to reimplement the recognize()
+ function to handle and filter the incoming input events for QWidget and
+ QGraphicsObject subclasses. Although the logic for gesture recognition is
+ implemented in this function, you can store persistent information about the
+ state of the recognition process in the QGesture object supplied. The
+ recognize() function must return a value of QGestureRecognizer::Result that
+ indicates the state of recognition for a given gesture and target object.
+ This determines whether or not a gesture event will be delivered to a target
+ object.
If you choose to represent a gesture by a custom QGesture subclass, you will need to
- reimplement the createGesture() function to construct instances of your gesture class.
+ reimplement the create() function to construct instances of your gesture class.
Similarly, you may need to reimplement the reset() function if your custom gesture
objects need to be specially handled when a gesture is canceled.
@@ -105,37 +108,37 @@ QT_BEGIN_NAMESPACE
This enum describes the result of the current event filtering step in
a gesture recognizer state machine.
- The result consists of a state value (one of Ignore, NotGesture,
- MaybeGesture, GestureTriggered, GestureFinished) and an optional hint
+ The result consists of a state value (one of Ignore, MayBeGesture,
+ TriggerGesture, FinishGesture, CancelGesture) and an optional hint
(ConsumeEventHint).
\value Ignore The event does not change the state of the recognizer.
- \value NotGesture The event made it clear that it is not a gesture. If the
- gesture recognizer was in GestureTriggered state before, then the gesture
- is canceled and the appropriate QGesture object will be delivered to the
- target as a part of a QGestureEvent.
-
- \value MaybeGesture The event changed the internal state of the recognizer,
+ \value MayBeGesture The event changed the internal state of the recognizer,
but it isn't clear yet if it is a gesture or not. The recognizer needs to
- filter more events to decide. Gesture recognizers in the MaybeGesture state
+ filter more events to decide. Gesture recognizers in the MayBeGesture state
may be reset automatically if they take too long to recognize gestures.
- \value GestureTriggered The gesture has been triggered and the appropriate
+ \value TriggerGesture The gesture has been triggered and the appropriate
QGesture object will be delivered to the target as a part of a
QGestureEvent.
- \value GestureFinished The gesture has been finished successfully and the
+ \value FinishGesture The gesture has been finished successfully and the
appropriate QGesture object will be delivered to the target as a part of a
QGestureEvent.
- \value ConsumeEventHint This hint specifies that the gesture framework should
- consume the filtered event and not deliver it to the receiver.
+ \value CancelGesture The event made it clear that it is not a gesture. If
+ the gesture recognizer was in GestureTriggered state before, then the
+ gesture is canceled and the appropriate QGesture object will be delivered
+ to the target as a part of a QGestureEvent.
+
+ \value ConsumeEventHint This hint specifies that the gesture framework
+ should consume the filtered event and not deliver it to the receiver.
\omitvalue ResultState_Mask
\omitvalue ResultHint_Mask
- \sa QGestureRecognizer::filterEvent()
+ \sa QGestureRecognizer::recognize()
*/
/*!
@@ -159,7 +162,7 @@ QGestureRecognizer::~QGestureRecognizer()
Reimplement this function to create a custom QGesture-derived gesture
object if necessary.
*/
-QGesture *QGestureRecognizer::createGesture(QObject *target)
+QGesture *QGestureRecognizer::create(QObject *target)
{
Q_UNUSED(target);
return new QGesture;
@@ -183,7 +186,7 @@ void QGestureRecognizer::reset(QGesture *gesture)
}
/*!
- \fn QGestureRecognizer::filterEvent(QGesture *gesture, QObject *watched, QEvent *event)
+ \fn QGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event)
Handles the given \a event for the \a watched object, updating the state of the \a gesture
object as required, and returns a suitable result for the current recognition step.
@@ -194,7 +197,34 @@ void QGestureRecognizer::reset(QGesture *gesture)
The result reflects how much of the gesture has been recognized. The state of the
\a gesture object is set depending on the result.
- \sa Qt::GestureState
+ \sa QGestureRecognizer::Result
+*/
+
+/*!
+ Registers the given \a recognizer in the gesture framework and returns a gesture ID
+ for it.
+
+ The application takes ownership of the \a recognizer and returns the gesture type
+ ID associated with it. For gesture recognizers which handle custom QGesture
+ objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType()
+ function) the return value is a generated gesture ID with the Qt::CustomGesture
+ flag set.
+
+ \sa unregisterRecognizer(), QGestureRecognizer::create(), QGesture
*/
+Qt::GestureType QGestureRecognizer::registerRecognizer(QGestureRecognizer *recognizer)
+{
+ return QGestureManager::instance()->registerGestureRecognizer(recognizer);
+}
+
+/*!
+ Unregisters all gesture recognizers of the specified \a type.
+
+ \sa registerRecognizer()
+*/
+void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type)
+{
+ QGestureManager::instance()->unregisterGestureRecognizer(type);
+}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h
index a3c990d..4eebf7c 100644
--- a/src/gui/kernel/qgesturerecognizer.h
+++ b/src/gui/kernel/qgesturerecognizer.h
@@ -43,6 +43,7 @@
#define QGESTURERECOGNIZER_H
#include <QtCore/qglobal.h>
+#include <QtCore/qnamespace.h>
QT_BEGIN_HEADER
@@ -58,30 +59,34 @@ class Q_GUI_EXPORT QGestureRecognizer
public:
enum ResultFlag
{
- Ignore = 0x0001,
- NotGesture = 0x0002,
- MaybeGesture = 0x0004,
- GestureTriggered = 0x0008, // Gesture started or updated
- GestureFinished = 0x0010,
+ Ignore = 0x0001,
- ResultState_Mask = 0x00ff,
+ MayBeGesture = 0x0002,
+ TriggerGesture = 0x0004,
+ FinishGesture = 0x0008,
+ CancelGesture = 0x0010,
+
+ ResultState_Mask = 0x00ff,
ConsumeEventHint = 0x0100,
// StoreEventHint = 0x0200,
// ReplayStoredEventsHint = 0x0400,
// DiscardStoredEventsHint = 0x0800,
- ResultHint_Mask = 0xff00
+ ResultHint_Mask = 0xff00
};
Q_DECLARE_FLAGS(Result, ResultFlag)
QGestureRecognizer();
virtual ~QGestureRecognizer();
- virtual QGesture *createGesture(QObject *target);
- virtual QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event) = 0;
-
+ virtual QGesture *create(QObject *target);
+ virtual Result recognize(QGesture *state, QObject *watched,
+ QEvent *event) = 0;
virtual void reset(QGesture *state);
+
+ static Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer);
+ static void unregisterRecognizer(Qt::GestureType type);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result)
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm
index 7019580..d842322 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac.mm
+++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm
@@ -53,13 +53,13 @@ QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer()
{
}
-QGesture *QMacSwipeGestureRecognizer::createGesture(QObject * /*target*/)
+QGesture *QMacSwipeGestureRecognizer::create(QObject * /*target*/)
{
return new QSwipeGesture;
}
QGestureRecognizer::Result
-QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event)
+QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event)
{
if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) {
QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
@@ -67,7 +67,7 @@ QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent
case QNativeGestureEvent::Swipe: {
QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
g->setSwipeAngle(ev->angle);
- return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint;
+ return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
break; }
default:
break;
@@ -90,13 +90,13 @@ QMacPinchGestureRecognizer::QMacPinchGestureRecognizer()
{
}
-QGesture *QMacPinchGestureRecognizer::createGesture(QObject * /*target*/)
+QGesture *QMacPinchGestureRecognizer::create(QObject * /*target*/)
{
return new QPinchGesture;
}
QGestureRecognizer::Result
-QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event)
+QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event)
{
if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) {
QPinchGesture *g = static_cast<QPinchGesture *>(gesture);
@@ -106,26 +106,26 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent
reset(gesture);
g->setStartCenterPoint(static_cast<QWidget*>(obj)->mapFromGlobal(ev->position));
g->setCenterPoint(g->startCenterPoint());
- g->setWhatChanged(QPinchGesture::CenterPointChanged);
- return QGestureRecognizer::MaybeGesture | QGestureRecognizer::ConsumeEventHint;
+ g->setChangeFlags(QPinchGesture::CenterPointChanged);
+ g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
case QNativeGestureEvent::Rotate: {
g->setLastScaleFactor(g->scaleFactor());
g->setLastRotationAngle(g->rotationAngle());
g->setRotationAngle(g->rotationAngle() + ev->percentage);
- g->setWhatChanged(QPinchGesture::RotationAngleChanged);
- return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint;
- break;
+ g->setChangeFlags(QPinchGesture::RotationAngleChanged);
+ g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
}
case QNativeGestureEvent::Zoom:
g->setLastScaleFactor(g->scaleFactor());
g->setLastRotationAngle(g->rotationAngle());
g->setScaleFactor(g->scaleFactor() + ev->percentage);
- g->setWhatChanged(QPinchGesture::ScaleFactorChanged);
- return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint;
- break;
+ g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
+ g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
case QNativeGestureEvent::GestureEnd:
- return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint;
- break;
+ return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
default:
break;
}
@@ -137,7 +137,8 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent
void QMacPinchGestureRecognizer::reset(QGesture *gesture)
{
QPinchGesture *g = static_cast<QPinchGesture *>(gesture);
- g->setWhatChanged(0);
+ g->setChangeFlags(0);
+ g->setTotalChangeFlags(0);
g->setScaleFactor(1.0f);
g->setTotalScaleFactor(1.0f);
g->setLastScaleFactor(1.0f);
@@ -158,7 +159,7 @@ QMacPanGestureRecognizer::QMacPanGestureRecognizer() : _panCanceled(true)
{
}
-QGesture *QMacPanGestureRecognizer::createGesture(QObject *target)
+QGesture *QMacPanGestureRecognizer::create(QObject *target)
{
if (!target)
return new QPanGesture;
@@ -172,7 +173,7 @@ QGesture *QMacPanGestureRecognizer::createGesture(QObject *target)
}
QGestureRecognizer::Result
-QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent *event)
+QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *event)
{
const int panBeginDelay = 300;
const int panBeginRadius = 3;
@@ -185,10 +186,9 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent
if (ev->touchPoints().size() == 1) {
reset(gesture);
_startPos = QCursor::pos();
- _lastPos = _startPos;
_panTimer.start(panBeginDelay, target);
_panCanceled = false;
- return QGestureRecognizer::MaybeGesture;
+ return QGestureRecognizer::MayBeGesture;
}
break;}
case QEvent::TouchEnd: {
@@ -197,7 +197,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent
const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
if (ev->touchPoints().size() == 1)
- return QGestureRecognizer::GestureFinished;
+ return QGestureRecognizer::FinishGesture;
break;}
case QEvent::TouchUpdate: {
if (_panCanceled)
@@ -212,23 +212,21 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent
if ((p - _startPos).manhattanLength() > panBeginRadius) {
_panCanceled = true;
_panTimer.stop();
- return QGestureRecognizer::NotGesture;
+ return QGestureRecognizer::CancelGesture;
}
} else {
const QPointF p = QCursor::pos();
- const QPointF posOffset = p - _lastPos;
+ const QPointF posOffset = p - _startPos;
g->setLastOffset(g->offset());
g->setOffset(QPointF(posOffset.x(), posOffset.y()));
- g->setTotalOffset(g->lastOffset() + g->offset());
- _lastPos = p;
- return QGestureRecognizer::GestureTriggered;
+ return QGestureRecognizer::TriggerGesture;
}
} else if (_panTimer.isActive()) {
// I only want to cancel the pan if the user is pressing
// more than one finger, and the pan hasn't started yet:
_panCanceled = true;
_panTimer.stop();
- return QGestureRecognizer::NotGesture;
+ return QGestureRecognizer::CancelGesture;
}
break;}
case QEvent::Timer: {
@@ -239,8 +237,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent
break;
// Begin new pan session!
_startPos = QCursor::pos();
- _lastPos = _startPos;
- return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint;
+ return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
}
break; }
default:
@@ -254,11 +251,9 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture)
{
QPanGesture *g = static_cast<QPanGesture *>(gesture);
_startPos = QPointF();
- _lastPos = QPointF();
_panCanceled = true;
g->setOffset(QPointF(0, 0));
g->setLastOffset(QPointF(0, 0));
- g->setTotalOffset(QPointF(0, 0));
g->setAcceleration(qreal(1));
QGestureRecognizer::reset(gesture);
}
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
index bdc2e08..2dac56a 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac_p.h
+++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
@@ -64,8 +64,8 @@ class QMacSwipeGestureRecognizer : public QGestureRecognizer
public:
QMacSwipeGestureRecognizer();
- QGesture *createGesture(QObject *target);
- QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event);
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
void reset(QGesture *gesture);
};
@@ -74,8 +74,8 @@ class QMacPinchGestureRecognizer : public QGestureRecognizer
public:
QMacPinchGestureRecognizer();
- QGesture *createGesture(QObject *target);
- QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event);
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
void reset(QGesture *gesture);
};
@@ -86,12 +86,11 @@ class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer
public:
QMacPanGestureRecognizer();
- QGesture *createGesture(QObject *target);
- QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event);
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
void reset(QGesture *gesture);
private:
QPointF _startPos;
- QPointF _lastPos;
QBasicTimer _panTimer;
bool _panCanceled;
};
diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp
index 352580e..e4b7cec 100644
--- a/src/gui/kernel/qsound_s60.cpp
+++ b/src/gui/kernel/qsound_s60.cpp
@@ -60,13 +60,13 @@ class QAuServerS60;
class QAuBucketS60 : public QAuBucket, public MMdaAudioPlayerCallback
{
public:
- QAuBucketS60( QAuServerS60 *server, QSound *sound);
+ QAuBucketS60(QAuServerS60 *server, QSound *sound);
~QAuBucketS60();
void play();
void stop();
- inline QSound* sound() const { return m_sound; }
+ inline QSound *sound() const { return m_sound; }
public: // from MMdaAudioPlayerCallback
void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
@@ -77,88 +77,106 @@ private:
QAuServerS60 *m_server;
bool m_prepared;
bool m_playCalled;
- CMdaAudioPlayerUtility* m_playUtility;
+ CMdaAudioPlayerUtility *m_playUtility;
};
class QAuServerS60 : public QAuServer
{
public:
- QAuServerS60( QObject* parent );
+ QAuServerS60(QObject *parent);
- void init( QSound* s )
+ void init(QSound *s)
{
- QAuBucketS60 *bucket = new QAuBucketS60( this, s );
- setBucket( s, bucket );
+ QAuBucketS60 *bucket = new QAuBucketS60(this, s);
+ setBucket(s, bucket);
}
- void play( QSound* s )
+ void play(QSound *s)
{
- bucket( s )->play();
+ bucket(s)->play();
}
- void stop( QSound* s )
+ void stop(QSound *s)
{
- bucket( s )->stop();
+ bucket(s)->stop();
}
bool okay() { return true; }
+ void play(const QString& filename);
+
protected:
- void playCompleted(QAuBucketS60* bucket, int error)
- {
- QSound *sound = bucket->sound();
- if(!error) {
- // We need to handle repeats by ourselves, since with Symbian API we don't
- // know how many loops have been played when user asks it
- if( decLoop( sound ) ) {
- play( sound );
- }
- } else {
- // We don't have a way to inform about errors -> just decrement loops
- // in order that QSound::isFinished will return true;
- while(decLoop(sound)) {}
- }
- }
+ void playCompleted(QAuBucketS60 *bucket, int error);
protected:
- QAuBucketS60* bucket( QSound *s )
+ QAuBucketS60 *bucket(QSound *s)
{
- return (QAuBucketS60*)QAuServer::bucket( s );
+ return (QAuBucketS60 *)QAuServer::bucket( s );
}
friend class QAuBucketS60;
+ // static QSound::play(filename) cannot be stopped, meaning that playCompleted
+ // will get always called and QSound gets removed form this list.
+ QList<QSound *> staticPlayingSounds;
};
-QAuServerS60::QAuServerS60(QObject* parent) :
+QAuServerS60::QAuServerS60(QObject *parent) :
QAuServer(parent)
{
setObjectName(QLatin1String("QAuServerS60"));
}
+void QAuServerS60::play(const QString& filename)
+{
+ QSound *s = new QSound(filename);
+ staticPlayingSounds.append(s);
+ play(s);
+}
+
+void QAuServerS60::playCompleted(QAuBucketS60 *bucket, int error)
+{
+ QSound *sound = bucket->sound();
+ if (!error) {
+ // We need to handle repeats by ourselves, since with Symbian API we don't
+ // know how many loops have been played when user asks it
+ if (decLoop(sound)) {
+ play(sound);
+ } else {
+ if (staticPlayingSounds.removeAll(sound))
+ delete sound;
+ }
+ } else {
+ // We don't have a way to inform about errors -> just decrement loops
+ // in order that QSound::isFinished will return true;
+ while (decLoop(sound)) {}
+ if (staticPlayingSounds.removeAll(sound))
+ delete sound;
+ }
+}
-QAuServer* qt_new_audio_server()
+QAuServer *qt_new_audio_server()
{
return new QAuServerS60(qApp);
}
-QAuBucketS60::QAuBucketS60( QAuServerS60 *server, QSound *sound )
- : m_sound( sound ), m_server( server ), m_prepared(false), m_playCalled(false)
+QAuBucketS60::QAuBucketS60(QAuServerS60 *server, QSound *sound)
+ : m_sound(sound), m_server(server), m_prepared(false), m_playCalled(false)
{
- QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath();
+ QString filepath = QFileInfo(m_sound->fileName()).absoluteFilePath();
filepath = QDir::toNativeSeparators(filepath);
TPtrC filepathPtr(qt_QString2TPtrC(filepath));
TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this);
m_playUtility->OpenFileL(filepathPtr));
- if(err){
+ if (err) {
m_server->playCompleted(this, err);
}
}
void QAuBucketS60::play()
{
- if(m_prepared) {
+ if (m_prepared) {
// OpenFileL call is completed we can start playing immediately
m_playUtility->Play();
} else {
@@ -180,11 +198,11 @@ void QAuBucketS60::MapcPlayComplete(TInt aError)
void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
{
- if(aError) {
+ if (aError) {
m_server->playCompleted(this, aError);
} else {
m_prepared = true;
- if(m_playCalled){
+ if (m_playCalled){
play();
}
}
@@ -192,7 +210,7 @@ void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds
QAuBucketS60::~QAuBucketS60()
{
- if(m_playUtility){
+ if (m_playUtility){
m_playUtility->Stop();
m_playUtility->Close();
}
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index dec2311..dfd49eb 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -44,6 +44,7 @@
#include "qgesture_p.h"
#include "qevent.h"
#include "qwidget.h"
+#include "qabstractscrollarea.h"
QT_BEGIN_NAMESPACE
@@ -51,29 +52,34 @@ QPanGestureRecognizer::QPanGestureRecognizer()
{
}
-QGesture *QPanGestureRecognizer::createGesture(QObject *target)
+QGesture *QPanGestureRecognizer::create(QObject *target)
{
if (target && target->isWidgetType()) {
+#if defined(Q_OS_WIN)
+ // for scroll areas on Windows we want to use native gestures instead
+ if (!qobject_cast<QAbstractScrollArea *>(target->parent()))
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
+#else
static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
+#endif
}
return new QPanGesture;
}
-QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event)
+QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event)
{
- QPanGesture *q = static_cast<QPanGesture*>(state);
+ QPanGesture *q = static_cast<QPanGesture *>(state);
QPanGesturePrivate *d = q->d_func();
- const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
QGestureRecognizer::Result result;
switch (event->type()) {
case QEvent::TouchBegin: {
- result = QGestureRecognizer::MaybeGesture;
+ result = QGestureRecognizer::MayBeGesture;
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
- d->lastPosition = p.pos().toPoint();
- d->lastOffset = d->totalOffset = d->offset = QPointF();
+ d->lastOffset = d->offset = QPointF();
break;
}
case QEvent::TouchEnd: {
@@ -83,13 +89,12 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
d->lastOffset = d->offset;
d->offset =
- QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
- p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2;
- d->totalOffset += d->offset;
+ QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(),
+ p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2;
}
- result = QGestureRecognizer::GestureFinished;
+ result = QGestureRecognizer::FinishGesture;
} else {
- result = QGestureRecognizer::NotGesture;
+ result = QGestureRecognizer::CancelGesture;
}
break;
}
@@ -99,14 +104,13 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
d->lastOffset = d->offset;
d->offset =
- QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
- p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2;
- d->totalOffset += d->offset;
- if (d->totalOffset.x() > 10 || d->totalOffset.y() > 10 ||
- d->totalOffset.x() < -10 || d->totalOffset.y() < -10) {
- result = QGestureRecognizer::GestureTriggered;
+ QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(),
+ p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2;
+ if (d->offset.x() > 10 || d->offset.y() > 10 ||
+ d->offset.x() < -10 || d->offset.y() < -10) {
+ result = QGestureRecognizer::TriggerGesture;
} else {
- result = QGestureRecognizer::MaybeGesture;
+ result = QGestureRecognizer::MayBeGesture;
}
}
break;
@@ -128,108 +132,128 @@ void QPanGestureRecognizer::reset(QGesture *state)
QPanGesture *pan = static_cast<QPanGesture*>(state);
QPanGesturePrivate *d = pan->d_func();
- d->totalOffset = d->lastOffset = d->offset = QPointF();
- d->lastPosition = QPoint();
+ d->lastOffset = d->offset = QPointF();
d->acceleration = 0;
-//#if defined(QT_MAC_USE_COCOA)
-// d->singleTouchPanTimer.stop();
-// d->prevMousePos = QPointF(0, 0);
-//#endif
-
QGestureRecognizer::reset(state);
}
-/*
-bool QPanGestureRecognizer::event(QEvent *event)
+
+//
+// QPinchGestureRecognizer
+//
+
+QPinchGestureRecognizer::QPinchGestureRecognizer()
{
-#if defined(QT_MAC_USE_COCOA)
- Q_D(QPanGesture);
- if (event->type() == QEvent::Timer) {
- const QTimerEvent *te = static_cast<QTimerEvent *>(event);
- if (te->timerId() == d->singleTouchPanTimer.timerId()) {
- d->singleTouchPanTimer.stop();
- updateState(Qt::GestureStarted);
- }
+}
+
+QGesture *QPinchGestureRecognizer::create(QObject *target)
+{
+ if (target && target->isWidgetType()) {
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
}
-#endif
+ return new QPinchGesture;
+}
- bool consume = false;
+QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event)
+{
+ QPinchGesture *q = static_cast<QPinchGesture *>(state);
+ QPinchGesturePrivate *d = q->d_func();
+
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
-#if defined(Q_WS_WIN)
-#elif defined(QT_MAC_USE_COCOA)
- // The following implements single touch
- // panning on Mac:
- const int panBeginDelay = 300;
- const int panBeginRadius = 3;
- const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
+ QGestureRecognizer::Result result;
switch (event->type()) {
case QEvent::TouchBegin: {
- if (ev->touchPoints().size() == 1) {
- d->delayManager->setEnabled(true);
- consume = d->delayManager->append(d->gestureTarget, *event);
- d->lastPosition = QCursor::pos();
- d->singleTouchPanTimer.start(panBeginDelay, this);
- }
- break;}
+ result = QGestureRecognizer::MayBeGesture;
+ break;
+ }
case QEvent::TouchEnd: {
- d->delayManager->setEnabled(false);
- if (state() != Qt::NoGesture) {
- updateState(Qt::GestureFinished);
- consume = true;
- d->delayManager->clear();
+ if (q->state() != Qt::NoGesture) {
+ result = QGestureRecognizer::FinishGesture;
} else {
- d->delayManager->replay();
+ result = QGestureRecognizer::CancelGesture;
}
- reset();
- break;}
+ break;
+ }
case QEvent::TouchUpdate: {
- consume = d->delayManager->append(d->gestureTarget, *event);
- if (ev->touchPoints().size() == 1) {
- if (state() == Qt::NoGesture) {
- // INVARIANT: The singleTouchTimer has still not fired.
- // Lets check if the user moved his finger so much from
- // the starting point that it makes sense to cancel:
- const QPointF startPos = ev->touchPoints().at(0).startPos().toPoint();
- const QPointF p = ev->touchPoints().at(0).pos().toPoint();
- if ((startPos - p).manhattanLength() > panBeginRadius) {
- d->delayManager->replay();
- consume = false;
- reset();
- } else {
- d->lastPosition = QCursor::pos();
- }
+ d->changeFlags = 0;
+ if (ev->touchPoints().size() == 2) {
+ QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
+ QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
+
+ d->hotSpot = p1.screenPos();
+ d->isHotSpotSet = true;
+
+ if (d->isNewSequence) {
+ d->startPosition[0] = p1.screenPos();
+ d->startPosition[1] = p2.screenPos();
+ }
+ QLineF line(p1.screenPos(), p2.screenPos());
+ QLineF tmp(line);
+ tmp.setLength(line.length() / 2.);
+ QPointF centerPoint = tmp.p2();
+
+ d->lastCenterPoint = d->centerPoint;
+ d->centerPoint = centerPoint;
+ d->changeFlags |= QPinchGesture::CenterPointChanged;
+
+ const qreal scaleFactor = QLineF(p1.pos(), p2.pos()).length()
+ / QLineF(d->startPosition[0], d->startPosition[1]).length();
+ if (d->isNewSequence) {
+ d->lastScaleFactor = scaleFactor;
} else {
- d->delayManager->clear();
- QPointF mousePos = QCursor::pos();
- QPointF dist = mousePos - d->lastPosition;
- d->lastPosition = mousePos;
- d->lastOffset = d->offset;
- d->offset = QSizeF(dist.x(), dist.y());
- d->totalOffset += d->offset;
- updateState(Qt::GestureUpdated);
+ d->lastScaleFactor = d->scaleFactor;
}
- } else if (state() == Qt::NoGesture) {
- d->delayManager->replay();
- consume = false;
- reset();
+ d->scaleFactor = scaleFactor;
+ d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor;
+ d->changeFlags |= QPinchGesture::ScaleFactorChanged;
+
+ const qreal rotationAngle = -line.angle();
+ if (d->isNewSequence)
+ d->lastRotationAngle = rotationAngle;
+ else
+ d->lastRotationAngle = d->rotationAngle;
+ d->rotationAngle = rotationAngle;
+ d->totalRotationAngle += d->rotationAngle - d->lastRotationAngle;
+ d->changeFlags |= QPinchGesture::RotationAngleChanged;
+
+ d->totalChangeFlags |= d->changeFlags;
+ d->isNewSequence = false;
+ result = QGestureRecognizer::TriggerGesture;
+ } else {
+ d->isNewSequence = true;
+ result = QGestureRecognizer::MayBeGesture;
}
- break;}
+ break;
+ }
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
case QEvent::MouseButtonRelease:
- if (d->delayManager->isEnabled())
- consume = d->delayManager->append(d->gestureTarget, *event);
+ result = QGestureRecognizer::Ignore;
break;
default:
- return false;
+ result = QGestureRecognizer::Ignore;
+ break;
}
-#else
- Q_UNUSED(event);
-#endif
- return QGestureRecognizer::Ignore;
+ return result;
+}
+
+void QPinchGestureRecognizer::reset(QGesture *state)
+{
+ QPinchGesture *pinch = static_cast<QPinchGesture *>(state);
+ QPinchGesturePrivate *d = pinch->d_func();
+
+ d->totalChangeFlags = d->changeFlags = 0;
+
+ d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF();
+ d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0;
+ d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0;
+
+ d->isNewSequence = true;
+
+ QGestureRecognizer::reset(state);
}
- */
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h
index fec5c2f..e6f346c 100644
--- a/src/gui/kernel/qstandardgestures_p.h
+++ b/src/gui/kernel/qstandardgestures_p.h
@@ -63,9 +63,19 @@ class QPanGestureRecognizer : public QGestureRecognizer
public:
QPanGestureRecognizer();
- QGesture *createGesture(QObject *target);
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
+ void reset(QGesture *state);
+};
+
+class QPinchGestureRecognizer : public QGestureRecognizer
+{
+public:
+ QPinchGestureRecognizer();
+
+ QGesture *create(QObject *target);
- QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
void reset(QGesture *state);
};
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 9165515..6a72cfa 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -197,6 +197,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
, picture(0)
#elif defined(Q_WS_WIN)
, noPaintOnScreen(0)
+ , nativeGesturePanEnabled(0)
#elif defined(Q_WS_MAC)
, needWindowChange(0)
, isGLWidget(0)
@@ -11736,22 +11737,22 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const
*/
/*!
- Subscribes the widget to a given \a gesture with a \a context.
+ Subscribes the widget to a given \a gesture with specific \a flags.
- \sa QGestureEvent
+ \sa ungrabGesture(), QGestureEvent
\since 4.6
*/
-void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context)
+void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags)
{
Q_D(QWidget);
- d->gestureContext.insert(gesture, context);
+ d->gestureContext.insert(gesture, flags);
(void)QGestureManager::instance(); // create a gesture manager
}
/*!
- Unsubscribes the widget to a given \a gesture type
+ Unsubscribes the widget from a given \a gesture type
- \sa QGestureEvent
+ \sa grabGesture(), QGestureEvent
\since 4.6
*/
void QWidget::ungrabGesture(Qt::GestureType gesture)
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index fce3f09..05f0069 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -354,7 +354,7 @@ public:
QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect);
- void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture);
+ void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
void ungrabGesture(Qt::GestureType type);
public Q_SLOTS:
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 58252ca..9270220 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3017,10 +3017,17 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
#else
QMacCocoaAutoReleasePool pool;
NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
+ if (iconButton == nil) {
+ QCFString string(q->windowTitle());
+ const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
+ [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]];
+ iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
+ }
if (icon.isNull()) {
[iconButton setImage:nil];
} else {
- NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(*pm));
+ QPixmap scaled = pm->scaled(QSize(16,16), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(scaled));
[iconButton setImage:image];
[image release];
}
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 73a7d68..8b03a85 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -630,7 +630,7 @@ public:
#ifndef QT_NO_ACTION
QList<QAction*> actions;
#endif
- QMap<Qt::GestureType, Qt::GestureContext> gestureContext;
+ QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
// Bit fields.
uint high_attributes[3]; // the low ones are in QWidget::widget_attributes
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 5bf7649..22a94b9 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -2036,7 +2036,7 @@ void QWidgetPrivate::winSetupGestures()
if (!q || !q->isVisible())
return;
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
- WId winid = q->effectiveWinId();
+ WId winid = q->internalWinId();
bool needh = false;
bool needv = false;
@@ -2052,6 +2052,8 @@ void QWidgetPrivate::winSetupGestures()
needv = (vbarpolicy == Qt::ScrollBarAlwaysOn ||
(vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum()));
singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled;
+ if (!winid)
+ winid = q->winId(); // enforces the native winid on the viewport
}
if (winid && qAppPriv->SetGestureConfig) {
GESTURECONFIG gc[1];
@@ -2071,17 +2073,6 @@ void QWidgetPrivate::winSetupGestures()
gc[0].dwBlock = GC_PAN;
}
-// gc[1].dwID = GID_ZOOM;
-// if (gestures.pinch)
-// gc[1].dwWant = GC_ZOOM;
-// else
-// gc[1].dwBlock = GC_ZOOM;
-// gc[2].dwID = GID_ROTATE;
-// if (gestures.pinch)
-// gc[2].dwWant = GC_ROTATE;
-// else
-// gc[2].dwBlock = GC_ROTATE;
-
qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0]));
}
}
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
index 12d3058..5fceb13 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
@@ -56,16 +56,16 @@ QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer()
{
}
-QGesture* QWinNativePanGestureRecognizer::createGesture(QObject *target) const
+QGesture *QWinNativePanGestureRecognizer::create(QObject *target)
{
if (!target)
return new QPanGesture; // a special case
- if (qobject_cast<QGraphicsObject*>(target))
- return 0;
if (!target->isWidgetType())
return 0;
+ if (qobject_cast<QGraphicsObject *>(target))
+ return 0;
- QWidget *q = static_cast<QWidget*>(target);
+ QWidget *q = static_cast<QWidget *>(target);
QWidgetPrivate *d = q->d_func();
d->nativeGesturePanEnabled = true;
d->winSetupGestures();
@@ -73,7 +73,9 @@ QGesture* QWinNativePanGestureRecognizer::createGesture(QObject *target) const
return new QPanGesture;
}
-QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event)
+QGestureRecognizer::Result QWinNativePanGestureRecognizer::recognize(QGesture *state,
+ QObject *,
+ QEvent *event)
{
QPanGesture *q = static_cast<QPanGesture*>(state);
QPanGesturePrivate *d = q->d_func();
@@ -85,26 +87,25 @@ QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture
case QNativeGestureEvent::GestureBegin:
break;
case QNativeGestureEvent::Pan:
- result = QGestureRecognizer::GestureTriggered;
+ result = QGestureRecognizer::TriggerGesture;
event->accept();
break;
case QNativeGestureEvent::GestureEnd:
if (q->state() == Qt::NoGesture)
return QGestureRecognizer::Ignore; // some other gesture has ended
- result = QGestureRecognizer::GestureFinished;
+ result = QGestureRecognizer::FinishGesture;
break;
default:
return QGestureRecognizer::Ignore;
}
if (q->state() == Qt::NoGesture) {
- d->lastOffset = d->totalOffset = d->offset = QPointF();
+ d->lastOffset = d->offset = QPointF();
+ d->startPosition = ev->position;
} else {
d->lastOffset = d->offset;
- d->offset = QPointF(ev->position.x() - d->lastPosition.x(),
- ev->position.y() - d->lastPosition.y());
- d->totalOffset += d->offset;
+ d->offset = QPointF(ev->position.x() - d->startPosition.x(),
+ ev->position.y() - d->startPosition.y());
}
- d->lastPosition = ev->position;
}
return result;
}
@@ -114,8 +115,8 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state)
QPanGesture *pan = static_cast<QPanGesture*>(state);
QPanGesturePrivate *d = pan->d_func();
- d->totalOffset = d->lastOffset = d->offset = QPointF();
- d->lastPosition = QPoint();
+ d->lastOffset = d->offset = QPointF();
+ d->startPosition = QPoint();
d->acceleration = 0;
QGestureRecognizer::reset(state);
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
index a1e8511..8fb0d50 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
@@ -62,9 +62,8 @@ class QWinNativePanGestureRecognizer : public QGestureRecognizer
public:
QWinNativePanGestureRecognizer();
- QGesture* createGesture(QObject *target) const;
-
- QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event);
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
void reset(QGesture *state);
};
diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri
index fea74fe..5884b68 100644
--- a/src/gui/s60framework/s60framework.pri
+++ b/src/gui/s60framework/s60framework.pri
@@ -1,3 +1,14 @@
+# This block serves the minimalistic resource file for S60 3.1 platforms.
+# Note there is no way to ifdef S60 version in mmp file, that is why the resource
+# file is always compiled for WINSCW
+minimalAppResource31 = \
+ "SOURCEPATH s60framework" \
+ "START RESOURCE s60main.rss" \
+ "HEADER" \
+ "TARGETPATH resource\apps" \
+ "END"
+MMP_RULES += minimalAppResource31
+
SOURCES += s60framework/qs60mainapplication.cpp \
s60framework/qs60mainappui.cpp \
s60framework/qs60maindocument.cpp
diff --git a/src/s60main/s60main.rss b/src/gui/s60framework/s60main.rss
index 07dc6a1..07dc6a1 100644
--- a/src/s60main/s60main.rss
+++ b/src/gui/s60framework/s60main.rss
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index bf2f68e..4c9541b 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -5656,102 +5656,103 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
default:
break;
}
-
+ } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty())
if (!icon.isNull())
return icon;
#if defined(Q_WS_MAC)
- OSType iconType = 0;
- switch (standardIcon) {
- case QStyle::SP_MessageBoxQuestion:
- case QStyle::SP_MessageBoxInformation:
- case QStyle::SP_MessageBoxWarning:
- case QStyle::SP_MessageBoxCritical:
- iconType = kGenericApplicationIcon;
- break;
- case SP_DesktopIcon:
- iconType = kDesktopIcon;
- break;
- case SP_TrashIcon:
- iconType = kTrashIcon;
- break;
- case SP_ComputerIcon:
- iconType = kComputerIcon;
- break;
- case SP_DriveFDIcon:
- iconType = kGenericFloppyIcon;
- break;
- case SP_DriveHDIcon:
- iconType = kGenericHardDiskIcon;
- break;
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- iconType = kGenericCDROMIcon;
- break;
- case SP_DriveNetIcon:
- iconType = kGenericNetworkIcon;
- break;
- case SP_DirOpenIcon:
- iconType = kOpenFolderIcon;
- break;
- case SP_DirClosedIcon:
- case SP_DirLinkIcon:
- iconType = kGenericFolderIcon;
- break;
- case SP_FileLinkIcon:
- case SP_FileIcon:
- iconType = kGenericDocumentIcon;
- break;
- case SP_DirIcon: {
- // A rather special case
- QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget);
- QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget);
- closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
- return closeIcon;
- }
- case SP_TitleBarNormalButton:
- case SP_TitleBarCloseButton: {
- QIcon titleBarIcon;
- if (standardIcon == SP_TitleBarCloseButton) {
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
- } else {
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ if (QApplication::desktopSettingsAware()) {
+ OSType iconType = 0;
+ switch (standardIcon) {
+ case QStyle::SP_MessageBoxQuestion:
+ case QStyle::SP_MessageBoxInformation:
+ case QStyle::SP_MessageBoxWarning:
+ case QStyle::SP_MessageBoxCritical:
+ iconType = kGenericApplicationIcon;
+ break;
+ case SP_DesktopIcon:
+ iconType = kDesktopIcon;
+ break;
+ case SP_TrashIcon:
+ iconType = kTrashIcon;
+ break;
+ case SP_ComputerIcon:
+ iconType = kComputerIcon;
+ break;
+ case SP_DriveFDIcon:
+ iconType = kGenericFloppyIcon;
+ break;
+ case SP_DriveHDIcon:
+ iconType = kGenericHardDiskIcon;
+ break;
+ case SP_DriveCDIcon:
+ case SP_DriveDVDIcon:
+ iconType = kGenericCDROMIcon;
+ break;
+ case SP_DriveNetIcon:
+ iconType = kGenericNetworkIcon;
+ break;
+ case SP_DirOpenIcon:
+ iconType = kOpenFolderIcon;
+ break;
+ case SP_DirClosedIcon:
+ case SP_DirLinkIcon:
+ iconType = kGenericFolderIcon;
+ break;
+ case SP_FileLinkIcon:
+ case SP_FileIcon:
+ iconType = kGenericDocumentIcon;
+ break;
+ case SP_DirIcon: {
+ // A rather special case
+ QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget);
+ QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget);
+ closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
+ return closeIcon;
+ }
+ case SP_TitleBarNormalButton:
+ case SP_TitleBarCloseButton: {
+ QIcon titleBarIcon;
+ if (standardIcon == SP_TitleBarCloseButton) {
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ } else {
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ }
+ return titleBarIcon;
}
- return titleBarIcon;
- }
- default:
- break;
- }
- if (iconType != 0) {
- QIcon retIcon;
- IconRef icon;
- IconRef overlayIcon = 0;
- if (iconType != kGenericApplicationIcon) {
- GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
- } else {
- FSRef fsRef;
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- GetProcessBundleLocation(&psn, &fsRef);
- GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
- if (standardIcon == SP_MessageBoxCritical) {
- overlayIcon = icon;
- GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
- }
- }
- if (icon) {
- qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
- ReleaseIconRef(icon);
- }
- if (overlayIcon)
- ReleaseIconRef(overlayIcon);
- return retIcon;
- }
+ default:
+ break;
+ }
+ if (iconType != 0) {
+ QIcon retIcon;
+ IconRef icon;
+ IconRef overlayIcon = 0;
+ if (iconType != kGenericApplicationIcon) {
+ GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
+ } else {
+ FSRef fsRef;
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ GetProcessBundleLocation(&psn, &fsRef);
+ GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
+ if (standardIcon == SP_MessageBoxCritical) {
+ overlayIcon = icon;
+ GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
+ }
+ }
+ if (icon) {
+ qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
+ ReleaseIconRef(icon);
+ }
+ if (overlayIcon)
+ ReleaseIconRef(overlayIcon);
+ return retIcon;
+ }
+ } // if (QApplication::desktopSettingsAware())
#endif // Q_WS_MAC
- }
switch (standardIcon) {
#ifndef QT_NO_IMAGEFORMAT_PNG
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index b87f3a8..350a8e6 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -499,7 +499,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
Q_UNUSED(app)
QPalette applicationPalette = QApplication::palette();
applicationPalette.setBrush(QPalette::Window, backgroundTexture());
- QApplication::setPalette(applicationPalette);
+ setThemePalette(app);
}
void QS60StylePrivate::deleteBackground()
@@ -743,7 +743,7 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
const QColor mainAreaTextColor =
s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0);
- widgetPalette.setColor(QPalette::All, QPalette::WindowText,
+ widgetPalette.setColor(QPalette::WindowText,
s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
QApplication::setPalette(widgetPalette, "QSlider");
// return to original palette after each widget
@@ -767,34 +767,34 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
QApplication::setPalette(widgetPalette, "QHeaderView");
widgetPalette = *palette;
- widgetPalette.setColor(QPalette::All, QPalette::ButtonText,
+ widgetPalette.setColor(QPalette::ButtonText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
QApplication::setPalette(widgetPalette, "QMenuBar");
widgetPalette = *palette;
- widgetPalette.setColor(QPalette::Active, QPalette::WindowText,
+ widgetPalette.setColor(QPalette::WindowText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
QApplication::setPalette(widgetPalette, "QTabBar");
widgetPalette = *palette;
- widgetPalette.setColor(QPalette::All, QPalette::Text,
+ widgetPalette.setColor(QPalette::Text,
s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
QApplication::setPalette(widgetPalette, "QTableView");
widgetPalette = *palette;
- widgetPalette.setColor(QPalette::All, QPalette::HighlightedText,
+ widgetPalette.setColor(QPalette::HighlightedText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
QApplication::setPalette(widgetPalette, "QLineEdit");
widgetPalette = *palette;
- widgetPalette.setColor(QPalette::All, QPalette::Text,
+ widgetPalette.setColor(QPalette::Text,
s60Color(QS60StyleEnums::CL_QsnTextColors, 34, 0));
- widgetPalette.setColor(QPalette::All, QPalette::HighlightedText,
+ widgetPalette.setColor(QPalette::HighlightedText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
QApplication::setPalette(widgetPalette, "QTextEdit");
widgetPalette = *palette;
- widgetPalette.setColor(QPalette::All, QPalette::HighlightedText,
+ widgetPalette.setColor(QPalette::HighlightedText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
QApplication::setPalette(widgetPalette, "QComboBox");
widgetPalette = *palette;
@@ -994,6 +994,10 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
const State bflags = toolBtn->state;
const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget));
+ QRect menuRect = QRect();
+ if (toolBtn->subControls & SC_ToolButtonMenu)
+ menuRect = subControlRect(control, toolBtn, SC_ToolButtonMenu, widget);
+
QStyleOptionToolButton toolButton = *toolBtn;
if (sub&SC_ToolButton) {
@@ -1006,7 +1010,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
toolBar = qobject_cast<QToolBar *>(widget->parentWidget());
if (bflags & (State_Sunken | State_On | State_Raised)) {
- tool.rect = button;
+ tool.rect = button.unite(menuRect);
tool.state = bflags;
// todo: I'd like to move extension button next to where last button is
@@ -1061,6 +1065,12 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
} else {
drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
}
+
+ if (toolButton.subControls & SC_ToolButtonMenu) {
+ tool.rect = menuRect;
+ tool.state = bflags;
+ drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
+ }
}
}
@@ -1752,7 +1762,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
#endif //QT_NO_MENUBAR
case CE_HeaderSection:
- if ( const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
+ if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
painter->save();
QPen linePen = QPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 1, header));
const int penWidth = (header->orientation == Qt::Horizontal) ?
@@ -1770,6 +1780,25 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
}
}
painter->restore();
+
+ //Draw corner button as normal pushButton.
+ if (qobject_cast<const QAbstractButton *>(widget)) {
+ //Make cornerButton slightly smaller so that it is not on top of table border graphic.
+ QStyleOptionHeader subopt = *header;
+ const int borderTweak =
+ QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1;
+ if (subopt.direction == Qt::LeftToRight)
+ subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak);
+ else
+ subopt.rect.adjust(0, borderTweak, -borderTweak, -borderTweak);
+ drawPrimitive(PE_PanelButtonBevel, &subopt, painter, widget);
+ } else if ((header->palette.brush(QPalette::Button) != Qt::transparent)) {
+ //Draw non-themed background. Background for theme is drawn in CE_ShapedFrame
+ //to get continuous theme graphic across all the header cells.
+ qDrawShadePanel(painter, header->rect, header->palette,
+ header->state & (State_Sunken | State_On), penWidth,
+ &header->palette.brush(QPalette::Button));
+ }
}
break;
case CE_HeaderEmptyArea: // no need to draw this
@@ -1840,15 +1869,24 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
} else if (qobject_cast<const QTableView *>(widget)) {
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags);
} else if (const QHeaderView *header = qobject_cast<const QHeaderView *>(widget)) {
- if (header->orientation() == Qt::Horizontal) {
- QRect headerRect = option->rect;
- const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- headerRect.adjust(0,frameWidth,-2*frameWidth,0);
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, flags);
- } else {
+ //QS60style draws header background here instead of in each headersection, to get
+ //continuous graphic from section to section.
+ QS60StylePrivate::SkinElementFlags adjustableFlags = flags;
+ QRect headerRect = option->rect;
+ if (header->orientation() != Qt::Horizontal) {
//todo: update to horizontal table graphic
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, option->rect, flags | QS60StylePrivate::SF_PointWest);
+ adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest);
+ } else {
+ const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
+ if (option->direction == Qt::LeftToRight)
+ headerRect.adjust(-2*frameWidth, 0, 0, 0);
+ else
+ headerRect.adjust(0, 0, 2*frameWidth, 0);
}
+ if (option->palette.brush(QPalette::Button).color() == Qt::transparent)
+ QS60StylePrivate::drawSkinElement(
+ QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, adjustableFlags);
+
} else if (qobject_cast<const QFrame *>(widget)) {
QCommonStyle::drawControl(element, option, painter, widget);
}
@@ -2204,7 +2242,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
// todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases
case PE_FrameLineEdit:
- case PE_IndicatorButtonDropDown:
case PE_IndicatorDockWidgetResizeHandle:
case PE_PanelTipLabel:
case PE_PanelScrollAreaCorner:
@@ -2266,10 +2303,19 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz += QSize(2*f->lineWidth, 4*f->lineWidth);
break;
case CT_TabBarTab:
- QSize naviPaneSize = QS60StylePrivate::naviPaneSize();
+ {
+ const QSize naviPaneSize = QS60StylePrivate::naviPaneSize();
+ sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
+ if (naviPaneSize.height() > sz.height())
+ sz.setHeight(naviPaneSize.height());
+ }
+ break;
+ case CT_ItemViewItem:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
- if (naviPaneSize.height() > sz.height())
- sz.setHeight(naviPaneSize.height());
+ if (QS60StylePrivate::isTouchSupported())
+ //Make itemview easier to use in touch devices
+ //QCommonStyle does not adjust height with horizontal margin, it only adjusts width
+ sz.setHeight(sz.height() + 2*pixelMetric(QStyle::PM_FocusFrameVMargin));
break;
default:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
@@ -2524,6 +2570,29 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
}
}
break;
+ case CC_ToolButton:
+ if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
+ const int indicatorRect = pixelMetric(PM_MenuButtonIndicator, toolButton, widget) +
+ 2*pixelMetric(PM_ButtonMargin, toolButton, widget);
+ ret = toolButton->rect;
+ const bool popup = (toolButton->features &
+ (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
+ == QStyleOptionToolButton::MenuButtonPopup;
+ switch (scontrol) {
+ case SC_ToolButton:
+ if (popup)
+ ret.adjust(0, 0, -indicatorRect, 0);
+ break;
+ case SC_ToolButtonMenu:
+ if (popup)
+ ret.adjust(ret.width() - indicatorRect, ret.height() - indicatorRect, 0, 0);
+ break;
+ default:
+ break;
+ }
+ ret = visualRect(toolButton->direction, toolButton->rect, ret);
+ }
+ break;
default:
ret = QCommonStyle::subControlRect(control, option, scontrol, widget);
}
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 678844c..0cd87bd 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -1382,13 +1382,13 @@ QSize QS60StylePrivate::naviPaneSize()
QSize QS60StyleModeSpecifics::naviPaneSize()
{
CAknNavigationControlContainer* naviContainer;
- if (S60->statusPane())
- naviContainer = static_cast<CAknNavigationControlContainer*>
- (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
- if (naviContainer)
- return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight);
- else
- return QSize(0,0);
+ if (S60->statusPane()) {
+ TRAPD(err, naviContainer = static_cast<CAknNavigationControlContainer*>
+ (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi))));
+ if (err==KErrNone)
+ return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight);
+ }
+ return QSize(0,0);
}
#endif // Q_WS_S60
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
index 14f0424..706b4e9 100644
--- a/src/gui/styles/qs60style_simulated.cpp
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -322,7 +322,7 @@ QPixmap QS60StylePrivate::backgroundTexture()
{
if (!m_background) {
const QSize size = QApplication::desktop()->screen()->size();
- QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size);
+ QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size, 0);
m_background = new QPixmap(background);
}
return *m_background;
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 3f6545c..9497b6f 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1831,7 +1831,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
e->ignore();
return;
}
- bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty()
+ bool isGettingInput = !e->commitString().isEmpty()
+ || e->preeditString() != cursor.block().layout()->preeditAreaText()
|| e->replacementLength() > 0;
if (isGettingInput) {
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 1690d87..85b539f 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -294,15 +294,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme)
Rest of the standard locations point to folder on same drive with executable, except
that if executable is in ROM the folder from C drive is returned.
- \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName.
- Use code like this to add it:
-
- \code
- QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- #ifdef Q_WS_MAC
- location.insert(location.count() - QCoreApplication::applicationName().count(),
- QCoreApplication::organizationName() + "/");
- #endif
\endcode
*/
diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp
index 0626e0a..23f9e60 100644
--- a/src/gui/util/qdesktopservices_mac.cpp
+++ b/src/gui/util/qdesktopservices_mac.cpp
@@ -153,9 +153,12 @@ QString QDesktopServices::storageLocation(StandardLocation type)
QString path = getFullPath(ref);
- QString appName = QCoreApplication::applicationName();
- if (!appName.isEmpty() && (type == DataLocation || type == CacheLocation))
- path += QLatin1Char('/') + appName;
+ if (type == DataLocation || type == CacheLocation) {
+ if (QCoreApplication::organizationName().isEmpty() == false)
+ path += QLatin1Char('/') + QCoreApplication::organizationName();
+ if (QCoreApplication::applicationName().isEmpty() == false)
+ path += QLatin1Char('/') + QCoreApplication::applicationName();
+ }
return path;
}
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 0896256..7d81d5a 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -293,13 +293,16 @@ void QAbstractScrollAreaPrivate::init()
q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layoutChildren();
+ viewport->grabGesture(Qt::PanGesture);
}
#ifdef Q_WS_WIN
void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on)
{
singleFingerPanEnabled = on;
- winSetupGestures();
+ QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport));
+ if (dd)
+ dd->winSetupGestures();
}
#endif // Q_WS_WIN
@@ -539,6 +542,7 @@ void QAbstractScrollArea::setViewport(QWidget *widget)
d->viewport->setParent(this);
d->viewport->setFocusProxy(this);
d->viewport->installEventFilter(d->viewportFilter.data());
+ d->viewport->grabGesture(Qt::PanGesture);
d->layoutChildren();
if (isVisible())
d->viewport->show();
@@ -935,6 +939,26 @@ bool QAbstractScrollArea::event(QEvent *e)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
return false;
+ case QEvent::Gesture:
+ {
+ QGestureEvent *ge = static_cast<QGestureEvent *>(e);
+ QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture));
+ if (g) {
+ QScrollBar *hBar = horizontalScrollBar();
+ QScrollBar *vBar = verticalScrollBar();
+ QPointF delta = g->lastOffset();
+ if (!delta.isNull()) {
+ if (QApplication::isRightToLeft())
+ delta.rx() *= -1;
+ int newX = hBar->value() - delta.x();
+ int newY = vBar->value() - delta.y();
+ hBar->setValue(newX);
+ vBar->setValue(newY);
+ }
+ return true;
+ }
+ return false;
+ }
case QEvent::StyleChange:
case QEvent::LayoutDirectionChange:
case QEvent::ApplicationLayoutDirectionChange:
@@ -990,6 +1014,8 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e)
#endif
return QFrame::event(e);
case QEvent::LayoutRequest:
+ case QEvent::Gesture:
+ case QEvent::GestureOverride:
return event(e);
default:
break;
@@ -1266,11 +1292,13 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y)
void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars()
{
layoutChildren();
-#ifdef Q_OS_WIN
+#ifdef Q_WS_WIN
// Need to re-subscribe to gestures as the content changes to make sure we
// enable/disable panning when needed.
- winSetupGestures();
-#endif // Q_OS_WIN
+ QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport));
+ if (dd)
+ dd->winSetupGestures();
+#endif // Q_WS_WIN
}
QPoint QAbstractScrollAreaPrivate::contentsOffset() const
@@ -1335,25 +1363,6 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport)
Q_UNUSED(viewport);
}
-//void QAbstractScrollAreaPrivate::_q_gestureTriggered()
-//{
-// Q_Q(QAbstractScrollArea);
-// QPanGesture *g = qobject_cast<QPanGesture*>(q->sender());
-// if (!g)
-// return;
-// QScrollBar *hBar = q->horizontalScrollBar();
-// QScrollBar *vBar = q->verticalScrollBar();
-// QSizeF delta = g->lastOffset();
-// if (!delta.isNull()) {
-// if (QApplication::isRightToLeft())
-// delta.rwidth() *= -1;
-// int newX = hBar->value() - delta.width();
-// int newY = vBar->value() - delta.height();
-// hbar->setValue(newX);
-// vbar->setValue(newY);
-// }
-//}
-
QT_END_NAMESPACE
#include "moc_qabstractscrollarea.cpp"
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 8f17e98..0fc94c9 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -401,7 +401,8 @@ void QLineControl::moveCursor(int pos, bool mark)
void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
{
int priorState = 0;
- bool isGettingInput = !event->commitString().isEmpty() || !event->preeditString().isEmpty()
+ bool isGettingInput = !event->commitString().isEmpty()
+ || event->preeditString() != preeditAreaText()
|| event->replacementLength() > 0;
bool cursorPositionChanged = false;
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index bb93546..0de7421 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -730,9 +730,6 @@ QPlainTextEditPrivate::QPlainTextEditPrivate()
backgroundVisible = false;
centerOnScroll = false;
inDrag = false;
-#ifdef Q_WS_WIN
- singleFingerPanEnabled = true;
-#endif
}
@@ -789,6 +786,9 @@ void QPlainTextEditPrivate::init(const QString &txt)
viewport->setCursor(Qt::IBeamCursor);
#endif
originalOffsetY = 0;
+#ifdef Q_WS_WIN
+ setSingleFingerPanEnabled(true);
+#endif
}
void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
@@ -1450,6 +1450,29 @@ bool QPlainTextEdit::event(QEvent *e)
d->sendControlEvent(e);
}
#endif
+ else if (e->type() == QEvent::Gesture) {
+ QGestureEvent *ge = static_cast<QGestureEvent *>(e);
+ QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture));
+ if (g) {
+ QScrollBar *hBar = horizontalScrollBar();
+ QScrollBar *vBar = verticalScrollBar();
+ if (g->state() == Qt::GestureStarted)
+ d->originalOffsetY = vBar->value();
+ QPointF offset = g->offset();
+ if (!offset.isNull()) {
+ if (QApplication::isRightToLeft())
+ offset.rx() *= -1;
+ // QPlainTextEdit scrolls by lines only in vertical direction
+ QFontMetrics fm(document()->defaultFont());
+ int lineHeight = fm.height();
+ int newX = hBar->value() - g->lastOffset().x();
+ int newY = d->originalOffsetY - offset.y()/lineHeight;
+ hBar->setValue(newX);
+ vBar->setValue(newY);
+ }
+ }
+ return true;
+ }
return QAbstractScrollArea::event(e);
}
@@ -2929,30 +2952,6 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons
(\a available is true) or unavailable (\a available is false).
*/
-//void QPlainTextEditPrivate::_q_gestureTriggered()
-//{
-// Q_Q(QPlainTextEdit);
-// QPanGesture *g = qobject_cast<QPanGesture*>(q->sender());
-// if (!g)
-// return;
-// QScrollBar *hBar = q->horizontalScrollBar();
-// QScrollBar *vBar = q->verticalScrollBar();
-// if (g->state() == Qt::GestureStarted)
-// originalOffsetY = vBar->value();
-// QSizeF totalOffset = g->totalOffset();
-// if (!totalOffset.isNull()) {
-// if (QApplication::isRightToLeft())
-// totalOffset.rwidth() *= -1;
-// // QPlainTextEdit scrolls by lines only in vertical direction
-// QFontMetrics fm(q->document()->defaultFont());
-// int lineHeight = fm.height();
-// int newX = hBar->value() - g->lastOffset().width();
-// int newY = originalOffsetY - totalOffset.height()/lineHeight;
-// hbar->setValue(newX);
-// vbar->setValue(newY);
-// }
-//}
-
QT_END_NAMESPACE
#include "moc_qplaintextedit.cpp"
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index d995e0f..88502e3 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -116,9 +116,6 @@ QTextEditPrivate::QTextEditPrivate()
preferRichText = false;
showCursorOnInitialShow = true;
inDrag = false;
-#ifdef Q_WS_WIN
- setSingleFingerPanEnabled(true);
-#endif
}
void QTextEditPrivate::createAutoBulletList()
@@ -186,6 +183,9 @@ void QTextEditPrivate::init(const QString &html)
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);
#endif
+#ifdef Q_WS_WIN
+ setSingleFingerPanEnabled(true);
+#endif
}
void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 7d6052b..b2474ed 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -15,14 +15,7 @@ contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles1):CONFIG += opengles1
contains(QT_CONFIG, opengles1cl):CONFIG += opengles1cl
contains(QT_CONFIG, opengles2):CONFIG += opengles2
-
-contains(QT_CONFIG, opengles.*) {
- for(p, QMAKE_LIBDIR_EGL) {
- exists($$p):LIBS_PRIVATE += -L$$p
- }
- !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
- !isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL
-}
+contains(QT_CONFIG, egl):CONFIG += egl
HEADERS += qgl.h \
qgl_p.h \
@@ -61,7 +54,7 @@ SOURCES += qgl.cpp \
gl2paintengineex/qpaintengineex_opengl2_p.h \
gl2paintengineex/qglengineshadersource_p.h \
gl2paintengineex/qglcustomshaderstage_p.h \
- gl2paintengineex/qtriangulatingstroker_p.h
+ gl2paintengineex/qtriangulatingstroker_p.h
SOURCES += qglshaderprogram.cpp \
qglpixmapfilter.cpp \
@@ -149,17 +142,3 @@ embedded {
}
INCLUDEPATH += ../3rdparty/harfbuzz/src
-
-contains(QT_CONFIG,opengles1) {
- LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1
- LIBS += $$QMAKE_LFLAGS_OPENGL_ES1
-} else:contains(QT_CONFIG,opengles1cl) {
- LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1CL
- LIBS += $$QMAKE_LFLAGS_OPENGL_ES1CL
-} else:contains(QT_CONFIG,opengles2) {
- LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2
- LIBS += $$QMAKE_LFLAGS_OPENGL_ES2
-} else {
- LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL
- LIBS += $$QMAKE_LFLAGS_OPENGL
-}
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 8768fbc..0eaab28 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -518,7 +518,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
m_singlePass = false;
QGLFramebufferObjectFormat format;
- format.setInternalTextureFormat(GL_RGBA);
+ format.setInternalTextureFormat(GLenum(GL_RGBA));
QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true);
if (!fbo)
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 080c3b2..e28c382 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -2827,4 +2827,54 @@ void QGLShaderProgram::shaderDestroyed()
#endif
+#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
+/*! \internal */
+void QGLShaderProgram::setUniformValue(int location, QMacCompatGLint value)
+{
+ setUniformValue(location, GLint(value));
+}
+
+/*! \internal */
+void QGLShaderProgram::setUniformValue(int location, QMacCompatGLuint value)
+{
+ setUniformValue(location, GLuint(value));
+}
+
+/*! \internal */
+void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLint value)
+{
+ setUniformValue(name, GLint(value));
+}
+
+/*! \internal */
+void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLuint value)
+{
+ setUniformValue(name, GLuint(value));
+}
+
+/*! \internal */
+void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLint *values, int count)
+{
+ setUniformValueArray(location, (const GLint *)values, count);
+}
+
+/*! \internal */
+void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLuint *values, int count)
+{
+ setUniformValueArray(location, (const GLuint *)values, count);
+}
+
+/*! \internal */
+void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLint *values, int count)
+{
+ setUniformValueArray(name, (const GLint *)values, count);
+}
+
+/*! \internal */
+void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count)
+{
+ setUniformValueArray(name, (const GLuint *)values, count);
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index b7bd2d7..49c3364 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -181,6 +181,17 @@ public:
int uniformLocation(const QByteArray& name) const;
int uniformLocation(const QString& name) const;
+#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
+ void setUniformValue(int location, QMacCompatGLint value);
+ void setUniformValue(int location, QMacCompatGLuint value);
+ void setUniformValue(const char *name, QMacCompatGLint value);
+ void setUniformValue(const char *name, QMacCompatGLuint value);
+ void setUniformValueArray(int location, const QMacCompatGLint *values, int count);
+ void setUniformValueArray(int location, const QMacCompatGLuint *values, int count);
+ void setUniformValueArray(const char *name, const QMacCompatGLint *values, int count);
+ void setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count);
+#endif
+
void setUniformValue(int location, GLfloat value);
void setUniformValue(int location, GLint value);
void setUniformValue(int location, GLuint value);
diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
index 4734144..158633d 100644
--- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
+++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
@@ -1,5 +1,7 @@
# Use subdirs template to suppress generation of unnecessary files
TEMPLATE = subdirs
-# We just want to extract the zip file containing sqlite binaries for Symbian
-BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip"
+# We just want to export the sqlite3 binaries for Symbian for platforms that do not have them.
+!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) {
+ BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip"
+}
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 022a072..90c9f27 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -12,7 +12,7 @@ symbian: {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc
- qtresources.path = $$APP_RESOURCE_DIR
+ qtresources.path = c:$$APP_RESOURCE_DIR
qtlibraries.sources = \
QtCore.dll \
@@ -24,24 +24,24 @@ symbian: {
qts60plugindeployment = \
"IF package(0x1028315F)" \
- " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \
+ " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \
"ELSEIF package(0x102752AE)" \
- " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"!:\\sys\\bin\\qts60plugin_3_2.dll\"" \
+ " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2.dll\"" \
"ELSEIF package(0x102032BE)" \
- " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"!:\\sys\\bin\\qts60plugin_3_1.dll\"" \
+ " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1.dll\"" \
"ELSE" \
- " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \
+ " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \
"ENDIF"
qtlibraries.pkg_postrules += qts60plugindeployment
sqlitedeployment = \
"; Deploy sqlite onto phone that does not have it (this should be replaced with embedded sis file when available)" \
"IF NOT package(0x2002533b) " \
- "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"!:\\sys\\bin\\sqlite3.dll\"" \
+ "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"c:\\sys\\bin\\sqlite3.dll\"" \
"ENDIF"
qtlibraries.pkg_postrules += sqlitedeployment
- qtlibraries.path = /sys/bin
+ qtlibraries.path = c:/sys/bin
vendorinfo = \
"; Localised Vendor name" \
@@ -67,15 +67,15 @@ symbian: {
!contains(QT_CONFIG, no-mng): imageformats_plugins.sources += qmng.dll
!contains(QT_CONFIG, no-tiff): imageformats_plugins.sources += qtiff.dll
!contains(QT_CONFIG, no-ico): imageformats_plugins.sources += qico.dll
- imageformats_plugins.path = $$QT_PLUGINS_BASE_DIR/imageformats
+ imageformats_plugins.path = c:$$QT_PLUGINS_BASE_DIR/imageformats
codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll
- codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs
+ codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs
contains(QT_CONFIG, phonon-backend) {
phonon_backend_plugins.sources += phonon_mmf.dll
- phonon_backend_plugins.path = $$QT_PLUGINS_BASE_DIR/phonon_backend
+ phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend
DEPLOYMENT += phonon_backend_plugins
}
@@ -85,7 +85,7 @@ symbian: {
qtlibraries.sources += QtSvg.dll
imageformats_plugins.sources += qsvg.dll
iconengines_plugins.sources = qsvgicon.dll
- iconengines_plugins.path = $$QT_PLUGINS_BASE_DIR/iconengines
+ iconengines_plugins.path = c:$$QT_PLUGINS_BASE_DIR/iconengines
DEPLOYMENT += iconengines_plugins
}
@@ -105,9 +105,9 @@ symbian: {
qtlibraries.sources += QtWebKit.dll
}
- graphicssystems_plugins.path = $$QT_PLUGINS_BASE_DIR/graphicssystems
+ graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems
contains(QT_CONFIG, openvg) {
- qtlibraries.sources = QtOpenVG.dll
+ qtlibraries.sources += QtOpenVG.dll
graphicssystems_plugins.sources += qvggraphicssystem.dll
}
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp
index d30e07a..edc2fb8 100644
--- a/src/s60main/qts60main_mcrt0.cpp
+++ b/src/s60main/qts60main_mcrt0.cpp
@@ -83,12 +83,10 @@ GLDEF_C TInt QtMainWrapper()
char **envp = 0;
// get args & environment
__crt0(argc, argv, envp);
- CleanupArrayDelete<char*>::PushL(argv);
- CleanupArrayDelete<char*>::PushL(envp);
//Call user(application)'s main
- int ret = 0;
- QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp););
- CleanupStack::PopAndDestroy(2, argv);
+ TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);));
+ delete[] argv;
+ delete[] envp;
return ret;
}
diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro
index cc3c547..47cf020 100644
--- a/src/s60main/s60main.pro
+++ b/src/s60main/s60main.pro
@@ -16,16 +16,6 @@ symbian {
SOURCES = qts60main.cpp \
qts60main_mcrt0.cpp
- # This block serves the minimalistic resource file for S60 3.1 platforms.
- # Note there is no way to ifdef S60 version in mmp file, that is why the resource
- # file is always compiled for WINSCW
- minimalAppResource31 = \
- "START RESOURCE s60main.rss" \
- "HEADER" \
- "TARGETPATH resource\apps" \
- "END"
- MMP_RULES += minimalAppResource31
-
# s60main needs to be built in ARM mode for GCCE to work.
MMP_RULES+="ALWAYS_BUILD_AS_ARM"
@@ -36,14 +26,4 @@ symbian {
error("$$_FILE_ is intended only for Symbian!")
}
-symbian-abld: {
- # abld build commands generated resources after the static library is built, and
- # we have dependency to resource from static lib -> resources need to be generated
- # explicitly before library
- rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1"
- rsgFix.commands = "-$(ABLD) resource $(PLATFORM) $(CFG) 2>NUL"
- QMAKE_EXTRA_TARGETS += rsgFix rsgFix2
- PRE_TARGETDEPS += rsgFix rsgFix2
-}
-
include(../qbase.pri)
diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h
index 8da61c9..ee7d6f6 100644
--- a/src/xmlpatterns/acceltree/qacceltree_p.h
+++ b/src/xmlpatterns/acceltree/qacceltree_p.h
@@ -89,7 +89,7 @@ namespace QPatternist
* @see <a href"http://www.inf.uni-konstanz.de/dbis/publications/download/accelerating-locsteps.pdf">Accelerating
* XPath Evaluation in Any RDBMS, Torsten Grust</a>
*/
- class AccelTree : public QAbstractXmlNodeModel
+ class Q_AUTOTEST_EXPORT AccelTree : public QAbstractXmlNodeModel
{
friend class AccelTreePrivate;
public:
diff --git a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h
index bb547bd..27e3c22 100644
--- a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h
+++ b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h
@@ -84,7 +84,7 @@ namespace QPatternist
*
* @author Frans Englich <frans.englich@nokia.com>
*/
- class CompressedWhitespace
+ class Q_AUTOTEST_EXPORT CompressedWhitespace
{
public:
/**