summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-04 18:36:19 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-04 18:36:19 (GMT)
commitf0bb9bc5b0f4c20536d6c77624bd148389b78c06 (patch)
tree9088a173de4bfbeea29bc9464d4cb46257df67cd /src/gui
parent60be72310c0f9469b3201b250b257473184ccf2a (diff)
parent1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd (diff)
downloadQt-f0bb9bc5b0f4c20536d6c77624bd148389b78c06.zip
Qt-f0bb9bc5b0f4c20536d6c77624bd148389b78c06.tar.gz
Qt-f0bb9bc5b0f4c20536d6c77624bd148389b78c06.tar.bz2
Merge commit 'origin/4.6' into 4.6
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp6
-rw-r--r--src/gui/kernel/qwidget_mac.mm2
-rw-r--r--src/gui/painting/qpaintdevice.qdoc2
-rw-r--r--src/gui/styles/qgtkstyle_p.cpp4
-rw-r--r--src/gui/widgets/qlinecontrol.cpp8
-rw-r--r--src/gui/widgets/qlineedit.cpp46
-rw-r--r--src/gui/widgets/qlineedit.h10
-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
11 files changed, 73 insertions, 13 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index b54596b..f93ffdf 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/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index e3af683..2361dd0 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -282,8 +282,8 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp
\row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home \i Shift+Home
\row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End \i Shift+End
- \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up \i (none) \i (none) \i (none)
- \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down \i (none) \i (none) \i (none)
+ \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none) \i (none)
+ \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none) \i (none)
\row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home \i Ctrl+Shift+Home
\row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End
\row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace \i (none)
@@ -732,6 +732,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac}
};
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 0d9f9ee..1907cca 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2617,8 +2617,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
releaseMouse();
if(mac_keyboard_grabber == this)
releaseKeyboard();
- if(acceptDrops())
- setAcceptDrops(false);
if(testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal
QApplicationPrivate::leaveModal(this);
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/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/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 87975c3..117c550 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -1586,16 +1586,16 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
}
}
#endif //QT_NO_CLIPBOARD
- else if (event == QKeySequence::MoveToStartOfLine) {
+ else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
home(0);
}
- else if (event == QKeySequence::MoveToEndOfLine) {
+ else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) {
end(0);
}
- else if (event == QKeySequence::SelectStartOfLine) {
+ else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) {
home(1);
}
- else if (event == QKeySequence::SelectEndOfLine) {
+ else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) {
end(1);
}
else if (event == QKeySequence::MoveToNextChar) {
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.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;
}