ListView crash



  • hello,

    i am working on a file browser, using a QAbstractListModel. thing is... i can browse through folders, but if one folder is packed with tones of files and folders the qml crashes.

    i got this function for browsing folders:
    @
    void ModelConcrete::downFolder(QString s)
    {

    m_dir.setFilter(QDir::AllDirs | QDir::Files | QDir::NoDot );    //m_dir is QDir
    m_dir.setSorting(QDir::DirsFirst | QDir::Name);
    m_dir.setPath(m_dir.path()+"/"+s);
    
    beginResetModel();
    m_list.clear();                               //m_list is QList<QFileInfo>
    m_list =  m_dir.entryInfoList();
    endResetModel();
    
    qDebug()<<"downFolder() was called";
    

    }
    @

    the listview is pretty basic... i'm printing list items with Component { Item {Rectangle {text and so on... and the Listview {id: delegate: and so on}



  • Not an answer, but an alternative. Qt has QFileSystemModel:

    bq. The QFileSystemModel class provides a data model for the local filesystem.



  • i am not using qtwidgets, only c++ and qml binding, so i cant use the QFileSystemModel.

    it crashes when it loads the names of the sub-folder and sub-files, in the qml.
    @
    Rectangle
    {
    width: 800
    height: 600
    Component
    {
    id: myDelegate
    Item
    {
    id: itemRoot;
    width: 150
    height: 30
    signal openFile(string fileName);
    Rectangle
    {
    anchors.fill: parent
    anchors.margins: 2
    radius: 10

                Text
                {
                    y:3
                    x:20
                    id: frstname
                    text: name     //sent through the listmodel 
                    color: "black"
                 }
    
                MouseArea
                {
                   //functions calls like browseFolder() and cdUp()
                }
            }
        }
    }
    

    @

    if I change the frstname.text to a static string like "folderName"... i can browse all folders with no problems whatsoever, downside.... all folders are named folderName.
    i tried to send the name of the folder through a connect(obj,signal,obj,slot,Qt::QueuedConnection) and directly also, but i only get the crash if a folder has many subfolders or subfiles.



  • so... QML Text component crashes...but if you use TextEdit or TextInput and use a MouseArea, the TextEdit or TextInput is hacked and it becomes a readonly mode, not writte(a)ble (excuse the english) as expected.

    should i mark the thread as [Solved-ish]?



  • Do you know how to text send from dialog box to main window.

    plzzzzzzz help me



  • Pawan! You should start in new discussion for other topic . Well! you can send text Using socket .!!!



  • the Text item works on someone else's computer.
    my Qt version is screwing me.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.