summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-01-13 10:18:00 +0100
committerAxel Spoerl <axel.spoerl@qt.io>2023-02-01 19:12:36 +0100
commitbd5589de658a91676b0cf36e154c19985fb7be88 (patch)
tree8a59de687fad24cd94f432724c1118dd93903ad4
parent93af309a707ea2ab133e281d837ac37b1351fb47 (diff)
QtWidgets: Fix errors about fields from anonymous namespaces (-Werror=subobject-linkage)
Move types to QtPrivate, fixing errors like: error: QCalendarWidgetPrivate’ has a field QCalendarWidgetPrivate::m_model whose type uses the anonymous namespace [-Werror=subobject-linkage] The error appears in CMake Unity (Jumbo) builds apparently due to multiple anonymous namespaces per file. Task-number: QTBUG-109394 Pick-to: 6.5 Change-Id: Id678af4db5633b1b2267425c7751f1312935d5d5 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.cpp7
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp24
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp12
-rw-r--r--src/widgets/kernel/qformlayout.cpp4
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp27
5 files changed, 51 insertions, 23 deletions
diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp
index fa33cf66b8..1b75e526d1 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.cpp
+++ b/src/printsupport/widgets/qprintpreviewwidget.cpp
@@ -14,7 +14,7 @@
QT_BEGIN_NAMESPACE
-namespace {
+namespace QtPrivate {
class PageItem : public QGraphicsItem
{
public:
@@ -136,7 +136,10 @@ protected:
}
};
-} // anonymous namespace
+} // namespace QtPrivate
+
+using GraphicsView = QtPrivate::GraphicsView;
+using PageItem = QtPrivate::PageItem;
class QPrintPreviewWidgetPrivate : public QWidgetPrivate
{
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index fcf96fb14f..8cee74477c 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -49,13 +49,21 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-namespace {
+namespace QtPrivate {
class QColorLuminancePicker;
class QColorPicker;
class QColorShower;
class QWellArray;
+class QColorWell;
class QColorPickingEventFilter;
-} // unnamed namespace
+} // namespace QtPrivate
+
+using QColorLuminancePicker = QtPrivate::QColorLuminancePicker;
+using QColorPicker = QtPrivate::QColorPicker;
+using QColorShower = QtPrivate::QColorShower;
+using QWellArray = QtPrivate::QWellArray;
+using QColorWell = QtPrivate::QColorWell;
+using QColorPickingEventFilter = QtPrivate::QColorPickingEventFilter;
class QColorDialogPrivate : public QDialogPrivate
{
@@ -150,7 +158,7 @@ private:
//////////// QWellArray BEGIN
-namespace {
+namespace QtPrivate {
class QWellArray : public QWidget
{
@@ -465,7 +473,7 @@ void QWellArray::keyPressEvent(QKeyEvent* e)
return;
}
-}
+} // namespace QtPrivate
//////////// QWellArray END
@@ -555,7 +563,7 @@ static inline void rgb2hsv(QRgb rgb, int &h, int &s, int &v)
c.getHsv(&h, &s, &v);
}
-namespace {
+namespace QtPrivate {
class QColorWell : public QWellArray
{
@@ -705,9 +713,13 @@ private:
bool crossVisible;
};
+} // namespace QtPrivate
+
static int pWidth = 220;
static int pHeight = 200;
+namespace QtPrivate {
+
class QColorLuminancePicker : public QWidget
{
Q_OBJECT
@@ -1308,7 +1320,7 @@ QColorShower::QColorShower(QColorDialog *parent)
retranslateStrings();
}
-} // unnamed namespace
+} // namespace QtPrivate
inline QRgb QColorDialogPrivate::currentColor() const { return cs->currentColor(); }
inline int QColorDialogPrivate::currentAlpha() const { return cs->currentAlpha(); }
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 1f4d6aa2e9..f83d7b153c 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -28,17 +28,15 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-namespace {
-struct Message {
- QString content;
- QString type;
-};
-}
-
class QErrorMessagePrivate : public QDialogPrivate
{
Q_DECLARE_PUBLIC(QErrorMessage)
public:
+ struct Message {
+ QString content;
+ QString type;
+ };
+
QPushButton * ok;
QCheckBox * again;
QTextEdit * errors;
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 991b1429d7..7e58273a90 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -13,7 +13,7 @@
QT_BEGIN_NAMESPACE
-namespace {
+namespace QtPrivate {
// Fixed column matrix, stores items as [i11, i12, i21, i22...],
// with FORTRAN-style index operator(r, c).
template <class T, int NumColumns>
@@ -152,7 +152,7 @@ class QFormLayoutPrivate : public QLayoutPrivate
Q_DECLARE_PUBLIC(QFormLayout)
public:
- typedef FixedColumnMatrix<QFormLayoutItem *, ColumnCount> ItemMatrix;
+ typedef QtPrivate::FixedColumnMatrix<QFormLayoutItem *, ColumnCount> ItemMatrix;
QFormLayoutPrivate();
~QFormLayoutPrivate() { }
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 3e03800229..8570232d23 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -37,13 +37,13 @@ enum {
MinimumDayOffset = 1
};
-namespace {
-
static QString formatNumber(int number, int fieldWidth)
{
return QString::number(number).rightJustified(fieldWidth, u'0');
}
+namespace QtPrivate {
+
class QCalendarDateSectionValidator
{
public:
@@ -398,9 +398,11 @@ struct SectionToken {
QCalendarDateSectionValidator *validator;
int repeat;
};
-} // unnamed namespace
-Q_DECLARE_TYPEINFO(SectionToken, Q_PRIMITIVE_TYPE);
-namespace {
+} // namespace QtPrivate
+
+Q_DECLARE_TYPEINFO(QtPrivate::SectionToken, Q_PRIMITIVE_TYPE);
+
+namespace QtPrivate {
class QCalendarDateValidator
{
@@ -1606,7 +1608,20 @@ protected:
}
};
-} // unnamed namespace
+} // namespace QtPrivate
+
+using QCalendarDateSectionValidator = QtPrivate::QCalendarDateSectionValidator;
+using QCalendarDayValidator = QtPrivate::QCalendarDayValidator;
+using QCalendarMonthValidator = QtPrivate::QCalendarMonthValidator;
+using QCalendarYearValidator = QtPrivate::QCalendarYearValidator;
+using QCalendarDateValidator = QtPrivate::QCalendarDateValidator;
+using QPrevNextCalButton = QtPrivate::QPrevNextCalButton;
+using QCalendarDelegate = QtPrivate::QCalendarDelegate;
+using QCalToolButton = QtPrivate::QCalToolButton;
+using QCalendarDelegate = QtPrivate::QCalendarDelegate;
+using QCalendarModel = QtPrivate::QCalendarModel;
+using QCalendarView = QtPrivate::QCalendarView;
+using QCalendarTextNavigator = QtPrivate::QCalendarTextNavigator;
class QCalendarWidgetPrivate : public QWidgetPrivate
{