Changes in Qt 6.9's moc lead to compilation errors in dumpcpp's C++
output. There are two separate issues:
1. Type libraries may contain properties/methods that have the same name
as a type that's defined in the TLB. That led to a type vs member
conflict in moc's output. That's resolved in moc itself.
2. In moc's output, types that are declared in the TLB must be qualified
with the TLB's namespace to resolve name conflicts.
This patch does the latter:
When writing the in-memory header file that's passed to moc we qualify
types that belong to the type library with the type library's namespace.
Pick-to: 6.9 6.10
Fixes: QTBUG-136512
Fixes: QTBUG-137347
Change-Id: I27858f145261f0aee392bef46756691ae0360dd2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
ActiveQt redefines three Qt types as structs in IDL files: QRect,
QPoint, and QSize. When dumpcpp is run on a type library that's created
from such an IDL file then it would write forward declarations of these
three types into the type libraries namespace. The resulting code did
not compile.
When writing forward declarations, skip these three types:
struct QRect
struct QPoint
struct QSize
Also include the headers for these three classes. They are actually
already pulled in by the hard-coded qpixmap.h included, but it's more
future-proof to include these explicitly.
Fixes: QTBUG-134098
Pick-to: 6.8 6.9 6.10
Change-Id: I829e41f204216c4b2585f5a7c3940f5c400d43ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
dumpcpp created "invalid" headers. These headers contained one closing
brace too many because we closed the "class scope" as a namespace.
Pick-to: 6.8 6.9
Change-Id: I06b94a0b1437c4994f710aa6d8a5a640d8c4ea39
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
moc does not generate either the "QtPrivate::TypeAndForceComplete<" or
the "uint(" code any more since qtbase commit
da4a6cf78ff42a4f69c2775997ff174ef647f3f3. This will match nothing, so
it's dead code. It also doesn't appear to be necessary any more, as
everything compiles.
There's no explanation of why this was needed in commit
b4d965231e.
Instead of cleaning up what moc is producing, we instead ask it to
produce ActiveQt-compliant code with the hidden --active-qt option.
This allows us to use the Q_OBJECT or Q_OBJECT_FAKE macros for full &
proper meta object, so the moc output matches the declarations. It was
missing the new qt_create_metaobjectdata() private template function
that moc is implementing. And if you don't declare it, then the moc
function won't work.
The function declaration works with both GCC and MSVC due to apparent
bugs (see https://conformance.godbolt.org/z/TEornTf5o).
Fixes: QTBUG-129724
Change-Id: I24a3e1cdcc2258791b13fffda65f2c8de0c450b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
moc can process stdin. When it does, it doesn't produce the #include
directive.
Change-Id: I95b0d396b67f47887addfffd0d16034a48171bf8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
moc's latest revision update (e2290b104fcbf1f7a035ce6a44248b5fe2e471bb
in qtbase) changed the way, method revisions are stored. This change
does not affect the code generated by dumpcpp so increasing the
expected revision is enough.
Change-Id: Iaa921a23cc3e422f5da8a29262cffb107d5b912e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
It generated code overloads of QAxBase::initializeFrom() that
apparently only existed in Qt 3.
Fixes: QTBUG-123533
Pick-to: 6.8 6.7
Change-Id: Ie5f4a416eb41321db4b92023a414c91ea90d789c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
After b83de5f9a43b094bbb77b3aeea77983ea508a2b0 in qtbase, moc
generates complete type information for enum types. ActiveQt declares
enums from type libraries (i.e. on namespace level) also in the
metaobject of each generated class (as we can't inherit the namespace
meta object from each QAxObject class). But those enum types don't
really exist on C++ level. So moc generates incorrectly qualified
enum types.
Augment the post-processing code to detect whether a type that is
actually in the namespace is used as if it was in the class, and
replace the qualifier.
Bump the metaobject revision.
Change-Id: I4d28abaa47a5fa3db70737d006b8e1becf8a51e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The C toupper function is locale-dependent. Given the right locale
(Türkiye, e.g.), toupper(i) is either
- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)
Both results are wrong for the use-cases at hand.
Task-number: QTBUG-109235
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Ia9726f0079c5f2625d97a341836b3d4505db6be1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: I7d7d21564161807692941b12085686711583d556
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Fixes configure time warnings like
CMake Warning at qtbase/cmake/QtToolHelpers.cmake:81 (message):
qt_internal_add_tool's PUBLIC_LIBRARIES option is deprecated, and will be
removed in a future Qt version. Use the LIBRARIES option instead.
Call Stack (most recent call first):
qtactiveqt/tools/dumpdoc/CMakeLists.txt:11 (qt_internal_add_tool)
Change-Id: Ibbd00183cafe6ac8b5c1dd4b30c5cc1948b65b7d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I07739807abcf7d8f305bb17cfdc6edefba49a2b1
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
If a property is declared with a type that is also the name of a member
function, then the generated code will result in conflicts and compile
errors. For instance, a property "AddressEntry" might be of type
"AddressEntry*" and have a getter "AddressEntry", where the type lives
in the same namespace as the current class. This is reproducible with
the qutlook example, which doesn't build.
This issue can also be provoked by valid C++ code, but since moc has
no information about which types are classes or enums, or in which
namespace they live in, we cannot do anything about that problem (yet).
However, dumpcpp has information about which namespace a type live in,
so we can postprocess the moc output and fix the problematic code by
fully qualifying the types used with the namespace they were generated
in.
This slows down dumpcpp runs quite a bit, but those are infrequent as
the type library typically doesn't change.
Fixes: QTBUG-100145
Pick-to: 6.4 6.3
Change-Id: Id9b4656cb1ff2c319e0b87bd22b7e9399e7c410d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Forward-declaring enums causes problems with the moc-generated code.
Introduce a variable to qaxbase storing the preformatted value string.
Task-number: QTBUG-100145
Pick-to: 6.4 6.3
Change-Id: I500353d9788e3ea20bf1cc64172ca1b640976e5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: Ibdefc58cad3b83d0d117fc333de76ccb5177a621
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This change is driven by the deprecation of (some) container count()
in favor of size(), so the int/qsizetype fixes are limited to the
vicinity of count()/size() replacements.
Pick-to: 6.3
Change-Id: If6606c9d4aec9bd1cf361efe8ffdf349ac031e79
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This option will use the control name instead of the UUID for
setControl() in the generated cpp file.
Change-Id: Ib100a53647a3c514bb6fa012268a821c70061079
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Call qt_internal_return_unless_building_tools() directly after
qt_internal_add_tool() to avoid having to special-case code for when
this function only creates imported targets in cross-builds.
Task-number: QTBUG-85084
Change-Id: I04b1f313828d611143c252a5f515f678298de91b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Remove the .pro/.pri project files and the associated
.prev_CMakeLists.txt files.
Task-number: QTBUG-78167
Pick-to: 6.1
Change-Id: I8dea2d3efccf8bae6a4b41779dccfaf5f9f83222
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QWidget/QObject were generated as base classes for the generated class,
which is no longer correct after the introduction of the
QAxBaseWidget/Object classes. Pass the correct base QMetaObject and
simplify the code since there is always a base class now.
Pick-to: 6.1
Change-Id: I822f2de4ce65785cd45dc3b4adf1923efae556be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Introduce QAxBaseObject and QAxBaseWidget providing
the static properties and signals of QAxObject and QAxWidget.
Rename the QAxBase methods to be called from the metacall
implementations of QAxObject and QAxWidget.
Add "classContext" as a real property on this occasion.
Change-Id: Ia4f4e45e091e2d575ed9e6b2dd212139a1146300
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Port the 2 main libraries, examples and tests.
Task-number: QTBUG-78167
Change-Id: I0d00c9fa352a96dcd0e1f42d52e6f15680abd9ed
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
dumpcpp contained an old version of moc code, which is now out
of date. Write out the interface as C++ code and run the real
moc on it to generate this. Some modifications are required.
Remove some asserts that checked on an empty meta object
created in the fallback path of QAxBasePrivate::metaObject()
which was removed by
0bcdc74f55.
Task-number: QTBUG-82945
Change-Id: Ide58bae1440331ea4d5da0fcc74b41f49f09599a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Commit e58b44d557b859b7b55869f1e137aa1bc8968307 in qtbase changes the
meta-object to store string data as an array of offsets and length into
the char array instead of a synthetic QByteArrayData (in the old
format). This is a port to the new data structure.
Change-Id: Ieacfdab69d799f954d9351f8424284b1e6633698
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Prepare for migration to Qt 6 by using QVector where possible.
Otherwise, use auto or typedefs like QVariantList.
Change-Id: I6d385efe1a45a0519cf4bb06a1f6d1ea869e890e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
- Use nullptr, override
- Move the constructor body to the implementation on grounds of
* Avoid code bloat by inlined constructors
* Avoid the ugly C-style cast from IDispatch to IUnknown
since both are just forward-declared in the header
[ChangeLog][ActiveQt] dumpcpp now generates the constructor code
into the .cpp file.
Change-Id: I180f64c2b32793d64080ecb8c4246b44b6c0b615
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
- Use const ref to avoid copies of variables
- Use range-based
- Streamline code a bit; loop over maps directly
instead of key lists
- Avoid repetitive calls to toLatin1()
- Signedness issue converting QVariant::Type
Change-Id: I04ec73548f0a56edea8e3c0e8ee76c23a65aa07b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
- Add override
- Use "= default" for trivial constructors/destructors
- Q_DISABLE_COPY_MOVE to delete move constructors and assignment
Change-Id: If773ad8c092ab8000b268c4231f7f27e5f484e56
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Apply Fixits by Qt Creator with some amendments.
Change-Id: Ia47cee2d55432ddc14635aa593c52d80ab39cc82
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Fix warnings emitted by clang, use default constructors where
applicable.
Remove some unused members.
Change-Id: I287ffa4d884be253ec5272e4266a1645376e7235
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
For MinGW, add {} to make it syntactically valid C++.
Task-number: QTCREATORBUG-22320
Change-Id: I6113fbe91e531ac2b6c087f6813b0608b56bc73b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Done to make single-threaded apartment (STA) usage more explicit.
CoInitializeEx(0, COINIT_APARTMENTTHREADED) does exactly the same as
CoInitialize(0), so there is no change in behavior.
REF: https://docs.microsoft.com/nb-no/windows/desktop/api/combaseapi/nf-combaseapi-coinitializeex
Change-Id: I2e2f77745b4360b1da1e6c284551d0f709aba546
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>