- StartWord/EndWord enum values has been logically replaced with StartOfItem/EndOfItem ones
to mention they are not about the word boundaries only.
+* Softkeys API was removed. The following functions and enums were removed:
+ - QAction::setSoftKeyRole()
+ - QAction::softKeyRole()
+ - QAction::SoftKeyRole
+ - Qt::WA_MergeSoftkeys
+ - Qt::WA_MergeSoftkeysRecursively
+ - Qt::WindowSoftkeysVisibleHint
+ - Qt::WindowSoftkeysRespondHint
+
QtGui
-----
* Accessibility has been refactored. The hierachy of accessible objects is implemented via
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "softkeys.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow mw;
- mw.showMaximized();
- return app.exec();
-}
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "softkeys.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- central = new QWidget(this);
- central->setContextMenuPolicy(Qt::NoContextMenu); // explicitly forbid usage of context menu so actions item is not shown menu
- setCentralWidget(central);
-
- // Create text editor and set softkeys to it
- textEditor= new QTextEdit(tr("Navigate in UI to see context sensitive softkeys in action"), this);
- QAction* clear = new QAction(tr("Clear"), this);
- clear->setSoftKeyRole(QAction::NegativeSoftKey);
-
- textEditor->addAction(clear);
-
- ok = new QAction(tr("Ok"), this);
- ok->setSoftKeyRole(QAction::PositiveSoftKey);
- connect(ok, SIGNAL(triggered()), this, SLOT(okPressed()));
-
- cancel = new QAction(tr("Cancel"), this);
- cancel->setSoftKeyRole(QAction::NegativeSoftKey);
- connect(cancel, SIGNAL(triggered()), this, SLOT(cancelPressed()));
-
- infoLabel = new QLabel(tr(""), this);
- infoLabel->setContextMenuPolicy(Qt::NoContextMenu);
-
- toggleButton = new QPushButton(tr("Custom"), this);
- toggleButton->setContextMenuPolicy(Qt::NoContextMenu);
- toggleButton->setCheckable(true);
-
- modeButton = new QPushButton(tr("Loop SK window type"), this);
- modeButton->setContextMenuPolicy(Qt::NoContextMenu);
-
- modeLabel = new QLabel(tr("Normal maximized"), this);
- modeLabel->setContextMenuPolicy(Qt::NoContextMenu);
-
- pushButton = new QPushButton(tr("File Dialog"), this);
- pushButton->setContextMenuPolicy(Qt::NoContextMenu);
-
- QComboBox* comboBox = new QComboBox(this);
- comboBox->setContextMenuPolicy(Qt::NoContextMenu);
- comboBox->insertItems(0, QStringList()
- << QApplication::translate("MainWindow", "Selection1", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("MainWindow", "Selection2", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("MainWindow", "Selection3", 0, QApplication::UnicodeUTF8)
- );
-
- layout = new QGridLayout;
- layout->addWidget(textEditor, 0, 0, 1, 2);
- layout->addWidget(infoLabel, 1, 0, 1, 2);
- layout->addWidget(toggleButton, 2, 0);
- layout->addWidget(pushButton, 2, 1);
- layout->addWidget(comboBox, 3, 0, 1, 2);
- layout->addWidget(modeButton, 4, 0, 1, 2);
- layout->addWidget(modeLabel, 5, 0, 1, 2);
- central->setLayout(layout);
-
- fileMenu = menuBar()->addMenu(tr("&File"));
- exit = new QAction(tr("&Exit"), this);
- fileMenu->addAction(exit);
-
- connect(clear, SIGNAL(triggered()), this, SLOT(clearTextEditor()));
- connect(pushButton, SIGNAL(clicked()), this, SLOT(openDialog()));
- connect(exit, SIGNAL(triggered()), this, SLOT(exitApplication()));
- connect(toggleButton, SIGNAL(clicked()), this, SLOT(setCustomSoftKeys()));
- connect(modeButton, SIGNAL(clicked()), this, SLOT(setMode()));
- pushButton->setFocus();
-}
-
-MainWindow::~MainWindow()
-{
-}
-
-void MainWindow::clearTextEditor()
-{
- textEditor->setText(tr(""));
-}
-
-void MainWindow::openDialog()
-{
- QFileDialog::getOpenFileName(this);
-}
-
-void MainWindow::addSoftKeys()
-{
- addAction(ok);
- addAction(cancel);
-}
-
-void MainWindow::setCustomSoftKeys()
-{
- if (toggleButton->isChecked()) {
- infoLabel->setText(tr("Custom softkeys set"));
- addSoftKeys();
- }
- else {
- infoLabel->setText(tr("Custom softkeys removed"));
- removeAction(ok);
- removeAction(cancel);
- }
-}
-
-void MainWindow::setMode()
-{
- if(isMaximized()) {
- showFullScreen();
- modeLabel->setText(tr("Normal Fullscreen"));
- } else {
- Qt::WindowFlags flags = windowFlags();
- if(flags & Qt::WindowSoftkeysRespondHint) {
- flags |= Qt::WindowSoftkeysVisibleHint;
- flags &= ~Qt::WindowSoftkeysRespondHint;
- setWindowFlags(flags); // Hides visible window
- showFullScreen();
- modeLabel->setText(tr("Fullscreen with softkeys"));
- } else if(flags & Qt::WindowSoftkeysVisibleHint) {
- flags &= ~Qt::WindowSoftkeysVisibleHint;
- flags &= ~Qt::WindowSoftkeysRespondHint;
- setWindowFlags(flags); // Hides visible window
- showMaximized();
- modeLabel->setText(tr("Normal Maximized"));
- } else {
- flags &= ~Qt::WindowSoftkeysVisibleHint;
- flags |= Qt::WindowSoftkeysRespondHint;
- setWindowFlags(flags); // Hides visible window
- showFullScreen();
- modeLabel->setText(tr("Fullscreen with SK respond"));
- }
- }
-}
-
-void MainWindow::exitApplication()
-{
- qApp->exit();
-}
-
-void MainWindow::okPressed()
-{
- infoLabel->setText(tr("OK pressed"));
-}
-
-void MainWindow::cancelPressed()
-{
- infoLabel->setText(tr("Cancel pressed"));
-}
-
-
+++ /dev/null
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Soft Keys
-Exec=/opt/usr/bin/softkeys
-Icon=softkeys
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SOFTKEYS_H
-#define SOFTKEYS_H
-
-#include <QtWidgets>
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-public:
-
-private slots:
- void clearTextEditor();
- void openDialog();
- void addSoftKeys();
- void exitApplication();
- void okPressed();
- void cancelPressed();
- void setCustomSoftKeys();
- void setMode();
-public:
- MainWindow(QWidget *parent = 0);
- ~MainWindow();
-private:
- QGridLayout *layout;
- QWidget *central;
- QTextEdit *textEditor;
- QLabel *infoLabel;
- QPushButton *toggleButton;
- QPushButton *pushButton;
- QPushButton *modeButton;
- QLabel *modeLabel;
- QMenu *fileMenu;
- QAction *addSoftKeysAct;
- QAction *exit;
- QAction *ok;
- QAction *cancel;
-};
-
-//! [0]
-class SoftKey : public QWidget
-{
- Q_OBJECT
-public:
- SoftKey(QWidget *parent = 0);
-};
-//! [0]
-
-#endif
+++ /dev/null
-HEADERS = softkeys.h
-SOURCES += \
- main.cpp \
- softkeys.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/softkeys
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS softkeys.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/softkeys
-INSTALLS += target sources
-
-QT += widgets
-
layout->addWidget(lineEdit);
setLayout(layout);
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *exitAction = new QAction(tr("Exit"), this);
- exitAction->setSoftKeyRole(QAction::NegativeSoftKey);
- connect (exitAction, SIGNAL(triggered()),this, SLOT(close()));
- addAction (exitAction);
-
- Qt::WindowFlags flags = windowFlags();
- flags |= Qt::WindowSoftkeysVisibleHint;
- setWindowFlags(flags);
-#endif
-
connect(lineEdit, SIGNAL(textChanged(QString)),
wigglyWidget, SLOT(setText(QString)));
if (!smallScreen){
#define QT_NO_SOCKS5
#endif
-// QSoftKeyManager
-#if !defined(QT_NO_SOFTKEYMANAGER) && (defined(QT_NO_ACTION))
-#define QT_NO_SOFTKEYMANAGER
-#endif
-
// QSplitter
#if !defined(QT_NO_SPLITTER) && (defined(QT_NO_RUBBERBAND))
#define QT_NO_SPLITTER
Name: QAction
SeeAlso: ???
-Feature: SOFTKEYMANAGER
-Description: Supports softkeys.
-Section: Gui
-Requires: ACTION
-Name: QSoftKeyManager
-SeeAlso: ???
-
Feature: CURSOR
Description: Supports mouse cursors.
Section: Kernel
BypassGraphicsProxyWidget = 0x20000000,
WindowOkButtonHint = 0x00080000,
WindowCancelButtonHint = 0x00100000,
- WindowSoftkeysVisibleHint = 0x40000000,
- WindowSoftkeysRespondHint = 0x80000000,
NoDropShadowWindowHint = 0x40000000
};
WA_WState_AcceptedTouchBeginEvent = 122,
WA_TouchPadAcceptSingleTouchEvents = 123,
- WA_MergeSoftkeys = 124,
- WA_MergeSoftkeysRecursively = 125,
-
WA_X11DoNotAcceptFocus = 126,
WA_MacNoShadow = 127,
\value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single
touch events to be sent to the widget.
- \value WA_MergeSoftkeys Allows widget to merge softkeys with parent widget,
- i.e. widget can set only one softkeys and request softkey implementation
- to take rest of the softkeys from the parent. Note parents are traversed until
- WA_MergeSoftkeys is not set. See also Qt::WA_MergeSoftkeysRecursively
- This attribute currently has effect only on Symbian platforms
-
- \value WA_MergeSoftkeysRecursively Allows widget to merge softkeys recursively
- with all parents. If this attribute is set, the widget parents are traversed until
- window boundary (widget without parent or dialog) is found.
- This attribute currently has effect only on Symbian platforms
-
\value WA_X11DoNotAcceptFocus Asks the window manager to not give focus
to this top level window. This attribute has no effect on non-X11
platforms.
\value WindowCancelButtonHint Adds a Cancel button to the window decoration of a dialog.
Only supported for Windows CE.
- \value WindowSoftkeysVisibleHint Makes softkeys visible when widget is fullscreen.
- Only supported for Symbian.
-
- \value WindowSoftkeysRespondHint Makes softkeys to receive key events even
- when invisible. With this hint the softkey actions are triggered
- even the softkeys are invisible i.e. the window is displayed with
- \c showFullscreen(). Only supported for Symbian.
-
\value WindowTransparentForInput Informs the window system that this window
is used only for output (displaying something) and does not take input.
Therefore input events should pass through as if it wasn't there.
\omitvalue MacGLClearDrawable
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
- \omitvalue UpdateSoftKeys
\omitvalue NativeGesture
*/
RequestSoftwareInputPanel = 199,
CloseSoftwareInputPanel = 200,
- UpdateSoftKeys = 201, // Internal for compressing soft key updates
-
WinIdChange = 203,
#ifndef QT_NO_GESTURES
Gesture = 198,
setResult(0);
bool showSystemDialogFullScreen = false;
- if (showSystemDialogFullScreen) {
- setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
+ if (showSystemDialogFullScreen)
setWindowState(Qt::WindowFullScreen);
- }
show();
QPointer<QDialog> guard = this;
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
QCheckBox * again;
QTextEdit * errors;
QLabel * icon;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *okAction;
-#endif
QQueue<QPair<QString, QString> > pending;
QSet<QString> doNotShow;
QSet<QString> doNotShowType;
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)
{
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
#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
#ifndef QT_NO_SHORTCUT
escapeShortcut(0),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- cancelAction(0),
-#endif
useDefaultCancelText(false)
{
}
#ifndef QT_NO_SHORTCUT
QShortcut *escapeShortcut;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *cancelAction;
-#endif
bool useDefaultCancelText;
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
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
}
/*!
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));
}
#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
, 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))
QLabel *titleLabel;
QLabel *subTitleLabel;
QWizardRuler *bottomRuler;
-#ifdef QT_SOFTKEYS_ENABLED
- mutable QAction *softKeys[QWizard::NButtons];
-#endif
QVBoxLayout *pageVBoxLayout;
QHBoxLayout *buttonLayout;
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;
} 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()
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
}
}
}
}
#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();
}
#include <qaccessible.h>
#include <qaccessible2.h>
#endif
-#include <private/qsoftkeymanager_p.h>
#ifndef QT_NO_GESTURE
# include <qscroller.h>
#endif
dropIndicatorPosition(QAbstractItemView::OnItem),
defaultDropAction(Qt::IgnoreAction),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- doneSoftKey(0),
-#endif
autoScroll(true),
autoScrollMargin(16),
autoScrollCount(0),
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)
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;
}
Q_D(QAbstractItemView);
QAbstractScrollArea::focusOutEvent(event);
d->viewport->update();
-
-#ifdef QT_SOFTKEYS_ENABLED
- if(!hasEditFocus())
- removeAction(d->doneSoftKey);
-#endif
}
/*!
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();
Qt::DropAction defaultDropAction;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *doneSoftKey;
-#endif
-
QString keyboardInput;
QElapsedTimer keyboardInputTime;
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
kernel/qstandardgestures.cpp \
kernel/qgesturerecognizer.cpp \
kernel/qgesturemanager.cpp \
- kernel/qsoftkeymanager.cpp \
kernel/qdesktopwidget.cpp \
kernel/qwidgetsvariant.cpp \
kernel/qapplication_qpa.cpp \
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
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.
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
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)
#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)
// 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};
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
-#ifndef qdoc
- void setSoftKeyRole(SoftKeyRole softKeyRole);
- SoftKeyRole softKeyRole() const;
-#endif
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
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;
|| 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;
((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 {
+++ /dev/null
-/****************************************************************************
-**
-** 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
+++ /dev/null
-/****************************************************************************
-**
-** 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
+++ /dev/null
-/****************************************************************************
-**
-** 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
#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>
\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
}
break;
case QEvent::FocusIn:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
focusInEvent((QFocusEvent*)event);
d->updateWidgetTransform();
break;
if (w && w->isVisible() && !w->isWindow())
QApplication::sendEvent(w, event);
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- if (isWindow())
- QSoftKeyManager::updateSoftKeys();
-#endif
-
break; }
case QEvent::LanguageChange:
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
case QEvent::ActionChanged:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
actionEvent((QActionEvent*)event);
break;
#endif
break;
#endif
- case QEvent::UpdateSoftKeys:
- return new QEvent(*e);
-
case QEvent::User:
case QEvent::MaxUser:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
#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>
#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
}
/*!
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);
QAbstractItemView *view;
QComboBoxPrivateScroller *top;
QComboBoxPrivateScroller *bottom;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *selectAction;
- QAction *cancelAction;
-#endif
};
class QComboMenuDelegate : public QAbstractItemDelegate
}
};
-#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
{
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;
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)
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;
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;
}
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();
}
}
}
-#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);
}
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();
}
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);
}
#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
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
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];
}
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;
}
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
#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));
|| 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);
void wceRefresh();
bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *menuBarAction;
-#endif
};
#endif // QT_NO_MENUBAR
mw.show();
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkeys add extra "Select" and "Back" actions to menu by default.
- // Two first actions will be Select and Back when softkeys are enabled
- int numSoftkeyActions = 2;
-#else
- int numSoftkeyActions = 0;
-#endif
-
QAction *action = new QAction(&actGroup);
action->setText("test one");
while (it.hasNext())
menu.addAction(it.next());
- QCOMPARE((int)menu.actions().size(), 2 + numSoftkeyActions);
+ QCOMPARE((int)menu.actions().size(), 2);
it = QListIterator<QAction*>(actGroup.actions());
while (it.hasNext())
menu.removeAction(it.next());
- QCOMPARE((int)menu.actions().size(), 0 + numSoftkeyActions);
+ QCOMPARE((int)menu.actions().size(), 0);
action = new QAction(&actGroup);
action->setText("test two");
while (it.hasNext())
menu.addAction(it.next());
- QCOMPARE((int)menu.actions().size(), 3 + numSoftkeyActions);
+ QCOMPARE((int)menu.actions().size(), 3);
}
void tst_QActionGroup::testActionInTwoQActionGroup()
void testSignalOrder();
void testDefaultButton_data();
void testDefaultButton();
-#ifdef QT_SOFTKEYS_ENABLED
- void testSoftKeyReparenting();
-#endif
void task191642_default();
private:
QTest::newRow("third accept explicit after add") << 0 << 2 << 2;
}
-static int softKeyCount(QWidget *widget)
-{
- int softkeyCount = 0;
-#ifndef QT_NO_ACTION
- QList<QAction *> actions = widget->actions();
- foreach (QAction *action, actions) {
- if (action->softKeyRole() != QAction::NoSoftKey)
- softkeyCount++;
- }
-#endif
- return softkeyCount;
-}
-
-#ifdef QT_SOFTKEYS_ENABLED
-void tst_QDialogButtonBox::testSoftKeyReparenting()
-{
- QDialog dialog;
- QDialogButtonBox *buttonBox = new QDialogButtonBox;
- buttonBox->addButton(QDialogButtonBox::Ok);
- buttonBox->addButton(QDialogButtonBox::Cancel);
-
-#ifndef QT_NO_ACTION
- QCOMPARE(softKeyCount(&dialog), 0);
- QCOMPARE(softKeyCount(buttonBox), 2);
-#endif
-
- // Were the softkeys re-parented correctly?
- dialog.setLayout(new QVBoxLayout);
- dialog.layout()->addWidget(buttonBox);
-#ifndef QT_NO_ACTION
- QCOMPARE(softKeyCount(&dialog), 2);
- QCOMPARE(softKeyCount(buttonBox), 0);
-#endif
-
- // Softkeys are only added to QDialog, not QWidget
- QWidget *nested = new QWidget;
- nested->setLayout(new QVBoxLayout);
- nested->layout()->addWidget(buttonBox);
-#ifndef QT_NO_ACTION
- QCOMPARE(softKeyCount(nested), 0);
- QCOMPARE(softKeyCount(buttonBox), 2);
-#endif
-}
-#endif
-
void tst_QDialogButtonBox::testDefaultButton()
{
QFETCH(int, whenToSetDefault);
mainwindow.addDockWidget(Qt::LeftDockWidgetArea, &dockwidget4);
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkeys add extra "Select" and "Back" actions to menu by default.
- // Two first actions will be Select and Back when softkeys are enabled
- int numSoftkeyActions = 2;
-#else
- int numSoftkeyActions = 0;
-#endif
-
QMenu *menu = mainwindow.createPopupMenu();
QVERIFY(menu != 0);
QList<QAction *> actions = menu->actions();
- QCOMPARE(actions.size(), 7 + numSoftkeyActions);
+ QCOMPARE(actions.size(), 7);
- QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget1.toggleViewAction());
- QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget2.toggleViewAction());
- QCOMPARE(actions.at(2 + numSoftkeyActions), dockwidget3.toggleViewAction());
- QCOMPARE(actions.at(3 + numSoftkeyActions), dockwidget4.toggleViewAction());
- QVERIFY(actions.at(4 + numSoftkeyActions)->isSeparator());
- QCOMPARE(actions.at(5 + numSoftkeyActions), toolbar1.toggleViewAction());
- QCOMPARE(actions.at(6 + numSoftkeyActions), toolbar2.toggleViewAction());
+ QCOMPARE(actions.at(0), dockwidget1.toggleViewAction());
+ QCOMPARE(actions.at(1), dockwidget2.toggleViewAction());
+ QCOMPARE(actions.at(2), dockwidget3.toggleViewAction());
+ QCOMPARE(actions.at(3), dockwidget4.toggleViewAction());
+ QVERIFY(actions.at(4)->isSeparator());
+ QCOMPARE(actions.at(5), toolbar1.toggleViewAction());
+ QCOMPARE(actions.at(6), toolbar2.toggleViewAction());
delete menu;
menu = mainwindow.createPopupMenu();
QVERIFY(menu != 0);
actions = menu->actions();
- QCOMPARE(actions.size(), 4 + numSoftkeyActions);
+ QCOMPARE(actions.size(), 4);
- QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget2.toggleViewAction());
- QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget3.toggleViewAction());
- QVERIFY(actions.at(2 + numSoftkeyActions)->isSeparator());
- QCOMPARE(actions.at(3 + numSoftkeyActions), toolbar2.toggleViewAction());
+ QCOMPARE(actions.at(0), dockwidget2.toggleViewAction());
+ QCOMPARE(actions.at(1), dockwidget3.toggleViewAction());
+ QVERIFY(actions.at(2)->isSeparator());
+ QCOMPARE(actions.at(3), toolbar2.toggleViewAction());
delete menu;
}
void tst_QMenu::addActionsAndClear()
{
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkeys add extra "Select" and "Back" actions to menu by default.
- // Two first actions will be Select and Back when softkeys are enabled
- int numSoftkeyActions = 2;
-#else
- int numSoftkeyActions = 0;
-#endif
-
- QCOMPARE(menus[0]->actions().count(), 0 + numSoftkeyActions);
+ QCOMPARE(menus[0]->actions().count(), 0);
createActions();
- QCOMPARE(menus[0]->actions().count(), 8 + numSoftkeyActions);
+ QCOMPARE(menus[0]->actions().count(), 8);
menus[0]->clear();
QCOMPARE(menus[0]->actions().count(), 0);
}
int maxWidth =0;
QRect result;
foreach (QAction *action, menu.actions()) {
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkey actions are not widgets and have no geometry.
- if (menu.actionGeometry(action).topLeft() == QPoint(0,0))
- continue;
-#endif
maxWidth = qMax(maxWidth, menu.actionGeometry(action).width());
result |= menu.actionGeometry(action);
QCOMPARE(result.x(), left + hmargin + panelWidth);