qcheckbox

Python高级进阶#015 pyqt5进度条QProgressBar结合使用qbasictimer

故事扮演 提交于 2021-02-13 05:03:44
本期GUI界面,我们继续学习新的控件Qprogressbar。 知识回顾 1.滑动控件qslider 控件设置的关键:设置最大值、最小值,绝对范围。 2.核心类库QtCore,枚举类Qt 核心枚举类的使用,可以帮助我们对代码的理解。 一、进度条的使用思想 进度条qprogressbar 使用思想: 1.载入类库 2.初始化类对象 3.设置最小值和最大值 4.时钟的使用QBasicTimer,槽方法对应类库的timerEvent 5.判断什么时候停止加载进度条 这里我们在学习使用进度条的时候,必须要结合使用时钟控件,这样才能让我们看到进度条动的感觉。 二、制作案例 说明如下: 1.界面由进度条和按钮组成 2.进度条的值范围为0~100 3.按钮的状态为“开始”、“停止”、“完成” 4..按钮需要能够控制进度条的运行 三、开发过程知识点介绍 1.导入时钟类 from PyQt5.QtCore import QBasicTimer 2.初始化进度条 self.pgb=QProgressBar(self) 类对象的初始化 self.pgb.move(50,50) 将进度条移动到指定位置 self.pgb.resize(300,20) 设置进度条宽高 3.设置进度条的范围 #设置进度条的范围 self.pgb.setMinimum(0) self.pgb.setMaximum(100)

How i can use <sub></sub> in text description from QCheckbox?

房东的猫 提交于 2021-01-28 08:38:21
问题 I want to use the HTML ui->FresBox->setText("f<sub>res</sub>"); but it does not work in a QCheckbox . It works fine if you use a label. What is the different and how can I use the HTML style in a QCheckbox . 回答1: Unfortunately, QCheckBox does not support HTML, so in these cases I prefer to use a QCheckBox plus a QLabel in a QHBoxLayout as I show below: #include <QtWidgets> int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget w; // start QCheckBox *checkbox = new QCheckBox();

【转】PyQt5系列教程(七)控件

∥☆過路亽.° 提交于 2021-01-14 10:14:58
PyQt5系列教程(七)控件 软硬件环境 Windows 10 Python 3.4.2 PyQt 5.5.1 PyCharm 5.0.4 前言 控件是PyQt应用程序的基石。PyQt5自带很多不同的控件,包括像button、check box、slider等等。在本节中我们将学习几个非常有用的控件:QCheckBox、ToggleButton、QSlider、QProgressBar和QCalendarWidget。 QCheckBox 一个QCheckBox会有2种状态:选中和为选中。它有一个选择框和一个label组成,它常常被用来表示应用的某些特性是可启用或不启用的。 # -*- coding: utf-8 -*- __author__ = 'djstava@gmail.com' """ ZetCode PyQt5 tutorial In this example, a QCheckBox widget is used to toggle the title of a window. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from PyQt5.QtWidgets import QWidget, QCheckBox, QApplication from

QCheckbox to check all other QCheckBoxes

为君一笑 提交于 2020-12-12 06:50:53
问题 My question is very similar to this post, Python PyQt - Checkbox to uncheck all other checkboxes. However, I am trying to check all other boxes when main checkbox is selected and at the same time, if any of the other boxes are selected independently, then I would like to deselect the main checkbox. I tried modifying the answer provided, but not able to put my head around the 'self.sender' signal. I am not able to change the selection when I deselect a checkbox. Here is the code that I

QCheckbox to check all other QCheckBoxes

狂风中的少年 提交于 2020-12-12 06:50:50
问题 My question is very similar to this post, Python PyQt - Checkbox to uncheck all other checkboxes. However, I am trying to check all other boxes when main checkbox is selected and at the same time, if any of the other boxes are selected independently, then I would like to deselect the main checkbox. I tried modifying the answer provided, but not able to put my head around the 'self.sender' signal. I am not able to change the selection when I deselect a checkbox. Here is the code that I

QCheckbox to check all other QCheckBoxes

拜拜、爱过 提交于 2020-12-12 06:50:29
问题 My question is very similar to this post, Python PyQt - Checkbox to uncheck all other checkboxes. However, I am trying to check all other boxes when main checkbox is selected and at the same time, if any of the other boxes are selected independently, then I would like to deselect the main checkbox. I tried modifying the answer provided, but not able to put my head around the 'self.sender' signal. I am not able to change the selection when I deselect a checkbox. Here is the code that I

QT中父子窗口事件传递与事件过滤器

穿精又带淫゛_ 提交于 2020-10-25 07:56:44
 处理监控系统的时候遇到问题,在MainWidget中创建多个子Widget的时候,原意是想鼠标点击先让MainWidget截获处理后再分派给子Widget去处理,但调试后发现如果子Widget重新实现了事件方法,就直接处理掉事件了,没有进到MainWidget的处理方法中去,如果子Widget没有accept或ignore该事件,则该事件就会被传递给其父亲,在子Widget存在accept或ignore事件的时候,想要经过一下MainWidget的处理方法,就得用到事件处理器,因此网上找了一下,发现QT的事件处理器可以处理。   QT将事件封装为QEvent实例以后,会呼叫QObject的event()方法,并且将QEvent实例传送给它,在某些情况下,希望在执行event()之前,先对一些事件进行处理或过滤,然后再决定是否呼叫event()方法,这时候可以使用事件过滤器。   可以重新定义一个继承自QObject(或其子类)的类的eventFilter()方法, bool FilterObject::eventFilter(QObject *object, QEvent *event) {   if(event->type() == QEvent::KeyPress)   {     QKeyEvent *keyEvent = static_cast<QKeyEvent *>

python - checkbox selection in QListView

╄→尐↘猪︶ㄣ 提交于 2020-07-09 05:11:32
问题 So, I developed a simple dialog with a checkbox, which allows the user to select one or several items from a list. Besides the standard OK and Cancel buttons, it adds Select All and Unselect All buttons, allowing the user to check/uncheck all items at once (this comes handy for large lists). import os, sys from PyQt4 import Qt, QtCore, QtGui class ChecklistDialog(QtGui.QDialog): def __init__(self, name, stringlist=None, checked=False, icon=None, parent=None): super(ChecklistDialog, self)._

Associate signal and slot to a qcheckbox create dynamically

元气小坏坏 提交于 2020-01-03 03:39:04
问题 I've got a very specific problem so I'm going to try to be as clear as possible. I've got a QTabWidget which contains QTableWidget , every line of my QTableWidget is create dynamically by reading a file. As you may see, when I create a line, I add a qCheckBox at the end. My goal now, is to send this line to the QTableWidget in the last tab of my QtableTab when I click on the qCheckBox ( and to delete this line when I uncheck the qCheckBox ). So every time I create a line dynamically, I try to

Qt编写安防视频监控系统22-摄像机搜索

家住魔仙堡 提交于 2019-12-30 14:54:42
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一、前言 摄像机搜索模块是后面新增加的,这个模块很有必要,一开始做视频监控系统的时候,那时候还没有研究出来一套纯Qt底层通信的onvif类,也就前几个月搞出来了,支持搜索设备信息和云台控制,所以马上加到了监控系统中,大部分的监控系统都支持两种搜索,一种是自家私有协议即SDK的方式搜索设备,只能搜索到自家的设备,另外一种就是用国际标准协议onvif,这个协议对于市面上大部分的网络摄像机都支持的,我买过的最便宜的onvif摄像机才70块钱,onvif内容还是比较多的,常用的基本上就三点:搜索设备拿到设备的详细信息比如视频流地址;云台控制;预置位设置与控制; 摄像机搜索功能直接做到了摄像机管理中,顶部提供一个搜索按钮,平时搜索功能是看不到了,切换搜索按钮用来显示和隐藏搜素区域,提供了广播搜索和单播搜索两种,广播搜素需要指定网卡搜索,单播搜索适用于一些不在同一个网段内,但是设备是可以ping通的,这就需要指定摄像机的IP进行单播搜索,用户姓名和用户密码必须填写正确,是对应摄像机的onvif用户信息,而不是摄像机的web登录用户。搜索到的设备都会在左侧的列表中显示,此时设备地址、媒体地址、云台地址、主码流地址、子码流地址、5个字段是空白的,需要单击获取所有按钮来获取这几个信息,一般来说一个系统所用的摄像机是一个厂家的