summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-10-16 10:43:36 +0200
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-10-16 10:46:48 +0200
commit8fc4f99e468a279e6bb8442adad6b6a46d1be1c3 (patch)
treedfd0540ecac0bc86594e9e997d7e979e40dacc6d /src/widgets
parentd3921cce47f834dd37cf0bb4085ba242dbbe2412 (diff)
parentf7241e8cb949ecf2d86fae2a759a8e1fdb148a26 (diff)
Merge remote-tracking branch 'gerrit/master' into newdocs
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.ui184
-rw-r--r--src/widgets/doc/src/modelview.qdoc23
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp70
-rw-r--r--src/widgets/itemviews/qlistview.cpp2
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp7
-rw-r--r--src/widgets/kernel/qwidget.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp62
-rw-r--r--src/widgets/styles/qgtkstyle.cpp1
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm26
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h8
-rw-r--r--src/widgets/styles/qmotifstyle_p.h82
-rw-r--r--src/widgets/widgets/qcombobox.cpp9
-rw-r--r--src/widgets/widgets/qdockwidget.cpp2
13 files changed, 204 insertions, 276 deletions
diff --git a/src/widgets/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui
index f7fe68fbbf..6545fc05d4 100644
--- a/src/widgets/dialogs/qfiledialog.ui
+++ b/src/widgets/dialogs/qfiledialog.ui
@@ -1,4 +1,5 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<comment>*********************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
@@ -40,8 +41,8 @@
**
*********************************************************************</comment>
<class>QFileDialog</class>
- <widget class="QDialog" name="QFileDialog" >
- <property name="geometry" >
+ <widget class="QDialog" name="QFileDialog">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -49,28 +50,28 @@
<height>316</height>
</rect>
</property>
- <property name="sizeGripEnabled" >
+ <property name="sizeGripEnabled">
<bool>true</bool>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="lookInLabel" >
- <property name="text" >
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lookInLabel">
+ <property name="text">
<string>Look in:</string>
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2" >
- <layout class="QHBoxLayout" >
+ <item row="0" column="1" colspan="2">
+ <layout class="QHBoxLayout">
<item>
- <widget class="QFileDialogComboBox" name="lookInCombo" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
+ <widget class="QFileDialogComboBox" name="lookInCombo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize" >
+ <property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
@@ -79,8 +80,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="backButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="backButton">
+ <property name="toolTip">
<string>Back</string>
</property>
<property name="accessibleName">
@@ -92,8 +93,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="forwardButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="forwardButton">
+ <property name="toolTip">
<string>Forward</string>
</property>
<property name="accessibleName">
@@ -105,8 +106,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="toParentButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="toParentButton">
+ <property name="toolTip">
<string>Parent Directory</string>
</property>
<property name="accessibleName">
@@ -118,8 +119,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="newFolderButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="newFolderButton">
+ <property name="toolTip">
<string>Create New Folder</string>
</property>
<property name="accessibleName">
@@ -131,8 +132,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="listModeButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="listModeButton">
+ <property name="toolTip">
<string>List View</string>
</property>
<property name="accessibleName">
@@ -144,8 +145,8 @@
</widget>
</item>
<item>
- <widget class="QToolButton" name="detailModeButton" >
- <property name="toolTip" >
+ <widget class="QToolButton" name="detailModeButton">
+ <property name="toolTip">
<string>Detail View</string>
</property>
<property name="accessibleName">
@@ -158,87 +159,102 @@
</item>
</layout>
</item>
- <item row="1" column="0" colspan="3" >
- <widget class="QSplitter" name="splitter" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <item row="1" column="0" colspan="3">
+ <widget class="QSplitter" name="splitter">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <widget class="QSidebar" name="sidebar" />
- <widget class="QFrame" name="frame" >
- <property name="frameShape" >
+ <widget class="QSidebar" name="sidebar">
+ <property name="accessibleName">
+ <string>Sidebar</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>List of places and bookmarks</string>
+ </property>
+ </widget>
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
- <property name="frameShadow" >
+ <property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin" >
+ <property name="leftMargin">
<number>0</number>
</property>
- <property name="topMargin" >
+ <property name="topMargin">
<number>0</number>
</property>
- <property name="rightMargin" >
+ <property name="rightMargin">
<number>0</number>
</property>
- <property name="bottomMargin" >
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
- <widget class="QStackedWidget" name="stackedWidget" >
- <property name="currentIndex" >
+ <widget class="QStackedWidget" name="stackedWidget">
+ <property name="currentIndex">
<number>0</number>
</property>
- <widget class="QWidget" name="page" >
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <widget class="QWidget" name="page">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin" >
+ <property name="leftMargin">
<number>0</number>
</property>
- <property name="topMargin" >
+ <property name="topMargin">
<number>0</number>
</property>
- <property name="rightMargin" >
+ <property name="rightMargin">
<number>0</number>
</property>
- <property name="bottomMargin" >
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
- <widget class="QFileDialogListView" name="listView" />
+ <widget class="QFileDialogListView" name="listView">
+ <property name="accessibleName">
+ <string>Files</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
- <widget class="QWidget" name="page_2" >
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <widget class="QWidget" name="page_2">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin" >
+ <property name="leftMargin">
<number>0</number>
</property>
- <property name="topMargin" >
+ <property name="topMargin">
<number>0</number>
</property>
- <property name="rightMargin" >
+ <property name="rightMargin">
<number>0</number>
</property>
- <property name="bottomMargin" >
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
- <widget class="QFileDialogTreeView" name="treeView" />
+ <widget class="QFileDialogTreeView" name="treeView">
+ <property name="accessibleName">
+ <string>Files</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
@@ -248,15 +264,15 @@
</widget>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="fileNameLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+ <item row="2" column="0">
+ <widget class="QLabel" name="fileNameLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize" >
+ <property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
@@ -264,43 +280,43 @@
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QFileDialogLineEdit" name="fileNameEdit" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <item row="2" column="1">
+ <widget class="QFileDialogLineEdit" name="fileNameEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
- <item rowspan="2" row="2" column="2" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
+ <item row="2" column="2" rowspan="2">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
- <item row="3" column="0" >
- <widget class="QLabel" name="fileTypeLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <item row="3" column="0">
+ <widget class="QLabel" name="fileTypeLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text" >
+ <property name="text">
<string>Files of type:</string>
</property>
</widget>
</item>
- <item row="3" column="1" >
- <widget class="QComboBox" name="fileTypeCombo" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <item row="3" column="1">
+ <widget class="QComboBox" name="fileTypeCombo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -345,11 +361,11 @@
<tabstop>listModeButton</tabstop>
<tabstop>detailModeButton</tabstop>
<tabstop>sidebar</tabstop>
+ <tabstop>treeView</tabstop>
<tabstop>listView</tabstop>
<tabstop>fileNameEdit</tabstop>
- <tabstop>fileTypeCombo</tabstop>
<tabstop>buttonBox</tabstop>
- <tabstop>treeView</tabstop>
+ <tabstop>fileTypeCombo</tabstop>
</tabstops>
<resources/>
<connections/>
diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc
index c133005b54..304af0058d 100644
--- a/src/widgets/doc/src/modelview.qdoc
+++ b/src/widgets/doc/src/modelview.qdoc
@@ -100,8 +100,8 @@
Let's have a closer look at a standard table widget. A table widget is a 2D
array of the data elements that the user can change. The table widget can be
integrated into a program flow by reading and writing the data elements that
- the table widget provides.
- This method is very intuitive and useful in many applications, but displaying
+ the table widget provides.
+ This method is very intuitive and useful in many applications, but displaying
and editing a database table with a standard table widget can be problematic.
Two copies of the data have to be coordinated: one outside the
widget; one inside the widget. The developer is responsible for
@@ -180,12 +180,12 @@
\section1 2. A Simple Model/View Application
- If you want to develop a model/view application, where should you start?
- We recommend starting with a simple example and extending it step-by-step.
- This makes understanding the architecture a lot easier. Trying to understand
- the model/view architecture in detail before invoking the IDE has proven
- to be less convenient for many developers. It is substantially easier to
- start with a simple model/view application that has demo data. Give it a
+ If you want to develop a model/view application, where should you start?
+ We recommend starting with a simple example and extending it step-by-step.
+ This makes understanding the architecture a lot easier. Trying to understand
+ the model/view architecture in detail before invoking the IDE has proven
+ to be less convenient for many developers. It is substantially easier to
+ start with a simple model/view application that has demo data. Give it a
try! Simply replace the data in the examples below with your own.
Below are 7 very simple and independent applications that show different
@@ -202,7 +202,7 @@
We have the usual \l {modelview-part2-main-cpp.html}{main()} function:
- Here is the interesting part: We create an instance of MyModel and use
+ Here is the interesting part: We create an instance of MyModel and use
\l{QTableView::setModel()}{tableView.setModel(&myModel);} to pass a
pointer of it to \l{QTableView}{tableView}. \l{QTableView}{tableView}
will invoke the methods of the pointer it has received to find out two
@@ -606,12 +606,9 @@
\e{Open Source Press}, ISBN 3-937514-12-0.
\li \b{Foundations of Qt Development} / Johan Thelin, \e{Apress}, ISBN 1-59059-831-8.
\li \b{Advanced Qt Programming} / Mark Summerfield, \e{Prentice Hall}, ISBN 0-321-63590-6.
- This book covers Model/View programming on more than 150 pages.
+ This book covers Model/View programming on more than 150 pages.
\endlist
- More information about these books is available on the
- \l{Books about Qt Programming}{Qt Web site}.
-
The following list provides an overview of example programs contained in the first three
books listed above. Some of them make very good templates for developing similar
applications.
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index b30bdbbc6b..8cb6d70d15 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1108,14 +1108,11 @@ void QAbstractItemView::reset()
if (d->selectionModel)
d->selectionModel->reset();
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset();
- QAccessibleEvent event(this, QAccessible::TableModelChanged);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::ModelReset);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3243,12 +3240,22 @@ void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelInde
// otherwise the items will be update later anyway
update(topLeft);
}
- return;
+ } else {
+ d->updateEditorData(topLeft, bottomRight);
+ if (isVisible() && !d->delayedPendingLayout)
+ d->viewport->update();
}
- d->updateEditorData(topLeft, bottomRight);
- if (!isVisible() || d->delayedPendingLayout)
- return; // no need to update
- d->viewport->update();
+
+#ifndef QT_NO_ACCESSIBILITY
+ if (QAccessible::isActive()) {
+ QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::DataChanged);
+ accessibleEvent.setFirstRow(topLeft.row());
+ accessibleEvent.setFirstColumn(topLeft.column());
+ accessibleEvent.setLastRow(bottomRight.row());
+ accessibleEvent.setLastColumn(bottomRight.column());
+ QAccessible::updateAccessibility(&accessibleEvent);
+ }
+#endif
}
/*!
@@ -3343,14 +3350,13 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star
q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState);
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsRemoved);
+ accessibleEvent.setFirstRow(start);
+ accessibleEvent.setLastRow(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3424,14 +3430,13 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s
q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState);
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsRemoved);
+ accessibleEvent.setFirstColumn(start);
+ accessibleEvent.setLastColumn(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
@@ -3447,15 +3452,14 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta
Q_UNUSED(end)
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsInserted);
+ accessibleEvent.setFirstRow(start);
+ accessibleEvent.setLastRow(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3473,14 +3477,13 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int
if (q->isVisible())
q->updateEditorGeometries();
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end);
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsInserted);
+ accessibleEvent.setFirstColumn(start);
+ accessibleEvent.setLastColumn(end);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
/*!
@@ -3501,15 +3504,12 @@ void QAbstractItemViewPrivate::_q_layoutChanged()
{
doDelayedItemsLayout();
#ifndef QT_NO_ACCESSIBILITY
-#ifdef Q_WS_X11
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
- QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset();
- QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
- QAccessible::updateAccessibility(&event);
+ QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ModelReset);
+ QAccessible::updateAccessibility(&accessibleEvent);
}
#endif
-#endif
}
void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 097802c909..ff703c9d8a 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE
that can be taken for views that are intended to display items with equal sizes
is to set the \l uniformItemSizes property to true.
- \sa {View Classes}, QTreeView, QTableView, QListWidget
+ \sa {View Classes}, {Item Views Puzzle Example}, QTreeView, QTableView, QListWidget
*/
/*!
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index 6b04c18b9d..5dc68e47e0 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -77,6 +77,7 @@ extern QWidget *qt_button_down;
extern QWidget *qt_popup_down;
extern bool qt_replay_popup_mouse_event;
int openPopupCount = 0;
+extern QPointer<QWidget> qt_last_mouse_receiver;
void QApplicationPrivate::createEventDispatcher()
{
@@ -249,6 +250,12 @@ void QApplicationPrivate::openPopup(QWidget *popup)
QApplication::sendEvent(fw, &e);
}
}
+
+ // Dispatch leave for last mouse receiver to update undermouse states
+ if (qt_last_mouse_receiver && !QWidget::mouseGrabber()) {
+ QApplicationPrivate::dispatchEnterLeave(0, qt_last_mouse_receiver.data());
+ qt_last_mouse_receiver = 0;
+ }
}
void QApplicationPrivate::initializeMultitouch_sys()
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 362a8f4e55..29083b0670 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -7807,7 +7807,7 @@ bool QWidget::event(QEvent *event)
{
Q_D(QWidget);
- // ignore mouse events when disabled
+ // ignore mouse and key events when disabled
if (!isEnabled()) {
switch(event->type()) {
case QEvent::TabletPress:
@@ -7822,6 +7822,8 @@ bool QWidget::event(QEvent *event)
case QEvent::TouchEnd:
case QEvent::TouchCancel:
case QEvent::ContextMenu:
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
#endif
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 85d46bb0a3..5c34caef6b 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -712,6 +712,24 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
#ifndef QT_NO_ITEMVIEWS
+static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
+{
+ qreal height = 0;
+ qreal widthUsed = 0;
+ textLayout.beginLayout();
+ while (true) {
+ QTextLine line = textLayout.createLine();
+ if (!line.isValid())
+ break;
+ line.setLineWidth(lineWidth);
+ line.setPosition(QPointF(0, height));
+ height += line.height();
+ widthUsed = qMax(widthUsed, line.naturalTextWidth());
+ }
+ textLayout.endLayout();
+ return QSizeF(widthUsed, height);
+}
+
QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int role) const
{
const QWidget *widget = option->widget;
@@ -725,10 +743,8 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
if (option->features & QStyleOptionViewItem::HasDisplay) {
QTextOption textOption;
textOption.setWrapMode(QTextOption::WordWrap);
- QTextLayout textLayout;
+ QTextLayout textLayout(option->text, option->font);
textLayout.setTextOption(textOption);
- textLayout.setFont(option->font);
- textLayout.setText(option->text);
const bool wrapText = option->features & QStyleOptionViewItem::WrapText;
const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1;
QRect bounds = option->rect;
@@ -745,20 +761,9 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
break;
}
- qreal height = 0, widthUsed = 0;
- textLayout.beginLayout();
- while (true) {
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
- line.setLineWidth(bounds.width());
- line.setPosition(QPointF(0, height));
- height += line.height();
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
- textLayout.endLayout();
- const QSize size(qCeil(widthUsed), qCeil(height));
- return QSize(size.width() + 2 * textMargin, size.height());
+ const int lineWidth = bounds.width();
+ const QSizeF size = viewItemTextLayout(textLayout, lineWidth);
+ return QSize(qCeil(size.width()) + 2 * textMargin, qCeil(size.height()));
}
break;
case Qt::DecorationRole:
@@ -773,25 +778,6 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
return QSize(0, 0);
}
-static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
-{
- qreal height = 0;
- qreal widthUsed = 0;
- textLayout.beginLayout();
- while (true) {
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
- line.setLineWidth(lineWidth);
- line.setPosition(QPointF(0, height));
- height += line.height();
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
- textLayout.endLayout();
- return QSizeF(widthUsed, height);
-}
-
-
void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const
{
const QWidget *widget = option->widget;
@@ -803,10 +789,8 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt
textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap);
textOption.setTextDirection(option->direction);
textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment));
- QTextLayout textLayout;
+ QTextLayout textLayout(option->text, option->font);
textLayout.setTextOption(textOption);
- textLayout.setFont(option->font);
- textLayout.setText(option->text);
viewItemTextLayout(textLayout, textRect.width());
diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp
index 552e2354c5..9bcf45e928 100644
--- a/src/widgets/styles/qgtkstyle.cpp
+++ b/src/widgets/styles/qgtkstyle.cpp
@@ -1935,7 +1935,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
gint interiorFocus = true;
d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
- GtkStyle *gtkToggleButtonStyle = gtkToggleButtonStyle;
int xt = interiorFocus ? gtkToggleButtonStyle->xthickness : 0;
int yt = interiorFocus ? gtkToggleButtonStyle->ythickness : 0;
if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 3376c3cd52..ecb3e7f222 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1836,6 +1836,7 @@ void QMacStylePrivate::animate()
}
if (!scrollBars.isEmpty()) {
int i = 0;
+ const qint64 dt = QDateTime::currentMSecsSinceEpoch();
while (i < scrollBars.size()) {
QWidget *maybeScroll = scrollBars.at(i);
if (!maybeScroll) {
@@ -1843,9 +1844,8 @@ void QMacStylePrivate::animate()
} else {
if (QScrollBar *sb = qobject_cast<QScrollBar *>(maybeScroll)) {
const OverlayScrollBarInfo& info = scrollBarInfos[sb];
- const QDateTime dt = QDateTime::currentDateTime();
- const qreal elapsed = qMax(info.lastHovered.msecsTo(dt),
- info.lastUpdate.msecsTo(dt));
+ const qreal elapsed = qMax(dt - info.lastHovered,
+ dt - info.lastUpdate);
const CGFloat opacity = 1.0 - qMax(0.0, (elapsed - ScrollBarFadeOutDelay) /
ScrollBarFadeOutDuration);
if ((opacity > 0.0 || !info.cleared) && (elapsed > ScrollBarFadeOutDelay)) {
@@ -1888,7 +1888,8 @@ bool QMacStyle::eventFilter(QObject *o, QEvent *e)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7 &&
[NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay && scrollArea) {
QMacStylePrivate::OverlayScrollBarInfo& info = d->scrollBarInfos[sb];
- const qreal elapsed = info.lastUpdate.msecsTo(QDateTime::currentDateTime());
+ const qint64 dt = QDateTime::currentMSecsSinceEpoch();
+ const qreal elapsed = dt - info.lastUpdate;
const CGFloat opacity = 1.0 - qMax(0.0, (elapsed - QMacStylePrivate::ScrollBarFadeOutDelay)
/ QMacStylePrivate::ScrollBarFadeOutDuration);
switch (e->type()) {
@@ -1897,8 +1898,8 @@ bool QMacStyle::eventFilter(QObject *o, QEvent *e)
// the fade out is stopped and it's set to 100% opaque
if (opacity > 0.0) {
info.hovered = true;
- info.lastUpdate = QDateTime::currentDateTime();
- info.lastHovered = QDateTime::currentDateTime();
+ info.lastUpdate = dt;
+ info.lastHovered = info.lastUpdate;
sb->update();
break;
}
@@ -5113,6 +5114,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ const qint64 dt = QDateTime::currentMSecsSinceEpoch();
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7 &&
[NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay &&
scrollBarsScrollArea(qobject_cast<const QScrollBar *>(widget)) &&
@@ -5127,7 +5129,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
info.lastMinimum = slider->minimum;
info.lastSize = slider->rect.size();
info.lastMaximum = slider->maximum;
- info.lastUpdate = QDateTime::currentDateTime();
+ info.lastUpdate = dt;
showSiblings = true;
}
@@ -5139,18 +5141,18 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
d->scrollBarInfos.value(sibling).lastUpdate);
info.cleared = false;
if (d->scrollBarInfos.value(sibling).hovered)
- info.lastUpdate = QDateTime::currentDateTime();
+ info.lastUpdate = dt;
}
- qreal elapsed = info.lastHovered.msecsTo(QDateTime::currentDateTime());
+ qreal elapsed = dt - info.lastHovered;
CGFloat opacity = 1.0 - qMax(0.0,
(elapsed - QMacStylePrivate::ScrollBarFadeOutDelay) /
QMacStylePrivate::ScrollBarFadeOutDuration);
const bool isHorizontal = slider->orientation == Qt::Horizontal;
if (info.hovered) {
- info.lastHovered = QDateTime::currentDateTime();
- info.lastUpdate = QDateTime::currentDateTime();
+ info.lastHovered = dt;
+ info.lastUpdate = dt;
opacity = 1.0;
// if the current scroll bar is hovered, none of the others might fade out
Q_FOREACH (const QScrollBar *sibling, siblings) {
@@ -5206,7 +5208,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// afterwards we draw the knob, since we cannot drow the know w/o the track,
// we simulate a scrollbar with a knob from 0.0 to 1.0
- elapsed = info.lastUpdate.msecsTo(QDateTime::currentDateTime());
+ elapsed = dt - info.lastUpdate;
opacity = 1.0 - qMax(0.0, (elapsed - QMacStylePrivate::ScrollBarFadeOutDelay) /
QMacStylePrivate::ScrollBarFadeOutDuration);
info.cleared = opacity <= 0.0;
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 2c129aa49d..ac482b8fc7 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -215,18 +215,18 @@ public:
: lastValue(-1),
lastMinimum(-1),
lastMaximum(-1),
- lastUpdate(QDateTime::currentDateTime()),
+ lastUpdate(QDateTime::currentMSecsSinceEpoch()),
hovered(false),
- lastHovered(QDateTime::fromTime_t(0)),
+ lastHovered(0),
cleared(false)
{}
int lastValue;
int lastMinimum;
int lastMaximum;
QSize lastSize;
- QDateTime lastUpdate;
+ qint64 lastUpdate;
bool hovered;
- QDateTime lastHovered;
+ qint64 lastHovered;
bool cleared;
};
mutable QMap<const QWidget*, OverlayScrollBarInfo> scrollBarInfos;
diff --git a/src/widgets/styles/qmotifstyle_p.h b/src/widgets/styles/qmotifstyle_p.h
deleted file mode 100644
index 76f8c01119..0000000000
--- a/src/widgets/styles/qmotifstyle_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOTIFSTYLE_P_H
-#define QMOTIFSTYLE_P_H
-#include <qlist.h>
-#include <qdatetime.h>
-#include <qprogressbar.h>
-#include "qmotifstyle.h"
-#include "qcommonstyle_p.h"
-
-QT_BEGIN_NAMESPACE
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
-// file may change from version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// Private class
-class QMotifStylePrivate : public QCommonStylePrivate
-{
- Q_DECLARE_PUBLIC(QMotifStyle)
-public:
- QMotifStylePrivate();
-
-public:
-#ifndef QT_NO_PROGRESSBAR
- QList<QProgressBar *> bars;
- int animationFps;
- int animateTimer;
- QTime startTime;
- int animateStep;
-#endif // QT_NO_PROGRESSBAR
-};
-
-QT_END_NAMESPACE
-
-#endif //QMOTIFSTYLE_P_H
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 98bcf7d6f2..870e25b241 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2007,10 +2007,13 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
/*!
\property QComboBox::currentText
- \brief the text of the current item
+ \brief the current text
- By default, for an empty combo box or a combo box in which no current
- item is set, this property contains an empty string.
+ If the combo box is editable, the current text is the value displayed
+ by the line edit. Otherwise, it is the value of the current item or
+ an empty string if the combo box is empty or no current item is set.
+
+ \sa editable
*/
QString QComboBox::currentText() const
{
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index cba4271ba0..12f957412f 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1052,7 +1052,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
}
}
- if (unplug && floating && nativeDeco)
+ if (floating && nativeDeco)
if (const QWindow *window = q->windowHandle())
if (QPlatformWindow *platformWindow = window->handle())
platformWindow->setFrameStrutEventsEnabled(true);