Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.1.3
-
None
-
Windows 10
Description
There seems to be a problem with ActiveX in Qt 6.1.3 when using user-defined types. This problem does not occur in Qt 5.12.2. Here are the steps to reproduce:
01. create directory C:\temp\comapp_with_own_type
02. copy the three files attached to this report (comapp.pro, comapp.rc, main.cpp) into directory C:\temp\comapp_with_own_type:
- comapp.pro is identical to C:\Qt\Examples\Qt-6.1.3\activeqt\comapp\comapp.pro, except it does not include ../shared.pri (which is irrelevant here)
- comapp.rc is identical to C:\Qt\Examples\Qt-6.1.3\activeqt\comapp\comapp.rc
- main.cpp is identical to C:\Qt\Examples\Qt-6.1.3\activeqt\comapp\main.cpp, except we have added our own type Job, which I have downsized to a bare minimum for the purpose of this report
03. in Qt Creator, open project C:\temp\comapp_with_own_type\comapp.pro
04. configure comapp.pro for Qt 5.12.2 MSVC2017 64bit and for Qt 6.1.3 MSVC2019 64bit, Debug mode; the build directories are C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug and C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug
05. build both versions (Qt 5.2.12 and Qt 6.1.3)
06. copy all the DLLs (*.dll) from C:\Qt\5.12.2\msvc2017_64\bin to C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug
07. copy all the DLLs (*.dll) from C:\Qt\6.1.3\msvc2019_64\bin to C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug
08. copy C:\Qt\6.1.3\msvc2019_64\plugins to C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug ; after this, the plugins are in directory C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug\plugins
09. open a PowerShell in administrator mode:
- in "Type here to search" (bottom left of the Windows desktop), type "PowerShell"
- right-click the icon "Windows PowerShell" and select "Run as administrator"
10. in Task Manager, make sure that comapp.exe is not running (i.e., not listed under "Background processes"); if comapp.exe is running, kill it
11. in PowerShell, execute the following commands:
PS C:\WINDOWS\system32> cd C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> .\comapp.exe /regserver
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> $app = New-Object -ComObject comapp.Application
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> $job = $app.newJob()
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> $job
System.__ComObject
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> $job -eq $null
False
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> $job.name = "Foo"
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> $job.getName()
Foo
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug> $app.quit()
PS C:\temp\build-comapp-Desktop_Qt_5_12_2_MSVC2017_64bit-Debug\debug>
As you can see, everything works as expected.
12. open another PowerShell in administrator mode:
- in "Type here to search" (bottom left of the Windows desktop), type "PowerShell"
- right-click the icon "Windows PowerShell" and select "Run as administrator"
13. in Task Manager, make sure that comapp.exe is not running (i.e., not listed under "Background processes"); if comapp.exe is running, kill it
14. in PowerShell, execute the following commands:
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> cd C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> .\comapp.exe /regserver
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> $app = New-Object -ComObject comapp.Application
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> $job = $app.newJob()
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> $job
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> $job -eq $null
True
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> $job.name = "Foo"
The property 'name' cannot be found on this object. Verify that the property exists and can be set.
At line:1 char:1
+ $job.name = "Foo"
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ( [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug> $app.quit()
PS C:\temp\build-comapp-Desktop_Qt_6_1_3_MSVC2019_64bit-Debug\debug>
As you can see, comapp.exe can be started and stopped, but creating an instance of Job fails.
One difference between Qt 5.12.2 and Qt 6.1.3 is that when comapp.exe executes line 2527 of C:\Qt\5.12.2\Src\qtactiveqt\src\activeqt\control\qaxserverbase.cpp:
if (vt == QVariant::UserType)
the condition is true, whereas when comapp.exe executes line 2522 of C:\Qt\6.1.3\Src\qtactiveqt\src\activeqt\control\qaxserverbase.cpp:
if (vt == QMetaType::User)
the condition is false.
Could you please confirm that you are able to reproduce?