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

边栏推荐
- Green, green the reed. dew and frost gleam.
- Strictmode analysis activity leakage -strictmode principle (3)
- Chromatic judgement bipartite graph
- 06. on several ways of redis persistence
- 软件开发完整流程
- 一些本质的区别
- Solve idea:class' xxx 'not found in module' xxx‘
- Exploration and practice of "flow batch integration" in JD
- Zero of DC learning notes -- overview and basic process introduction
- QT5-布局在创作中的理解应用
猜你喜欢

qt5-MVC:数据可视化的层次揭秘

Q play soft large toast to bring more comfortable sleep

Green, green the reed. dew and frost gleam.

Unknown database连接数据库错误

Construction and beautification of personal blog

WIN11中MathType编辑中“打开数学输入面板”是灰色不可编辑

Impact relay zc-23/dc220v

QT5-布局在创作中的理解应用

Solve idea:class' xxx 'not found in module' xxx‘

Institute of Microbiology, commonly used biochemical reactions in microbiological testing
随机推荐
About the general input operation mode of unity
【模拟】922. Sort Array By Parity II
Construction and beautification of personal blog
Xjy-220/43ac220v static signal relay
【Proteus仿真】Arduino UNO +74C922键盘解码驱动4X4矩阵键盘
ASCII、Unicode、GBK、UTF-8之间的关系
Openmv and k210 of the f question of the 2021 video game call the openmv API for line patrol, which is completely open source.
直播商城源码,实现左右联动商品分类页面
Solve idea:class' xxx 'not found in module' xxx‘
Draw some interesting figures with flutter's canvas
短信在企业中的应用有哪些?
K210 access control complete
微生物安全與健康,什麼是生物處理?
06. on several ways of redis persistence
做生意更加务实
ESP8266 RC522
Interpreting the scientific and technological literacy contained in maker Education
迪赛智慧数——其他图表(平行坐标图):2021年应届专业就业情况
医疗HIS行业短信发送解决方案
1175. Prime Arrangements