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

QDir is missing Q_FLAGS call for the property "Filters"

    XMLWordPrintable

Details

    • 38be0d13830efd2d98281c645c3a60afe05ffece

    Description

      Problem:
      QDir::Filters is not a meta-type
      Impact:
      QDir::Filters not being a meta-type, Qt Designer (or QtScript) can't handle the property as a type.

      As an example, I have a custom QWidget with the following body:
      class MyCustomWidget :public QWidget{
      Q_OBJECT
      Q_PROPERTY(QDir::Filters filters READ filters WRITE setFilters)
      public:
      ...
      void setFilters(const QDir::Filters& filters);
      const QDir::Filters& filters()const;
      };

      If the widget is inside a Designer plugin, then when the Qt Designer is started, the following message is printed:
      MetaProperty::read: Unable to handle unregistered datatype 'QDir::Filters' for property 'MyCustomWidget::filters'

      Solution:
      Call Q_FLAGS(Filter Filters) inside qdir.h in addition to the already existing Q_DECLARE_FLAGS(Filters, Filter) and Q_DECLARE_OPERATORS_FOR_FLAGS(QDir::Filters)

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            finetjul Julien Finet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes