summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-08-12 13:20:08 (GMT)
committeraxis <qt-info@nokia.com>2009-08-12 15:05:52 (GMT)
commitecb4110040218fafaad8717c7c58de1086d3590d (patch)
tree3d803129114440896ef702c397342e5af77663b6 /src/gui/kernel
parent9bba7e42a2988967507d536c497c54efc791eb67 (diff)
downloadQt-ecb4110040218fafaad8717c7c58de1086d3590d.zip
Qt-ecb4110040218fafaad8717c7c58de1086d3590d.tar.gz
Qt-ecb4110040218fafaad8717c7c58de1086d3590d.tar.bz2
Revised SIP API.
After discussions with Matthias, several things were changed: - the autoSipOnMouseFocus property was removed and replaced with a new style hint, SH_RequestSoftwareInputPanel. This means the style can define when the input panel is launched. - The code which sends RequestSoftwareInputPanel events was moved into its own function, and the widgets call that function. AutoTest: Included and passed RevBy: mae
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication.cpp35
-rw-r--r--src/gui/kernel/qapplication.h4
-rw-r--r--src/gui/kernel/qapplication_p.h1
-rw-r--r--src/gui/kernel/qwidget_p.h14
4 files changed, 14 insertions, 40 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 5d1ef8c..734ba66 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -453,7 +453,6 @@ bool QApplicationPrivate::animate_tooltip = false;
bool QApplicationPrivate::fade_tooltip = false;
bool QApplicationPrivate::animate_toolbox = false;
bool QApplicationPrivate::widgetCount = false;
-bool QApplicationPrivate::auto_sip_on_mouse_focus = false;
#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
bool QApplicationPrivate::inSizeMove = false;
#endif
@@ -1068,7 +1067,6 @@ QApplication::~QApplication()
QApplicationPrivate::animate_tooltip = false;
QApplicationPrivate::fade_tooltip = false;
QApplicationPrivate::widgetCount = false;
- QApplicationPrivate::auto_sip_on_mouse_focus = false;
#ifndef QT_NO_STATEMACHINE
// trigger unregistering of QStateMachine's GUI types
@@ -3460,39 +3458,6 @@ Qt::LayoutDirection QApplication::layoutDirection()
return layout_direction;
}
-/*!
- \property autoSipOnMouseFocus
- \since 4.6
- \brief toggles SIP (software input panel) launch policy
-
- This property holds whether widgets should request a software input
- panel when it is focused with the mouse. This is typically used to
- launch a virtual keyboard on devices which have very few or no keys.
-
- If the property is set to true, the widget asks for an input panel
- on the mouse click which causes the widget to be focused. If the
- property is set to false, the user must click a second time before
- the widget asks for an input panel.
-
- \note If the widget is focused by other means than a mouse click,
- the next click is will trigger an input panel request,
- regardless of the value of this property.
-
- The default is platform dependent.
-
- \sa QEvent::RequestSoftwareInputPanel, QInputContext
-*/
-
-void QApplication::setAutoSipOnMouseFocus(bool enable)
-{
- QApplicationPrivate::auto_sip_on_mouse_focus = enable;
-}
-
-bool QApplication::autoSipOnMouseFocus()
-{
- return QApplicationPrivate::auto_sip_on_mouse_focus;
-}
-
/*!
\obsolete
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index fcb3a7c..1f92b1a 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -97,8 +97,6 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication
Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime)
Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval)
Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval)
- Q_PROPERTY(bool autoSipOnMouseFocus READ autoSipOnMouseFocus
- WRITE setAutoSipOnMouseFocus)
#ifndef QT_NO_WHEELEVENT
Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines)
#endif
@@ -299,8 +297,6 @@ public Q_SLOTS:
#endif
void setAutoSipEnabled(const bool enabled);
bool autoSipEnabled() const;
- void setAutoSipOnMouseFocus(bool);
- bool autoSipOnMouseFocus();
static void closeAllWindows();
static void aboutQt();
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index dc8ea6c..c0f4f39 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -432,7 +432,6 @@ public:
static bool fade_tooltip;
static bool animate_toolbox;
static bool widgetCount; // Coupled with -widgetcount switch
- static bool auto_sip_on_mouse_focus;
#ifdef Q_WS_MAC
static bool native_modal_dialog_active;
#endif
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index f4cd61a..86702ac 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -61,6 +61,7 @@
#include "QtGui/qregion.h"
#include "QtGui/qsizepolicy.h"
#include "QtGui/qstyle.h"
+#include "QtGui/qapplication.h"
#ifdef Q_WS_WIN
#include "QtCore/qt_windows.h"
@@ -461,6 +462,19 @@ public:
QSize adjustedSize() const;
+ inline void handleSoftwareInputPanel(Qt::MouseButton button, bool clickCausedFocus)
+ {
+ Q_Q(QWidget);
+ if (button == Qt::LeftButton && qApp->autoSipEnabled()) {
+ QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
+ q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+ if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
+ QEvent event(QEvent::RequestSoftwareInputPanel);
+ QApplication::sendEvent(q, &event);
+ }
+ }
+ }
+
#ifndef Q_WS_QWS // Almost cross-platform :-)
void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect());