Fix compilation of public headers with QT_NO_DEPRECATED defined
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 30 Apr 2012 12:26:41 +0000 (14:26 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 2 May 2012 09:14:09 +0000 (11:14 +0200)
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 <frederik.gladhorn@nokia.com>
12 files changed:
src/corelib/plugin/qpluginloader.h
src/gui/accessible/qaccessible.cpp
src/gui/accessible/qaccessible.h
src/gui/kernel/qevent.cpp
src/gui/kernel/qevent.h
src/gui/kernel/qguiapplication.cpp
src/gui/kernel/qguiapplication.h
src/gui/kernel/qinputmethod.h
src/gui/kernel/qwindow.cpp
src/gui/kernel/qwindow.h
src/widgets/kernel/qapplication.cpp
src/widgets/kernel/qapplication.h

index 6ca1892..0e62d36 100644 (file)
@@ -69,7 +69,7 @@ public:
 
     QObject *instance();
 
-    QT_DEPRECATED static QObjectList staticInstances();
+    static QObjectList staticInstances();
 
     bool load();
     bool unload();
index e40b51a..0231846 100644 (file)
@@ -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.
index 2e00197..ce7c54e 100644 (file)
@@ -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
index 52f040e..7ac5538 100644 (file)
@@ -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<Attribute> &QInputMethodEvent::attributes() const
index 4c01993..f611fe4 100644 (file)
@@ -458,15 +458,18 @@ public:
     QInputMethodEvent();
     QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
     void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
-    QT_DEPRECATED void setTentativeCommitString(const QString &tentativeCommitString);
-
     inline const QList<Attribute> &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);
 
index 91c2a9d..e7c2b60 100644 (file)
@@ -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()
index 75a0f6c..a741d13 100644 (file)
@@ -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();
index 92ae016..095c17f 100644 (file)
@@ -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);
index b042283..fd271e6 100644 (file)
@@ -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
 {
index 118e3ec..c2c81fd 100644 (file)
@@ -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;
 
index 9950099..385c5ca 100644 (file)
@@ -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)
 {
index 206692e..4aac97a 100644 (file)
@@ -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 *);