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

Non-Native Dialog opens file when attempting to open invalid file

    XMLWordPrintable

Details

    • macOS
    • 0f77aff05 (dev), 41e943aed (6.7), 6c94d77ad (6.6), 4a16ed404 (tqtc/lts-6.5)

    Description

      To reproduce, open the richtext Text Edit example.

      In textedit.cpp, add the following line to TextEdit::fileOpen()

      fileDialog.setOption(QFileDialog::DontUseNativeDialog);

      Run the example, open a new blank page and open the dialog to select a file.

      Navigate to a directory that contains a valid and invalid file to open. The exact filetype does not matter.

      Click a valid file once. Double click an invalid file.

      This will result in the valid file you clicked being loaded into the Text Edit.

       

      This is not the expected behavior, which would be nothing happening at all.

       

      The customer who opened the related ticket also provided a fix:

      Modify 'QTreeView::mouseDoubleClickEvent(QMouseEvent *event)` method (around line 1948 of qtreeview.cpp)

       

      • if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this))
        + if ((!style()>styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this))
        &&((d->model->flags(persistent) & Qt::ItemIsEnabled) != 0))

      Attachments

        Issue Links

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

          Activity

            People

              kkyzivat Keith Kyzivat
              kevin.zhang Kevin Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes