Bug 510091 - [KConfig Compiler] Incorrect forward declaration of QQmlEngine and QJSEngine inside namespace.
Summary: [KConfig Compiler] Incorrect forward declaration of QQmlEngine and QJSEngine...
Status: CONFIRMED
Alias: None
Product: frameworks-kconfig
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 6.18.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Matthew Dawson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-30 08:41 UTC by Trần Nam Tuấn (Bill)
Modified: 2025-09-30 14:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trần Nam Tuấn (Bill) 2025-09-30 08:41:16 UTC
When using KConfig Compiler with NameSpace and QmlRegistration options enabled, the forward declaration of QQmlEngine and QJSEngine are placed inside the namespace. If the Singleton option is enabled, the final code fails to compile. Specifically, these line in the generated source code:

```
using namespace NameSpace;

// ...

Config *Config::create(QQmlEngine *, QJSEngine *)
{
    // Error: Incomplete type 'Namespace::QQmlEngine' named in nested  name specifier
    QQmlEngine::setObjectOwnership(self(), QQmlEngine::CppOwnership);
    return self();
}
```
Comment 1 Trần Nam Tuấn (Bill) 2025-09-30 08:43:50 UTC
(In reply to Trần Nam Tuấn (Bill) from comment #0)
> When using KConfig Compiler with NameSpace and QmlRegistration options
> enabled, the forward declaration of QQmlEngine and QJSEngine are placed
> inside the namespace. If the Singleton option is enabled, the final code
> fails to compile.
>

Rephrasing: When using KConfig Compiler with NameSpace, Singleton and QmlRegistration options enabled, the forward declaration of QQmlEngine and QJSEngine are placed inside the namespace, which causes the final code to fail to compile.