From 38a38b0c971ee910cbe1d6359eba57dd2a1a279f Mon Sep 17 00:00:00 2001 From: Shenghua Su Date: Wed, 17 Feb 2010 12:03:02 +0100 Subject: fix QTBUG-7898 Merge-request: 455 Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index ff10fa1..b4bfcaf 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2917,7 +2917,7 @@ QDate QLocale::toDate(const QString &string, FormatType format) const #ifndef QT_NO_DATESTRING QDateTime QLocale::toDateTime(const QString &string, FormatType format) const { - return toDateTime(string, dateFormat(format)); + return toDateTime(string, dateTimeFormat(format)); } #endif -- cgit v0.12 From 00f1ec35393cf8cc5b96fc11dd1e35078d02ba0a Mon Sep 17 00:00:00 2001 From: Shenghua Su Date: Wed, 17 Feb 2010 12:03:05 +0100 Subject: add test case for QTBUG-7898 that QLocale::toDateTime(QString, FormatType) cannot convert value correctly Merge-request: 455 Reviewed-by: Thiago Macieira --- tests/auto/qlocale/tst_qlocale.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 3dc4dad..ff77db1 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -141,6 +141,8 @@ private slots: void ampm(); + void QTBUG_7898(); + private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; }; @@ -2019,5 +2021,23 @@ void tst_QLocale::symbianSystemLocale() } #endif +void tst_QLocale::QTBUG_7898() +{ + QLocale locale = QLocale(QLocale::English); + //QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM"); // with no blank space char after "AM", call "toDateTime" will get invalid value + QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM "); + + QDateTime value1 = locale.toDateTime(dateTimeStr , locale.dateTimeFormat(QLocale::LongFormat));qDebug()< Date: Wed, 17 Feb 2010 12:03:08 +0100 Subject: remove debug info Merge-request: 455 Reviewed-by: Thiago Macieira --- tests/auto/qlocale/tst_qlocale.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index ff77db1..c9095ed 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -2027,7 +2027,7 @@ void tst_QLocale::QTBUG_7898() //QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM"); // with no blank space char after "AM", call "toDateTime" will get invalid value QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM "); - QDateTime value1 = locale.toDateTime(dateTimeStr , locale.dateTimeFormat(QLocale::LongFormat));qDebug()< Date: Wed, 17 Feb 2010 12:03:13 +0100 Subject: add test for toDateTime() using QLocale::LongFormat Merge-request: 455 Reviewed-by: Thiago Macieira --- tests/auto/qlocale/tst_qlocale.cpp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index c9095ed..5a87154 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -141,8 +141,6 @@ private slots: void ampm(); - void QTBUG_7898(); - private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; }; @@ -1019,6 +1017,9 @@ void tst_QLocale::toDateTime_data() QTest::newRow("RFC-1123") << "C" << QDateTime(QDate(2007, 11, 1), QTime(18, 8, 30)) << "ddd, dd MMM yyyy hh:mm:ss 'GMT'" << "Thu, 01 Nov 2007 18:08:30 GMT"; + + QTest::newRow("longFormat") << "en_US" << QDateTime(QDate(2009, 1, 5), QTime(11, 48, 32)) + << "dddd, MMMM d, yyyy h:mm:ss AP " << "Monday, January 5, 2009 11:48:32 AM "; } void tst_QLocale::toDateTime() @@ -1030,6 +1031,8 @@ void tst_QLocale::toDateTime() QLocale l(localeName); QCOMPARE(l.toDateTime(string, format), result); + if (l.dateTimeFormat(QLocale::LongFormat) == format) + QCOMPARE(l.toDateTime(string, QLocale::LongFormat), result); } void tst_QLocale::macDefaultLocale() @@ -2021,23 +2024,5 @@ void tst_QLocale::symbianSystemLocale() } #endif -void tst_QLocale::QTBUG_7898() -{ - QLocale locale = QLocale(QLocale::English); - //QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM"); // with no blank space char after "AM", call "toDateTime" will get invalid value - QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM "); - - QDateTime value1 = locale.toDateTime(dateTimeStr , locale.dateTimeFormat(QLocale::LongFormat)); - QDateTime value2 = locale.toDateTime(dateTimeStr , QLocale::LongFormat); - QCOMPARE(value1.isValid(), value2.isValid()); - if (value1.isValid()) { - QCOMPARE(value1, value2); - QCOMPARE(locale.toString(value1), dateTimeStr); - QCOMPARE(locale.toString(value2), dateTimeStr); - QCOMPARE(locale.toString(value1, locale.dateTimeFormat(QLocale::LongFormat)), dateTimeStr); - QCOMPARE(locale.toString(value2, locale.dateTimeFormat(QLocale::LongFormat)), dateTimeStr); - } -} - QTEST_APPLESS_MAIN(tst_QLocale) #include "tst_qlocale.moc" -- cgit v0.12 From 39534745d6c274c2588fd7ce396da2f38415bd86 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 17 Feb 2010 14:21:14 +0100 Subject: Mac: QSystemTrayIcon::DoubleClick and midmouse not working On Mac, we never emit the activation signal of the tray icon with other reasons than triggered. The reason; it was never implemented. This patch connect the dots. Task-number: QTBUG-5770 --- src/gui/kernel/qcocoaview_mac.mm | 15 ----- src/gui/kernel/qt_cocoa_helpers_mac.mm | 15 +++++ src/gui/kernel/qt_cocoa_helpers_mac_p.h | 1 + src/gui/util/qsystemtrayicon_mac.mm | 114 ++++++++++++++++---------------- 4 files changed, 72 insertions(+), 73 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index ec00583..e7cd718 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -84,21 +84,6 @@ extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm extern QPointer qt_mouseover; //qapplication_mac.mm extern QPointer qt_button_down; //qapplication_mac.cpp -Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum) -{ - if (buttonNum == 0) - return Qt::LeftButton; - if (buttonNum == 1) - return Qt::RightButton; - if (buttonNum == 2) - return Qt::MidButton; - if (buttonNum == 3) - return Qt::XButton1; - if (buttonNum == 4) - return Qt::XButton2; - return Qt::NoButton; -} - struct dndenum_mapper { NSDragOperation mac_code; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index f2ec4af..7f0ae57 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -648,6 +648,21 @@ bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widge } #endif +Qt::MouseButton cocoaButton2QtButton(long buttonNum) +{ + if (buttonNum == 0) + return Qt::LeftButton; + if (buttonNum == 1) + return Qt::RightButton; + if (buttonNum == 2) + return Qt::MidButton; + if (buttonNum == 3) + return Qt::XButton1; + if (buttonNum == 4) + return Qt::XButton2; + return Qt::NoButton; +} + // Helper to share code between QCocoaWindow and QCocoaView bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent) { diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index c43ea55..8d29ce1 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -137,6 +137,7 @@ void qt_mac_update_mouseTracking(QWidget *widget); OSStatus qt_mac_drawCGImage(CGContextRef cg, const CGRect *inbounds, CGImageRef); bool qt_mac_checkForNativeSizeGrip(const QWidget *widget); void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent); +Qt::MouseButton cocoaButton2QtButton(long buttonNum); #ifdef QT_MAC_USE_COCOA bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); void qt_cocoaChangeOverrideCursor(const QCursor &cursor); diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm index 0265a83..2359822 100644 --- a/src/gui/util/qsystemtrayicon_mac.mm +++ b/src/gui/util/qsystemtrayicon_mac.mm @@ -110,7 +110,7 @@ QT_USE_NAMESPACE -(QSystemTrayIcon*)icon; -(NSStatusItem*)item; -(QRectF)geometry; -- (void)triggerSelector:(id)sender; +- (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton; - (void)doubleClickSelector:(id)sender; @end @@ -121,7 +121,7 @@ QT_USE_NAMESPACE -(id)initWithParent:(QNSStatusItem*)myParent; -(QSystemTrayIcon*)icon; -(void)menuTrackingDone:(NSNotification*)notification; --(void)mousePressed:(NSEvent *)mouseEvent; +-(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton; @end @@ -333,12 +333,10 @@ QT_END_NAMESPACE [self setNeedsDisplay:YES]; } --(void)mousePressed:(NSEvent *)mouseEvent +-(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton { - int clickCount = [mouseEvent clickCount]; - down = !down; - if(!down && [self icon]->contextMenu()) - [self icon]->contextMenu()->hide(); + down = YES; + int clickCount = [mouseEvent clickCount]; [self setNeedsDisplay:YES]; #ifndef QT_MAC_USE_COCOA @@ -348,47 +346,52 @@ QT_END_NAMESPACE const short scale = hgt - 4; #endif - if( down && ![self icon]->icon().isNull() ) { + if (![self icon]->icon().isNull() ) { NSImage *nsaltimage = static_cast(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale), QIcon::Selected))); [self setImage: nsaltimage]; [nsaltimage release]; } - - if (down) - [parent triggerSelector:self]; - else if ((clickCount%2)) + if ((clickCount == 2)) { + [self menuTrackingDone:nil]; [parent doubleClickSelector:self]; - while (down) { - mouseEvent = [[self window] nextEventMatchingMask:NSLeftMouseDownMask | NSLeftMouseUpMask - | NSLeftMouseDraggedMask | NSRightMouseDownMask | NSRightMouseUpMask - | NSRightMouseDraggedMask]; - switch ([mouseEvent type]) { - case NSRightMouseDown: - case NSRightMouseUp: - case NSLeftMouseDown: - case NSLeftMouseUp: - [self menuTrackingDone:nil]; - break; - case NSRightMouseDragged: - case NSLeftMouseDragged: - default: - /* Ignore any other kind of event. */ - break; - } - }; + } else { + [parent triggerSelector:self button:mouseButton]; + } } -(void)mouseDown:(NSEvent *)mouseEvent { - [self mousePressed:mouseEvent]; + [self mousePressed:mouseEvent button:Qt::LeftButton]; +} + +-(void)mouseUp:(NSEvent *)mouseEvent +{ + Q_UNUSED(mouseEvent); + [self menuTrackingDone:nil]; } - (void)rightMouseDown:(NSEvent *)mouseEvent { - [self mousePressed:mouseEvent]; + [self mousePressed:mouseEvent button:Qt::RightButton]; +} + +-(void)rightMouseUp:(NSEvent *)mouseEvent +{ + Q_UNUSED(mouseEvent); + [self menuTrackingDone:nil]; } +- (void)otherMouseDown:(NSEvent *)mouseEvent +{ + [self mousePressed:mouseEvent button:cocoaButton2QtButton([mouseEvent buttonNumber])]; +} + +-(void)otherMouseUp:(NSEvent *)mouseEvent +{ + Q_UNUSED(mouseEvent); + [self menuTrackingDone:nil]; +} -(void)drawRect:(NSRect)rect { [[parent item] drawStatusBarBackgroundInRect:rect withHighlight:down]; @@ -433,45 +436,40 @@ QT_END_NAMESPACE } return QRectF(); } -- (void)triggerSelector:(id)sender { + +- (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton { Q_UNUSED(sender); - if(!icon) + if (!icon) return; - qtsystray_sendActivated(icon, QSystemTrayIcon::Trigger); + + if (mouseButton == Qt::MidButton) + qtsystray_sendActivated(icon, QSystemTrayIcon::MiddleClick); + else + qtsystray_sendActivated(icon, QSystemTrayIcon::Trigger); + if (icon->contextMenu()) { -#if 0 - const QRectF geom = [self geometry]; - if(!geom.isNull()) { - [[NSNotificationCenter defaultCenter] addObserver:imageCell - selector:@selector(menuTrackingDone:) - name:nil - object:self]; - icon->contextMenu()->exec(geom.topLeft().toPoint(), 0); - [imageCell menuTrackingDone:nil]; - } else -#endif - { #ifndef QT_MAC_USE_COCOA - [[[self item] view] removeAllToolTips]; - iconPrivate->updateToolTip_sys(); + [[[self item] view] removeAllToolTips]; + iconPrivate->updateToolTip_sys(); #endif - NSMenu *m = [[QNSMenu alloc] initWithQMenu:icon->contextMenu()]; - [m setAutoenablesItems: NO]; - [[NSNotificationCenter defaultCenter] addObserver:imageCell - selector:@selector(menuTrackingDone:) - name:NSMenuDidEndTrackingNotification - object:m]; - [item popUpStatusItemMenu: m]; - [m release]; - } + NSMenu *m = [[QNSMenu alloc] initWithQMenu:icon->contextMenu()]; + [m setAutoenablesItems: NO]; + [[NSNotificationCenter defaultCenter] addObserver:imageCell + selector:@selector(menuTrackingDone:) + name:NSMenuDidEndTrackingNotification + object:m]; + [item popUpStatusItemMenu: m]; + [m release]; } } + - (void)doubleClickSelector:(id)sender { Q_UNUSED(sender); if(!icon) return; qtsystray_sendActivated(icon, QSystemTrayIcon::DoubleClick); } + @end class QSystemTrayIconQMenu : public QMenu -- cgit v0.12 From bcb4e290959da6e1790551f67de00ba78ac2f791 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Feb 2010 15:24:33 +0100 Subject: Fix compilation of Qt Assistant when WebKit isn't built. You need to ensure qconfig.h is included before you can check if QT_NO_WEBKIT is defined. Reviewed-by: kh1 --- tools/assistant/tools/assistant/helpviewer_qtb.cpp | 4 ++-- tools/assistant/tools/assistant/helpviewer_qtb.h | 3 +++ tools/assistant/tools/assistant/helpviewer_qwv.cpp | 4 ++-- tools/assistant/tools/assistant/helpviewer_qwv.h | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp index 3aafe67..1e439dc 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp @@ -38,11 +38,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#if defined(QT_NO_WEBKIT) - #include "helpviewer_qtb.h" #include "helpviewer_qwv.h" +#if defined(QT_NO_WEBKIT) + #include "centralwidget.h" #include "helpenginewrapper.h" #include "tracer.h" diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.h b/tools/assistant/tools/assistant/helpviewer_qtb.h index e927b34..9a9a8fd 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.h +++ b/tools/assistant/tools/assistant/helpviewer_qtb.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#include + #if defined(QT_NO_WEBKIT) #ifndef HELPVIEWERQTB_H diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index 4857e00..eec5a35 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -38,10 +38,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#if !defined(QT_NO_WEBKIT) - #include "helpviewer_qwv.h" +#if !defined(QT_NO_WEBKIT) + #include "centralwidget.h" #include "helpenginewrapper.h" #include "tracer.h" diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h index 3f2e537..f326f8a 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.h +++ b/tools/assistant/tools/assistant/helpviewer_qwv.h @@ -38,6 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#include + #if !defined(QT_NO_WEBKIT) #ifndef HELPVIEWERQWV_H -- cgit v0.12 From a0110546f7ba8e9d9ec903e2ac13a85b3af93901 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Feb 2010 16:58:50 +0100 Subject: Fix compilation with IBM xlC 7: "../../../../../include/QtCore/../../src/corelib/kernel/qmetatype.h", line 202.49: 1540-0062 (S) The incomplete class "QMetaTypeId" must not be used as a qualifier. So move the Q_DECLARE_METATYPE before the use. Reviewed-By: hjk --- tools/designer/src/components/formeditor/formwindow.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp index 631ca7c..15775f6 100644 --- a/tools/designer/src/components/formeditor/formwindow.cpp +++ b/tools/designer/src/components/formeditor/formwindow.cpp @@ -1436,6 +1436,14 @@ struct ArrowKeyOperation { int arrowKey; }; +} // namespace + +QT_END_NAMESPACE +Q_DECLARE_METATYPE(qdesigner_internal::ArrowKeyOperation) +QT_BEGIN_NAMESPACE + +namespace qdesigner_internal { + QRect ArrowKeyOperation::apply(const QRect &rect) const { QRect r = rect; @@ -2964,4 +2972,3 @@ QUndoStack *FormWindow::commandHistory() const QT_END_NAMESPACE -Q_DECLARE_METATYPE(qdesigner_internal::ArrowKeyOperation) -- cgit v0.12 From d7f6785ba9bbb61d0b6e8f80ef8bf9da0e90442e Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 17 Feb 2010 16:51:29 +0100 Subject: remove -lz from OPENSSL_LIBS so as to respect qt-zlib OPENSSL_LIBS can introduce -lz. To respect qt-zlib, this must be replaced with -lQtCore4. Otherwise, linking can fail due to there being two different libraries providing zlib. Merge-request: 405 Reviewed-by: Thiago Macieira --- src/network/ssl/ssl.pri | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 72ea80f..899aa30 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -35,5 +35,11 @@ symbian { RESOURCES += network.qrc # Add optional SSL libs + !contains(QT_CONFIG, system-zlib):contains(OPENSSL_LIBS, -lz) { + # Use the zlib in QtCore + OPENSSL_LIBS -= -lz + OPENSSL_LIBS += -lQtCore4 + } LIBS_PRIVATE += $$OPENSSL_LIBS + } -- cgit v0.12 From 3d5d159ac8ef506e6b1f33822547df0af54bbeb3 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 17 Feb 2010 16:51:38 +0100 Subject: remove -lz from QT_LFLAGS_PSQL so as to respect qt-zlib QT_LFLAGS_PSQL can introduce -lz. To respect qt-zlib, this must be be removed so that zlib will come from -lQtCore4. Otherwise, linking can fail due to there being two different libraries providing zlib. This affects building shared Qt. This patch fixes the problem for win32-g++ and also unix. Assumed that QT_LFLAGS_PSQL is set in configure step if -lpq is not enough. Not sure why parallel logic is in src/sql/drivers/drivers.pri but I fixed that too. Merge-request: 405 Reviewed-by: Thiago Macieira --- src/plugins/sqldrivers/psql/psql.pro | 11 ++++------- src/sql/drivers/drivers.pri | 13 +++++-------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro index 29fbada..0a38ee4 100644 --- a/src/plugins/sqldrivers/psql/psql.pro +++ b/src/plugins/sqldrivers/psql/psql.pro @@ -4,18 +4,15 @@ HEADERS = ../../../sql/drivers/psql/qsql_psql.h SOURCES = main.cpp \ ../../../sql/drivers/psql/qsql_psql.cpp -unix: { +unix|win32-g++: { !isEmpty(QT_LFLAGS_PSQL) { - LIBS *= $$QT_LFLAGS_PSQL + !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz + !static:LIBS *= $$QT_LFLAGS_PSQL QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL } !contains(LIBS, .*pq.*):LIBS *= -lpq } -win32:!contains(LIBS, .*pq.* ) { - !win32-g++:LIBS *= -llibpq - win32-g++:LIBS *= -lpq - LIBS *= -lws2_32 -ladvapi32 -} +win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32 include(../qsqldriverbase.pri) diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri index 184eca9..aac0267 100644 --- a/src/sql/drivers/drivers.pri +++ b/src/sql/drivers/drivers.pri @@ -6,19 +6,16 @@ contains(sql-drivers, psql) { HEADERS += drivers/psql/qsql_psql.h SOURCES += drivers/psql/qsql_psql.cpp - unix { - !isEmpty(QT_LFLAGS_PSQL) { - LIBS *= $$QT_LFLAGS_PSQL + unix|win32-g++ { + !static:!isEmpty(QT_LFLAGS_PSQL) { + !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz + !static:LIBS *= $$QT_LFLAGS_PSQL QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL } !contains(LIBS, .*pq.*):LIBS *= -lpq } - win32 { - !win32-g++:!contains( LIBS, .*pq.* ):LIBS *= -llibpq - win32-g++:!contains( LIBS, .*pq.* ):LIBS *= -lpq - LIBS *= -lws2_32 -ladvapi32 - } + win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32 } contains(sql-drivers, mysql) { -- cgit v0.12 From 686da4276a3d16f3f609442886f7a743a13b1f37 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 17 Feb 2010 16:51:47 +0100 Subject: Revert "remove -lz from OPENSSL_LIBS so as to respect qt-zlib" This reverts commit 7228fdef61fd126481574e53d6d022d134219cc3. Merge-request: 405 Reviewed-by: Thiago Macieira --- src/network/ssl/ssl.pri | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 899aa30..72ea80f 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -35,11 +35,5 @@ symbian { RESOURCES += network.qrc # Add optional SSL libs - !contains(QT_CONFIG, system-zlib):contains(OPENSSL_LIBS, -lz) { - # Use the zlib in QtCore - OPENSSL_LIBS -= -lz - OPENSSL_LIBS += -lQtCore4 - } LIBS_PRIVATE += $$OPENSSL_LIBS - } -- cgit v0.12 From d69069eaa0b17ad02ef6604672ef9ee21eb53928 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Feb 2010 18:54:52 +0100 Subject: AIX has a #define for hz, so undef it --- tools/qmlviewer/qmlviewer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index e2073dc..f4f04be 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -40,6 +40,10 @@ ****************************************************************************/ #include + +#ifdef hz +#undef hz +#endif #include "ui_recopts.h" #include "qmlviewer.h" -- cgit v0.12 From 5119ae6d364a5ac738894d0e60131f21eaf403f2 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 16 Feb 2010 13:28:11 +0100 Subject: Added a new flag to fine-tune gesture propagation policy When a graphicsobject subscribes to a gesture using the IgnoredGesturesPropagateToParent flag, normal propagation rules do not apply to the gesture, and instead all gestures of the given type that are started over the item will propagate to parent items only. Task-number: QTBUG-7400 Reviewed-by: Andreas --- src/corelib/global/qnamespace.h | 3 +- src/gui/graphicsview/qgraphicsscene.cpp | 78 +++++++++++++++++++++++++++--- tests/auto/gestures/tst_gestures.cpp | 86 +++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 7 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 35ff8e7..6ee8ae9 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1725,7 +1725,8 @@ public: enum GestureFlag { DontStartGestureOnChildren = 0x01, - ReceivePartialGestures = 0x02 + ReceivePartialGestures = 0x02, + IgnoredGesturesPropagateToParent = 0x04 }; Q_DECLARE_FLAGS(GestureFlags, GestureFlag) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9a36d46..3280e86 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5936,6 +5936,9 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) typedef QHash > GesturesPerItem; GesturesPerItem gesturesPerItem; + // gestures that are only supposed to propagate to parent items. + QSet parentPropagatedGestures; + QSet startedGestures; foreach (QGesture *gesture, allGestures) { QGraphicsObject *target = gestureTargets.value(gesture, 0); @@ -5946,6 +5949,10 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) startedGestures.insert(gesture); } else { gesturesPerItem[target].append(gesture); + Qt::GestureFlags flags = + target->QGraphicsItem::d_func()->gestureContext.value(gesture->gestureType()); + if (flags & Qt::IgnoredGesturesPropagateToParent) + parentPropagatedGestures.insert(gesture); } } @@ -6035,6 +6042,10 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) Q_ASSERT(!gestureTargets.contains(g)); gestureTargets.insert(g, receiver); gesturesPerItem[receiver].append(g); + Qt::GestureFlags flags = + receiver->QGraphicsItem::d_func()->gestureContext.value(g->gestureType()); + if (flags & Qt::IgnoredGesturesPropagateToParent) + parentPropagatedGestures.insert(g); } it = ignoredConflictedGestures.begin(); e = ignoredConflictedGestures.end(); @@ -6044,13 +6055,17 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) Q_ASSERT(!gestureTargets.contains(g)); gestureTargets.insert(g, receiver); gesturesPerItem[receiver].append(g); + Qt::GestureFlags flags = + receiver->QGraphicsItem::d_func()->gestureContext.value(g->gestureType()); + if (flags & Qt::IgnoredGesturesPropagateToParent) + parentPropagatedGestures.insert(g); } DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "Started gestures:" << normalGestures.keys() << "All gestures:" << gesturesPerItem.values(); - // deliver all events + // deliver all gesture events QList alreadyIgnoredGestures; QHash > itemIgnoredGestures; QList targetItems = gesturesPerItem.keys(); @@ -6070,9 +6085,26 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) foreach(QGesture *g, alreadyIgnoredGestures) { QMap::iterator contextit = gid->gestureContext.find(g->gestureType()); - bool deliver = contextit != gid->gestureContext.end() && - (g->state() == Qt::GestureStarted || - (contextit.value() & Qt::ReceivePartialGestures)); + bool deliver = false; + if (contextit != gid->gestureContext.end()) { + if (g->state() == Qt::GestureStarted) { + deliver = true; + } else { + const Qt::GestureFlags flags = contextit.value(); + if (flags & Qt::ReceivePartialGestures) { + QGraphicsObject *originalTarget = gestureTargets.value(g); + Q_ASSERT(originalTarget); + QGraphicsItemPrivate *otd = originalTarget->QGraphicsItem::d_func(); + const Qt::GestureFlags originalTargetFlags = otd->gestureContext.value(g->gestureType()); + if (originalTargetFlags & Qt::IgnoredGesturesPropagateToParent) { + // only deliver to parents of the original target item + deliver = item->isAncestorOf(originalTarget); + } else { + deliver = true; + } + } + } + } if (deliver) gestures += g; } @@ -6100,18 +6132,52 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) << "item has ignored the event, will propagate." << item << ignoredGestures; itemIgnoredGestures[item] += ignoredGestures; + alreadyIgnoredGestures = ignoredGestures.toList(); + + // remove gestures that are supposed to be propagated to + // parent items only. + QSet parentGestures; + for (QSet::iterator it = ignoredGestures.begin(); + it != ignoredGestures.end();) { + if (parentPropagatedGestures.contains(*it)) { + parentGestures.insert(*it); + it = ignoredGestures.erase(it); + } else { + ++it; + } + } + + QSet itemsSet = targetItems.toSet(); + + foreach(QGesture *g, parentGestures) { + // get the original target for the gesture + QGraphicsItem *item = gestureTargets.value(g, 0); + Q_ASSERT(item); + const Qt::GestureType gestureType = g->gestureType(); + // iterate through parent items of the original gesture + // target item and collect potential receivers + do { + if (QGraphicsObject *obj = item->toGraphicsObject()) { + if (item->d_func()->gestureContext.contains(gestureType)) + itemsSet.insert(obj); + } + if (item->isPanel()) + break; + } while ((item = item->parentItem())); + } + QMap conflictedGestures; QList > itemsForConflictedGestures; QHash normalGestures; getGestureTargets(ignoredGestures, viewport, &conflictedGestures, &itemsForConflictedGestures, &normalGestures); - QSet itemsSet = targetItems.toSet(); for (int k = 0; k < itemsForConflictedGestures.size(); ++k) itemsSet += itemsForConflictedGestures.at(k).toSet(); + targetItems = itemsSet.toList(); + qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst); - alreadyIgnoredGestures = conflictedGestures.values(); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "new targets:" << targetItems; i = -1; // start delivery again diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 952136b..e6de590 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -333,6 +333,7 @@ private slots: void unregisterRecognizer(); void autoCancelGestures(); void autoCancelGestures2(); + void graphicsViewParentPropagation(); }; tst_Gestures::tst_Gestures() @@ -698,6 +699,9 @@ public: bool acceptGestureOverride; QSet ignoredGestures; + QSet ignoredStartedGestures; + QSet ignoredUpdatedGestures; + QSet ignoredFinishedGestures; QRectF size; int instanceNumber; @@ -710,6 +714,9 @@ public: events.clear(); overrideEvents.clear(); ignoredGestures.clear(); + ignoredStartedGestures.clear(); + ignoredUpdatedGestures.clear(); + ignoredFinishedGestures.clear(); } protected: @@ -732,6 +739,24 @@ protected: QGestureEvent *e = static_cast(event); foreach(Qt::GestureType type, ignoredGestures) e->ignore(e->gesture(type)); + foreach(QGesture *g, e->gestures()) { + switch (g->state()) { + case Qt::GestureStarted: + if (ignoredStartedGestures.contains(g->gestureType())) + e->ignore(g); + break; + case Qt::GestureUpdated: + if (ignoredUpdatedGestures.contains(g->gestureType())) + e->ignore(g); + break; + case Qt::GestureFinished: + if (ignoredFinishedGestures.contains(g->gestureType())) + e->ignore(g); + break; + default: + break; + } + } } else if (event->type() == QEvent::GestureOverride) { ++gestureOverrideEventsReceived; eventsPtr = &overrideEvents; @@ -1471,5 +1496,66 @@ void tst_Gestures::autoCancelGestures2() QCOMPARE(parent->events.all.count(), 2); } +void tst_Gestures::graphicsViewParentPropagation() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item0 = new GestureItem("item0"); + scene.addItem(item0); + item0->setPos(0, 0); + item0->grabGesture(CustomGesture::GestureType); + item0->setZValue(1); + + GestureItem *item1 = new GestureItem("item1"); + scene.addItem(item1); + item1->setPos(0, 0); + item1->setZValue(5); + + GestureItem *item1_c1 = new GestureItem("item1_child1"); + item1_c1->setParentItem(item1); + item1_c1->setPos(0, 0); + + GestureItem *item1_c1_c1 = new GestureItem("item1_child1_child1"); + item1_c1_c1->setParentItem(item1_c1); + item1_c1_c1->setPos(0, 0); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); + item1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); + item1_c1->grabGesture(CustomGesture::GestureType, Qt::IgnoredGesturesPropagateToParent); + item1_c1_c1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); + + item0->ignoredUpdatedGestures << CustomGesture::GestureType; + item0->ignoredFinishedGestures << CustomGesture::GestureType; + item1->ignoredUpdatedGestures << CustomGesture::GestureType; + item1->ignoredFinishedGestures << CustomGesture::GestureType; + item1_c1->ignoredUpdatedGestures << CustomGesture::GestureType; + item1_c1->ignoredFinishedGestures << CustomGesture::GestureType; + item1_c1_c1->ignoredUpdatedGestures << CustomGesture::GestureType; + item1_c1_c1->ignoredFinishedGestures << CustomGesture::GestureType; + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(10, 10), item1_c1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item1_c1_c1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1_c1_c1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1_c1->gestureEventsReceived, 0); + QCOMPARE(item1_c1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount-1); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + QCOMPARE(item0->gestureEventsReceived, 0); + QCOMPARE(item0->gestureOverrideEventsReceived, 1); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From 7eb4b5efe05708b1e5e31ad5c4b150f601f90049 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Feb 2010 19:28:33 +0100 Subject: Remove these friend declarations that aren't necessary in 4.7 --- src/corelib/codecs/qtextcodec.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h index 5012b42..e37527d 100644 --- a/src/corelib/codecs/qtextcodec.h +++ b/src/corelib/codecs/qtextcodec.h @@ -171,11 +171,6 @@ public: private: const QTextCodec *c; QTextCodec::ConverterState state; - - friend class QXmlStreamWriter; - friend class QXmlStreamWriterPrivate; - friend class QCoreXmlStreamWriter; - friend class QCoreXmlStreamWriterPrivate; }; class Q_CORE_EXPORT QTextDecoder { -- cgit v0.12 From eeb121d54e345e92ab74d8c43e07d803a0e144ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 18 Feb 2010 09:10:57 +0100 Subject: Compile. NSInteger is int/long on 32/64 bit. --- src/gui/kernel/qcocoaview_mac.mm | 1 + src/gui/kernel/qt_cocoa_helpers_mac.mm | 2 +- src/gui/kernel/qt_cocoa_helpers_mac_p.h | 1 - src/gui/util/qsystemtrayicon_mac.mm | 1 + 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index e7cd718..d5e7534 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -692,6 +692,7 @@ extern "C" { qt_button_down = 0; } +extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); - (void)otherMouseDown:(NSEvent *)theEvent { if (!qt_button_down) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 7f0ae57..901bf0e 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -648,7 +648,7 @@ bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widge } #endif -Qt::MouseButton cocoaButton2QtButton(long buttonNum) +Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum) { if (buttonNum == 0) return Qt::LeftButton; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 8d29ce1..c43ea55 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -137,7 +137,6 @@ void qt_mac_update_mouseTracking(QWidget *widget); OSStatus qt_mac_drawCGImage(CGContextRef cg, const CGRect *inbounds, CGImageRef); bool qt_mac_checkForNativeSizeGrip(const QWidget *widget); void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent); -Qt::MouseButton cocoaButton2QtButton(long buttonNum); #ifdef QT_MAC_USE_COCOA bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); void qt_cocoaChangeOverrideCursor(const QCursor &cursor); diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm index 2359822..5cadbbd 100644 --- a/src/gui/util/qsystemtrayicon_mac.mm +++ b/src/gui/util/qsystemtrayicon_mac.mm @@ -382,6 +382,7 @@ QT_END_NAMESPACE [self menuTrackingDone:nil]; } +extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); - (void)otherMouseDown:(NSEvent *)mouseEvent { [self mousePressed:mouseEvent button:cocoaButton2QtButton([mouseEvent buttonNumber])]; -- cgit v0.12