summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMorten Sorvig <msorvig@trolltech.com>2009-09-17 04:52:40 (GMT)
committerMorten Sorvig <msorvig@trolltech.com>2009-09-17 04:52:40 (GMT)
commit4bf2d055aa31a7d2768538368d2984a3d594650e (patch)
treeccf2345bf6c31dee238c8486c79a842dbb214f07 /src/gui
parentdb8f89cdb4fcb0d8436db80d50221308900dca01 (diff)
parent64e03f7ada9eb6af7c65dbea7a36ebcb3f4e67fb (diff)
downloadQt-4bf2d055aa31a7d2768538368d2984a3d594650e.zip
Qt-4bf2d055aa31a7d2768538368d2984a3d594650e.tar.gz
Qt-4bf2d055aa31a7d2768538368d2984a3d594650e.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/embedded/directfb.pri2
-rw-r--r--src/gui/kernel/qapplication.cpp2
-rw-r--r--src/gui/kernel/qapplication_x11.cpp2
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp26
-rw-r--r--src/gui/kernel/qt_x11_p.h2
-rw-r--r--src/gui/painting/qdrawutil.cpp3
-rw-r--r--src/gui/text/qfontmetrics.cpp10
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp6
-rw-r--r--src/gui/widgets/qdockwidget.cpp2
10 files changed, 46 insertions, 11 deletions
diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri
index 7dae9d5..43ff0c7 100644
--- a/src/gui/embedded/directfb.pri
+++ b/src/gui/embedded/directfb.pri
@@ -8,7 +8,7 @@
#DEFINES += QT_DIRECTFB_IMAGECACHE
#DEFINES += QT_NO_DIRECTFB_WM
#DEFINES += QT_NO_DIRECTFB_LAYER
-#DEFINES += QT_NO_DIRECTFB_PALETTE
+#DEFINES += QT_DIRECTFB_PALETTE
#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
#DEFINES += QT_NO_DIRECTFB_MOUSE
#DEFINES += QT_NO_DIRECTFB_KEYBOARD
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 1fd2d39..0ff7314 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -4773,7 +4773,7 @@ void QApplicationPrivate::emitLastWindowClosed()
#ifdef QT_KEYPAD_NAVIGATION
/*!
- Sets what kind of focus navigation Qt should use.
+ Sets the kind of focus navigation Qt should use to \a mode.
This feature is available in Qt for Embedded Linux, Symbian and Windows CE
only.
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 601cd11..bbce438 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -190,10 +190,12 @@ static const char * x11_atomnames = {
"TARGETS\0"
"MULTIPLE\0"
"TIMESTAMP\0"
+ "SAVE_TARGETS\0"
"CLIP_TEMPORARY\0"
"_QT_SELECTION\0"
"_QT_CLIPBOARD_SENTINEL\0"
"_QT_SELECTION_SENTINEL\0"
+ "CLIPBOARD_MANAGER\0"
"RESOURCE_MANAGER\0"
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index b2f682b..9621944 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -787,6 +787,7 @@ static Atom send_targets_selection(QClipboardData *d, Window window, Atom proper
types.append(ATOM(TARGETS));
types.append(ATOM(MULTIPLE));
types.append(ATOM(TIMESTAMP));
+ types.append(ATOM(SAVE_TARGETS));
XChangeProperty(X11->display, window, property, XA_ATOM, 32,
PropModeReplace, (uchar *) types.data(), types.size());
@@ -911,8 +912,31 @@ bool QClipboard::event(QEvent *e)
XEvent *xevent = (XEvent *)(((QClipboardEvent *)e)->data());
Display *dpy = X11->display;
- if (!xevent)
+ if (!xevent) {
+ // That means application exits and we need to give clipboard
+ // content to the clipboard manager.
+ // First we check if there is a clipboard manager.
+ if (XGetSelectionOwner(X11->display, ATOM(CLIPBOARD_MANAGER)) == XNone
+ || !owner)
+ return true;
+
+ Window ownerId = owner->internalWinId();
+ Q_ASSERT(ownerId);
+ // we delete the property so the manager saves all TARGETS.
+ XDeleteProperty(X11->display, ownerId, ATOM(_QT_SELECTION));
+ XConvertSelection(X11->display, ATOM(CLIPBOARD_MANAGER), ATOM(SAVE_TARGETS),
+ ATOM(_QT_SELECTION), ownerId, X11->time);
+ XSync(dpy, false);
+
+ XEvent event;
+ // waiting until the clipboard manager fetches the content.
+ if (!X11->clipboardWaitForEvent(ownerId, SelectionNotify, &event, 10000)) {
+ qWarning("QClipboard: Unable to receive an event from the "
+ "clipboard manager in a reasonable time");
+ }
+
return true;
+ }
switch (xevent->type) {
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index 1b02ed3..61acbac 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -544,10 +544,12 @@ struct QX11Data
TARGETS,
MULTIPLE,
TIMESTAMP,
+ SAVE_TARGETS,
CLIP_TEMPORARY,
_QT_SELECTION,
_QT_CLIPBOARD_SENTINEL,
_QT_SELECTION_SENTINEL,
+ CLIPBOARD_MANAGER,
RESOURCE_MANAGER,
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index c4a9373..0a82a9f 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1066,8 +1066,9 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs,
/*!
\fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
- \since 4.6
\relates <qdrawutil.h>
+ \since 4.6
+ \overload
Draws the given \a pixmap into the given \a target rectangle, using the
given \a painter. The pixmap will be split into nine segments and drawn
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index b2784d6..ce122aa 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -528,13 +528,15 @@ int QFontMetrics::rightBearing(QChar ch) const
int QFontMetrics::width(const QString &text, int len) const
{
int pos = text.indexOf(QLatin1Char('\x9c'));
- QString txt = (pos == -1) ? text : text.left(pos);
- if (len < 0)
- len = txt.length();
+ if (pos != -1) {
+ len = (len < 0) ? pos : qMin(pos, len);
+ } else if (len < 0) {
+ len = text.length();
+ }
if (len == 0)
return 0;
- QTextEngine layout(txt, d);
+ QTextEngine layout(text, d);
layout.ignoreBidi = true;
return qRound(layout.width(0, len));
}
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 41f4b4a..470c8e1 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -170,7 +170,7 @@ void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, in
return;
int endPosition;
- QTextBlock lastBlock = doc->findBlock(from + charsAdded);
+ QTextBlock lastBlock = doc->findBlock(from + charsAdded + (charsRemoved > 0 ? 1 : 0));
if (lastBlock.isValid())
endPosition = lastBlock.position() + lastBlock.length();
else
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index b43bd06..81c9142 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1396,8 +1396,12 @@ void QTextEngine::itemize() const
int length = layoutData->string.length();
if (!length)
return;
-
+#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
+ // ATSUI requires RTL flags to correctly identify the character stops.
+ bool ignore = false;
+#else
bool ignore = ignoreBidi;
+#endif
if (!ignore && option.textDirection() == Qt::LeftToRight) {
ignore = true;
const QChar *start = layoutData->string.unicode();
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index 0e434be..a574262f 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1136,7 +1136,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
/*!
\property QDockWidget::windowTitle
- \internal
+ \brief the dock widget title (caption)
By default, this property contains an empty string.
*/