qlist

Qt widget for displaying large amount of data rows

左心房为你撑大大i 提交于 2019-11-30 15:24:23
I am trying to display a large amount of columnar records in a scrollable view using Qt (5.1). The number of rows I would like to be able to browse can vary from 100 million to 1 Billion, say. The QTableWidget with a custom model works a few million rows, but the QTableWidget allocates data for each row because you can re-size the rows height, and so it must store data for this, which can use megabytes or even gigabytes of memory with 100M rows. I do not require the re-sizeable rows functionality just a multi-column list would be ideal, but QTreeCtrl doesnt seem to work with many rows, and

关于QFrame继承于QWidget 和 QListWidget也继承于QWidget

爷,独闯天下 提交于 2019-11-30 00:26:31
Reimplemented Protected Functions(重新实现的受保护的方法) 在我测试关于drag and drop (拖放事件)的时候,我发现同样给QFrame和QListWidget添加三个Qlabel组件,QFrame和QListWidget对于鼠标响应事件的处理机制是不同的,后面翻看Qt源代码之后发现: QFrame直接继承于QWidget,对于event(QEvent* e)实现了一次重载。 而QListWidget通过多次继承之后继承于QWidget,在此期间event(QEvent* e)实现了多次重载,具体是做什么没有去细看,可以想象QFrame和QListWidget对于事件的处理是有差别的。 自己做的测试是 :把三个QLabel分别放进QFrame和QListWidget之后对QLabel使用鼠标点击,QFrame和QListWidget都重新实现了mousePressEvent(QMousePressEvent* event),但是只有QFrame对鼠标按下事件做出响应,QListWidget没有对鼠标按下事件做出响应。 来源: https://blog.csdn.net/n__o_more/article/details/100980329

Qt widget for displaying large amount of data rows

前提是你 提交于 2019-11-29 22:19:55
问题 I am trying to display a large amount of columnar records in a scrollable view using Qt (5.1). The number of rows I would like to be able to browse can vary from 100 million to 1 Billion, say. The QTableWidget with a custom model works a few million rows, but the QTableWidget allocates data for each row because you can re-size the rows height, and so it must store data for this, which can use megabytes or even gigabytes of memory with 100M rows. I do not require the re-sizeable rows

Save QList<int> to QSettings

橙三吉。 提交于 2019-11-28 21:30:47
I want to save a QList<int> to my QSettings without looping through it. I know that I could use writeArray() and a loop to save all items or to write the QList to a QByteArray and save this but then it is not human readable in my INI file.. Currently I am using the following to transform my QList<int> to QList<QVariant> : QList<QVariant> variantList; //Temp is the QList<int> for (int i = 0; i < temp.size(); i++) variantList.append(temp.at(i)); And to save this QList<Variant> to my Settings I use the following code: QVariant list; list.setValue(variantList); //saveSession is my QSettings object

QList vs QVector revisited

橙三吉。 提交于 2019-11-28 20:23:06
问题 My question is basically when to choose QVector and when to choose QList as your Qt container. What I already know: Qt docs: QList class For most purposes, QList is the right class to use. Its index-based API is more convenient than QLinkedList's iterator-based API, and it is usually faster than QVector because of the way it stores its items in memory. It also expands to less code in your executable. The same is written is this very popular Q&A: QVector vs QList. It also favors QList. But: on

Qt的容器类

孤人 提交于 2019-11-28 19:48:53
Qt提供了多种容器类,这些容器可以用于存储指定类型的数据项,并且可以实现对字符串列表的添加,存储,删除等操作。 容器类是基础模板的类,如常用的容器类 QList <T> ,T是一个具体的类型,可以是int,float等简单类型,也可以是QString,QDate等类,但不可以是QObject或任何其子类。T必须是一个可赋值的类型。 例如用 QList <T> 定义一个字符串列表的容器,其定义方法是: QList <QString> strList; 这样定义了一个QList容器类的变量strList,它的数据项是QString,所以strList可以用于处理字符串列表,例如: strList.append("one"); strList.append("two"); strList.append("three"); QString str = strList[0]; //str = "one" Qt的容器类大致分为 顺序容器 和 关联容器 。 顺序容器类 Qt的顺序容器类有QList,QLinkedList,QVector,QStack和QQueue。 QList QList是最常用的容器类,虽然它是以数组列表的形式实现的,但是在其前后添加数据非常快,QList以下标索引的方式对数据项进行访问。 QList用于添加,插入,替换,移动,删除数据项的函数有:insert()

Accessing C++ QLists from QML

别等时光非礼了梦想. 提交于 2019-11-28 19:14:20
If I've got a list of things in C++, how do I expose that to QML (in Qt5 / QtQuick 2)? It seems like QML can only understand QObject -derived classes, which is an issue because QObject s can't be put in a QList or copied. How do I do this: struct Thing { int size; QString name; }; class ThingManager : public QObject { Q_OBJECT // These macros support QtQuick, in case we one day want to use it to make a slick // interface (when QML desktop components are released). Q_PROPERTY(QList<Thing> things READ things NOTIFY thingssChanged) public: // ... QList<Thing> things() const; // ... }; So that I

Why do Qt's container classes not allow movable, non-copyable element types?

◇◆丶佛笑我妖孽 提交于 2019-11-28 13:18:48
The Qt container classes QList<T> , QVector<T> etc. require their element types to be copyable. Since C++11, the STL containers require their element type to be copyable or movable only. Why do the Qt containers not support move-only element types? Qt bug #54685 has explicit confirmation from Qt developers that move-only types are not (and will never be) supported because of Qt containers' principle of implicit sharing. When you copy one Qt container to another, you're not doing a deep copy—the containers share their contents internally. Only when a modifying function is called on a container

QList: Out of memory

时光怂恿深爱的人放手 提交于 2019-11-28 12:54:34
I have a graphical application written in Qt for embedded linux. Part of this application is to update a display screen every 250 ms. However, after about 8-10 hours the application crashes with a "QList: Out of memory" error. I've isolated the function and the lines (in a sense) where it happens, but I have no idea why it happens since I'm not using QList. The only active lines of code in this function are at the end of this question. I realize that QList doesn't ever 'shrink' the memory it uses to hold items, but I'm not using QList anywhere in my code. I'm only calling 'setStyleSheet' to

Why do Qt's container classes not allow movable, non-copyable element types?

我们两清 提交于 2019-11-27 07:45:10
问题 The Qt container classes QList<T> , QVector<T> etc. require their element types to be copyable. Since C++11, the STL containers require their element type to be copyable or movable only. Why do the Qt containers not support move-only element types? 回答1: Qt bug #54685 has explicit confirmation from Qt developers that move-only types are not (and will never be) supported because of Qt containers' principle of implicit sharing. When you copy one Qt container to another, you're not doing a deep