Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ListView crash
Qt 6.11 is out! See what's new in the release blog

ListView crash

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mititelud
    wrote on last edited by
    #1

    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}

    :)

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Seamus Boyle
      wrote on last edited by
      #2

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

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mititelud
        wrote on last edited by
        #3

        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.

        :)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mititelud
          wrote on last edited by
          #4

          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]?

          :)

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Pawan Pal
            wrote on last edited by
            #5

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

            plzzzzzzz help me

            1 Reply Last reply
            0
            • A Offline
              A Offline
              ankursaxena
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mititelud
                wrote on last edited by
                #7

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

                :)

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved