summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-12-08 16:55:42 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-12-08 16:55:42 (GMT)
commit33418800a5c78e06182bc0b41a2eabaf8aafc0fc (patch)
treea5e30275f88c6f473b1e3d09f42c94799f7ac21e /src
parent74b0c482b1edf606e1326c9053c612a7e514dee4 (diff)
parent971acc6d34559a2c5035888a5891ea29ad8628af (diff)
downloadQt-33418800a5c78e06182bc0b41a2eabaf8aafc0fc.zip
Qt-33418800a5c78e06182bc0b41a2eabaf8aafc0fc.tar.gz
Qt-33418800a5c78e06182bc0b41a2eabaf8aafc0fc.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp13
-rw-r--r--src/corelib/kernel/qmath.h57
-rw-r--r--src/corelib/tools/qvector.h2
-rw-r--r--src/gui/dialogs/dialogs.pri18
-rw-r--r--src/gui/dialogs/qprogressdialog.cpp4
-rw-r--r--src/gui/egl/qegl.cpp5
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp2
-rw-r--r--src/gui/kernel/qwidget_mac.mm112
-rw-r--r--src/gui/painting/qpaintdevice.qdoc2
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/styles/qgtkstyle_p.cpp4
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp3
-rw-r--r--src/gui/util/qsystemtrayicon.cpp3
-rw-r--r--src/gui/util/qsystemtrayicon_mac.mm28
-rw-r--r--src/gui/widgets/qlineedit.cpp46
-rw-r--r--src/gui/widgets/qlineedit.h10
-rw-r--r--src/gui/widgets/qlineedit_p.cpp6
-rw-r--r--src/gui/widgets/qlineedit_p.h2
-rw-r--r--src/gui/widgets/qplaintextedit.cpp2
-rw-r--r--src/gui/widgets/qtextedit.cpp2
-rw-r--r--src/opengl/qgl.cpp1
-rw-r--r--src/opengl/qgl_p.h1
-rw-r--r--src/opengl/qglframebufferobject.cpp4
-rw-r--r--src/opengl/qglpaintdevice.cpp10
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp1
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp83
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp2
30 files changed, 310 insertions, 125 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index c6eef5e..c305341 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -509,7 +509,11 @@ LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
}
}
}
+#ifdef Q_OS_WINCE
+ return 0;
+#else
return CallNextHookEx(0, code, wp, lp);
+#endif
}
static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher)
@@ -636,11 +640,13 @@ void QEventDispatcherWin32::createInternalHwnd()
return;
d->internalHwnd = qt_create_internal_window(this);
+#ifndef Q_OS_WINCE
// setup GetMessage hook needed to drive our posted events
d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId());
if (!d->getMessageHook) {
qFatal("Qt: INTERNALL ERROR: failed to install GetMessage hook");
}
+#endif
// register all socket notifiers
QList<int> sockets = (d->sn_read.keys().toSet()
@@ -731,6 +737,11 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
}
if (haveMessage) {
+#ifdef Q_OS_WINCE
+ // WinCE doesn't support hooks at all, so we have to call this by hand :(
+ (void) qt_GetMessageHook(0, PM_REMOVE, (LPARAM) &msg);
+#endif
+
if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
if (seenWM_QT_SENDPOSTEDEVENTS) {
needWM_QT_SENDPOSTEDEVENTS = true;
@@ -1065,9 +1076,11 @@ void QEventDispatcherWin32::closingDown()
d->timerVec.clear();
d->timerDict.clear();
+#ifndef Q_OS_WINCE
if (d->getMessageHook)
UnhookWindowsHookEx(d->getMessageHook);
d->getMessageHook = 0;
+#endif
}
bool QEventDispatcherWin32::event(QEvent *e)
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index a9e4378..820f424 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -76,6 +76,16 @@ inline int qFloor(qreal v)
return int(floor(v));
}
+inline qreal qFabs(qreal v)
+{
+#ifdef QT_USE_MATH_H_FLOATS
+ if(sizeof(qreal) == sizeof(float))
+ return fabsf(float(v));
+ else
+#endif
+ return fabs(v);
+}
+
inline qreal qSin(qreal v)
{
#ifdef QT_USE_MATH_H_FLOATS
@@ -96,6 +106,16 @@ inline qreal qCos(qreal v)
return cos(v);
}
+inline qreal qTan(qreal v)
+{
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return tanf(float(v));
+ else
+#endif
+ return tan(v);
+}
+
inline qreal qAcos(qreal v)
{
#ifdef QT_USE_MATH_H_FLOATS
@@ -106,6 +126,36 @@ inline qreal qAcos(qreal v)
return acos(v);
}
+inline qreal qAsin(qreal v)
+{
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return asinf(float(v));
+ else
+#endif
+ return asin(v);
+}
+
+inline qreal qAtan(qreal v)
+{
+#ifdef QT_USE_MATH_H_FLOATS
+ if(sizeof(qreal) == sizeof(float))
+ return atanf(float(v));
+ else
+#endif
+ return atan(v);
+}
+
+inline qreal qAtan2(qreal x, qreal y)
+{
+#ifdef QT_USE_MATH_H_FLOATS
+ if(sizeof(qreal) == sizeof(float))
+ return atan2f(float(x), float(y));
+ else
+#endif
+ return atan2(x, y);
+}
+
inline qreal qSqrt(qreal v)
{
#ifdef QT_USE_MATH_H_FLOATS
@@ -126,6 +176,13 @@ inline qreal qLn(qreal v)
return log(v);
}
+inline qreal qExp(qreal v)
+{
+ // only one signature
+ // exists, exp(double)
+ return exp(v);
+}
+
inline qreal qPow(qreal x, qreal y)
{
#ifdef QT_USE_MATH_H_FLOATS
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 201e7b3..e00cf3f 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -219,7 +219,7 @@ public:
inline const_iterator &operator--() { i--; return *this; }
inline const_iterator operator--(int) { T *n = i; i--; return n; }
inline const_iterator &operator+=(int j) { i+=j; return *this; }
- inline const_iterator &operator-=(int j) { i+=j; return *this; }
+ inline const_iterator &operator-=(int j) { i-=j; return *this; }
inline const_iterator operator+(int j) const { return const_iterator(i+j); }
inline const_iterator operator-(int j) const { return const_iterator(i-j); }
inline int operator-(const_iterator j) const { return i - j.i; }
diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri
index b9fad41..63f64a2 100644
--- a/src/gui/dialogs/dialogs.pri
+++ b/src/gui/dialogs/dialogs.pri
@@ -28,13 +28,27 @@ HEADERS += \
dialogs/qprintpreviewdialog.h
!embedded:mac {
- OBJECTIVE_SOURCES += dialogs/qcolordialog_mac.mm \
- dialogs/qfiledialog_mac.mm \
+ OBJECTIVE_SOURCES += dialogs/qfiledialog_mac.mm \
dialogs/qfontdialog_mac.mm \
dialogs/qnspanelproxy_mac.mm \
dialogs/qpagesetupdialog_mac.mm \
dialogs/qprintdialog_mac.mm
+
+# Compile qcolordialog_mac.mm with exception support, disregarding the -no-exceptions
+# configure option. (qcolordialog_mac needs to catch exceptions thrown by cocoa)
+ EXCEPTION_SOURCES = dialogs/qcolordialog_mac.mm
+ exceptions_compiler.commands = $$QMAKE_CXX -c
+ exceptions_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
+ exceptions_compiler.commands += -fexceptions
+ exceptions_compiler.dependency_type = TYPE_C
+ exceptions_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+ exceptions_compiler.input = EXCEPTION_SOURCES
+ exceptions_compiler.variable_out = OBJECTS
+ exceptions_compiler.name = compiling[exceptopns] ${QMAKE_FILE_IN}
+ silent:exceptions_compiler.commands = @echo compiling[exceptopns] ${QMAKE_FILE_IN} && $$exceptions_compiler.commands
+ QMAKE_EXTRA_COMPILERS += exceptions_compiler
}
+
win32 {
HEADERS += dialogs/qwizard_win_p.h
SOURCES += dialogs/qdialogsbinarycompat_win.cpp \
diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp
index f5024bb..98b15e9 100644
--- a/src/gui/dialogs/qprogressdialog.cpp
+++ b/src/gui/dialogs/qprogressdialog.cpp
@@ -424,10 +424,6 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
{
Q_D(QProgressDialog);
delete d->cancel;
-#ifdef QT_SOFTKEYS_ENABLED
- delete d->cancelAction;
- d->cancelAction = 0;
-#endif
d->cancel = cancelButton;
if (cancelButton) {
if (cancelButton->parentWidget() == this) {
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index cf28dc4..6ee4bfc 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -429,7 +429,10 @@ QString QEglContext::extensions()
bool QEglContext::hasExtension(const char* extensionName)
{
- return extensions().contains(QLatin1String(extensionName));
+ QList<QByteArray> extensions =
+ QByteArray(reinterpret_cast<const char *>
+ (eglQueryString(QEglContext::defaultDisplay(0), EGL_EXTENSIONS))).split(' ');
+ return extensions.contains(extensionName);
}
QEglContext *QEglContext::currentContext(QEgl::API api)
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index 686096c..6718a28 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -158,7 +158,7 @@ QGraphicsAnchor::~QGraphicsAnchor()
\property QGraphicsAnchor::sizePolicy
\brief the size policy for the QGraphicsAnchor.
- By setting the size policy on an anchor you can configure how the item can resize itself
+ By setting the size policy on an anchor you can configure how the anchor can resize itself
from its preferred spacing. For instance, if the anchor has the size policy
QSizePolicy::Minimum, the spacing is the minimum size of the anchor. However, its size
can grow up to the anchors maximum size. If the default size policy is QSizePolicy::Fixed,
@@ -247,7 +247,7 @@ QGraphicsAnchorLayout::~QGraphicsAnchorLayout()
/*!
Creates an anchor between the edge \a firstEdge of item \a firstItem and the edge \a secondEdge
- of item \a secondItem. The magnitude of the anchor is picked up from the style. Anchors
+ of item \a secondItem. The spacing of the anchor is picked up from the style. Anchors
between a layout edge and an item edge will have a size of 0.
If there is already an anchor between the edges, the the new anchor will replace the old one.
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index bb45e7e..bc47872 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -9713,7 +9713,7 @@ void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
QWidget *widget = event->widget();
- if (widget) {
+ if (widget && (dd->control->textInteractionFlags() & Qt::TextEditable) && boundingRect().contains(event->pos())) {
qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), dd->clickCausedFocus);
}
dd->clickCausedFocus = 0;
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index acfeff8..de6e6cb 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1625,7 +1625,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
QPoint offset = d->offset();
if ((command & QItemSelectionModel::Current) == 0)
d->pressedPosition = pos + offset;
- else if (!indexAt(d->pressedPosition).isValid())
+ else if (!indexAt(d->pressedPosition - offset).isValid())
d->pressedPosition = visualRect(currentIndex()).center() + offset;
if (edit(index, NoEditTriggers, event))
@@ -2195,7 +2195,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
// note that we don't check if the new current index is enabled because moveCursor() makes sure it is
if (command & QItemSelectionModel::Current) {
d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate);
- if (!indexAt(d->pressedPosition).isValid())
+ if (!indexAt(d->pressedPosition - d->offset()).isValid())
d->pressedPosition = visualRect(oldCurrent).center() + d->offset();
QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center());
setSelection(rect, command);
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 775d773..1acc9b3 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -190,7 +190,7 @@ bool QSoftKeyManager::event(QEvent *e)
}
QWidget *parent = source->parentWidget();
- if (parent && softKeys.isEmpty())
+ if (parent && softKeys.isEmpty() && !source->isWindow())
source = parent;
else
break;
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 1907cca..7dc4d85 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3654,6 +3654,16 @@ void QWidgetPrivate::setFocus_sys()
}
}
+NSComparisonResult compareViews2Raise(id view1, id view2, void *context)
+{
+ id topView = reinterpret_cast<id>(context);
+ if (view1 == topView)
+ return NSOrderedDescending;
+ if (view2 == topView)
+ return NSOrderedAscending;
+ return NSOrderedSame;
+}
+
void QWidgetPrivate::raise_sys()
{
Q_Q(QWidget);
@@ -3661,7 +3671,6 @@ void QWidgetPrivate::raise_sys()
return;
#if QT_MAC_USE_COCOA
- QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
// Calling orderFront shows the window on Cocoa too.
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
@@ -3673,16 +3682,9 @@ void QWidgetPrivate::raise_sys()
SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
}
} else {
- // Cocoa doesn't really have an idea of Z-ordering, but you can
- // fake it by changing the order of it. But beware, removing an
- // NSView will also remove it as the first responder. So we re-set
- // the first responder just in case:
NSView *view = qt_mac_nativeview_for(q);
NSView *parentView = [view superview];
- NSResponder *firstResponder = [[view window] firstResponder];
- [view removeFromSuperview];
- [parentView addSubview:view];
- [[view window] makeFirstResponder:firstResponder];
+ [parentView sortSubviewsUsingFunction:compareViews2Raise context:reinterpret_cast<void *>(view)];
}
#else
if(q->isWindow()) {
@@ -3700,47 +3702,29 @@ void QWidgetPrivate::raise_sys()
#endif
}
+NSComparisonResult compareViews2Lower(id view1, id view2, void *context)
+{
+ id topView = reinterpret_cast<id>(context);
+ if (view1 == topView)
+ return NSOrderedAscending;
+ if (view2 == topView)
+ return NSOrderedDescending;
+ return NSOrderedSame;
+}
+
void QWidgetPrivate::lower_sys()
{
Q_Q(QWidget);
if((q->windowType() == Qt::Desktop))
return;
#ifdef QT_MAC_USE_COCOA
- QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
OSWindowRef window = qt_mac_window_for(q);
[window orderBack:window];
} else {
- // Cocoa doesn't really have an idea of Z-ordering, but you can
- // fake it by changing the order of it. In this case
- // we put the item at the beginning of the list, but that means
- // we must re-insert everything since we cannot modify the list directly.
- NSView *myview = qt_mac_nativeview_for(q);
- NSView *parentView = [myview superview];
- NSArray *tmpViews = [parentView subviews];
- NSMutableArray *subviews = [[NSMutableArray alloc] initWithCapacity:[tmpViews count]];
- [subviews addObjectsFromArray:tmpViews];
- NSResponder *firstResponder = [[myview window] firstResponder];
- // Implicit assumption that myViewIndex is included in subviews, that's why I'm not checking
- // myViewIndex.
- NSUInteger index = 0;
- NSUInteger myViewIndex = 0;
- bool foundMyView = false;
- for (NSView *subview in subviews) {
- [subview removeFromSuperview];
- if (subview == myview) {
- foundMyView = true;
- myViewIndex = index;
- }
- ++index;
- }
- [parentView addSubview:myview];
- if (foundMyView)
- [subviews removeObjectAtIndex:myViewIndex];
- for (NSView *subview in subviews)
- [parentView addSubview:subview];
- [subviews release];
- [[myview window] makeFirstResponder:firstResponder];
+ NSView *view = qt_mac_nativeview_for(q);
+ NSView *parentView = [view superview];
+ [parentView sortSubviewsUsingFunction:compareViews2Lower context:reinterpret_cast<void *>(view)];
}
#else
if(q->isWindow()) {
@@ -3753,6 +3737,16 @@ void QWidgetPrivate::lower_sys()
#endif
}
+NSComparisonResult compareViews2StackUnder(id view1, id view2, void *context)
+{
+ const QHash<NSView *, int> &viewOrder = *reinterpret_cast<QHash<NSView *, int> *>(context);
+ if (viewOrder[view1] < viewOrder[view2])
+ return NSOrderedAscending;
+ if (viewOrder[view1] > viewOrder[view2])
+ return NSOrderedDescending;
+ return NSOrderedSame;
+}
+
void QWidgetPrivate::stackUnder_sys(QWidget *w)
{
// stackUnder
@@ -3761,37 +3755,23 @@ void QWidgetPrivate::stackUnder_sys(QWidget *w)
return;
#ifdef QT_MAC_USE_COCOA
// Do the same trick as lower_sys() and put this widget before the widget passed in.
- QMacCocoaAutoReleasePool pool;
- NSView *myview = qt_mac_nativeview_for(q);
+ NSView *myView = qt_mac_nativeview_for(q);
NSView *wView = qt_mac_nativeview_for(w);
- NSView *parentView = [myview superview];
- NSArray *tmpViews = [parentView subviews];
- NSMutableArray *subviews = [[NSMutableArray alloc] initWithCapacity:[tmpViews count]];
- [subviews addObjectsFromArray:tmpViews];
- // Implicit assumption that myViewIndex and wViewIndex is included in subviews,
- // that's why I'm not checking myViewIndex.
- NSUInteger index = 0;
- NSUInteger myViewIndex = 0;
- NSUInteger wViewIndex = 0;
- for (NSView *subview in subviews) {
- [subview removeFromSuperview];
- if (subview == myview)
- myViewIndex = index;
- else if (subview == wView)
- wViewIndex = index;
- ++index;
- }
- index = 0;
+ QHash<NSView *, int> viewOrder;
+ NSView *parentView = [myView superview];
+ NSArray *subviews = [parentView subviews];
+ NSUInteger index = 1;
+ // make a hash of view->zorderindex and make sure z-value is always odd,
+ // so that when we modify the order we create a new (even) z-value which
+ // will not interfere with others.
for (NSView *subview in subviews) {
- if (index == myViewIndex)
- continue;
- if (index == wViewIndex)
- [parentView addSubview:myview];
- [parentView addSubview:subview];
+ viewOrder.insert(subview, index * 2);
++index;
}
- [subviews release];
+ viewOrder[myView] = viewOrder[wView] - 1;
+
+ [parentView sortSubviewsUsingFunction:compareViews2StackUnder context:reinterpret_cast<void *>(&viewOrder)];
#else
QWidget *p = q->parentWidget();
if(!p || p != w->parentWidget())
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index ac1c3de..e923e90 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -82,7 +82,7 @@
horizontal and vertical resolution of the device in dots per
inch. The physicalDpiX() and physicalDpiY() functions also return
the resolution of the device in dots per inch, but note that if
- the logical and vertical resolution differ, the corresponding
+ the logical and physical resolution differ, the corresponding
QPaintEngine must handle the mapping. Finally, the colorCount()
function returns the number of different colors available for the
paint device.
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 443c9c5..30f8c9e 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -284,7 +284,7 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev)
// Update matrix.
if (q->d_ptr->state->WxF) {
- q->d_ptr->state->redirectionMatrix *= q->d_ptr->state->worldMatrix;
+ q->d_ptr->state->redirectionMatrix = q->d_ptr->state->matrix;
q->d_ptr->state->redirectionMatrix.translate(-offset.x(), -offset.y());
q->d_ptr->state->worldMatrix = QTransform();
q->d_ptr->state->WxF = false;
diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp
index 5f4ebae..22dfc62 100644
--- a/src/gui/styles/qgtkstyle_p.cpp
+++ b/src/gui/styles/qgtkstyle_p.cpp
@@ -202,8 +202,12 @@ Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0;
typedef int (*x11ErrorHandler)(Display*, XErrorEvent*);
+QT_END_NAMESPACE
+
Q_DECLARE_METATYPE(QGtkStylePrivate*);
+QT_BEGIN_NAMESPACE
+
static void gtkStyleSetCallback(GtkWidget*)
{
qRegisterMetaType<QGtkStylePrivate *>();
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index 54f2964..50be342 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -623,8 +623,7 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
painter->save();
- QMatrix m = painter->matrix();
- bool complexXForm = m.m11() != 1.0 || m.m22() != 1.0 || m.m12() != 0.0 || m.m21() != 0.0;
+ bool complexXForm = painter->deviceTransform().type() > QTransform::TxTranslate;
bool translucentToplevel = false;
QPaintDevice *pdev = painter->device();
diff --git a/src/gui/util/qsystemtrayicon.cpp b/src/gui/util/qsystemtrayicon.cpp
index c6ea00f..6f2b501 100644
--- a/src/gui/util/qsystemtrayicon.cpp
+++ b/src/gui/util/qsystemtrayicon.cpp
@@ -380,6 +380,9 @@ bool QSystemTrayIcon::supportsMessages()
On Windows, the \a millisecondsTimeoutHint is usually ignored by the system
when the application has focus.
+ On Mac OS X, the Growl notification system must be installed for this function to
+ display messages.
+
\sa show() supportsMessages()
*/
void QSystemTrayIcon::showMessage(const QString& title, const QString& msg,
diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm
index b74ca85..93295a7 100644
--- a/src/gui/util/qsystemtrayicon_mac.mm
+++ b/src/gui/util/qsystemtrayicon_mac.mm
@@ -314,8 +314,22 @@ QT_END_NAMESPACE
{
Q_UNUSED(notification);
down = NO;
+
+ if( ![self icon]->icon().isNull() ) {
+#ifndef QT_MAC_USE_COCOA
+ const short scale = GetMBarHeight()-4;
+#else
+ CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
+ const short scale = hgt - 4;
+#endif
+ NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale))));
+ [self setImage: nsimage];
+ [nsimage release];
+ }
+
if([self icon]->contextMenu())
[self icon]->contextMenu()->hide();
+
[self setNeedsDisplay:YES];
}
@@ -327,6 +341,20 @@ QT_END_NAMESPACE
[self icon]->contextMenu()->hide();
[self setNeedsDisplay:YES];
+#ifndef QT_MAC_USE_COCOA
+ const short scale = GetMBarHeight()-4;
+#else
+ CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
+ const short scale = hgt - 4;
+#endif
+
+ if( down && ![self icon]->icon().isNull() ) {
+ NSImage *nsaltimage = static_cast<NSImage *>(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))
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 785b2bd..2c1acdb 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -383,6 +383,38 @@ void QLineEdit::setText(const QString& text)
d->control->setText(text);
}
+// ### Qt 4.7: remove this #if guard
+#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5)
+/*!
+ \since 4.7
+
+ \property QLineEdit::placeholderText
+ \brief the line edit's placeholder text
+
+ Setting this property makes the line edit display a grayed-out
+ placeholder text as long as the text() is empty and the widget doesn't
+ have focus.
+
+ By default, this property contains an empty string.
+
+ \sa text()
+*/
+QString QLineEdit::placeholderText() const
+{
+ Q_D(const QLineEdit);
+ return d->placeholderText;
+}
+
+void QLineEdit::setPlaceholderText(const QString& placeholderText)
+{
+ Q_D(QLineEdit);
+ if (d->placeholderText != placeholderText) {
+ d->placeholderText = placeholderText;
+ if (!hasFocus())
+ update();
+ }
+}
+#endif
/*!
\property QLineEdit::displayText
@@ -1517,7 +1549,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
}
#endif
- if (!isReadOnly())
+ if (!isReadOnly() && rect().contains(e->pos()))
d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
d->clickCausedFocus = 0;
}
@@ -1829,6 +1861,18 @@ void QLineEdit::paintEvent(QPaintEvent *)
}
QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height());
+ if (d->control->text().isEmpty()) {
+ if (!hasFocus() && !d->placeholderText.isEmpty()) {
+ QColor col = pal.text().color();
+ col.setAlpha(128);
+ QPen oldpen = p.pen();
+ p.setPen(col);
+ p.drawText(lineRect, va, d->placeholderText);
+ p.setPen(oldpen);
+ return;
+ }
+ }
+
int cix = qRound(d->control->cursorToX());
// horizontal scrolling. d->hscroll is the left indent from the beginning
diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h
index ac918c7..594e488 100644
--- a/src/gui/widgets/qlineedit.h
+++ b/src/gui/widgets/qlineedit.h
@@ -83,6 +83,10 @@ class Q_GUI_EXPORT QLineEdit : public QWidget
Q_PROPERTY(bool undoAvailable READ isUndoAvailable)
Q_PROPERTY(bool redoAvailable READ isRedoAvailable)
Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
+// ### Qt 4.7: remove this #if guard
+#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5)
+ Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
+#endif
public:
explicit QLineEdit(QWidget* parent=0);
@@ -98,6 +102,12 @@ public:
QString displayText() const;
+// ### Qt 4.7: remove this #if guard
+#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5)
+ QString placeholderText() const;
+ void setPlaceholderText(const QString &);
+#endif
+
int maxLength() const;
void setMaxLength(int);
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index d03c003..4437fef 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -103,12 +103,12 @@ void QLineEditPrivate::_q_handleWindowActivate()
void QLineEditPrivate::_q_textEdited(const QString &text)
{
Q_Q(QLineEdit);
+ emit q->textEdited(text);
#ifndef QT_NO_COMPLETER
- if (control->completer() &&
- control->completer()->completionMode() != QCompleter::InlineCompletion)
+ if (control->completer()
+ && control->completer()->completionMode() != QCompleter::InlineCompletion)
control->complete(-1); // update the popup on cut/paste/del
#endif
- emit q->textEdited(text);
}
void QLineEditPrivate::_q_cursorPositionChanged(int from, int to)
diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h
index 244d2be..dc648e8 100644
--- a/src/gui/widgets/qlineedit_p.h
+++ b/src/gui/widgets/qlineedit_p.h
@@ -142,6 +142,8 @@ public:
int topTextMargin;
int rightTextMargin;
int bottomTextMargin;
+
+ QString placeholderText;
};
#endif // QT_NO_LINEEDIT
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index eae8b7d..89fe7b8 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -1969,7 +1969,7 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e)
d->ensureCursorVisible();
}
- if (!isReadOnly())
+ if (!isReadOnly() && rect().contains(e->pos()))
d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
d->clickCausedFocus = 0;
}
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 1c49ef0..1bc0bf1 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -1578,7 +1578,7 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e)
d->autoScrollTimer.stop();
ensureCursorVisible();
}
- if (!isReadOnly())
+ if (!isReadOnly() && rect().contains(e->pos()))
d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
d->clickCausedFocus = 0;
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 5ada125..94b8aa5 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1495,6 +1495,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
version_flags_cached = false;
version_flags = QGLFormat::OpenGL_Version_None;
current_fbo = 0;
+ default_fbo = 0;
active_engine = 0;
}
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 8e472e5..ab72c9c 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -328,6 +328,7 @@ public:
GLint max_texture_size;
GLuint current_fbo;
+ GLuint default_fbo;
QPaintEngine *active_engine;
static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; }
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index d79283e..d0297c9 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -899,8 +899,8 @@ bool QGLFramebufferObject::release()
#endif
if (current) {
- current->d_ptr->current_fbo = 0;
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+ current->d_ptr->current_fbo = current->d_ptr->default_fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, current->d_ptr->default_fbo);
}
return true;
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
index 2867de5..bcd90a5 100644
--- a/src/opengl/qglpaintdevice.cpp
+++ b/src/opengl/qglpaintdevice.cpp
@@ -89,6 +89,12 @@ void QGLPaintDevice::beginPaint()
ctx->d_ptr->current_fbo = m_thisFBO;
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO);
}
+
+ // Set the default fbo for the context to m_thisFBO so that
+ // if some raw GL code between beginNativePainting() and
+ // endNativePainting() calls QGLFramebufferObject::release(),
+ // painting will revert to the window surface's fbo.
+ ctx->d_ptr->default_fbo = m_thisFBO;
}
void QGLPaintDevice::ensureActiveTarget()
@@ -101,6 +107,8 @@ void QGLPaintDevice::ensureActiveTarget()
ctx->d_ptr->current_fbo = m_thisFBO;
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO);
}
+
+ ctx->d_ptr->default_fbo = m_thisFBO;
}
void QGLPaintDevice::endPaint()
@@ -111,6 +119,8 @@ void QGLPaintDevice::endPaint()
ctx->d_ptr->current_fbo = m_previousFBO;
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_previousFBO);
}
+
+ ctx->d_ptr->default_fbo = 0;
}
QGLFormat QGLPaintDevice::format() const
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 3f13405..5d039cf 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -1025,7 +1025,6 @@ QVariant QDB2Result::data(int field)
break;
case QVariant::Double:
{
- QString value=qGetStringData(d->hStmt, field, info.length() + 1, isNull);
switch(numericalPrecisionPolicy()) {
case QSql::LowPrecisionInt32:
v = new QVariant(qGetIntData(d->hStmt, field, isNull));
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index 17f2c92..f130087 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -2200,26 +2200,34 @@ bool QOCIDriver::rollbackTransaction()
QStringList QOCIDriver::tables(QSql::TableType type) const
{
QStringList tl;
+ QStringList sysUsers = QStringList() << QLatin1String("MDSYS")
+ << QLatin1String("LBACSYS")
+ << QLatin1String("SYS")
+ << QLatin1String("SYSTEM")
+ << QLatin1String("WKSYS")
+ << QLatin1String("CTXSYS")
+ << QLatin1String("WMSYS");
+
+ QString user = d->user;
+ if ( isIdentifierEscaped(user, QSqlDriver::TableName))
+ user = stripDelimiters(user, QSqlDriver::TableName);
+ else
+ user = user.toUpper();
+
+ if(sysUsers.contains(user))
+ sysUsers.removeAll(user);;
+
if (!isOpen())
return tl;
QSqlQuery t(createResult());
t.setForwardOnly(true);
if (type & QSql::Tables) {
- t.exec(QLatin1String("select owner, table_name from all_tables "
- "where owner != 'MDSYS' "
- "and owner != 'LBACSYS' "
- "and owner != 'SYS' "
- "and owner != 'SYSTEM' "
- "and owner != 'WKSYS'"
- "and owner != 'CTXSYS'"
- "and owner != 'WMSYS'"));
-
- QString user = d->user;
- if ( isIdentifierEscaped(user, QSqlDriver::TableName))
- user = stripDelimiters(user, QSqlDriver::TableName);
- else
- user = user.toUpper();
+ QString query = QLatin1String("select owner, table_name from all_tables where ");
+ QStringList whereList;
+ foreach(const QString &sysUserName, sysUsers)
+ whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' ");
+ t.exec(query + whereList.join(QLatin1String(" and ")));
while (t.next()) {
if (t.value(0).toString().toUpper() != user.toUpper())
@@ -2229,30 +2237,21 @@ QStringList QOCIDriver::tables(QSql::TableType type) const
}
// list all table synonyms as well
- t.exec(QLatin1String("select owner, synonym_name from all_synonyms "
- "where owner != 'MDSYS' "
- "and owner != 'LBACSYS' "
- "and owner != 'SYS' "
- "and owner != 'SYSTEM' "
- "and owner != 'WKSYS'"
- "and owner != 'CTXSYS'"
- "and owner != 'WMSYS'"));
+ query = QLatin1String("select owner, synonym_name from all_synonyms where ");
+ t.exec(query + whereList.join(QLatin1String(" and ")));
while (t.next()) {
if (t.value(0).toString() != d->user)
- tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString());
+ tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString());
else
tl.append(t.value(1).toString());
}
}
if (type & QSql::Views) {
- t.exec(QLatin1String("select owner, view_name from all_views "
- "where owner != 'MDSYS' "
- "and owner != 'LBACSYS' "
- "and owner != 'SYS' "
- "and owner != 'SYSTEM' "
- "and owner != 'WKSYS'"
- "and owner != 'CTXSYS'"
- "and owner != 'WMSYS'"));
+ QString query = QLatin1String("select owner, view_name from all_views where ");
+ QStringList whereList;
+ foreach(const QString &sysUserName, sysUsers)
+ whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' ");
+ t.exec(query + whereList.join(QLatin1String(" and ")));
while (t.next()) {
if (t.value(0).toString().toUpper() != d->user.toUpper())
tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString());
@@ -2265,6 +2264,28 @@ QStringList QOCIDriver::tables(QSql::TableType type) const
while (t.next()) {
tl.append(t.value(0).toString());
}
+ QString query = QLatin1String("select owner, table_name from all_tables where ");
+ QStringList whereList;
+ foreach(const QString &sysUserName, sysUsers)
+ whereList << QLatin1String("owner = '") + sysUserName + QLatin1String("' ");
+ t.exec(query + whereList.join(QLatin1String(" or ")));
+
+ while (t.next()) {
+ if (t.value(0).toString().toUpper() != user.toUpper())
+ tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString());
+ else
+ tl.append(t.value(1).toString());
+ }
+
+ // list all table synonyms as well
+ query = QLatin1String("select owner, synonym_name from all_synonyms where ");
+ t.exec(query + whereList.join(QLatin1String(" or ")));
+ while (t.next()) {
+ if (t.value(0).toString() != d->user)
+ tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString());
+ else
+ tl.append(t.value(1).toString());
+ }
}
return tl;
}
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index 5f0a35d..aec54d6 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -563,7 +563,7 @@ QString QSqlRelationalTableModel::selectStatement() const
// If there are duplicate field names they must be aliased
if (fieldNames.value(fieldList[i]) > 1) {
- QString relTableName = relation.tableName();
+ QString relTableName = relation.tableName().section(QChar::fromLatin1('.'), -1, -1);
if (d->db.driver()->isIdentifierEscaped(relTableName, QSqlDriver::TableName))
relTableName = d->db.driver()->stripDelimiters(relTableName, QSqlDriver::TableName);
QString displayColumn = relation.displayColumn();