Fail compilation when QtCharts in the same TU

Because QtGraphs has inherited many of its classes
from QtCharts, the modules have many classes with the same
name. Therefore, mixing QtCharts and QtGraphs headers in
the same TU violates ODR. This patch includes the check for that and
fails compilation with an error message.

Pick-to: 6.8 6.9
Task-number: QTBUG-135691
Change-Id: Ifedc1f6c7cf4823e58b650cd8d14275621a8470e
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
This commit is contained in:
Sami Varanka 2025-05-27 12:14:53 +03:00
parent f4d674e412
commit e5194cb74e
1 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,11 @@
the same class names.
#endif
#ifdef QTCHARTS_HEADERS
#error Mixing QtCharts and QtGraphs in the same TU is unsupported since they use\
the same class names.
#endif
#define QTGRAPHS_HEADERS
#endif