diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets) -include(GenerateExportHeader) +include(ECMGenerateExportHeader) include(CMakePackageConfigHelpers) include(ECMSetupVersion) include(ECMGenerateHeaders) @@ -31,6 +31,8 @@ PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5WidgetsAddonsConfigVersion.cmake" SOVERSION 5) +set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,8 +100,15 @@ add_library(KF5WidgetsAddons ${kwidgetsaddons_SRCS}) -generate_export_header(KF5WidgetsAddons BASE_NAME KWidgetsAddons) add_library(KF5::WidgetsAddons ALIAS KF5WidgetsAddons) +ecm_generate_export_header(KF5WidgetsAddons + BASE_NAME KWidgetsAddons + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 5.0 5.13 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_link_libraries(KF5WidgetsAddons PUBLIC Qt5::Widgets) diff --git a/src/kactionmenu.h b/src/kactionmenu.h --- a/src/kactionmenu.h +++ b/src/kactionmenu.h @@ -60,11 +60,12 @@ KActionMenu(const QIcon &icon, const QString &text, QObject *parent); ~KActionMenu() override; +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** - * @deprecated + * @deprecated Since 5.0. */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void remove(QAction *); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KActionMenu::removeAction(QAction*)") + void remove(QAction *); #endif /** @@ -77,13 +78,14 @@ QAction *insertSeparator(QAction *before); void removeAction(QAction *action); +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * Returns this action's menu as a KMenu, if it is one. * If none exists, one will be created. - * @deprecated use menu() instead. + * @deprecated Since 5.0, use menu() instead. */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - inline KWIDGETSADDONS_DEPRECATED QMenu *popupMenu() + inline KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KActionMenu::menu()") + QMenu *popupMenu() { return menu(); } diff --git a/src/kactionmenu.cpp b/src/kactionmenu.cpp --- a/src/kactionmenu.cpp +++ b/src/kactionmenu.cpp @@ -106,7 +106,7 @@ return button; } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KActionMenu::remove(QAction *cmd) { if (cmd) { diff --git a/src/kmessagebox.h b/src/kmessagebox.h --- a/src/kmessagebox.h +++ b/src/kmessagebox.h @@ -849,11 +849,12 @@ */ KWIDGETSADDONS_EXPORT void setDontShowAgainConfig(KConfig *cfg); -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * @deprecated since 5.0, use setDontShowAgainConfig() */ -KWIDGETSADDONS_DEPRECATED_EXPORT inline void setDontShowAskAgainConfig(KConfig *cfg) { setDontShowAgainConfig(cfg); } +KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KMessageBox::setDontShowAgainConfig(KConfig*)") +KWIDGETSADDONS_EXPORT inline void setDontShowAskAgainConfig(KConfig *cfg) { setDontShowAgainConfig(cfg); } #endif /** diff --git a/src/kmultitabbar.h b/src/kmultitabbar.h --- a/src/kmultitabbar.h +++ b/src/kmultitabbar.h @@ -95,7 +95,7 @@ */ int appendButton(const QIcon &icon, int id = -1, QMenu *popup = nullptr, const QString ¬_used_yet = QString()); -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 13) /** * append a new button to the button area. The button can later on be accessed with button(ID) * eg for connecting signals to it @@ -108,7 +108,8 @@ * @param popup A popup menu which should be displayed if the button is clicked * @param not_used_yet will be used for a popup text in the future */ - KWIDGETSADDONS_DEPRECATED int appendButton(const QPixmap &pic, int id = -1, QMenu *popup = nullptr, const QString ¬_used_yet = QString()); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 13, "Use KMultiTabBar::appendButton(const QIcon&, ...)") + int appendButton(const QPixmap &pic, int id = -1, QMenu *popup = nullptr, const QString ¬_used_yet = QString()); #endif /** @@ -125,7 +126,7 @@ */ int appendTab(const QIcon &icon, int id = -1, const QString &text = QString()); -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 13) /** * append a new tab to the tab area. It can be accessed lateron with tabb(id); * @@ -135,7 +136,8 @@ * @param id an arbitrary ID which can be used later on to identify the tab * @param text if a mode with text is used it will be the tab text, otherwise a mouse over hint */ - KWIDGETSADDONS_DEPRECATED int appendTab(const QPixmap &pic, int id = -1, const QString &text = QString()); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 13, "Use KMultiTabBar::appendTab(const QIcon&, ...)") + int appendTab(const QPixmap &pic, int id = -1, const QString &text = QString()); #endif /** diff --git a/src/kmultitabbar.cpp b/src/kmultitabbar.cpp --- a/src/kmultitabbar.cpp +++ b/src/kmultitabbar.cpp @@ -566,7 +566,7 @@ return 0; } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 13) int KMultiTabBar::appendButton(const QPixmap &pic, int id, QMenu *popup, const QString &x) { // reuse icon variant @@ -597,7 +597,7 @@ return 0; } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 13) int KMultiTabBar::appendTab(const QPixmap &pic, int id, const QString &text) { d->m_internal->appendTab(pic, id, text); diff --git a/src/kratingwidget.h b/src/kratingwidget.h --- a/src/kratingwidget.h +++ b/src/kratingwidget.h @@ -124,11 +124,12 @@ */ void setRating(int rating); +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** - * \deprecated use setRating( int rating ) + * \deprecated Since 5.0, use setRating(int rating) */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void setRating(unsigned int rating); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRatingWidget::setRating(int)") + void setRating(unsigned int rating); #endif /** @@ -138,24 +139,26 @@ */ void setMaxRating(int max); +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** - * \deprecated use setMaxRating( int max ) + * \deprecated Since 5.0, use setMaxRating( int max ) */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void setMaxRating(unsigned int max); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRatingWidget::setMaxRating(int)") + void setMaxRating(unsigned int max); #endif /** * If half steps are enabled (the default) then * one rating step corresponds to half a star. */ void setHalfStepsEnabled(bool enabled); +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** - * \deprecated Use setHalfStepsEnabled + * \deprecated Since 5.0, use setHalfStepsEnabled(bool). */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void setOnlyPaintFullSteps(bool); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRatingWidget::setHalfStepsEnabled(bool)") + void setOnlyPaintFullSteps(bool); #endif /** @@ -184,14 +187,15 @@ */ void setCustomPixmap(const QPixmap &pixmap); +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * Set the pixap to be used to display a rating step. * By default the "rating" pixmap is loaded. * - * \deprecated use setCustomPixmap + * \deprecated Since 5.0, use setCustomPixmap() */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void setPixmap(const QPixmap &); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRatingWidget::setCustomPixmap(const QPixmap&)") + void setPixmap(const QPixmap &); #endif /** diff --git a/src/kratingwidget.cpp b/src/kratingwidget.cpp --- a/src/kratingwidget.cpp +++ b/src/kratingwidget.cpp @@ -55,7 +55,7 @@ delete d; } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KRatingWidget::setPixmap(const QPixmap &pix) { setCustomPixmap(pix); @@ -133,7 +133,7 @@ return d->ratingPainter.halfStepsEnabled(); } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KRatingWidget::setRating(unsigned int rating) { setRating((int)rating); @@ -151,7 +151,7 @@ } } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KRatingWidget::setMaxRating(unsigned int max) { setMaxRating((int)max); @@ -170,7 +170,7 @@ update(); } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KRatingWidget::setOnlyPaintFullSteps(bool fs) { setHalfStepsEnabled(!fs); diff --git a/src/kruler.h b/src/kruler.h --- a/src/kruler.h +++ b/src/kruler.h @@ -128,39 +128,50 @@ */ ~KRuler(); +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * Sets the minimal value of the ruler pointer (default is 0). * * This method calls update() so that the widget is painted after leaving * to the main event loop. * + * @deprecated Since 5.0, use setMinimum(int). **/ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void setMinValue(int); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::setMinimum(int)") + void setMinValue(int); #endif +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * Returns the minimal value of the ruler pointer. + * + * @deprecated Since 5.0, use minimum(). **/ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED int minValue() const; + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::minimum()") + int minValue() const; #endif +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * Sets the maximum value of the ruler pointer (default is 100). * * This method calls update() so that the widget is painted after leaving * to the main event loop. + * + * @deprecated Since 5.0, use setMaximum(). */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void setMaxValue(int); + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::setMaximum(int)") + void setMaxValue(int); #endif +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * Returns the maximal value of the ruler pointer. + * + * @deprecated Since 5.0, use maximum(). */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED int maxValue() const; + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::maximum()") + int maxValue() const; #endif /** @@ -237,8 +248,13 @@ void setShowPointer(bool); bool showPointer() const; -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED void setFrameStyle(int); +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) + /** + * Is a no-op. + * @deprecated Since 5.0. + */ + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "No longer a feature") + void setFrameStyle(int); #endif /** diff --git a/src/kruler.cpp b/src/kruler.cpp --- a/src/kruler.cpp +++ b/src/kruler.cpp @@ -182,31 +182,31 @@ delete d; } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KRuler::setMinValue(int value) { setMinimum(value); } #endif -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) int KRuler::minValue() const { return minimum(); } #endif -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KRuler::setMaxValue(int value) { setMaximum(value); } #endif -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) int KRuler::maxValue() const { @@ -364,7 +364,7 @@ return d->showpointer; } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) void KRuler::setFrameStyle(int) { diff --git a/src/ktoolbarpopupaction.h b/src/ktoolbarpopupaction.h --- a/src/ktoolbarpopupaction.h +++ b/src/ktoolbarpopupaction.h @@ -73,15 +73,16 @@ */ ~KToolBarPopupAction() override; +#if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0) /** * The popup menu that is shown when clicking (some time) on the toolbar * button. You may want to plug items into it on creation, or connect to * aboutToShow for a more dynamic menu. * - * \deprecated use menu() instead + * \deprecated Since 5.0, use menu() instead */ -#ifndef KWIDGETSADDONS_NO_DEPRECATED - KWIDGETSADDONS_DEPRECATED QMenu *popupMenu() const; + KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KToolBarPopupAction::menu()") + QMenu *popupMenu() const; #endif /** diff --git a/src/ktoolbarpopupaction.cpp b/src/ktoolbarpopupaction.cpp --- a/src/ktoolbarpopupaction.cpp +++ b/src/ktoolbarpopupaction.cpp @@ -58,7 +58,7 @@ delete menu(); } -#ifndef KWIDGETSADDONS_NO_DEPRECATED +#if KWIDGETSADDONS_BUILD_DEPRECATED_SINCE(5, 0) QMenu *KToolBarPopupAction::popupMenu() const { return menu();