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

[REG 5.5->5.6] The renamed item's information is not available in handler of QFileSystemModel::fileRenamed()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.1
    • 5.6.0
    • Widgets: Itemviews
    • None
    • Windows 7, Linux
    • e27fae353ca9a2d4d5054d32bb3a2622ccf9d889 (qtbase/5.6, 22.4.2016, 5.6.1)

    Description

      Consider the following example:

      1) Create QFIleSystemModel and attach it to a view, connect fileRenamed() signal
      2) Create a subdirectory x1/x2/x3 under the root
      3) Expand x1
      4) Rename x2 to xx
      5) Catch fileRenamed() signal and get the information: m_model->fileInfo(path + '/' + newName).

      Result:

      fileInfo() reports that the directory "xx" doesn't exist

      Using the attached project:

      1) Compile and run
      2) Click "Expand"
      3) Select "x2", press F2 and rename "x2" to "xx"

      Result: in the stderr console you see

      Renamed x2 to xx
      New file exists: false

      Dirty workaround: check the item's information after some time using QTimer::singleShot(10, ...);

      Using qtbug52561.zip:

      "/tmp/watcher-text2"
      "5.6.1 xcb"
      Renamed "x2" to "xx"
      New file exists: "/tmp/watcher-text2/x1/xx" idx= true QModelIndex(0,0,0x254a6d0,QFileSystemModel(0x245a5f0)) 
      exist= false absPath= "/tmp/watcher-text2/xx"
      
      "/tmp/watcher-text2"
      "5.5.1 xcb"
      Renamed "x2" to "xx"
      New file exists: "/tmp/watcher-text2/x1/xx" idx= true QModelIndex(0,0,0x15c0f80,QFileSystemModel(0x158f2e0)) 
      exist= true absPath= "/tmp/watcher-text2/x1/xx"
      

      Attachments

        1. qtbug52561.zip
          3 kB
        2. watcher.zip
          5 kB

        Issue Links

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

          Activity

            People

              avolkov Alexander Volkov
              dmitryrx Dmitry
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes