当前位置:网站首页>Qt5 mvc: revealing the secrets of data visualization
Qt5 mvc: revealing the secrets of data visualization
2022-07-01 01:31:00 【Teacher Detian】
MVC Mode principle
Every program has its principle , We learn through their principles , To understand their work direction , It will make our study very simple .
Uncover the data hierarchy order
- Create format layout
- Call the visualization function
- Build character list model
- Define list source data columns
- Add the data source list to the list model
- Add the list model to the visualization function ( Visual Click to send signal – Activate the message box )
- Message box slot function , It is equivalent to the functional interaction of column number data , Complete data message function debugging
- Add visualization to the layout , It is equivalent to placing it inside the window
- Activate visual layout , It is equivalent to uncovering the red cloth on the plaque of data , Officially publicize the opening to the public .
Message slot function
def clicked(self,item):
QMessageBox.information()— Message box
Parameters 1: Inherited parent class self
Parameters 2:QListView— Trigger inherited from QListView
Parameters 3: Box information , Signal list index item.row()
remarks :
item— Is the content of the list
.row()— Is to call the display row index of the current content (0,1,2…)
Program source code
from PyQt5.Qt import *
import sys
app = QApplication([])
class ListView(QWidget):
def __init__(self,parent=None):
super(ListView,self).__init__(parent)
self.setWindowTitle('QListView Example ')
self.resize(300,270)
layout = QVBoxLayout()
listview = QListView()
listmodel = QStringListModel()# A list of characters : Display models for lists
self.list = [' list 1',' list 2',' list 3']
listmodel.setStringList(self.list)
listview.setModel(listmodel)
listview.clicked.connect(self.clicked) # Launch a item.row() Index data to self.clicked
layout.addWidget(listview)
self.setLayout(layout) # Layout effective statement , Must be complete , Otherwise, the added visualization template cannot be displayed
# Click to pop up the message box , Clicking on each list item will have a value stored in the slot function item in ,item.row() Method will display the index data of the corresponding item
def clicked(self,item):
QMessageBox.information(self,'QListView',' You chose '+self.list[item.row()])
win = ListView()
win.show()
sys.exit(app.exec_())

边栏推荐
- Pytorch programming knowledge (2)
- About the general input operation mode of unity
- Pre training / transfer learning of models
- 【Qt5-基础篇_1】从0开始,德天老师和你一起学习——窗口简介
- Parity linked list [two general directions of linked list operation]
- 3dsmax插件开发遍历节点对象和Object获取及INode变换矩阵说明
- JS to convert numbers into Chinese characters for output
- 基础知识之一——STA基础概述
- Docker deployment MySQL 8
- C# 自定义并动态切换光标
猜你喜欢
![Split the linked list [take next first and then cut the linked list to prevent chain breakage]](/img/eb/708ab20c13df75f4dbd2d6461d3602.png)
Split the linked list [take next first and then cut the linked list to prevent chain breakage]
![[network packet loss and network delay? This artifact can help you deal with everything!]](/img/c4/f733b23327458b9266b9cbcccb6f14.png)
[network packet loss and network delay? This artifact can help you deal with everything!]

Interpreting the scientific and technological literacy contained in maker Education

Docker deployment MySQL 8

dc_ Study and summary of labs--lab1

编译安装oh-my-zsh

那些一门心思研究自动化测试的人,后来怎样了?

微生物健康,食品微生物检测为什么很重要

Installing mongodb database in Windows Environment

Green, green the reed. dew and frost gleam.
随机推荐
WIN11中MathType编辑中“打开数学输入面板”是灰色不可编辑
User defined annotation implementation verification
ESP8266 RC522
【模拟】922. Sort Array By Parity II
[queue] 933 Number of Recent Calls
Thinking brought by strictmode -strictmode principle (5)
Call the classic architecture and build the model based on the classic
【Qt5-基础篇】随机数显示屏展示
DC學習筆記正式篇之零——綜述與基本流程介紹
OCR的一些项目
visual studio 2019 下载
Applet Custom Grid
Sécurité et santé microbiennes, qu'est - ce que le traitement biologique?
Impact relay zc-23/dc220v
Basic knowledge of software and hardware -- diary (1)
Visual studio 2019 shortcut notes
视频教程 | 长安链推出系列视频教程合集(入门)
Unknown database连接数据库错误
一站式洞察行业热点,飞瓜数据B站新功能「流量大盘」上线!
数字IC设计流程总结