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

Nameclash between QtQuick.Window and internal type of Qt3DQuick3DRenderPlugin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.13.0
    • Qt3D
    • None
    • Win64, VS2017
    • 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

            seanharmer Sean Harmer
            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