pyqt pyside qcombobox disable wheel scrolling,去除滚轮改变值和获取焦点功能

from PyQt5 import QtWidgets, QtCore

class CustemComboBox(QtWidgets.QComboBox):
def __init__(self, parent = None):
super(CustemComboBox,self).__init__(parent) self.setFocusPolicy(QtCore.Qt.StrongFocus) def wheelEvent(self, e):
e.ignore()
pass

这样之后,qcombobox 使用中键滚轮的时候就不会再改变当前值了,而且滚轮中键滚动,也不会影响其所在的scroll控件滚动(如果有的话)

改方式同样适应于有wheelEvent的类,例如QSpinBox和QDoubleSpinBox

pyqt pyside qcombobox disable wheel scrolling的更多相关文章

  1. pyqt pyside QLineEdit 重写键盘事件

    pyqt pyside QLineEdit 重写键盘事件 def keyPressEvent(self, event): if (event.modifiers() & QtCore.Qt.S ...

  2. pyqt pyside 设置窗口关闭时删除自身

    pyqt pyside 设置窗口关闭时删除自身 self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

  3. pyqt pyside 窗口自动调整大小

    pyqt pyside 窗口自动调整大小 在QTimer中一直调整 def initTimer(self): self.resizeTimer = QtCore.QTimer(self) self.r ...

  4. pyqt pyside QLabel 显示图片

    pyqt pyside QLabel 显示图片 pixmap = QtGui.QPixmap("D:/myPicture.jpg") label.setPixmap(pixmap) ...

  5. pyqt pyside QPushButton 图标(icon)大小自适应设置

    pyqt pyside QPushButton 图标(icon)大小自适应设置 img = QtGui.QImage(r'd:/test.png') pixmap = QtGui.QPixmap(im ...

  6. pyqt pyside QAction 代码中触发

    pyqt pyside QAction 代码中触发 一般如果多个QAction(在同一个 QButtonGroup 中,而且是 checkable 的),不同情况下我们希望其中某个默认checked: ...

  7. PyQt PySide QListWidget 添加自定义 widget

    PyQt PySide QListWidget 添加自定义 widget 原文链接:https://stackoverflow.com/questions/25187444/pyqt-qlistwid ...

  8. PySide——Python图形化界面入门教程(六)

    PySide——Python图形化界面入门教程(六) ——QListView和QStandardItemModel 翻译自:http://pythoncentral.io/pyside-pyqt-tu ...

  9. 【Android应用开发】RecycleView API 翻译 (文档翻译)

    . RecyclerView extends ViewGroupimplements ScrollingView NestedScrollingChild java.lang.Object    ↳ ...

随机推荐

  1. 查询父节点parentNode

    示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 <!DOCTYPE htm ...

  2. 7个步骤让PC网站自动适配手机网页

    传统的网站如何完成向移动设备的快速转型? 通过移动适配技术可以实现,切图网是国内首家基于web技术服务的公司,而移动适配主要通过底层的web技术开发手段来完成,下面切图网将从技术角度来告诉你通过7个步 ...

  3. Linux/ubuntu 心得

    基本命令 有n个软件未被升级(有强迫症的,不爽的 apt-get dist-upgrade 更改主机名字 git 不要免密输入的话,可在当前工作目录执行 git config credential.h ...

  4. phpstrom

    在phpstrom 中启用composer 步骤: 1.打开编辑器,选择 文件(file)->设置(setting),找到 Command Line Tool Support ,点击 + 号进行 ...

  5. python-django-天天生鲜项目

    1 需求分析 github源码:https://www.github.com/wangyingchuang/dailyfresh 1.1  用户模块 1) 注册页 l  注册时校验用户名是否已被注册. ...

  6. Python数值日期时间笔记

    数值: 格式化 小数位的处理 随机数: random.choice() 序列中随机选择一个值 random.sample() 获取指定数目的序列 random.shuffle() 打乱顺序 rando ...

  7. post请求 大坑 注意点

    如果后台接收的是一个list 前台请求的时候 PLdelete() { //批量删除流量计 console.log(this.multipleSelection instanceof Array,9) ...

  8. 牛客 82E 无向图中的最短距离 (bitset,bfs)

    有一个n个点的无向图,有m次查询,每次查询给出一些(xi,yi) 令dist(x,y)表示x和y点在图中最短距离,dist(x,x)=0,如果x,y不连通则dist(x,y) = inf 每次查询图中 ...

  9. 使用paypal-php-sdk开发php国际支付

    参考:https://github.com/paypal/PayPal-PHP-SDK/wiki https://blog.csdn.net/markely/article/details/79044 ...

  10. (九)Struts标签基础(二)

    2.3 非表单标签 2.3.1 <s:actionerror>标签, this.addActionError("错误信息1");   //使用addActionErro ...