Two traversal styles of qt6 QList (STL-style-iterators, java-style-iterators)

Article directory Two traversal styles of qt6 QList STL-Style Iterators java-style-iterators QListIterator QMutableListIterator References Two traversal styles of qt6 QList QList provides both STL-style iterators and Java-style iterators QList provides both STL-style iterators and Java-style iterators Warning: Iterators on implicitly shared containers do not work exactly like STL-iterators. You should avoid copying a container while […]

QListWidget of Qt6 – Qt imitation ToDesk sidebar (1)

1. Overview of QLitWidget Note: This article is not a simple translation of Qt documents or interface functions, but focuses on the demonstration and use of Qt Designer without code. QListWidget, also known as the list box class, provides a list view similar to that provided by QListView, but it has a classic item-based interface […]

Use of QListView (forward and reverse insertion)

First, before introducing QListView, let’s talk about the difference between QListView and QListWidget: 1. QListView is a model (model/view) form type, and QListWidget is an Item form type. 2. The use of QListView is more complicated, and generally needs to be used with the data model QAbstractListModel and item agent QStyledItemDelegate. The QListWidget is easy […]

04-6_Qt 5.9 C++ Development Guide_QListWidget and QToolButton

Article directory 1. Introduction to the example 2. Source code 2.1 Hybrid interface design 2.2 mainwindow.h 2.3 mainwindow.cpp 1. Introduction to the example There are two types of components in Qt for Item processing, One is Item Views, including QListView, QTreeView, QTableView, QColumnView, etc.; The other is Item Widgets >, including QListWidget, QTreeWidget, and QTableWidget. […]

Qt model view framework: QListView, QListWidget

QListView 1. Description QListView presents the items stored in the model as a simple non-hierarchical list or collection of icons. This view does not display horizontal or vertical headers. QStandardItemModel * model = new QStandardItemModel; for(int i = 0; i < 11; + + i) { QStandardItem *item = new QStandardItem(QString::number(i)); model->appendRow(item); } QListView listView; […]

Qt model view framework: QTableWidget, QTableView, QListWidgetItem

QTableWidget 1. Description Standard form widget. Items in a QTableWidget are provided by QTableWidgetItem. How to use: tableWidget = new QTableWidget(12, 3, this); tableWidget = new QTableWidget(this); tableWidget->setRowCount(10); tableWidget->setColumnCount(5); or: QTableWidgetItem *newItem = new QTableWidgetItem(tr(“%1”).arg((row + 1)*(column + 1))); tableWidget->setItem(row, column, newItem); 2. Member functions 2.1. Signal 1. void cellActivated(int row, int column) This signal […]

QListView is customized using Delegate

Objective: Use Model/View to realize list content loading; Use Delegate to realize the design of Item; Item can contain multiple controls of different types; Item can handle mouse hover and press events of multiple controls; Item can support input controls; Realize that the content of the list is dynamically loaded with the scroll bar; Realize […]

118-Model/View-list view QListView

List view QListView QListView is a pure view class used to store lists in Qt. Prior to this, the list view and icon view were provided by QListBox and QIconView. QListView provides a more flexible method based on Qt’s model/view architecture. QListView implements the interface defined by QAbstractItemView and can display data provided by models […]

Python Qt GUI design: QTableView, QListView, QListWidet, QTableWidget, QTreeWidget and QTreeWidget ltem table and tree class (upgrade – 1)…

The problem solved by tables and trees is how to present more data regularly in one control. PyQt provides two control classes to solve this problem, one of which is a table-structured control class, and the other is a tree-structured control class. 1, QTableView class Under normal circumstances, an application needs to interact with a […]

Use of Qt QToolButton and QListWidget

1. Introduction to this article: This article mainly demonstrates the use of QListWidget, and also involves the use of toolbox (QToolBox) and tool button (QToolButton). It will also create a drop-down menu of tool buttons and a shortcut menu of QListWidget components through Action. Show the following picture: 2. QListWidget QListWidget is a component that […]