summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKaloyan Chehlarski <kaloyan.chehlarski@qt.io>2024-08-26 14:08:33 +0200
committerKaloyan Chehlarski <kaloyan.chehlarski@qt.io>2024-08-27 13:09:49 +0200
commitd11709f18d692f4a3431999e90dddf0d7cdf15df (patch)
tree4bdb21f73cf65d316b544958f6e7c6a6360a42a3 /examples
parent87f58bae3265abf671360f727ef4343fcbffd698 (diff)
Fix static logging category deprecation warnings
This is a second attempt at getting rid of the deprecation warnings caused by the new logging category macros in 6.9. These cause build failures on warnings-as-errors configurations, and need to be fixed properly without affecting backwards compatibility. The change introduces a new Q_WEBENGINE_LOGGING_CATEGORY macro, intended to be used across the WebEngine sources. The macro is not exported to users, so the QtPdf example that declares its own logging category uses an #ifdef instead. The new macro is placed in its own header inside src/core/, and is intended to be removed whenever the next LTS release allows us to break compatibility with 6.8, and just directly use Q_STATIC_LOGGING_CATEGORY everywhere. Fixes: QTBUG-127975 Change-Id: I9174dab21bd597c862e569e170161782cc108ece Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/pdfwidgets/pdfviewer/mainwindow.cpp4
-rw-r--r--examples/pdfwidgets/pdfviewer/mainwindow.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.cpp b/examples/pdfwidgets/pdfviewer/mainwindow.cpp
index 25c2cbaab..abe462750 100644
--- a/examples/pdfwidgets/pdfviewer/mainwindow.cpp
+++ b/examples/pdfwidgets/pdfviewer/mainwindow.cpp
@@ -23,7 +23,11 @@ using namespace Qt::StringLiterals;
const qreal zoomMultiplier = qSqrt(2.0);
+#if defined(Q_STATIC_LOGGING_CATEGORY)
+Q_STATIC_LOGGING_CATEGORY(lcExample, "qt.examples.pdfviewer")
+#else
Q_LOGGING_CATEGORY(lcExample, "qt.examples.pdfviewer")
+#endif
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.h b/examples/pdfwidgets/pdfviewer/mainwindow.h
index 7f5a5dbca..009e3c1e0 100644
--- a/examples/pdfwidgets/pdfviewer/mainwindow.h
+++ b/examples/pdfwidgets/pdfviewer/mainwindow.h
@@ -7,8 +7,6 @@
#include <QLoggingCategory>
#include <QMainWindow>
-Q_DECLARE_LOGGING_CATEGORY(lcExample)
-
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;