pyqt 过滤事件
# 过滤鼠标滚轮事件
class stepItem(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.init_ui()
self.init_ui_data() def init_ui(self):
self.setObjectName('scriptManager')
self.ui = stepItem_ui.Ui_stepItem()
self.ui.setupUi(self)
self.ui.comboBox_type.setStyleSheet("QComboBox QAbstractItemView::item{height:25px;}")
self.ui.comboBox_type.setView(QListView())
self.ui.comboBox_relyon.clear() self.ui.textEdit_step_result.clear()
self.ui.textEdit_step_result.adjustSize() self.connect(self.ui.comboBox_type, SIGNAL('currentIndexChanged(int)'), self.currentIndexChanged) # 过滤鼠标滚轮事件
self.ui.comboBox_type.installEventFilter(self)
self.ui.comboBox_relyon.installEventFilter(self) def eventFilter(self, source, event):
if source == self.ui.comboBox_type:
if event.type() == QEvent.Wheel:
return True
if source == self.ui.comboBox_relyon:
if event.type() == QEvent.Wheel:
return True return QWidget.eventFilter(self, source, event) def init_ui_data(self):
self.get_res(gl.gl_data["SET_STEP_RES"], None) def get_res(self, data, param):
'''
获取步骤资源
:param data:
:return:
''' if data.has_key("DATA"):
self.ui.comboBox_type.clear()
self.ui.comboBox_type.addItem('', 0)
list_res = data["DATA"]
for res in list_res:
self.ui.comboBox_type.addItem(res['S_STEP_TYPE_NAME'], res['I_STEP_TYPE_ID'])
# self.ui.comboBox_type.setItemData(res['I_STEP_TYPE_ID'], res['I_STEP_TYPE_ID'])
# self.ui.comboBox_type.setCurrentIndex(0) def setStepData(self, stepNum, stepType, stepValue):
# self.ui.label_step.setText(stepNum)
# self.ui.comboBox_type.setCurrentIndex(self.ui.comboBox_type.findText(stepType))
# self.ui.lineEdit.setText(stepValue)
pass def currentIndexChanged(self):
#text = self.ui.comboBox_type.currentText().toUtf8().data()
step_index = self.ui.comboBox_type.currentIndex()
# aa = self.ui.comboBox_type.itemData(id).toInt()
step_name = self.ui.comboBox_type.itemText(step_index)
step_id = self.ui.comboBox_type.itemData(step_index) self.ui.lineEdit.setReadOnly(False)
if step_id == 3 or step_id == 9 or step_id == 10 or step_id == 13:
if len(self.ui.lineEdit.text()) == 0:
self.ui.lineEdit.setText(QString(u'该选项不需要参数!'))
self.ui.lineEdit.setReadOnly(True)
else:
if self.ui.lineEdit.text() == QString(u'该选项不需要参数!'):
self.ui.lineEdit.clear()
self.ui.lineEdit.setReadOnly(False)
self.ui.lineEdit.setFocus() # print text if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
myQWidget = stepItem()
myQWidget.show()
# myQWidget.test()
sys.exit(app.exec_()) 所有事件记录:
AccessibilityDescription = 130
AccessibilityHelp = 119
AccessibilityPrepare = 86
ActionAdded = 114
ActionChanged = 113
ActionRemoved = 115
ActivationChange = 99
ApplicationActivate = 121
ApplicationActivated = 121
ApplicationDeactivate = 122
ApplicationDeactivated = 122
ApplicationFontChange = 36
ApplicationLayoutDirectionChange = 37
ApplicationPaletteChange = 38
ApplicationWindowIconChange = 35
ChildAdded = 68
ChildPolished = 69
ChildRemoved = 71
Clipboard = 40
Close = 19
CloseSoftwareInputPanel = 200
ContentsRectChange = 178
ContextMenu = 82
CursorChange = 183
DeferredDelete = 52
DragEnter = 60
DragLeave = 62
DragMove = 61
Drop = 63
DynamicPropertyChange = 170
EnabledChange = 98
Enter = 10
EnterWhatsThisMode = 124
FileOpen = 116
FocusIn = 8
FocusOut = 9
FontChange = 97
Gesture = 198
GestureOverride = 202
GrabKeyboard = 188
GrabMouse = 186
GraphicsSceneContextMenu = 159
GraphicsSceneDragEnter = 164
GraphicsSceneDragLeave = 166
GraphicsSceneDragMove = 165
GraphicsSceneDrop = 167
GraphicsSceneHelp = 163
GraphicsSceneHoverEnter = 160
GraphicsSceneHoverLeave = 162
GraphicsSceneHoverMove = 161
GraphicsSceneMouseDoubleClick = 158
GraphicsSceneMouseMove = 155
GraphicsSceneMousePress = 156
GraphicsSceneMouseRelease = 157
GraphicsSceneMove = 182
GraphicsSceneResize = 181
GraphicsSceneWheel = 168
Hide = 18
HideToParent = 27
HoverEnter = 127
HoverLeave = 128
HoverMove = 129
IconDrag = 96
IconTextChange = 101
InputMethod = 83
KeyboardLayoutChange = 169
KeyPress = 6
KeyRelease = 7
LanguageChange = 89
LayoutDirectionChange = 90
LayoutRequest = 76
Leave = 11
LeaveWhatsThisMode = 125
LocaleChange = 88
MacSizeChange = 177
MaxUser = 65535
MenubarUpdated = 153
MetaCall = 43
ModifiedChange = 102
MouseButtonDblClick = 4
MouseButtonPress = 2
MouseButtonRelease = 3
MouseMove = 5
MouseTrackingChange = 109
Move = 13
NonClientAreaMouseButtonDblClick = 176
NonClientAreaMouseButtonPress = 174
NonClientAreaMouseButtonRelease = 175
NonClientAreaMouseMove = 173
None = 0
OkRequest = 94
Paint = 12
PaletteChange = 39
ParentAboutToChange = 131
ParentChange = 21
PlatformPanel = 212
Polish = 75
PolishRequest = 74
QueryWhatsThis = 123
RequestSoftwareInputPanel = 199
Resize = 14
Shortcut = 117
ShortcutOverride = 51
Show = 17
ShowToParent = 26
SockAct = 50
StateMachineSignal = 192
StateMachineWrapped = 193
StatusTip = 112
StyleChange = 100
TabletEnterProximity = 171
TabletLeaveProximity = 172
TabletMove = 87
TabletPress = 92
TabletRelease = 93
Timer = 1
ToolBarChange = 120
ToolTip = 110
ToolTipChange = 184
TouchBegin = 194
TouchEnd = 196
TouchUpdate = 195
UngrabKeyboard = 189
UngrabMouse = 187
UpdateLater = 78
UpdateRequest = 77
User = 1000
WhatsThis = 111
WhatsThisClicked = 118
Wheel = 31
WindowActivate = 24
WindowBlocked = 103
WindowDeactivate = 25
WindowIconChange = 34
WindowStateChange = 105
WindowTitleChange = 33
WindowUnblocked = 104
WinEventAct = 132
WinIdChange = 203
ZOrderChange = 126
pyqt 过滤事件的更多相关文章
- TADOTable 用过滤事件 后 记录数据和 记录的内容
用 过滤事件,过滤后 ADOTbTrade.RecordCount 是总数, 但是,记录内容是 过滤后的 ADOTbTrade.First; while not ADOTbTrade.Eof do b ...
- pyqt信号事件相关网址说明及python相关
pyqt在线文档: http://www.rzcucc.com/search/pyqt.sourceforge.net/Docs/PyQt4/-qdatetime-2.html PyQT信号槽_学习笔 ...
- PyQt 5事件和信号
信号槽Signals & slots sld.valueChanged.connect(lcd.display) # 将滚动条的valueChanged信号连接到lcd的display插槽 # ...
- EasyUI datagrid 过滤事件段
//dateTimeRange过滤扩展 $.extend($.fn.datagrid.defaults.filters, { dateRange: { /*onInit: function(targe ...
- (十三)事件分发器——event()函数,事件过滤
事件分发器——event()函数 事件过滤 事件进入窗口之前被拦截 eventFilter #include "mywidget.h" #include "ui_mywi ...
- [AlwaysOn Availability Groups]AG扩展事件
AG扩展事件 SQL Server 2012定义了一些关于AlwaysOn的扩展事件.你可以监控这些扩展事件来帮助诊断AG的根本问题.你也可以使用以下语句查看扩展事件: SELECT * FROM s ...
- Qt自定义事件的实现(转)
原文:http://blog.csdn.net/michealtx/article/details/6866094 初学Qt,用了Qt自带的事件,然后想怎么才能定义自己的事件呢?又如何使用自定义事件呢 ...
- SQL 扩展事件
在本篇,我通过使用新建“Session ”对话框来创建新的扩展事件会话.定义一个自己的扩展事件,动作和谓词,并且发布一个以收集事件数据为目的的会话. 首先从UI开始 在SQLServer2008R2以 ...
- SQL Server 扩展事件(Extented Events)从入门到进阶(1)——从SQL Trace到Extented Events
由于工作需要,决定深入研究SQL Server的扩展事件(Extended Events/xEvents),经过资料搜索,发现国外大牛的系列文章,作为“学习”阶段,我先翻译这系列文章,后续在工作中的心 ...
随机推荐
- JDBC值事务
事务的四大特性: 原子性, 一致性(比如说A给B转账,A转了之后B的账户增加了,两个都完成才叫一致性),隔离性(A给B转账,A给C转账,AB和AC并发是无关的),永久性(转账之后 不可能复原,就是说不 ...
- java基础杂烩
1. int ... arg: 可变参数 2. 数组拷贝放在JDK中的System类中,arraycopy(原数组,从原数组那一个索引开始拷贝,目标数组,在目标数组哪一个位置开始粘贴,拷贝元素的个 ...
- 通过js调用android原生方法
有时候我们有这样一个需求,监听html中控件的一些事件.例如点击html中某个按钮,跳转到别的activity,复制某段文本. 首先是对webview的设置: myWebView = (WebView ...
- _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
原文地址::http://blog.csdn.net/xiaolongwang2010/article/details/7550505 相关网帖 1.错误找不到WinsdkVer.h----http: ...
- Qt工程打包发布
Qt版本 5.7.1 1.添加环境变量 在..\Qt5.7.0\5.7\msvc2013_64\bin(..省略了盘符,例如我的是D:\Qt\Qt5.7.0\5.7\msvc2013_64\bin) ...
- github添加ssh方法(windows版)
生成一个新的SSH key 打开 git bash 输入 ssh-keygen -t rsa -b 4096 -C "your_email@example.com" 输入一个文件 ...
- idea 分支主干管理
1.创建分支 2.切换主干/分支 3.合并主干.分支
- Python3.4下安装pip和MySQLdb
想用pyhton3.4做数据分析,pip和MySQLdb是必要的,一个便于安装常用模块,一个用来操作数据库.当时安装这两个模块时,由于没有人指导,花了很多的时间才安装好. 安装pip时,按照网上的教程 ...
- iOS 实例变量修饰符
@public 可以在其他类中访问被@public修饰的成员变量 可以在本类中访问被@public修饰的成员变量 可以在子类中访问fl中被@public修饰的成员变量 @private 不可以在其他类 ...
- InstallSheild的一些常量
在用InstallShield制作安装包的时候,我们经常需要用到一些常量,弄清楚这些常量的具体含义,可以方便我们灵活使用脚本. TARGETDIR 默认安装路径,在安装过程中用户可手动更改.如:安装 ...