Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. listview
    Log in to post

    • SOLVED QML ListView freezes with large models - creates and destroys all items
      QML and Qt Quick • qml listview qt6 qt6.4.0 • • eramne  

      12
      0
      Votes
      12
      Posts
      84
      Views

      Defining a handler for a property change signal, and then setting a break point in that handler is my usual technique for finding unwanted changes.
    • UNSOLVED ScrollView in ListView delegate: can't scroll in Qt6 build
      QML and Qt Quick • qml listview scrollview • • RickS  

      1
      0
      Votes
      1
      Posts
      91
      Views

      No one has replied

    • UNSOLVED ListView and scrollable TextArea refreshing problems
      QML and Qt Quick • listview scrollview textarea • • RickS  

      1
      0
      Votes
      1
      Posts
      79
      Views

      No one has replied

    • SOLVED ListView model from Q_PROPERTY problems
      QML and Qt Quick • qml listview qobject qproperty • • Kyeiv  

      2
      0
      Votes
      2
      Posts
      262
      Views

      @Kyeiv said in ListView model from Q_PROPERTY problems: What am i doing wrong that the view is empty? The problem is that QList<QString>() is not a valid type for a QML model! QML model can be QList<QObject*>() or QStringList() (cf https://doc.qt.io/qt-5/qtquick-modelviewsdata-cppmodels.html). Change your Q_PROPERTY from QList<QString> to QStringList and it will work as expected.
    • UNSOLVED ListView scroll and flick speed
      Mobile and Embedded • android listview widgets scroll speed flick speed • • Fitndex-developer  

      1
      0
      Votes
      1
      Posts
      155
      Views

      No one has replied

    • SOLVED Access item inside ListView via delegate
      QML and Qt Quick • qml listview delegate button • • Ratzz  

      14
      0
      Votes
      14
      Posts
      1143
      Views

      @GrecKo , I mean without the button, when I edit the values of TextEdit, I should be able to get the modified text. I tried via property. It always gave me empty
    • UNSOLVED ListView - The add and remove animations remains sometimes stuck in the middle and leaves artifacts
      QML and Qt Quick • listview animations remove stuck add • • jeanmilost  

      1
      0
      Votes
      1
      Posts
      361
      Views

      No one has replied

    • UNSOLVED ListView - Why Space key is never received in Keys.onPressed() signal?
      QML and Qt Quick • listview keyboard keys space keys.onpressed • • jeanmilost  

      3
      0
      Votes
      3
      Posts
      294
      Views

      @LeLev Thank you very much for your answer. It helped me to understand my issue a little more. So I tried your code, and it works, meaning that the ListView isn't eating the Space key. However my interface is a little more complex than this one, it contains other objects like SwipeView, and yes, my items contain components like buttons which may take the focus. However I already tried to deactivate them and even thus the issue remained. I played a while around the code you posted. I noticed that the following code no longer receives any key: Rectangle { anchors.fill: parent color: "transparent" visible: true SwipeView { anchors.fill: parent activeFocusOnTab: false Page { background: null ListView { id: view anchors.fill: parent spacing: 2 focus: true model: ListModel { ListElement { name: "el1" } ListElement { name: "el2" } ListElement { name: "el3" } } delegate: Button { focus: false focusPolicy: Qt.NoFocus onFocusChanged: {if (focus) focus = false;} width: parent.width height: 50 text: index === view.currentIndex ? "currentIndex" : modelData onClicked: { view.currentIndex = index } } Keys.onPressed: { console.warn("key clicked"); if (event.key === Qt.Key_Space) { console.log("space clicked"); console.log(view.model.get(view.currentIndex).name); // view.model.get(ind).name = "new value" event.accepted = true; } } } } } } So I assume that some components operate like filters and may stop internally the keyboard signals, or at least a part of them, without let the choice to the developer to bypass this behavior (or at least I don't know how to do). To be honest I'm a little puzzled, because I worked for15 years with the Windows API before changing for Qt, and receiving a keyboard notification was never an issue, even when the parent component already received it before (in fact it was the contrary: the message could be blocked in the parent, but by default it was passing). So now the question is: in the above code, how can I receive the keyboard signals, and in particular the Space key, in my ListView despite of the parent SwipeView? Or which solution is normally used in a such situation, e.g is there a way to globally listen the keyboard and intercept keys in the Windows level, BEFORE any component receives them?
    • UNSOLVED ListView: position CurrentItem as last visible element?
      QML and Qt Quick • qml listview currentindex • • mks__  

      1
      0
      Votes
      1
      Posts
      217
      Views

      No one has replied

    • UNSOLVED QML ListView's positionViewAtIndex incorrectly modifies currentIndex
      QML and Qt Quick • qml listview • • mks__  

      2
      0
      Votes
      2
      Posts
      331
      Views

      Just an update, not sure if this is the reason for the behavior described above, but I had two ListView properties set to values, which could be contributing to this: preferredHighlightBegin: Math.floor(width/2) preferredHighlightEnd: Math.floor(width/2 + 1) I noticed that to trigger the issue I had to resize the window, so it makes sense to me that once I resized the window the preferredHighlight area would be not in the center, while positionViewAtIndex would position the item exactly at the center, which would then cause currentIndex to be updated to the next item.
    • UNSOLVED Sorting words from SQLite into alphabetical sections
      QML and Qt Quick • listview sqlite • • gabor53  

      1
      0
      Votes
      1
      Posts
      194
      Views

      No one has replied

    • SOLVED ListView - How to refresh rows which content changed without slowdown?
      QML and Qt Quick • listview layout slow refresh force • • jeanmilost  

      3
      0
      Votes
      3
      Posts
      583
      Views

      @jeanmilost said in ListView - How to refresh rows which content changed without slowdown?: view.model.dataChanged(view.model.index(0, columnCount - 1), view.model.index(rowCount - 1, columnCount - 1)); So you are emiting dataChanged from QML? That seems like a bad practice, why can't you do that in the model?
    • UNSOLVED integrating with QAbstractListModel
      QML and Qt Quick • listview signal & slot • • ahmad98  

      1
      0
      Votes
      1
      Posts
      152
      Views

      No one has replied

    • UNSOLVED Listview viewing order
      QML and Qt Quick • listview vieworder • • ThMars  

      6
      0
      Votes
      6
      Posts
      459
      Views

      @ThMars then check the itemsIndex property of the returned object
    • UNSOLVED Emulating ListView as TableView
      QML and Qt Quick • qml listview tableview view • • Ahti  

      6
      0
      Votes
      6
      Posts
      348
      Views

      @fcarney I am new to Qt so don't anything about Loader and Can you please take a look at this question too: https://forum.qt.io/topic/111852/inconsistency-between-model-and-view-while-updating-qsqltablemodel-cell
    • SOLVED Saving memory by freeing off-screen QListView items?
      General and Desktop • listview sql model qlistview qsqltablemodel • • tague  

      10
      0
      Votes
      10
      Posts
      474
      Views

      @Christian-Ehrlicher It caches entries that could have fairly high resolution images in them. 100MB consumed is quite reasonable for my particular use case. I've solved my problem my creating a general-purpose list model class which does not retain too many recent items in memory, and then implementing an application-specific subclass that will automatically produce small, low-resolution thumbnails and save them to a separate table to allow for faster loading later on.
    • SOLVED QML ScrollView binding loop for "contentHeight"
      QML and Qt Quick • qml listview scrollview binding loop • • prex  

      5
      0
      Votes
      5
      Posts
      826
      Views

      @fcarney Easy as that. This works perfectly fine with just a ListView. I added a ScrollBar to it and I have the same without any binding loops. Thanks!
    • SOLVED ListView Header flickers during scrolling
      QML and Qt Quick • qml listview scroll bar • • alexmarian1990  

      1
      0
      Votes
      1
      Posts
      315
      Views

      No one has replied

    • SOLVED How to remove element from ListView by clicking on this element's remove button
      QML and Qt Quick • listview listmodel component • • Kyeiv  

      4
      0
      Votes
      4
      Posts
      3406
      Views

      @Shrinidhi-Upadhyaya Hello ,i want to remove some checked listview elements...for that can you help pls.. Like i created a listview and gave checkbox so i want to remove the items which are checked by clicking one delete button ,some are saying i can use signal slots in cpp and connect to the qml but i really have no idea how to do that,can you please help me with that.
    • SOLVED Insert into ListView with Loader
      QML and Qt Quick • qml listview pyside2 loader • • oscarthorn  

      2
      0
      Votes
      2
      Posts
      337
      Views

      Ah, I found the problem. I was telling beginInserRows I was going to insert at the end and then not inserting at the end. Telling it the right place solved the problem.
    • UNSOLVED How to propagate changes in SingleTon type custom QAbstractListModel on QML ListView?
      QML and Qt Quick • qml listview qabstractlistmo • • qml.newbie  

      3
      0
      Votes
      3
      Posts
      443
      Views

      @VRonin said in How to propagate changes in SingleTon type custom QAbstractListModel on QML ListView?: @qml.newbie said in How to propagate changes in SingleTon type custom QAbstractListModel on QML ListView?: m_hackNewsList.append(HackNews{id, deleted, type, by, time, text, dead, parentId, pollId, kidsIdList, url, score, title, partsIdList, descendantCount}); You need to call beginInsertRows/endInsertRows before/after m_hackNewsList.append(HackNews{id, deleted, type, by, time, text, dead, parentId, pollId, kidsIdList, url, score, title, partsIdList, descendantCount}); I have now added these lines but even now it's not working. Could be down to something I did wrong in the main.cpp where I'm registering the model for qml? The main cpp file is as below. #include <QGuiApplication> #include <QQmlApplicationEngine> #include "NetworkRequestMaker.h" #include "HackNewsModel.h" int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); NetworkRequestMaker testRequestMaker; qmlRegisterType<HackNewsModel>("Hacknews", 1, 0, "HackNewsModel"); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
    • UNSOLVED listView changes are updated only when delegates are destroyed
      QML and Qt Quick • listview delegate • • lionking_dexi  

      5
      0
      Votes
      5
      Posts
      1861
      Views

      @JonB Thank you for your explanation. I understand what i need to do, but i need a little help in making the right signals and slots. My project was setup using the "Using C++ Models in QML {tutorial}" as a guide. here the ToDoList class is set as the data in ToDoListModel class. In the ToDoList Calss there are: 1.appendItem() function, which emits the signals preItemAppended() and postItemAppended() 2.removeItem() funciton, which emits the signals preItemRemoved() and postItemRemoved() [these work fine] 3.similar to the appendItem() and removeItem() I am trying to make a setItemAt() function that will modify the existing data. but there was no steps in the tutorial to indicate how i could notify the model to emit the dataChanged() signal. I tried making my own signal in the data class and a slot in model class but i couldn't figure out how to connect them. the main function has a ToDoList object but no ToDoListModel object (ToDoListModel is just registered to qml). i am only familiar with using the connect(*sender,signal,*receiver, slot) function to connect. I suspect that it has something to do with the 'Q_PROPERTY(ToDoList *list READ list WRITE setList NOTIFY listChanged)' line in the ToDoListModel header file. following the tutorial I removed the NOTIFY listChanged part. summary:which signal do i need to emit from the data class(ToDoList) to have the model class (ToDoListModel) emit the dataChanged() signal?
    • SOLVED Wie muss ich eine QML ListView erstellen damit diese sich so verhält wie eine QListView? Damit meine ich Elemente auswählen (hinterlegung beim Klicken) und bei einem Klick den index des geklickten Elements ermitteln
      German • qml listview • • sm-a  

      3
      0
      Votes
      3
      Posts
      747
      Views

      Hi @J-Hilk vielen vielen Dank. Das hat mir sehr weitergeholfen und es funktioniert jetzt dank Deiner Hilfe. Eine schöne neue Woche wünsche ich Dir. Grüße Sven
    • UNSOLVED endRemoveRows() and QML ListView deleteLater() synchronization
      QML and Qt Quick • qml listview deletelater • • Zaraka  

      2
      0
      Votes
      2
      Posts
      563
      Views

      Had the same problem. Fixed it by not binding the object referenced by the role to a property and using the property but using the role name directly to acces the model item. Instead of property MyItem myItem: model.object text: myItem.foo try text: model.object.foo
    • UNSOLVED ListView won't get updated when I change data in my custom model
      General and Desktop • listview listmodel data models models • • ivarec  

      11
      0
      Votes
      11
      Posts
      975
      Views

      Can we finally see where and how you emit dataChanged()? And with which indexes?
    • How to avoid C++ models in Qt and why you should care
      Announcements • qml listview mvc listmodel architecture • • GTDev  

      2
      2
      Votes
      2
      Posts
      643
      Views

      Waiting for guide "How to avoid JavaScript models in Qt and why should you care" (performance, memory usage)
    • UNSOLVED QML ListView on prepend items to QAbstractListModel, ListView jumps to first element
      QML and Qt Quick • qml listview mobile scrolling qlistmodel • • blacky_i  

      1
      0
      Votes
      1
      Posts
      560
      Views

      No one has replied

    • UNSOLVED create listView with certain items from array
      General and Desktop • listview model array modeldata • • Ldweller  

      1
      0
      Votes
      1
      Posts
      463
      Views

      No one has replied

    • SOLVED Access function/slot loader element in listview
      QML and Qt Quick • listview function loader • • Delta_sim  

      4
      0
      Votes
      4
      Posts
      527
      Views

      Indeed it works ! I did 2 mistakes, I forgot ".item" after currentItem and I didn't changed currentIndex when I switch between pages because I use positionViewAtIndex. But positionViewAtIndex don't change currentIndex of the listView. Thanks guys !
    • UNSOLVED positioning to the top of a listview after having incremented the size of a line
      QML and Qt Quick • listview positioning • • nath  

      1
      0
      Votes
      1
      Posts
      299
      Views

      No one has replied

    • SOLVED Getting CurrentIndex
      QML and Qt Quick • listview currentindex • • gabor53  

      4
      0
      Votes
      4
      Posts
      773
      Views

      @gabor53 If you can provide a complete example then I can see the issue first hand then as it seems like it should work, but it is hard to say without seeing it.
    • SOLVED How to increase the "scrolling height" of a Qml ListView?
      QML and Qt Quick • qml listview quick flickable • • daljit97  

      13
      0
      Votes
      13
      Posts
      3429
      Views

      @GrecKo oh thank you very much. I confused bottomMargin for anchors.bottomMargin. I wasn't aware of this property being available. This is exactly what I needed!
    • UNSOLVED Vertical ListView inside horizontal SwipeView buggy scrolling
      QML and Qt Quick • listview flickable scrolling • • daljit97  

      2
      0
      Votes
      2
      Posts
      665
      Views

      Hi , you can use the SwipeView property interactive, to look when ListView are scrolling and enable in ListView when SwipeView scrolling
    • UNSOLVED What are the ways to implement very smooth auto scroll for three list views at a time in QML?
      QML and Qt Quick • qml listview animation scrolling • • Rohn  

      1
      0
      Votes
      1
      Posts
      442
      Views

      No one has replied

    • UNSOLVED Qt signal from model item to QML slot
      QML and Qt Quick • qml listview signal & slot • • ionick  

      4
      0
      Votes
      4
      Posts
      1506
      Views

      In this case, the color of the model item is being changed somewhere in the backend You don't require to do this. This is where Model View framework comes into picture. color change should automatically taken care by the model itself. I'm assuming that you have written custom model. Are you sending the dataChanged(..) signal whenever data is changed at model ?
    • SOLVED binding QStandardItemModel from C++ with QML
      QML and Qt Quick • qml qtquick listview model binding roles • • fantaz  

      3
      0
      Votes
      3
      Posts
      3554
      Views

      Thanks for the feedback. I have a follow up question though. Where are QML's default role names documented? I couldn't see the list. It would save me a lot of time. EDIT Here they are: link.
    • UNSOLVED Creating a complex List Model in QML
      QML and Qt Quick • listview qtquick2 listmodel • • pra7  

      1
      0
      Votes
      1
      Posts
      461
      Views

      No one has replied