qt下面例子学习(部分功能)
from aa import Ui_Form
from PyQt4.Qt import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from sys import *
class A(QWidget,Ui_Form):
def __init__(self):
super(A,self).__init__()
self.setupUi(self)
self.Button.clicked.connect(self.aaa)
self.Box.stateChanged.connect(self.selectaa)
#self.Button.installEventFilter(self)
self.Button.setCheckable(True)
def eventFilter(self,watched,event):
if watched == self.Button:
if event.type() == QEvent.MouseButtonPress:
mouseEvent = QMouseEvent(event)
if mouseEvent.buttons() == Qt.LeftButton:
print 'left'
else:
print 'about'
return QWidget.eventFilter(self,watched,event)
def aaa(self):
text=self.Edit.text()
row1=self.table1.rowCount()
self.table1.insertRow(row1)
item=QTableWidgetItem(text)
# item.setTextAlignment(Qt.AlignLeft|Qt.AlignCenter)
# item.setBackgroundColor(Qt.red)
try:
self.table1.setItem(row1,0,item)
self.Box.setCheckState(Qt.Unchecked)
self.table1.item(row1,0).setCheckState(Qt.Unchecked)
if text.isEmpty():
self.table1.setRowCount(row1)
self.table1.item(row1,0).setData(10,QVariant())
for i in range(row1):
if self.table1.item(i,0).isSelected()!=False:
self.table1.item(i,0).setCheckState(Qt.Checked)
except:
QMessageBox.information(self,u'警告',u'edit或者表格中为空')
def selectaa(self):
box=self.Box.isChecked()
row=self.table1.rowCount()
col=self.table1.columnCount()
for i in range(row):
for j in range(col):
if self.table1.item(i,0):
if box:
self.table1.item(i,0).setSelected(True)
self.table1.item(i,0).setCheckState(Qt.Checked)
else:
self.table1.item(i,0).setCheckState(Qt.Unchecked)
app=QApplication([])
a=A()
a.show()
exit(app.exec_())
下面是截图

qt下面例子学习(部分功能)的更多相关文章
- QT blockingmaster例子学习
dialog.h: #ifndef DIALOG_H #define DIALOG_H #include <QDialog> #include "masterthread.h&q ...
- (转)Qt Model/View 学习笔记 (七)——Delegate类
Qt Model/View 学习笔记 (七) Delegate 类 概念 与MVC模式不同,model/view结构没有用于与用户交互的完全独立的组件.一般来讲, view负责把数据展示 给用户,也 ...
- (转)Qt Model/View 学习笔记 (五)——View 类
Qt Model/View 学习笔记 (五) View 类 概念 在model/view架构中,view从model中获得数据项然后显示给用户.数据显示的方式不必与model提供的表示方式相同,可以与 ...
- 数百个 HTML5 例子学习 HT 图形组件 – 3D建模篇
http://www.hightopo.com/demo/pipeline/index.html <数百个 HTML5 例子学习 HT 图形组件 – WebGL 3D 篇>里提到 HT 很 ...
- 数百个 HTML5 例子学习 HT 图形组件 – 3D 建模篇
http://www.hightopo.com/demo/pipeline/index.html <数百个 HTML5 例子学习 HT 图形组件 – WebGL 3D 篇>里提到 HT 很 ...
- 数百个 HTML5 例子学习 HT 图形组件 – WebGL 3D 篇
<数百个 HTML5 例子学习 HT 图形组件 – 拓扑图篇>一文让读者了解了 HT的 2D 拓扑图组件使用,本文将对 HT 的 3D 功能做个综合性的介绍,以便初学者可快速上手使用 HT ...
- 数百个 HTML5 例子学习 HT 图形组件 – 拓扑图篇
HT 是啥:Everything you need to create cutting-edge 2D and 3D visualization. 这口号是当年心目中的产品方向,接着就朝这个方向慢慢打 ...
- Qt 智能指针学习(7种指针)
Qt 智能指针学习 转载自:http://blog.csdn.net/dbzhang800/article/details/6403285 从内存泄露开始? 很简单的入门程序,应该比较熟悉吧 ^_^ ...
- HTML5 例子学习 HT 图形组件
HTML5 例子学习 HT 图形组件 HT 是啥:Everything you need to create cutting-edge 2D and 3D visualization. 这口号是当年心 ...
随机推荐
- 应用按home键无最近应用
在应用的AndroidManifest里面添加加载模式
- BNU10792:沙漠旅行者
有个旅行者计划横穿沙漠,沙漠中水资源很匮乏.旅行者需要依靠补给站的支持,才能横穿整个沙漠.假设所有的补给站都在一条直线上,而且旅行者一定沿着这条直线走.起点在1号补给站,终点在第N号补给站,起点和终点 ...
- 金典 SQL笔记(4)
由于在本地笔记上写的.CSDN markdown编辑器仅仅支持.md格式导入, 图片没办法直接导进去.写的多了懒的一张一张图片切图上传; 直接整个文章切成图片上传上去了. watermark/2/te ...
- NSUserDefaults读取和写入自定义对象
NSUserDefaults可以存取一些短小的信息. 比如存入再读出一个字符串到NSUserDefaults: - NSString *string = [NSString stringWithStr ...
- Win32<CreatFile>
CreateFile函数详解 CreateFile The CreateFile function creates or opens the following objects and returns ...
- InstallShield常用prq文件的下载地址
VC 2010 redist X86: http://saturn.installshield.com/is/prerequisites/microsoft visual c++ 2010 redis ...
- WCF 客户端与服务端消息传输
WCF很多需要认证信息,保证服务的安全,可以使用消息来实现 WCF 实现消息的方式: WCF中有两个接口: IClientMessageInspector [定义一个消息检查器对象,该对象可以添加到 ...
- SQL2008安装重启失败
我今天安装SQL2008的一些问题经历SQL2008安装重启失败大致出错信息如下:RebootRequiredCheck 检查是否需要挂起计算机重新启动.挂起重新启动会导致安装程序失败. 失败 需要重 ...
- ActiveReport 9手把手搭建环境及实战
本文借鉴葡萄城空间产品,纯属分享,无任何营利目的 下载ActiveReports 9 专业版 打开下面的网站,点击立即下载,请您填写真实电子邮件地址,以获取ActiveReports产品试用版---系 ...
- Linux CentOS PhpMyAdmin安装
安装好PHP,Apache和MySQL程序后,为了管理MySQL数据库,我们需要安装phpMyAdmin程序.下面是关于如何在centos安装phpMyAdmin程序的方法.1.管理员root身份登录 ...