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

边栏推荐
- 日志 logrus第三方库的使用
- Installing mongodb database in Windows Environment
- Visual studio 2019 Download
- Two position relay st2-2l/ac220v
- 使用StrictMode-StrictMode原理(1)
- 图的连通性基础
- None of the following candidates is applicable because of a receiver type mismatch
- 流批一体在京东的探索与实践
- 【office办公-pdf篇】pdf合并与拆分让我们摆脱付费软件的功能限制好不好
- Use strictmode strictmode principle (1)
猜你喜欢

Green, green the reed. dew and frost gleam.

农产品换房?“变相”购房补贴!

zabbix如何配置告警短信?(预警短信通知设置流程)

flutter报错 -- The argument type ‘Function‘ can‘t be assigned to the parameter type ‘void Function()?‘

neo4j安装、运行以及项目的构建和功能实现
![Parity linked list [two general directions of linked list operation]](/img/4e/ce860bc172bb75f456427ba26a7842.png)
Parity linked list [two general directions of linked list operation]

dc_labs--lab1的学习与总结

流批一体在京东的探索与实践

Pre training / transfer learning of models

DC學習筆記正式篇之零——綜述與基本流程介紹
随机推荐
neo4j安装、运行以及项目的构建和功能实现
Dls-20 double position relay 220VDC
关于白盒测试,这些技巧你得游刃有余~
【Qt5-基础篇_1】从0开始,德天老师和你一起学习——窗口简介
Use strictmode strictmode principle (1)
TypeError: can‘t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to
使用 C# 创造 ASCII 艺术
Unknown database连接数据库错误
Digital IC design process summary
【Proteus仿真】Arduino UNO +74C922键盘解码驱动4X4矩阵键盘
[deepin] common sets
mysql插入\更新前+判断条件
1175. Prime Arrangements
One of the basics - overview of sta Basics
Open3d point cloud color rendering
dc_labs--lab1的学习与总结
短视频平台开发,依靠DrawerLayout实现侧滑菜单效果
Chromatic judgement bipartite graph
gin 配置文件
StrictMode分析Registion-StrictMode原理(4)