Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114000

ActiveX user-defined types not working in Qt 6.1.3 (but work in Qt 5.12.2)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.1.3
    • Active Qt
    • None
    • Windows 10
    • Windows

    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?

      Attachments

        1. comapp.pro
          0.2 kB
        2. comapp.rc
          0.0 kB
        3. main.cpp
          8 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            owolff Oliver Wolff
            antonius Antoine Trux
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes