summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-14 16:02:08 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-14 16:02:08 (GMT)
commit0f4505dd18a1342b62a049d4c37414179d6ec065 (patch)
tree3be71264d34e2ec7534a404634ae39f3cf47d497 /src/gui
parentb371999d3e9c207047be6afda89d008b6cf04763 (diff)
parent8876c7c44744b0813f98ebbb0f748331f9d8a22c (diff)
downloadQt-0f4505dd18a1342b62a049d4c37414179d6ec065.zip
Qt-0f4505dd18a1342b62a049d4c37414179d6ec065.tar.gz
Qt-0f4505dd18a1342b62a049d4c37414179d6ec065.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (21 commits) Added missing newline after warning message when using -L with qml Doc: updating scripts Fixed a crash on embedded due to uninitialized pointer. Fix a race where QThread::exit() is "lost" when called after start() qdoc: Removed all <table> attributes in favor of using css. Autotest failure: dialogModality test fails on cocoa (macgui) Force the bic test to compile in 32-bit mode on Mac Revert "Doc: Updating design files." Remove statically allocated pixmaps through the post routine qdoc: Checked for empty title. qdoc: Added TOC to class ref pages. Cocoa: qwidget autotest fails on setToolTip Compile on Mac OS 10.4 Bearer management changes from Qt Mobility (7a5ff985) Partially revert "Sunstudio12.1(5.10): Fix compile errors GTK style and other minor compile errors" Fix margins for placeholdertext in QLineEdit qdoc: Added TOC to module pages. Doc: Updating design files. Doc: Fixing design bugs. Updating the index page and script/style files. Adding some image files. qdoc: Changed <ul> elements in TOC. ...
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm15
-rw-r--r--src/gui/kernel/qcursor_mac.mm10
-rw-r--r--src/gui/widgets/qlineedit.cpp9
4 files changed, 24 insertions, 14 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index b0a23d4..5f5e29f 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -186,11 +186,9 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
gestureManager = 0;
gestureWidget = 0;
-#if defined(Q_WS_X11) || defined(Q_WS_WIN)
move_cursor = 0;
copy_cursor = 0;
link_cursor = 0;
-#endif
#if defined(Q_WS_WIN)
ignore_cursor = 0;
#endif
@@ -1045,11 +1043,9 @@ QApplication::~QApplication()
qt_clipboard = 0;
#endif
-#if defined(Q_WS_X11) || defined(Q_WS_WIN)
delete d->move_cursor; d->move_cursor = 0;
delete d->copy_cursor; d->copy_cursor = 0;
delete d->link_cursor; d->link_cursor = 0;
-#endif
#if defined(Q_WS_WIN)
delete d->ignore_cursor; d->ignore_cursor = 0;
#endif
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 9c5380b..dd12f65 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -673,13 +673,14 @@ static int qCocoaViewCount = 0;
// Send mouse move and hover events as well:
if (!qAppInstance()->activePopupWidget() || qAppInstance()->activePopupWidget() == qwidget->window()) {
- if (qwidget->testAttribute(Qt::WA_MouseTracking)) {
- NSEvent *mouseEvent = [NSEvent mouseEventWithType:NSMouseMoved
- location:windowPoint modifierFlags:[event modifierFlags] timestamp:[event timestamp]
- windowNumber:[event windowNumber] context:[event context] eventNumber:[event eventNumber]
- clickCount:0 pressure:0];
- qt_mac_handleMouseEvent(self, mouseEvent, QEvent::MouseMove, Qt::NoButton);
- }
+ // This mouse move event should be sendt, even when mouse
+ // tracking is switched off (to trigger tooltips):
+ NSEvent *mouseEvent = [NSEvent mouseEventWithType:NSMouseMoved
+ location:windowPoint modifierFlags:[event modifierFlags] timestamp:[event timestamp]
+ windowNumber:[event windowNumber] context:[event context] eventNumber:[event eventNumber]
+ clickCount:0 pressure:0];
+ qt_mac_handleMouseEvent(self, mouseEvent, QEvent::MouseMove, Qt::NoButton);
+
if (qwidget->testAttribute(Qt::WA_Hover)) {
QHoverEvent he(QEvent::HoverEnter, QPoint(viewPoint.x, viewPoint.y), QPoint(-1, -1));
QApplicationPrivate::instance()->notify_helper(qwidget, &he);
diff --git a/src/gui/kernel/qcursor_mac.mm b/src/gui/kernel/qcursor_mac.mm
index 03e38b0..c3d6c54 100644
--- a/src/gui/kernel/qcursor_mac.mm
+++ b/src/gui/kernel/qcursor_mac.mm
@@ -224,6 +224,15 @@ QPoint QCursor::pos()
void QCursor::setPos(int x, int y)
{
+#ifdef QT_MAC_USE_COCOA
+ CGPoint pos;
+ pos.x = x;
+ pos.y = y;
+
+ CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0);
+ CGEventPost(kCGHIDEventTap, e);
+ CFRelease(e);
+#else
CGWarpMouseCursorPosition(CGPointMake(x, y));
/* I'm not too keen on doing this, but this makes it a lot easier, so I just
@@ -240,6 +249,7 @@ void QCursor::setPos(int x, int y)
QApplication::mouseButtons(), QApplication::keyboardModifiers());
qt_sendSpontaneousEvent(widget, &me);
}
+#endif
}
void QCursorData::initCursorFromBitmap()
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 0b8dca9..655fc61 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1869,13 +1869,18 @@ void QLineEdit::paintEvent(QPaintEvent *)
}
QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height());
+ int minLB = qMax(0, -fm.minLeftBearing());
+ int minRB = qMax(0, -fm.minRightBearing());
+
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);
+ lineRect.adjust(minLB, 0, 0, 0);
+ QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width());
+ p.drawText(lineRect, va, elidedText);
p.setPen(oldpen);
return;
}
@@ -1889,8 +1894,6 @@ void QLineEdit::paintEvent(QPaintEvent *)
// the below code handles all scrolling based on the textline (widthUsed,
// minLB, minRB), the line edit rect (lineRect) and the cursor position
// (cix).
- int minLB = qMax(0, -fm.minLeftBearing());
- int minRB = qMax(0, -fm.minRightBearing());
int widthUsed = qRound(d->control->naturalTextWidth()) + 1 + minRB;
if ((minLB + widthUsed) <= lineRect.width()) {
// text fits in lineRect; use hscroll for alignment