当前位置:网站首页>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_())

边栏推荐
- Open3d point cloud bounding box
- [stack] 921 Minimum Add to Make Parentheses Valid
- 使用 C# 创造 ASCII 艺术
- 小程序自定义宫格
- TypeError: Argument ‘angle‘ can not be treated as a double
- 【qt5-tab标签精讲】Tab标签及内容分层解析
- 图灵奖得主LeCun指明AI未来的出路在于自主学习,这家公司已踏上征途
- MFC TCP communication server client demo notes vs2019
- 未来的 Web3会带来什么?
- StrictMode卡顿与泄漏检测-StrictMode原理(2)
猜你喜欢

一站式洞察行业热点,飞瓜数据B站新功能「流量大盘」上线!

K210 site helmet

Institute of Microbiology, commonly used biochemical reactions in microbiological testing

Dls-20 double position relay 220VDC

Basic knowledge 3 - standard unit library
![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]

Microbiological health, why is food microbiological testing important

Zero of DC learning notes -- overview and basic process introduction

未来的 Web3会带来什么?

软件开发完整流程
随机推荐
一站式洞察行业热点,飞瓜数据B站新功能「流量大盘」上线!
Service grid ASM year end summary: how do end users use the service grid?
Dls-20 double position relay 220VDC
Draw some interesting figures with flutter's canvas
Parity linked list [two general directions of linked list operation]
Dls-42/6-4 dc110v double position relay
System.CommandLine版CSRebot
Basic knowledge II - Basic definitions related to sta
MATLAB 最远点采样(FPS改进版)
Basic knowledge 3 - standard unit library
Matlab farthest point sampling (FPS improved version)
TypeError: Argument ‘angle‘ can not be treated as a double
Open3D 点云颜色渲染
【Proteus仿真】Arduino UNO +74C922键盘解码驱动4X4矩阵键盘
一些本质的区别
软件开发完整流程
flutter报错 -- The argument type ‘Function‘ can‘t be assigned to the parameter type ‘void Function()?‘
Unknown database连接数据库错误
Interpreting the scientific and technological literacy contained in maker Education
What will Web3 bring in the future?