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

Nameclash between QtQuick.Window and internal type of Qt3DQuick3DRenderPlugin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.0
    • Fix Version/s: None
    • Component/s: Qt3D
    • Labels:
      None
    • Environment:
      Win64, VS2017
    • Platform/s:
      All

      Description

      consider the following piece of QML code:

      import QtQuick 2.13
      import QtQuick.Window 2.13
      import QtQuick.Scene3D 2.0
      
      import Qt3D.Render 2.0
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      }
      

      Running this piece of code results in a runtime error:

      qrc:/main.qml:9 Only for assigning window surface property
      

      The reason is that Qt3DQuick3DRenderPlugin registers an uncreatable type also named window, although it is just an internal wrapper of QWindow.

      (See https://code.woboq.org/qt5/qt3d/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp.html Line 164.)

      While it is possible to import QtQuick.Windows using an alias, e.g.
      import QtQuick.Window 2.13 as W and then use W.Window { ....
      this should not be neccessary for a number of reasons:

      1. Only standard Qt modules are used. There should be no nameclashes within a single product.
      2. There is no apparent reason why the internal type uses the same name as the publicly documented class Window
      3. The error message is not helpfull without looking into the sourcecode

      This is a follow up to https://forum.qt.io/topic/105826/nameclash-between-qtquick-window-and-qt3d-window/5

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            seanharmer Sean Harmer
            Reporter:
            axeljaeger Axel J├Ąger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes