summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJerome Pasion <jerome.pasion@digia.com>2012-11-02 14:41:27 +0100
committerJerome Pasion <jerome.pasion@digia.com>2012-11-02 14:41:27 +0100
commitc808dd27459e030fde0577feb8ba06e3bd465526 (patch)
tree4bf898dc4a88e2b03c9716f940638a2e01c6c0ce /src/widgets
parentd9d8845d507a6bdbc9c9f24c0d9d86dca513461d (diff)
parent300534fc214f2547a63594ce0891e9a54c8f33ca (diff)
Merge branch 'master' of ssh://codereview.qt-project.org/qt/qtbase into newdocs
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qdialog.cpp5
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp16
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp50
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h1
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp22
-rw-r--r--src/widgets/dialogs/qwizard.cpp56
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp29
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h4
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp2
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp6
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp4
-rw-r--r--src/widgets/itemviews/qtableview.cpp8
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp2
-rw-r--r--src/widgets/kernel/kernel.pri3
-rw-r--r--src/widgets/kernel/qaction.cpp51
-rw-r--r--src/widgets/kernel/qaction.h14
-rw-r--r--src/widgets/kernel/qaction_p.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp3
-rw-r--r--src/widgets/kernel/qsoftkeymanager.cpp270
-rw-r--r--src/widgets/kernel/qsoftkeymanager_common_p.h85
-rw-r--r--src/widgets/kernel/qsoftkeymanager_p.h112
-rw-r--r--src/widgets/kernel/qwidget.cpp37
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp12
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp11
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm9
-rw-r--r--src/widgets/styles/qstyleanimation.cpp45
-rw-r--r--src/widgets/styles/qstyleanimation_p.h24
-rw-r--r--src/widgets/styles/qstylehelper.cpp17
-rw-r--r--src/widgets/styles/qstylehelper_p.h2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp53
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp14
-rw-r--r--src/widgets/widgets/qcombobox.cpp50
-rw-r--r--src/widgets/widgets/qcombobox.h4
-rw-r--r--src/widgets/widgets/qcombobox_p.h4
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp134
-rw-r--r--src/widgets/widgets/qlineedit.h1
-rw-r--r--src/widgets/widgets/qmenu.cpp23
-rw-r--r--src/widgets/widgets/qmenubar.cpp14
-rw-r--r--src/widgets/widgets/qmenubar_p.h3
44 files changed, 232 insertions, 984 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 261039009c..7b47f4e135 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -516,11 +516,6 @@ int QDialog::exec()
setAttribute(Qt::WA_ShowModal, true);
setResult(0);
- bool showSystemDialogFullScreen = false;
- if (showSystemDialogFullScreen) {
- setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
- setWindowState(Qt::WindowFullScreen);
- }
show();
QPointer<QDialog> guard = this;
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index a7c257b300..fa240ccaf3 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -66,10 +66,6 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
#endif
-#if defined(QT_SOFTKEYS_ENABLED)
-#include <qaction.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QErrorMessagePrivate : public QDialogPrivate
@@ -80,9 +76,6 @@ public:
QCheckBox * again;
QTextEdit * errors;
QLabel * icon;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *okAction;
-#endif
QQueue<QPair<QString, QString> > pending;
QSet<QString> doNotShow;
QSet<QString> doNotShowType;
@@ -245,12 +238,6 @@ QErrorMessage::QErrorMessage(QWidget * parent)
d->again->setChecked(true);
grid->addWidget(d->again, 1, 1, Qt::AlignTop);
d->ok = new QPushButton(this);
-#ifdef QT_SOFTKEYS_ENABLED
- d->okAction = new QAction(d->ok);
- d->okAction->setSoftKeyRole(QAction::PositiveSoftKey);
- connect(d->okAction, SIGNAL(triggered()), this, SLOT(accept()));
- addAction(d->okAction);
-#endif
#if defined(Q_OS_WINCE)
@@ -402,9 +389,6 @@ void QErrorMessagePrivate::retranslateStrings()
{
again->setText(QErrorMessage::tr("&Show this message again"));
ok->setText(QErrorMessage::tr("&OK"));
-#ifdef QT_SOFTKEYS_ENABLED
- okAction->setText(ok->text());
-#endif
}
QT_END_NAMESPACE
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index d9d318765d..9a2e32b631 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -552,7 +552,7 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
directory.absolutePath() :
QString());
options->setInitiallySelectedNameFilter(q->selectedNameFilter());
- options->setInitiallySelectedFiles(q->selectedFiles());
+ options->setInitiallySelectedFiles(userSelectedFiles());
}
void QFileDialogPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
@@ -1009,6 +1009,24 @@ QStringList QFileDialogPrivate::typedFiles() const
return addDefaultSuffixToFiles(files);
}
+// Return selected files without defaulting to the root of the file system model
+// used for initializing QFileDialogOptions for native dialogs. The default is
+// not suitable for native dialogs since it mostly equals directory().
+QStringList QFileDialogPrivate::userSelectedFiles() const
+{
+ if (nativeDialogInUse)
+ return addDefaultSuffixToFiles(selectedFiles_sys());
+
+ QStringList files;
+ foreach (const QModelIndex &index, qFileDialogUi->listView->selectionModel()->selectedRows())
+ files.append(index.data(QFileSystemModel::FilePathRole).toString());
+
+ if (files.isEmpty() && !lineEdit()->text().isEmpty())
+ files = typedFiles();
+
+ return files;
+}
+
QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesToFix) const
{
QStringList files;
@@ -1046,19 +1064,13 @@ QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesT
QStringList QFileDialog::selectedFiles() const
{
Q_D(const QFileDialog);
- if (d->nativeDialogInUse)
- return d->addDefaultSuffixToFiles(d->selectedFiles_sys());
- QModelIndexList indexes = d->qFileDialogUi->listView->selectionModel()->selectedRows();
- QStringList files;
- for (int i = 0; i < indexes.count(); ++i)
- files.append(indexes.at(i).data(QFileSystemModel::FilePathRole).toString());
-
- if (files.isEmpty() && !d->lineEdit()->text().isEmpty())
- files = d->typedFiles();
- const FileMode fm = fileMode();
- if (files.isEmpty() && !(fm == ExistingFile || fm == ExistingFiles))
- files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
+ QStringList files = d->userSelectedFiles();
+ if (files.isEmpty()) {
+ const FileMode fm = fileMode();
+ if (fm != ExistingFile && fm != ExistingFiles)
+ files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
+ }
return files;
}
@@ -1201,9 +1213,11 @@ void QFileDialog::selectNameFilter(const QString &filter)
d->selectNameFilter_sys(filter);
return;
}
- int i;
+ int i = -1;
if (testOption(HideNameFilterDetails)) {
- i = d->qFileDialogUi->fileTypeCombo->findText(qt_strip_filters(qt_make_filter_list(filter)).first());
+ const QStringList filters = qt_strip_filters(qt_make_filter_list(filter));
+ if (!filters.isEmpty())
+ i = d->qFileDialogUi->fileTypeCombo->findText(filters.first());
} else {
i = d->qFileDialogUi->fileTypeCombo->findText(filter);
}
@@ -1770,7 +1784,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
@@ -1855,7 +1869,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
@@ -1942,7 +1956,7 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
dialog.setAcceptMode(AcceptSave);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index b13f36a4d6..592c4a0ac6 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -128,6 +128,7 @@ public:
static QString workingDirectory(const QString &path);
static QString initialSelection(const QString &path);
QStringList typedFiles() const;
+ QStringList userSelectedFiles() const;
QStringList addDefaultSuffixToFiles(const QStringList filesToFix) const;
bool removeDirectory(const QString &path);
void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text);
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index fe7aeae558..fbbc4191bc 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -57,10 +57,6 @@
#include <private/qdialog_p.h>
#include <limits.h>
-#if defined(QT_SOFTKEYS_ENABLED)
-#include <qaction.h>
-#endif
-
QT_BEGIN_NAMESPACE
// If the operation is expected to take this long (as predicted by
@@ -81,9 +77,6 @@ public:
#ifndef QT_NO_SHORTCUT
escapeShortcut(0),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- cancelAction(0),
-#endif
useDefaultCancelText(false)
{
}
@@ -110,9 +103,6 @@ public:
#ifndef QT_NO_SHORTCUT
QShortcut *escapeShortcut;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *cancelAction;
-#endif
bool useDefaultCancelText;
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
@@ -443,16 +433,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
int h = qMax(isVisible() ? height() : 0, sizeHint().height());
resize(w, h);
if (cancelButton)
-#if !defined(QT_SOFTKEYS_ENABLED)
cancelButton->show();
-#else
- {
- d->cancelAction = new QAction(cancelButton->text(), cancelButton);
- d->cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);
- connect(d->cancelAction, SIGNAL(triggered()), this, SIGNAL(canceled()));
- addAction(d->cancelAction);
- }
-#endif
}
/*!
@@ -471,9 +452,6 @@ void QProgressDialog::setCancelButtonText(const QString &cancelButtonText)
if (!cancelButtonText.isNull()) {
if (d->cancel) {
d->cancel->setText(cancelButtonText);
-#ifdef QT_SOFTKEYS_ENABLED
- d->cancelAction->setText(cancelButtonText);
-#endif
} else {
setCancelButton(new QPushButton(cancelButtonText, this));
}
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 58aa474368..7f1cb09225 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -75,10 +75,6 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
#include <string.h> // for memset()
-#ifdef QT_SOFTKEYS_ENABLED
-#include "qaction.h"
-#endif
-
QT_BEGIN_NAMESPACE
// These fudge terms were needed a few places to obtain pixel-perfect results
@@ -565,12 +561,9 @@ public:
, maximumWidth(QWIDGETSIZE_MAX)
, maximumHeight(QWIDGETSIZE_MAX)
{
- for (int i = 0; i < QWizard::NButtons; ++i) {
+ for (int i = 0; i < QWizard::NButtons; ++i)
btns[i] = 0;
-#ifdef QT_SOFTKEYS_ENABLED
- softKeys[i] = 0;
-#endif
- }
+
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
@@ -657,9 +650,6 @@ public:
QLabel *titleLabel;
QLabel *subTitleLabel;
QWizardRuler *bottomRuler;
-#ifdef QT_SOFTKEYS_ENABLED
- mutable QAction *softKeys[QWizard::NButtons];
-#endif
QVBoxLayout *pageVBoxLayout;
QHBoxLayout *buttonLayout;
@@ -1387,28 +1377,6 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
if (which < QWizard::NStandardButtons)
pushButton->setText(buttonDefaultText(wizStyle, which, this));
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *softKey = new QAction(pushButton->text(), pushButton);
- QAction::SoftKeyRole softKeyRole;
- switch(which) {
- case QWizard::NextButton:
- case QWizard::FinishButton:
- case QWizard::CancelButton:
- softKeyRole = QAction::NegativeSoftKey;
- break;
- case QWizard::BackButton:
- case QWizard::CommitButton:
- case QWizard::HelpButton:
- case QWizard::CustomButton1:
- case QWizard::CustomButton2:
- case QWizard::CustomButton3:
- default:
- softKeyRole = QAction::PositiveSoftKey;
- break;
- }
- softKey->setSoftKeyRole(softKeyRole);
- softKeys[which] = softKey;
-#endif
connectButton(which);
}
return true;
@@ -1422,10 +1390,6 @@ void QWizardPrivate::connectButton(QWizard::WizardButton which) const
} else {
QObject::connect(btns[which], SIGNAL(clicked()), q, SLOT(_q_emitCustomButtonClicked()));
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- QObject::connect(softKeys[which], SIGNAL(triggered()), btns[which], SIGNAL(clicked()));
-#endif
}
void QWizardPrivate::updateButtonTexts()
@@ -1439,9 +1403,6 @@ void QWizardPrivate::updateButtonTexts()
btns[i]->setText(buttonCustomTexts.value(i));
else if (i < QWizard::NStandardButtons)
btns[i]->setText(buttonDefaultText(wizStyle, i, this));
-#ifdef QT_SOFTKEYS_ENABLED
- softKeys[i]->setText(btns[i]->text());
-#endif
}
}
}
@@ -1686,19 +1647,6 @@ void QWizardPrivate::_q_updateButtonStates()
}
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAbstractButton *wizardButton;
- for (int i = 0; i < QWizard::NButtons; ++i) {
- wizardButton = btns[i];
- if (wizardButton && !wizardButton->testAttribute(Qt::WA_WState_Hidden)) {
- wizardButton->hide();
- q->addAction(softKeys[i]);
- } else {
- q->removeAction(softKeys[i]);
- }
- }
-#endif
-
enableUpdates();
}
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 8cb6d70d15..0308fb44a9 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -62,7 +62,6 @@
#include <qaccessible.h>
#include <qaccessible2.h>
#endif
-#include <private/qsoftkeymanager_p.h>
#ifndef QT_NO_GESTURE
# include <qscroller.h>
#endif
@@ -95,9 +94,6 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
dropIndicatorPosition(QAbstractItemView::OnItem),
defaultDropAction(Qt::IgnoreAction),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- doneSoftKey(0),
-#endif
autoScroll(true),
autoScrollMargin(16),
autoScrollCount(0),
@@ -139,10 +135,6 @@ void QAbstractItemViewPrivate::init()
viewport->setBackgroundRole(QPalette::Base);
q->setAttribute(Qt::WA_InputMethodEnabled);
-
-#ifdef QT_SOFTKEYS_ENABLED
- doneSoftKey = QSoftKeyManager::createKeyedAction(QSoftKeyManager::DoneSoftKey, Qt::Key_Back, q);
-#endif
}
void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
@@ -1611,11 +1603,6 @@ bool QAbstractItemView::event(QEvent *event)
case QEvent::FontChange:
d->doDelayedItemsLayout(); // the size of the items will change
break;
-#ifdef QT_SOFTKEYS_ENABLED
- case QEvent::LanguageChange:
- d->doneSoftKey->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::DoneSoftKey));
- break;
-#endif
default:
break;
}
@@ -2197,11 +2184,6 @@ void QAbstractItemView::focusOutEvent(QFocusEvent *event)
Q_D(QAbstractItemView);
QAbstractScrollArea::focusOutEvent(event);
d->viewport->update();
-
-#ifdef QT_SOFTKEYS_ENABLED
- if(!hasEditFocus())
- removeAction(d->doneSoftKey);
-#endif
}
/*!
@@ -2226,23 +2208,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
if (QApplication::keypadNavigationEnabled()) {
if (!hasEditFocus()) {
setEditFocus(true);
-#ifdef QT_SOFTKEYS_ENABLED
- // If we can't keypad navigate to any direction, there is no sense to add
- // "Done" softkey, since it basically does nothing when there is
- // only one widget in screen
- if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal)
- || QWidgetPrivate::canKeypadNavigate(Qt::Vertical))
- addAction(d->doneSoftKey);
-#endif
return;
}
}
break;
case Qt::Key_Back:
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
-#ifdef QT_SOFTKEYS_ENABLED
- removeAction(d->doneSoftKey);
-#endif
setEditFocus(false);
} else {
event->ignore();
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index 5fa658d4b0..99d064ddba 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -402,10 +402,6 @@ public:
Qt::DropAction defaultDropAction;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *doneSoftKey;
-#endif
-
QString keyboardInput;
QElapsedTimer keyboardInputTime;
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index ec5f2d5655..a320e6134a 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -365,14 +365,12 @@ QModelIndex QColumnView::moveCursor(CursorAction cursorAction, Qt::KeyboardModif
return (current.parent());
else
return current;
- break;
case MoveRight:
if (model()->hasChildren(current))
return model()->index(0, 0, current);
else
return current.sibling(current.row() + 1, current.column());
- break;
default:
break;
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index 70750c6006..43cf8afb79 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -53,10 +53,6 @@
#include <qpa/qplatformtheme.h>
#if defined(Q_OS_WIN)
-#if defined(_WIN32_IE)
-# undef _WIN32_IE
-#endif
-# define _WIN32_IE 0x0500
# include <qt_windows.h>
# include <commctrl.h>
# include <objbase.h>
@@ -72,7 +68,7 @@ QT_BEGIN_NAMESPACE
\class QFileIconProvider
\inmodule QtWidgets
-
+
\brief The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes.
*/
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 08f10defb8..e7e3a58670 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1349,6 +1349,8 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order)
// This is so that people can set the position of the sort indicator before the fill the model
int old = d->sortIndicatorSection;
+ if (old == logicalIndex && order == d->sortIndicatorOrder)
+ return;
d->sortIndicatorSection = logicalIndex;
d->sortIndicatorOrder = order;
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 5f24c3ea1b..09e59579b8 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -560,7 +560,7 @@ void QExpandingLineEdit::updateMinimumWidth()
QStyleOptionFrameV2 opt;
initStyleOption(&opt);
-
+
int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, 0).
expandedTo(QApplication::globalStrut()), this).width();
setMinimumWidth(minWidth);
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index fa5a62805f..6a330fc7cb 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -538,9 +538,9 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
- // let the editor take up all available space
+ // let the editor take up all available space
//if the editor is not a QLineEdit
- //or it is in a QTableView
+ //or it is in a QTableView
#if !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT)
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 80abb050ee..d84dc608b9 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -2198,7 +2198,7 @@ int QTableView::sizeHintForRow(int row) const
option.rect.setX(columnViewportPosition(index.column()));
option.rect.setWidth(columnWidth(index.column()));
}
-
+
QWidget *editor = d->editorForIndex(index).widget.data();
if (editor && d->persistent.contains(editor)) {
hint = qMax(hint, editor->sizeHint().height());
@@ -2206,7 +2206,7 @@ int QTableView::sizeHintForRow(int row) const
int max = editor->maximumSize().height();
hint = qBound(min, hint, max);
}
-
+
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).height());
}
@@ -2251,7 +2251,7 @@ int QTableView::sizeHintForColumn(int column) const
if (d->verticalHeader->isSectionHidden(logicalRow))
continue;
index = d->model->index(logicalRow, column, d->root);
-
+
QWidget *editor = d->editorForIndex(index).widget.data();
if (editor && d->persistent.contains(editor)) {
hint = qMax(hint, editor->sizeHint().width());
@@ -2259,7 +2259,7 @@ int QTableView::sizeHintForColumn(int column) const
int max = editor->maximumSize().width();
hint = qBound(min, hint, max);
}
-
+
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).width());
}
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index ece5b21ae2..bcaf8dc2c3 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1716,7 +1716,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
// we have to split the focus rect into two rects
if (allColumnsShowFocus && !option.showDecorationSelected
&& header->sectionsMoved() && (header->visualIndex(0) != 0)) {
- QRect sectionRect(0, y, header->sectionPosition(0), height);
+ QRect sectionRect(0, y, header->sectionPosition(0), height);
o.rect = style()->visualRect(layoutDirection(), d->viewport->rect(), sectionRect);
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter);
}
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 5305f64cc9..f689e87f8d 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -1477,7 +1477,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, QTreeWidgetItem *after
/*!
Destroys this tree widget item.
-
+
The item will be removed from \l{QTreeWidget}s to which it has
been added. This makes it safe to delete an item at any time.
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index 0108b80dcf..c1e2bd8b77 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\class QTreeWidgetItemIterator
\ingroup model-view
\inmodule QtWidgets
-
+
\brief The QTreeWidgetItemIterator class provides a way to iterate over the
items in a QTreeWidget instance.
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index b2f05e3cab..4d3d7c4e0a 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -33,8 +33,6 @@ HEADERS += \
kernel/qstandardgestures_p.h \
kernel/qgesturerecognizer.h \
kernel/qgesturemanager_p.h \
- kernel/qsoftkeymanager_p.h \
- kernel/qsoftkeymanager_common_p.h \
kernel/qdesktopwidget_qpa_p.h \
kernel/qwidgetwindow_qpa_p.h
@@ -59,7 +57,6 @@ SOURCES += \
kernel/qstandardgestures.cpp \
kernel/qgesturerecognizer.cpp \
kernel/qgesturemanager.cpp \
- kernel/qsoftkeymanager.cpp \
kernel/qdesktopwidget.cpp \
kernel/qwidgetsvariant.cpp \
kernel/qapplication_qpa.cpp \
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index e835f927d0..64b856ea96 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -81,9 +81,8 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
- forceEnabledInSoftkeys(false), menuActionSoftkeys(false),
iconVisibleInMenu(-1),
- menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
+ menuRole(QAction::TextHeuristicRole),
priority(QAction::NormalPriority)
{
#ifndef QT_NO_SHORTCUT
@@ -280,27 +279,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
File menu in your menubar and the File menu has a submenu, setting the
MenuRole for the actions in that submenu have no effect. They will never be moved.
*/
-#ifndef qdoc
-/*! \since 4.6
- \enum QAction::SoftKeyRole
-
- This enum describes how an action should be placed in the softkey bar. Currently this enum only
- has an effect on the Symbian platform.
-
- \value NoSoftKey This action should not be used as a softkey
- \value PositiveSoftKey This action is used to describe a softkey with a positive or non-destructive
- role such as Ok, Select, or Options.
- \value NegativeSoftKey This action is used to describe a soft ey with a negative or destructive role
- role such as Cancel, Discard, or Close.
- \value SelectSoftKey This action is used to describe a role that selects a particular item or widget
- in the application.
-
- Actions with a softkey role defined are only visible in the softkey bar when the widget containing
- the action has focus. If no widget currently has focus, the softkey framework will traverse up the
- widget parent hierarchy looking for a widget containing softkey actions.
- */
-#endif
/*!
Constructs an action with \a parent. If \a parent is an action
group the action will be automatically inserted into the group.
@@ -1287,34 +1266,6 @@ QAction::MenuRole QAction::menuRole() const
return d->menuRole;
}
-#ifndef qdoc
-/*!
- \property QAction::softKeyRole
- \brief the action's softkey role
- \since 4.6
-
- This indicates what type of role this action describes in the softkey framework
- on platforms where such a framework is supported. Currently this is only
- supported on the Symbian platform.
-
- The softkey role can be changed any time.
-*/
-void QAction::setSoftKeyRole(SoftKeyRole softKeyRole)
-{
- Q_D(QAction);
- if (d->softKeyRole == softKeyRole)
- return;
-
- d->softKeyRole = softKeyRole;
- d->sendDataChanged();
-}
-
-QAction::SoftKeyRole QAction::softKeyRole() const
-{
- Q_D(const QAction);
- return d->softKeyRole;
-}
-#endif
/*!
\property QAction::iconVisibleInMenu
\brief Whether or not an action should show an icon in a menu
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index e149975de7..6a3c0bee68 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -66,9 +66,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject
Q_DECLARE_PRIVATE(QAction)
Q_ENUMS(MenuRole)
-#ifndef qdoc
- Q_ENUMS(SoftKeyRole)
-#endif
Q_ENUMS(Priority)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
@@ -87,9 +84,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject
#endif
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY changed)
Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole NOTIFY changed)
-#ifndef qdoc
- Q_PROPERTY(SoftKeyRole softKeyRole READ softKeyRole WRITE setSoftKeyRole NOTIFY changed)
-#endif
Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu NOTIFY changed)
Q_PROPERTY(Priority priority READ priority WRITE setPriority)
@@ -97,10 +91,6 @@ public:
// note this is copied into qplatformmenu.h, which must stay in sync
enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
AboutRole, PreferencesRole, QuitRole };
-#ifndef qdoc
- enum SoftKeyRole {
- NoSoftKey, PositiveSoftKey, NegativeSoftKey, SelectSoftKey };
-#endif
enum Priority { LowPriority = 0,
NormalPriority = 128,
HighPriority = 256};
@@ -178,10 +168,6 @@ public:
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
-#ifndef qdoc
- void setSoftKeyRole(SoftKeyRole softKeyRole);
- SoftKeyRole softKeyRole() const;
-#endif
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 6e25427b31..32c55e6de2 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -106,13 +106,9 @@ public:
uint separator : 1;
uint fontSet : 1;
- //for soft keys management
- uint forceEnabledInSoftkeys : 1;
- uint menuActionSoftkeys : 1;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
QAction::MenuRole menuRole;
- QAction::SoftKeyRole softKeyRole;
QAction::Priority priority;
QList<QWidget *> widgets;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 3e0f803f5d..efa52456e8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -902,7 +902,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::Resize
|| event->type() == QEvent::Move
|| event->type() == QEvent::LanguageChange
- || event->type() == QEvent::UpdateSoftKeys
|| event->type() == QEvent::InputMethod)) {
for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
const QPostEvent &cur = *it;
@@ -917,8 +916,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
((QMoveEvent *)(cur.event))->p = ((QMoveEvent *)event)->p;
} else if (cur.event->type() == QEvent::LanguageChange) {
;
- } else if (cur.event->type() == QEvent::UpdateSoftKeys) {
- ;
} else if ( cur.event->type() == QEvent::InputMethod ) {
*(QInputMethodEvent *)(cur.event) = *(QInputMethodEvent *)event;
} else {
diff --git a/src/widgets/kernel/qsoftkeymanager.cpp b/src/widgets/kernel/qsoftkeymanager.cpp
deleted file mode 100644
index 64ee6b0f2e..0000000000
--- a/src/widgets/kernel/qsoftkeymanager.cpp
+++ /dev/null
@@ -1,270 +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$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-#include "qevent.h"
-#include "qbitmap.h"
-#include "private/qsoftkeymanager_p.h"
-#include "private/qaction_p.h"
-#include "private/qsoftkeymanager_common_p.h"
-
-#ifndef QT_NO_SOFTKEYMANAGER
-QT_BEGIN_NAMESPACE
-
-QSoftKeyManager *QSoftKeyManagerPrivate::self = 0;
-
-QString QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
-{
- QString softKeyText;
- switch (standardKey) {
- case OkSoftKey:
- softKeyText = QSoftKeyManager::tr("Ok");
- break;
- case SelectSoftKey:
- softKeyText = QSoftKeyManager::tr("Select");
- break;
- case DoneSoftKey:
- softKeyText = QSoftKeyManager::tr("Done");
- break;
- case MenuSoftKey:
- softKeyText = QSoftKeyManager::tr("Options");
- break;
- case CancelSoftKey:
- softKeyText = QSoftKeyManager::tr("Cancel");
- break;
- default:
- break;
- };
-
- return softKeyText;
-}
-
-QSoftKeyManager *QSoftKeyManager::instance()
-{
- if (!QSoftKeyManagerPrivate::self)
- QSoftKeyManagerPrivate::self = new QSoftKeyManager;
-
- return QSoftKeyManagerPrivate::self;
-}
-
-QSoftKeyManager::QSoftKeyManager() :
- QObject(*(new QSoftKeyManagerPrivate), 0)
-{
-}
-
-QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
-{
- QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
- QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
- switch (standardKey) {
- case MenuSoftKey: // FALL-THROUGH
- QActionPrivate::get(action)->menuActionSoftkeys = true;
- case OkSoftKey:
- case SelectSoftKey:
- case DoneSoftKey:
- softKeyRole = QAction::PositiveSoftKey;
- break;
- case CancelSoftKey:
- softKeyRole = QAction::NegativeSoftKey;
- break;
- }
- action->setSoftKeyRole(softKeyRole);
- action->setVisible(false);
- setForceEnabledInSoftkeys(action);
- return action;
-}
-
-/*! \internal
-
- Creates a QAction and registers the 'triggered' signal to send the given key event to
- \a actionWidget as a convenience.
-
-*/
-QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget)
-{
-#ifndef QT_NO_ACTION
- QScopedPointer<QAction> action(createAction(standardKey, actionWidget));
-
- connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent()));
- connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*)));
- QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key);
- return action.take();
-#endif //QT_NO_ACTION
-}
-
-void QSoftKeyManager::cleanupHash(QObject *obj)
-{
- Q_D(QSoftKeyManager);
- QAction *action = qobject_cast<QAction*>(obj);
- d->keyedActions.remove(action);
-}
-
-void QSoftKeyManager::sendKeyEvent()
-{
- Q_D(QSoftKeyManager);
- QAction *action = qobject_cast<QAction*>(sender());
-
- if (!action)
- return;
-
- Qt::Key keyToSend = d->keyedActions.value(action, Qt::Key_unknown);
-
- if (keyToSend != Qt::Key_unknown)
- QApplication::postEvent(action->parentWidget(),
- new QKeyEvent(QEvent::KeyPress, keyToSend, Qt::NoModifier));
-}
-
-void QSoftKeyManager::updateSoftKeys()
-{
- QSoftKeyManager::instance()->d_func()->pendingUpdate = true;
- QEvent *event = new QEvent(QEvent::UpdateSoftKeys);
- QApplication::postEvent(QSoftKeyManager::instance(), event);
-}
-
-bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level)
-{
- Q_D(QSoftKeyManager);
- bool ret = false;
- foreach(QAction *action, source.actions()) {
- if (action->softKeyRole() != QAction::NoSoftKey
- && (action->isVisible() || isForceEnabledInSofkeys(action))) {
- d->requestedSoftKeyActions.insert(level, action);
- ret = true;
- }
- }
- return ret;
-}
-
-
-static bool isChildOf(const QWidget *c, const QWidget *p)
-{
- while (c) {
- if (c == p)
- return true;
- c = c->parentWidget();
- }
- return false;
-}
-
-QWidget *QSoftKeyManager::softkeySource(QWidget *previousSource, bool& recursiveMerging)
-{
- Q_D(QSoftKeyManager);
- QWidget *source = NULL;
- if (!previousSource) {
- // Initial source is primarily focuswidget and secondarily activeWindow
- QWidget *focus = QApplication::focusWidget();
- QWidget *popup = QApplication::activePopupWidget();
- if (popup) {
- if (isChildOf(focus, popup))
- source = focus;
- else
- source = popup;
- }
- if (!source) {
- QWidget *modal = QApplication::activeModalWidget();
- if (modal) {
- if (isChildOf(focus, modal))
- source = focus;
- else
- source = modal;
- }
- }
- if (!source) {
- source = focus;
- if (!source)
- source = QApplication::activeWindow();
- }
- } else {
- // Softkey merging is based on four criterias
- // 1. Implicit merging is used whenever focus widget does not specify any softkeys
- bool implicitMerging = d->requestedSoftKeyActions.isEmpty();
- // 2. Explicit merging with parent is used whenever WA_MergeSoftkeys widget attribute is set
- bool explicitMerging = previousSource->testAttribute(Qt::WA_MergeSoftkeys);
- // 3. Explicit merging with all parents
- recursiveMerging |= previousSource->testAttribute(Qt::WA_MergeSoftkeysRecursively);
- // 4. Implicit and explicit merging always stops at window boundary
- bool merging = (implicitMerging || explicitMerging || recursiveMerging) && !previousSource->isWindow();
-
- source = merging ? previousSource->parentWidget() : NULL;
- }
- return source;
-}
-
-bool QSoftKeyManager::handleUpdateSoftKeys()
-{
- Q_D(QSoftKeyManager);
- int level = 0;
- d->requestedSoftKeyActions.clear();
- bool recursiveMerging = false;
- QWidget *source = softkeySource(NULL, recursiveMerging);
- d->initialSoftKeySource = source;
- while (source) {
- if (appendSoftkeys(*source, level))
- ++level;
- source = softkeySource(source, recursiveMerging);
- }
-
- d->updateSoftKeys_sys();
- d->pendingUpdate = false;
- return true;
-}
-
-void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action)
-{
- QActionPrivate::get(action)->forceEnabledInSoftkeys = true;
-}
-
-bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action)
-{
- return QActionPrivate::get(action)->forceEnabledInSoftkeys;
-}
-
-bool QSoftKeyManager::event(QEvent *e)
-{
-#ifndef QT_NO_ACTION
- if (e->type() == QEvent::UpdateSoftKeys)
- return handleUpdateSoftKeys();
-#endif //QT_NO_ACTION
- return false;
-}
-
-QT_END_NAMESPACE
-#endif //QT_NO_SOFTKEYMANAGER
diff --git a/src/widgets/kernel/qsoftkeymanager_common_p.h b/src/widgets/kernel/qsoftkeymanager_common_p.h
deleted file mode 100644
index 27e1b869ae..0000000000
--- a/src/widgets/kernel/qsoftkeymanager_common_p.h
+++ /dev/null
@@ -1,85 +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 QSOFTKEYMANAGER_COMMON_P_H
-#define QSOFTKEYMANAGER_COMMON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qobject_p.h>
-
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_SOFTKEYMANAGER
-
-QT_BEGIN_NAMESPACE
-
-class QSoftKeyManagerPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QSoftKeyManager)
-
-public:
- virtual void updateSoftKeys_sys() {}
-
-protected:
- static QSoftKeyManager *self;
- QHash<QAction*, Qt::Key> keyedActions;
- QMultiHash<int, QAction*> requestedSoftKeyActions;
- QWidget *initialSoftKeySource;
- bool pendingUpdate;
-};
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_SOFTKEYMANAGER
-
-QT_END_HEADER
-
-#endif // QSOFTKEYMANAGER_COMMON_P_H
diff --git a/src/widgets/kernel/qsoftkeymanager_p.h b/src/widgets/kernel/qsoftkeymanager_p.h
deleted file mode 100644
index a80088d33c..0000000000
--- a/src/widgets/kernel/qsoftkeymanager_p.h
+++ /dev/null
@@ -1,112 +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 QSOFTKEYMANAGER_P_H
-#define QSOFTKEYMANAGER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include "QtWidgets/qaction.h"
-
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_SOFTKEYMANAGER
-QT_BEGIN_NAMESPACE
-
-class QSoftKeyManagerPrivate;
-
-class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QSoftKeyManager)
-
-public:
-
- enum StandardSoftKey {
- OkSoftKey,
- SelectSoftKey,
- DoneSoftKey,
- MenuSoftKey,
- CancelSoftKey
- };
-
- static void updateSoftKeys();
-
- static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget);
- static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget);
- static QString standardSoftKeyText(StandardSoftKey standardKey);
- static void setForceEnabledInSoftkeys(QAction *action);
- static bool isForceEnabledInSofkeys(QAction *action);
-
-protected:
- bool event(QEvent *e);
-
-private:
- QSoftKeyManager();
- static QSoftKeyManager *instance();
- bool appendSoftkeys(const QWidget &source, int level);
- QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging);
- bool handleUpdateSoftKeys();
-
-private Q_SLOTS:
- void cleanupHash(QObject* obj);
- void sendKeyEvent();
-
-private:
- Q_DISABLE_COPY(QSoftKeyManager)
-};
-
-QT_END_NAMESPACE
-#endif //QT_NO_SOFTKEYMANAGER
-
-QT_END_HEADER
-
-#endif //QSOFTKEYMANAGER_P_H
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 07dab9e784..2feb797985 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -77,7 +77,6 @@
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qfileinfo.h"
-#include "private/qsoftkeymanager_p.h"
#include <QtGui/qinputmethod.h>
#include <private/qgraphicseffect_p.h>
@@ -906,30 +905,6 @@ void QWidget::setAutoFillBackground(bool enabled)
\sa QEvent, QPainter, QGridLayout, QBoxLayout
- \section1 Softkeys
-
- Since Qt 4.6, Softkeys are usually physical keys on a device that have a corresponding label or
- other visual representation on the screen that is generally located next to its
- physical counterpart. They are most often found on mobile phone platforms. In
- modern touch based user interfaces it is also possible to have softkeys that do
- not correspond to any physical keys. Softkeys differ from other onscreen labels
- in that they are contextual.
-
- In Qt, contextual softkeys are added to a widget by calling addAction() and
- passing a \c QAction with a softkey role set on it. When the widget
- containing the softkey actions has focus, its softkeys should appear in
- the user interface. Softkeys are discovered by traversing the widget
- hierarchy so it is possible to define a single set of softkeys that are
- present at all times by calling addAction() for a given top level widget.
-
- On some platforms, this concept overlaps with \c QMenuBar such that if no
- other softkeys are found and the top level widget is a QMainWindow containing
- a QMenuBar, the menubar actions may appear on one of the softkeys.
-
- Note: Currently softkeys are only supported on the Symbian Platform.
-
- \sa addAction(), QAction, QMenuBar
-
*/
QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
@@ -7956,9 +7931,6 @@ bool QWidget::event(QEvent *event)
}
break;
case QEvent::FocusIn:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
focusInEvent((QFocusEvent*)event);
d->updateWidgetTransform();
break;
@@ -8109,12 +8081,6 @@ bool QWidget::event(QEvent *event)
if (w && w->isVisible() && !w->isWindow())
QApplication::sendEvent(w, event);
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- if (isWindow())
- QSoftKeyManager::updateSoftKeys();
-#endif
-
break; }
case QEvent::LanguageChange:
@@ -8199,9 +8165,6 @@ bool QWidget::event(QEvent *event)
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
case QEvent::ActionChanged:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
actionEvent((QActionEvent*)event);
break;
#endif
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 900818d5c6..b49441beba 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -234,14 +234,20 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
while (enterParent->parent())
enterParent = enterParent->parent();
if (thisParent == enterParent) {
+ QGuiApplicationPrivate::currentMouseWindow = enterWindow;
enter = enterWindow->widget();
QWindowSystemInterfacePrivate::removeWindowSystemEvent(systemEvent);
}
}
}
- QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
- QApplicationPrivate::dispatchEnterLeave(enter, leave);
- qt_last_mouse_receiver = enter;
+ // Enter-leave between sibling widgets is ignored when there is a mousegrabber - this makes
+ // both native and non-native widgets work similarly.
+ // When mousegrabbing, leaves are only generated if leaving the parent window.
+ if (!enter || !QWidget::mouseGrabber()) {
+ QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
+ QApplicationPrivate::dispatchEnterLeave(enter, leave);
+ qt_last_mouse_receiver = enter;
+ }
} else {
QApplicationPrivate::dispatchEnterLeave(m_widget, 0);
qt_last_mouse_receiver = m_widget;
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index 98d4098634..8c66ec4051 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -69,7 +69,6 @@ static QEvent *cloneEvent(QEvent *e)
return new QEvent(*e);
case QEvent::Leave:
return new QEvent(*e);
- break;
case QEvent::Paint:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
@@ -443,9 +442,6 @@ static QEvent *cloneEvent(QEvent *e)
break;
#endif
- case QEvent::UpdateSoftKeys:
- return new QEvent(*e);
-
case QEvent::User:
case QEvent::MaxUser:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 990245a113..2b6d843723 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1081,13 +1081,9 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const
/*! \internal */
void QCommonStylePrivate::stopAnimation(const QObject *target) const
{
- QStyleAnimation *animation = animations.value(target);
- if (animation) {
- if (animation->state() == QAbstractAnimation::Stopped)
- animations.take(target)->deleteLater();
- else
- animation->stop();
- }
+ QStyleAnimation *animation = animations.take(target);
+ if (animation && animation->state() != QAbstractAnimation::Stopped)
+ animation->stop();
}
/*! \internal */
@@ -2777,7 +2773,6 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget);
else
return subElementRect(QStyle::SE_FrameContents, opt, widget);
- break;
case QFrame::WinPanel:
frameWidth = 2;
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index f1d513bc23..83895b64b0 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -5399,7 +5399,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QStyleOptionGroupBox groupBox(*gb);
groupBox.state |= QStyle::State_Mini; // Force mini-sized checkbox to go with small-sized label
bool didModifySubControls = false;
- if ((widget && !widget->testAttribute(Qt::WA_SetFont))
+ if ((!widget || !widget->testAttribute(Qt::WA_SetFont))
&& QApplication::desktopSettingsAware()) {
groupBox.subControls = groupBox.subControls & ~SC_GroupBoxLabel;
didModifySubControls = true;
@@ -5434,7 +5434,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
case CC_ToolButton:
if (const QStyleOptionToolButton *tb
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
- if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
+
+ if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
if (tb->subControls & SC_ToolButtonMenu) {
QStyleOption arrowOpt(0);
arrowOpt.rect = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
@@ -6030,7 +6031,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
break;
case CC_ToolButton:
ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
- if (sc == SC_ToolButtonMenu && widget && !qobject_cast<QToolBar*>(widget->parentWidget())) {
+ if (sc == SC_ToolButtonMenu && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
ret.adjust(-1, 0, 0, 0);
}
break;
@@ -6176,7 +6177,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
// Do this by add enough space around the contents so that rounded
// borders (including highlighting when active) will show.
sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12;
- sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset;
+ sz.rheight() += 4;
break;
case QStyle::CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index d81532f8a5..0138996e33 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -163,4 +163,49 @@ bool QProgressStyleAnimation::isUpdateNeeded() const
return false;
}
+QNumberStyleAnimation::QNumberStyleAnimation(QObject *target) :
+ QStyleAnimation(target), _start(0.0), _end(1.0), _prev(0.0)
+{
+ setDuration(250);
+}
+
+qreal QNumberStyleAnimation::startValue() const
+{
+ return _start;
+}
+
+void QNumberStyleAnimation::setStartValue(qreal value)
+{
+ _start = value;
+}
+
+qreal QNumberStyleAnimation::endValue() const
+{
+ return _end;
+}
+
+void QNumberStyleAnimation::setEndValue(qreal value)
+{
+ _end = value;
+}
+
+qreal QNumberStyleAnimation::currentValue() const
+{
+ qreal step = qreal(currentTime() - delay()) / (duration() - delay());
+ return _start + qMax(qreal(0), step) * (_end - _start);
+}
+
+bool QNumberStyleAnimation::isUpdateNeeded() const
+{
+ if (QStyleAnimation::isUpdateNeeded()) {
+ qreal current = currentValue();
+ if (!qFuzzyCompare(_prev, current))
+ {
+ _prev = current;
+ return true;
+ }
+ }
+ return false;
+}
+
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index 3188eebebc..d9869533ef 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -110,6 +110,30 @@ private:
mutable int _step;
};
+class QNumberStyleAnimation : public QStyleAnimation
+{
+ Q_OBJECT
+
+public:
+ QNumberStyleAnimation(QObject *target);
+
+ qreal startValue() const;
+ void setStartValue(qreal value);
+
+ qreal endValue() const;
+ void setEndValue(qreal value);
+
+ qreal currentValue() const;
+
+protected:
+ bool isUpdateNeeded() const;
+
+private:
+ qreal _start;
+ qreal _end;
+ mutable qreal _prev;
+};
+
QT_END_NAMESPACE
#endif // QSTYLEANIMATION_P_H
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index e23db2b637..8d67683eae 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -86,6 +86,23 @@ qreal dpiScaled(qreal value)
#endif
}
+// Searches for an ancestor of a particular accessible role
+bool hasAncestor(QObject *obj, QAccessible::Role role)
+{
+ bool found = false;
+#ifndef QT_NO_ACCESSIBILITY
+ QObject *parent = obj ? obj->parent() : 0;
+ while (parent && !found) {
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parent);
+ if (iface && iface->role() == role)
+ found = true;
+ delete iface;
+ parent = parent->parent();
+ }
+#endif // QT_NO_ACCESSIBILITY
+ return found;
+}
+
#ifndef QT_NO_DIAL
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index e47722bd9f..ab6a97e59a 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -44,6 +44,7 @@
#include <QtCore/qstring.h>
#include <QtGui/qpolygon.h>
#include <QtCore/qstringbuilder.h>
+#include <QtGui/qaccessible.h>
#ifndef QSTYLEHELPER_P_H
#define QSTYLEHELPER_P_H
@@ -81,6 +82,7 @@ namespace QStyleHelper
void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
int left = 0, int top = 0, int right = 0,
int bottom = 0);
+ bool hasAncestor(QObject *obj, QAccessible::Role role);
}
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 87c67dc84b..b20e6f5ea5 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -151,12 +151,36 @@ inline QObject *styleObject(const QStyleOption *option) {
return option ? option->styleObject : 0;
}
+/* \internal
+ Checks if we can animate on a style option
+*/
bool canAnimate(const QStyleOption *option) {
return option
&& option->styleObject
&& !option->styleObject->property("_q_no_animation").toBool();
}
+/* \internal
+ Used by animations to clone a styleoption and shift its offset
+*/
+QStyleOption *clonedAnimationStyleOption(const QStyleOption*option) {
+ QStyleOption *styleOption = 0;
+ if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option))
+ styleOption = new QStyleOptionSlider(*slider);
+ else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox*>(option))
+ styleOption = new QStyleOptionSpinBox(*spinbox);
+ else if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox*>(option))
+ styleOption = new QStyleOptionGroupBox(*groupBox);
+ else if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox*>(option))
+ styleOption = new QStyleOptionComboBox(*combo);
+ else if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option))
+ styleOption = new QStyleOptionButton(*button);
+ else
+ styleOption = new QStyleOption(*option);
+ styleOption->rect = QRect(QPoint(0,0), option->rect.size());
+ return styleOption;
+}
+
/*!
\class QWindowsVistaStyle
@@ -402,14 +426,8 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
doTransition = false;
if (doTransition) {
- QStyleOption *styleOption = 0;
- if (const QStyleOptionGroupBox *combo = qstyleoption_cast<const QStyleOptionGroupBox*>(option))
- styleOption = new QStyleOptionGroupBox(*combo);
- else
- styleOption = new QStyleOption(*option);
-
+ QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState;
- styleOption->rect = QRect(QPoint(0,0), newRect.size());
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
@@ -975,16 +993,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
- QStyleOption *styleOption = 0;
- if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox*>(option))
- styleOption = new QStyleOptionComboBox(*combo);
- else if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option))
- styleOption = new QStyleOptionButton(*button);
- else
- styleOption = new QStyleOption(*option);
-
+ QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState;
- styleOption->rect = QRect(QPoint(0,0), newRect.size());
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
startImage.fill(0);
@@ -1664,6 +1674,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
}
if (doTransition) {
+
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
startImage.fill(0);
QPainter startPainter(&startImage);
@@ -1676,15 +1687,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
// Draw the image that ends the animation by using the current styleoption
- QStyleOptionComplex *styleOption = 0;
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option))
- styleOption = new QStyleOptionSlider(*slider);
- else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox*>(option))
- styleOption = new QStyleOptionSpinBox(*spinbox);
- else
- styleOption = new QStyleOptionComplex(*option);
-
- styleOption->rect = QRect(QPoint(0,0), option->rect.size());
+ QStyleOptionComplex *styleOption = qstyleoption_cast<QStyleOptionComplex*>(clonedAnimationStyleOption(option));
styleObject->setProperty("_q_no_animation", true);
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 108e65a2d1..896d5c2213 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -42,12 +42,18 @@
#include "qsystemtrayicon_p.h"
#ifndef QT_NO_SYSTEMTRAYICON
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
+#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
+# undef _WIN32_WINNT
+#endif
+#if !defined(_WIN32_WINNT)
+# define _WIN32_WINNT 0x0600
#endif
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x600
+#if defined(_WIN32_IE) && _WIN32_IE < 0x0600
+# undef _WIN32_IE
+#endif
+#if !defined(_WIN32_IE)
+# define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE
#endif
#include <private/qsystemlibrary_p.h>
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 74b3dc77d3..f22fc196a2 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -64,7 +64,6 @@
#include <private/qcombobox_p.h>
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
-#include <private/qsoftkeymanager_p.h>
#include <qdebug.h>
#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC)
#include <private/qcore_mac_p.h>
@@ -561,13 +560,6 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
#endif
connect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView);
- addAction(selectAction);
- addAction(cancelAction);
-#endif
}
/*!
@@ -617,11 +609,6 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e)
view->setMouseTracking(combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo));
setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo));
-#ifdef QT_SOFTKEYS_ENABLED
- } else if (e->type() == QEvent::LanguageChange) {
- selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
- cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
-#endif
}
QWidget::changeEvent(e);
@@ -822,6 +809,14 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
*/
/*!
+ \fn void QComboBox::currentTextChanged(const QString &text)
+ \since 5.0
+
+ This signal is sent whenever currentText changes. The new value
+ is passed as \a text.
+*/
+
+/*!
Constructs a combobox with the given \a parent, using the default
model QStandardItemModel.
*/
@@ -980,9 +975,12 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
}
if (currentIndex.row() >= topLeft.row() && currentIndex.row() <= bottomRight.row()) {
+ const QString text = q->itemText(currentIndex.row());
if (lineEdit) {
- lineEdit->setText(q->itemText(currentIndex.row()));
+ lineEdit->setText(text);
updateLineEditGeometry();
+ } else {
+ emit q->currentTextChanged(text);
}
q->update();
}
@@ -1242,7 +1240,11 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
{
Q_Q(QComboBox);
emit q->currentIndexChanged(index.row());
- emit q->currentIndexChanged(itemText(index));
+ const QString text = itemText(index);
+ emit q->currentIndexChanged(text);
+ // signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here
+ if (!lineEdit)
+ emit q->currentTextChanged(text);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(q, QAccessible::NameChanged);
QAccessible::updateAccessibility(&event);
@@ -1714,6 +1716,7 @@ void QComboBox::setLineEdit(QLineEdit *edit)
connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed()));
connect(d->lineEdit, SIGNAL(editingFinished()), this, SLOT(_q_editingFinished()));
connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(editTextChanged(QString)));
+ connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(currentTextChanged(QString)));
d->lineEdit->setFrame(false);
d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu);
d->lineEdit->setFocusProxy(this);
@@ -2001,6 +2004,17 @@ void QComboBox::setCurrentIndex(int index)
d->setCurrentIndex(mi);
}
+void QComboBox::setCurrentText(const QString &text)
+{
+ if (isEditable()) {
+ setEditText(text);
+ } else {
+ const int i = findText(text);
+ if (i > -1)
+ setCurrentIndex(i);
+ }
+}
+
void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
{
Q_Q(QComboBox);
@@ -2034,7 +2048,11 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
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
+ The setter setCurrentText() simply calls setEditText() if the combo box is editable.
+ Otherwise, if there is a matching text in the list, currentIndex is set to the
+ corresponding index.
+
+ \sa editable, setEditText()
*/
QString QComboBox::currentText() const
{
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index f1f1b133cb..bce6c98f2c 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -66,7 +66,7 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget
Q_ENUMS(SizeAdjustPolicy)
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(int count READ count)
- Q_PROPERTY(QString currentText READ currentText USER true)
+ Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText NOTIFY currentTextChanged USER true)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems)
Q_PROPERTY(int maxCount READ maxCount WRITE setMaxCount)
@@ -211,6 +211,7 @@ public Q_SLOTS:
void clearEditText();
void setEditText(const QString &text);
void setCurrentIndex(int index);
+ void setCurrentText(const QString &text);
Q_SIGNALS:
void editTextChanged(const QString &);
@@ -220,6 +221,7 @@ Q_SIGNALS:
void highlighted(const QString &);
void currentIndexChanged(int index);
void currentIndexChanged(const QString &);
+ void currentTextChanged(const QString &);
protected:
void focusInEvent(QFocusEvent *e);
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index eaf218283d..c51e6bb388 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -254,10 +254,6 @@ private:
QAbstractItemView *view;
QComboBoxPrivateScroller *top;
QComboBoxPrivateScroller *bottom;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *selectAction;
- QAction *cancelAction;
-#endif
};
class QComboMenuDelegate : public QAbstractItemDelegate
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index d25332a077..f20fc522ba 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -255,31 +255,6 @@ static const uint layouts[2][5][14] =
}
};
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
-class QDialogButtonEnabledProxy : public QObject
-{
-public:
- QDialogButtonEnabledProxy(QObject *parent, QWidget *src, QAction *trg) : QObject(parent), source(src), target(trg)
- {
- source->installEventFilter(this);
- target->setEnabled(source->isEnabled());
- }
- ~QDialogButtonEnabledProxy()
- {
- source->removeEventFilter(this);
- }
- bool eventFilter(QObject *object, QEvent *event)
- {
- if (object == source && event->type() == QEvent::EnabledChange) {
- target->setEnabled(source->isEnabled());
- }
- return false;
- };
-private:
- QWidget *source;
- QAction *target;
-};
-#endif
class QDialogButtonBoxPrivate : public QWidgetPrivate
{
@@ -290,9 +265,6 @@ public:
QList<QAbstractButton *> buttonLists[QDialogButtonBox::NRoles];
QHash<QPushButton *, QDialogButtonBox::StandardButton> standardButtonHash;
-#ifdef QT_SOFTKEYS_ENABLED
- QHash<QAbstractButton *, QAction *> softKeyActions;
-#endif
Qt::Orientation orientation;
QDialogButtonBox::ButtonLayout layoutPolicy;
@@ -312,9 +284,6 @@ public:
void addButtonsToLayout(const QList<QAbstractButton *> &buttonList, bool reverse);
void retranslateStrings();
const char *standardButtonText(QDialogButtonBox::StandardButton sbutton) const;
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role);
-#endif
};
QDialogButtonBoxPrivate::QDialogButtonBoxPrivate(Qt::Orientation orient)
@@ -577,62 +546,10 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked()));
QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed()));
buttonLists[role].append(button);
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = createSoftKey(button, role);
- softKeyActions.insert(button, action);
- new QDialogButtonEnabledProxy(action, button, action);
-#endif
if (doLayout)
layoutButtons();
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
-QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role)
-{
- Q_Q(QDialogButtonBox);
- QAction::SoftKeyRole softkeyRole;
-
- QAction *action = new QAction(button->text(), button);
-
- switch (role) {
- case ApplyRole:
- case AcceptRole:
- case YesRole:
- case ActionRole:
- case HelpRole:
- softkeyRole = QAction::PositiveSoftKey;
- break;
- case RejectRole:
- case DestructiveRole:
- case NoRole:
- case ResetRole:
- softkeyRole = QAction::NegativeSoftKey;
- break;
- default:
- break;
- }
- QObject::connect(action, SIGNAL(triggered()), button, SIGNAL(clicked()));
- action->setSoftKeyRole(softkeyRole);
-
-
- QWidget *dialog = 0;
- QWidget *p = q;
- while (p && !p->isWindow()) {
- p = p->parentWidget();
- if ((dialog = qobject_cast<QDialog *>(p)))
- break;
- }
-
- if (dialog) {
- dialog->addAction(action);
- } else {
- q->addAction(action);
- }
-
- return action;
-}
-#endif
-
void QDialogButtonBoxPrivate::createStandardButtons(QDialogButtonBox::StandardButtons buttons)
{
uint i = QDialogButtonBox::FirstButton;
@@ -724,11 +641,6 @@ void QDialogButtonBoxPrivate::retranslateStrings()
if (buttonText) {
QPushButton *button = it.key();
button->setText(QDialogButtonBox::tr(buttonText));
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = softKeyActions.value(button, 0);
- if (action)
- action->setText(button->text());
-#endif
}
++it;
}
@@ -921,11 +833,6 @@ void QDialogButtonBox::setOrientation(Qt::Orientation orientation)
void QDialogButtonBox::clear()
{
Q_D(QDialogButtonBox);
-#ifdef QT_SOFTKEYS_ENABLED
- // Delete softkey actions as they have the buttons as parents
- qDeleteAll(d->softKeyActions.values());
- d->softKeyActions.clear();
-#endif
// Remove the created standard buttons, they should be in the other lists, which will
// do the deletion
d->standardButtonHash.clear();
@@ -1003,13 +910,6 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
}
}
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = d->softKeyActions.value(button, 0);
- if (action) {
- d->softKeyActions.remove(button);
- delete action;
- }
-#endif
if (!d->internalRemove)
button->setParent(0);
}
@@ -1080,11 +980,6 @@ QPushButton *QDialogButtonBox::addButton(StandardButton button)
void QDialogButtonBox::setStandardButtons(StandardButtons buttons)
{
Q_D(QDialogButtonBox);
-#ifdef QT_SOFTKEYS_ENABLED
- // Delete softkey actions since they have the buttons as parents
- qDeleteAll(d->softKeyActions.values());
- d->softKeyActions.clear();
-#endif
// Clear out all the old standard buttons, then recreate them.
qDeleteAll(d->standardButtonHash.keys());
d->standardButtonHash.clear();
@@ -1242,38 +1137,9 @@ bool QDialogButtonBox::event(QEvent *event)
}
if (!hasDefault && firstAcceptButton)
firstAcceptButton->setDefault(true);
-#ifdef QT_SOFTKEYS_ENABLED
- if (dialog)
- setFixedSize(0,0);
-#endif
}else if (event->type() == QEvent::LanguageChange) {
d->retranslateStrings();
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- else if (event->type() == QEvent::ParentChange) {
- QWidget *dialog = 0;
- QWidget *p = this;
- while (p && !p->isWindow()) {
- p = p->parentWidget();
- if ((dialog = qobject_cast<QDialog *>(p)))
- break;
- }
-
- // If the parent changes, then move the softkeys
- for (QHash<QAbstractButton *, QAction *>::const_iterator it = d->softKeyActions.constBegin();
- it != d->softKeyActions.constEnd(); ++it) {
- QAction *current = it.value();
- QList<QWidget *> widgets = current->associatedWidgets();
- foreach (QWidget *w, widgets)
- w->removeAction(current);
- if (dialog)
- dialog->addAction(current);
- else
- addAction(current);
- }
- }
-#endif
-
return QWidget::event(event);
}
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 71ffbf2847..f18fd4a34b 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -225,6 +225,7 @@ public:
private:
friend class QAbstractSpinBox;
+ friend class QAccessibleLineEdit;
#ifdef QT_KEYPAD_NAVIGATION
friend class QDateTimeEdit;
#endif
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index ffded7839f..fe7e444e86 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -69,7 +69,6 @@
#include "qpushbutton.h"
#include <private/qpushbutton_p.h>
#include <private/qaction_p.h>
-#include <private/qsoftkeymanager_p.h>
#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -158,15 +157,6 @@ void QMenuPrivate::init()
QObject::connect(platformMenu, SIGNAL(aboutToShow()), q, SIGNAL(aboutToShow()));
QObject::connect(platformMenu, SIGNAL(aboutToHide()), q, SIGNAL(aboutToHide()));
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Back, q);
- selectAction->setPriority(QAction::HighPriority);
- cancelAction->setPriority(QAction::HighPriority);
- q->addAction(selectAction);
- q->addAction(cancelAction);
-#endif
}
int QMenuPrivate::scrollerHeight() const
@@ -1674,12 +1664,6 @@ void QMenu::clear()
QList<QAction*> acts = actions();
for(int i = 0; i < acts.size(); i++) {
-#ifdef QT_SOFTKEYS_ENABLED
- Q_D(QMenu);
- // Lets not touch to our internal softkey actions
- if(acts[i] == d->selectAction || acts[i] == d->cancelAction)
- continue;
-#endif
removeAction(acts[i]);
if (acts[i]->parent() == this && acts[i]->d_func()->widgets.isEmpty())
delete acts[i];
@@ -2383,13 +2367,6 @@ QMenu::event(QEvent *e)
}
return true;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- case QEvent::LanguageChange: {
- d->selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
- d->cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
- }
- break;
-#endif
default:
break;
}
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index e53dc2cac2..35c665bb25 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -70,10 +70,6 @@
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
#endif
-#ifdef QT_SOFTKEYS_ENABLED
-#include <private/qsoftkeymanager_p.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QMenuBarExtension : public QToolButton
@@ -719,9 +715,6 @@ void QMenuBarPrivate::init()
#endif
q->setBackgroundRole(QPalette::Button);
oldWindow = oldParent = 0;
-#ifdef QT_SOFTKEYS_ENABLED
- menuBarAction = 0;
-#endif
handleReparent();
q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
@@ -1285,6 +1278,8 @@ void QMenuBar::actionEvent(QActionEvent *e)
}
} else if (menu) {
menu->setText(e->action()->text());
+ menu->setVisible(e->action()->isVisible());
+ menu->setEnabled(e->action()->isEnabled());
d->platformMenuBar->syncMenu(menu);
}
}
@@ -1403,11 +1398,6 @@ void QMenuBar::changeEvent(QEvent *e)
|| e->type() == QEvent::ApplicationFontChange) {
d->itemsDirty = true;
d->updateGeometries();
-#ifdef QT_SOFTKEYS_ENABLED
- } else if (e->type() == QEvent::LanguageChange) {
- if (d->menuBarAction)
- d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey));
-#endif
}
QWidget::changeEvent(e);
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index 4960c60f83..0f08a4e414 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -188,9 +188,6 @@ public:
void wceRefresh();
bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *menuBarAction;
-#endif
};
#endif // QT_NO_MENUBAR