Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem implementing back function with QfileSystemModel and QlistView



  • Hi,

    I have implemented file system back button function with following
    @
    void Dialog:n_pushButton_pressed()
    {
    QModelIndex indexedit=ui->listView->currentIndex();
    QModelIndex indexparent=indexedit.parent();
    qDebug()<<indexedit;
    qDebug()<<indexparent;
    ui->listView->setRootIndex(indexparent);

    }@

    but this is the output which i have got
    @
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )
    QModelIndex(2,0,0x8920040,QFileSystemModel(0x87e00 a8) )
    QModelIndex(1,0,0x86da1b8,QFileSystemModel(0x87e00 a8) )

    @

    in here back key works only once then button wont update .please help me with this issue ...Thanks


Log in to reply