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

边栏推荐
- Use strictmode strictmode principle (1)
- 图灵奖得主LeCun指明AI未来的出路在于自主学习,这家公司已踏上征途
- Visual studio 2019 Download
- zabbix如何配置告警短信?(预警短信通知设置流程)
- mysql数据库基础:流程控制
- Construction and beautification of personal blog
- Kongyiji's first question: how much do you know about service communication?
- What will Web3 bring in the future?
- 使用 C# 创造 ASCII 艺术
- 直播商城源码,实现左右联动商品分类页面
猜你喜欢

zabbix如何配置告警短信?(预警短信通知设置流程)
![[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!]

Note d'étude du DC: zéro dans le chapitre officiel - - Aperçu et introduction du processus de base

【qt5-tab标签精讲】Tab标签及内容分层解析

Locking relay ydb-100, 100V

Microbiological health, why is food microbiological testing important

基础知识之一——STA基础概述

个人博客搭建与美化

New opportunities for vr/ar brought by metauniverse

农产品换房?“变相”购房补贴!
随机推荐
Document service design
Call the classic architecture and build the model based on the classic
About the general input operation mode of unity
Digital IC design process summary
孙宇晨接受瑞士媒体Bilan采访:熊市不会持续太久
Mustache syntax
Draw some interesting figures with flutter's canvas
【栈】921. Minimum Add to Make Parentheses Valid
New opportunities for vr/ar brought by metauniverse
Docker deployment MySQL 8
Open3D 点云颜色渲染
Xjy-220/43ac220v static signal relay
二季度最后一天
使用StrictMode-StrictMode原理(1)
编译安装oh-my-zsh
Typora的使用
Complete software development process
微生物安全与健康,什么是生物处理?
【Qt5-基础篇】随机数显示屏展示
软件开发完整流程