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

"FileDialogDelegate.icon" is not available in QtQuick.Controls.impl 255.255

    XMLWordPrintable

Details

    Description

      I get the following error from https://codereview.qt-project.org/c/qt/qtquickcontrols2/+/318565/20/src/imports/controls/basic/FileDialog.qml#129:

      qrc:/main.qml:13:5: Type FileDialog unavailable
      file:///media/dev2/qt-dev-debug/qtbase/qml/QtQuick/Controls/Basic/FileDialog.qml:129:17: "FileDialogDelegate.icon" is not available in QtQuick.Controls.impl 255.255.
      

      when running this QML (with QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs) in main()):

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Dialogs
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          FileDialog {
              title: "FileDialog"
              visible: true
          }
      }
      

      I tried adding a foreign declaration for it, but it didn't help:

      diff --git a/src/quickcontrols2impl/qtquickcontrols2foreign_p.h b/src/quickcontrols2impl/qtquickcontrols2foreign_p.h
      index 6285e43c5..950d19adc 100644
      --- a/src/quickcontrols2impl/qtquickcontrols2foreign_p.h
      +++ b/src/quickcontrols2impl/qtquickcontrols2foreign_p.h
      @@ -35,6 +35,7 @@
       ****************************************************************************/
       
       #include <QtQml/qqml.h>
      +#include <QtQuickTemplates2/private/qquickicon_p.h>
       #include <QtQuickTemplates2/private/qquickoverlay_p.h>
       #include <QtQuickTemplates2/private/qquicksplitview_p.h>
       
      @@ -73,4 +74,12 @@ struct QQuickSplitHandleAttachedForeign
           QML_ADDED_IN_VERSION(2, 13)
       };
       
      +struct QQuickIconForeign
      +{
      +    Q_GADGET
      +    QML_ANONYMOUS
      +    QML_FOREIGN(QQuickIcon)
      +    QML_ADDED_IN_VERSION(2, 3)
      +};
      +
       QT_END_NAMESPACE
      

      FileDialogDelegate is declared here: https://codereview.qt-project.org/c/qt/qtquickcontrols2/+/318565/20/src/quickcontrols2impl/qquickfiledialogdelegate_p.h#59

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes