From 36b3a6ad3818b6c8d0849d5e5d63de22c2a2a430 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 30 Apr 2012 14:26:41 +0200 Subject: Fix compilation of public headers with QT_NO_DEPRECATED defined Put the functions in QT_DEPRECATED_SINCE if possible QPluginLoader::staticInstances is not documented as deprecated, and do not reference any alternative use. So I unmarked it as deprecated. Change-Id: I556c3f3657fb0490dd5543fcc56718fe9bd394e7 Reviewed-by: Frederik Gladhorn --- src/corelib/plugin/qpluginloader.h | 2 +- src/gui/accessible/qaccessible.cpp | 9 +-------- src/gui/accessible/qaccessible.h | 16 ++++++++++++++-- src/gui/kernel/qevent.cpp | 7 ++----- src/gui/kernel/qevent.h | 7 +++++-- src/gui/kernel/qguiapplication.cpp | 9 ++++----- src/gui/kernel/qguiapplication.h | 6 ++++-- src/gui/kernel/qinputmethod.h | 2 ++ src/gui/kernel/qwindow.cpp | 5 +---- src/gui/kernel/qwindow.h | 4 +++- src/widgets/kernel/qapplication.cpp | 14 +++----------- src/widgets/kernel/qapplication.h | 14 +++++++++++--- 12 files changed, 51 insertions(+), 44 deletions(-) diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h index 6ca1892fa9..0e62d3660b 100644 --- a/src/corelib/plugin/qpluginloader.h +++ b/src/corelib/plugin/qpluginloader.h @@ -69,7 +69,7 @@ public: QObject *instance(); - QT_DEPRECATED static QObjectList staticInstances(); + static QObjectList staticInstances(); bool load(); bool unload(); diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index e40b51a74e..02318468bb 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -641,18 +641,11 @@ void QAccessible::setRootObject(QObject *object) } /*! + \fn void QAccessible::updateAccessibility(QObject *object, int child, Event reason) \deprecated Use the version with a single \l QAccessibleEvent paremeter instead. */ -void QAccessible::updateAccessibility(QObject *object, int child, Event reason) -{ - Q_ASSERT(object); - - QAccessibleEvent ev(object, reason); - ev.setChild(child); - updateAccessibility(&ev); -} /*! Notifies about a change that might be relevant for accessibility clients. diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 2e0019705f..ce7c54e00b 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -342,8 +342,9 @@ public: static RootObjectHandler installRootObjectHandler(RootObjectHandler); static QAccessibleInterface *queryAccessibleInterface(QObject *); - - QT_DEPRECATED static void updateAccessibility(QObject *object, int child, Event reason); +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED static inline void updateAccessibility(QObject *object, int child, Event reason); +#endif static void updateAccessibility(QAccessibleEvent *event); static bool isActive(); @@ -626,6 +627,17 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface); Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleEvent &ev); #endif +#if QT_DEPRECATED_SINCE(5, 0) +inline void QAccessible::updateAccessibility(QObject *object, int child, Event reason) +{ + Q_ASSERT(object); + + QAccessibleEvent ev(object, reason); + ev.setChild(child); + updateAccessibility(&ev); +} +#endif + #endif // QT_NO_ACCESSIBILITY QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 52f040e0b2..7ac5538d6e 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1672,16 +1672,13 @@ void QInputMethodEvent::setCommitString(const QString &commitString, int replace } /*! - Sets the tentative commit string to \a tentativeCommitString. + \fn void QInputMethodEvent::setTentativeCommitString(const QString &string) + Sets the tentative commit string to \a string. The tentative commit string is what the preedit string is expected to be committed as. The string can be used within the editor to trigger code that reacts on text changes such as validators. \deprecated */ -void QInputMethodEvent::setTentativeCommitString(const QString &tentativeCommitString) -{ - tentativeCommit = tentativeCommitString; -} /*! \fn const QList &QInputMethodEvent::attributes() const diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 4c019938b8..f611fe4ab7 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -458,15 +458,18 @@ public: QInputMethodEvent(); QInputMethodEvent(const QString &preeditText, const QList &attributes); void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); - QT_DEPRECATED void setTentativeCommitString(const QString &tentativeCommitString); - inline const QList &attributes() const { return attrs; } inline const QString &preeditString() const { return preedit; } inline const QString &commitString() const { return commit; } inline int replacementStart() const { return replace_from; } inline int replacementLength() const { return replace_length; } + +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline void setTentativeCommitString(const QString &string) + { tentativeCommit = string; } QT_DEPRECATED inline const QString &tentativeCommitString() const { return tentativeCommit; } +#endif QInputMethodEvent(const QInputMethodEvent &other); diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 91c2a9d99b..e7c2b60305 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2163,18 +2163,17 @@ QInputMethod *QGuiApplication::inputMethod() const } /*! + \fn QInputPanel *QGuiApplication::inputPanel() const returns the input panel. The input panel returns properties about the state and position of the virtual keyboard. It also provides information about the position of the current focused input element. - \sa QInputPanel + \obsolete + + \sa inputMethod() */ -QInputPanel *QGuiApplication::inputPanel() const -{ - return inputMethod(); -} /*! \fn void QGuiApplication::fontDatabaseChanged() diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 75a0f6cd4b..a741d13eb3 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -90,7 +90,7 @@ public: static QWindow *modalWindow(); -#ifdef QT_DEPRECATED +#if QT_DEPRECATED_SINCE(5, 0) static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); } #endif static QWindow *focusWindow(); @@ -130,7 +130,9 @@ public: static void setDesktopSettingsAware(bool on); static bool desktopSettingsAware(); - QT_DEPRECATED QInputPanel *inputPanel() const; +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED QInputPanel *inputPanel() const { return inputMethod(); } +#endif QInputMethod *inputMethod() const; static QPlatformNativeInterface *platformNativeInterface(); diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h index 92ae016b97..095c17ffd8 100644 --- a/src/gui/kernel/qinputmethod.h +++ b/src/gui/kernel/qinputmethod.h @@ -69,11 +69,13 @@ class Q_GUI_EXPORT QInputMethod : public QObject Q_ENUMS(Action) public: +#ifdef QT_DEPRECATED QT_DEPRECATED QObject *inputItem() const; QT_DEPRECATED void setInputItem(QObject *inputItemChanged); // the window containing the editor QT_DEPRECATED QWindow *inputWindow() const; +#endif QTransform inputItemTransform() const; void setInputItemTransform(const QTransform &transform); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b042283071..fd271e6d6e 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -265,13 +265,10 @@ void QWindow::setVisible(bool visible) } /*! + \fn bool QWindow::visible() const Returns true if the window is set to visible. \obsolete */ -bool QWindow::visible() const -{ - return isVisible(); -} bool QWindow::isVisible() const { diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 118e3ec25f..c2c81fd2d7 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -102,7 +102,9 @@ public: void setSurfaceType(SurfaceType surfaceType); SurfaceType surfaceType() const; - QT_DEPRECATED bool visible() const; +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline bool visible() const { return isVisible(); } +#endif bool isVisible() const; diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 99500998db..385c5caccc 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1954,13 +1954,11 @@ bool QApplication::event(QEvent *e) } /*! + \fn void QApplication::syncX() Was used to synchronize with the X server in 4.x, here for source compatibility. \internal \obsolete */ -void QApplication::syncX() -{ -} void QApplicationPrivate::notifyLayoutDirectionChange() { @@ -4247,26 +4245,20 @@ int QApplication::keyboardInputInterval() */ /*! + \fn QLocale QApplication::keyboardInputLocale() \since 4.2 \obsolete Returns the current keyboard input locale. Replaced with QInputMethod::locale() */ -QLocale QApplication::keyboardInputLocale() -{ - return qApp ? qApp->inputMethod()->locale() : QLocale::c(); -} /*! + \fn Qt::LayoutDirection QApplication::keyboardInputDirection()* \since 4.2 \obsolete Returns the current keyboard input direction. Replaced with QInputMethod::inputDirection() */ -Qt::LayoutDirection QApplication::keyboardInputDirection() -{ - return qApp ? qApp->inputMethod()->inputDirection() : Qt::LeftToRight; -} bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event) { diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 206692e6d4..4aac97aece 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -97,7 +97,9 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication public: QApplication(int &argc, char **argv, int = ApplicationFlags); +#ifdef QT_DEPRECATED QT_DEPRECATED QApplication(int &argc, char **argv, bool GUIenabled, int = ApplicationFlags); +#endif QApplication(int &argc, char **argv, Type, int = ApplicationFlags); virtual ~QApplication(); @@ -145,7 +147,9 @@ public: static QWidget *topLevelAt(const QPoint &p); static inline QWidget *topLevelAt(int x, int y) { return topLevelAt(QPoint(x, y)); } - QT_DEPRECATED static void syncX(); +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED static inline void syncX() {} +#endif static void beep(); static void alert(QWidget *widget, int duration = 0); @@ -182,8 +186,12 @@ public: virtual void saveState(QSessionManager& sm); #endif - QT_DEPRECATED static QLocale keyboardInputLocale(); - QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection(); +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED static QLocale keyboardInputLocale() + { return qApp ? qApp->inputMethod()->locale() : QLocale::c(); } + QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection() + { return qApp ? qApp->inputMethod()->inputDirection() : Qt::LeftToRight; } +#endif static int exec(); bool notify(QObject *, QEvent *); -- cgit v1.2.3