pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <small id='rMrQq'></small><noframes id='rMrQq'>

      <bdo id='rMrQq'></bdo><ul id='rMrQq'></ul>

    1. <tfoot id='rMrQq'></tfoot>
      <legend id='rMrQq'><style id='rMrQq'><dir id='rMrQq'><q id='rMrQq'></q></dir></style></legend>

    2. <i id='rMrQq'><tr id='rMrQq'><dt id='rMrQq'><q id='rMrQq'><span id='rMrQq'><b id='rMrQq'><form id='rMrQq'><ins id='rMrQq'></ins><ul id='rMrQq'></ul><sub id='rMrQq'></sub></form><legend id='rMrQq'></legend><bdo id='rMrQq'><pre id='rMrQq'><center id='rMrQq'></center></pre></bdo></b><th id='rMrQq'></th></span></q></dt></tr></i><div class="fyqqesj" id='rMrQq'><tfoot id='rMrQq'></tfoot><dl id='rMrQq'><fieldset id='rMrQq'></fieldset></dl></div>

    3. 如何在右側 cilck 上的 Qdoublespinbox 上向 QtCore.Qt.

      how to add an action to QtCore.Qt.DefaultContextMenu on Qdoublespinbox on right cilck?(如何在右側 cilck 上的 Qdoublespinbox 上向 QtCore.Qt.DefaultContextMenu 添加操作?)
      <i id='Avq8O'><tr id='Avq8O'><dt id='Avq8O'><q id='Avq8O'><span id='Avq8O'><b id='Avq8O'><form id='Avq8O'><ins id='Avq8O'></ins><ul id='Avq8O'></ul><sub id='Avq8O'></sub></form><legend id='Avq8O'></legend><bdo id='Avq8O'><pre id='Avq8O'><center id='Avq8O'></center></pre></bdo></b><th id='Avq8O'></th></span></q></dt></tr></i><div class="kvyfqzu" id='Avq8O'><tfoot id='Avq8O'></tfoot><dl id='Avq8O'><fieldset id='Avq8O'></fieldset></dl></div>

        • <bdo id='Avq8O'></bdo><ul id='Avq8O'></ul>
                <tbody id='Avq8O'></tbody>
              <legend id='Avq8O'><style id='Avq8O'><dir id='Avq8O'><q id='Avq8O'></q></dir></style></legend>
              <tfoot id='Avq8O'></tfoot>
            • <small id='Avq8O'></small><noframes id='Avq8O'>

                本文介紹了如何在右側 cilck 上的 Qdoublespinbox 上向 QtCore.Qt.DefaultContextMenu 添加操作?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我使用 Qt Designer 開發了一個相當復雜的 GUI 工具.

                有關該工具的更多詳細信息,請參閱:

                然后點擊添加按鈕,然后點擊提升按鈕.

                對于另一個QDoubleSpinBox,右鍵單擊并選擇DoubleSpinBox選項所在的新Promote To選項.

                <小時>

                您可以在這里找到一個示例

                I have developed a fairly complex GUI tool using the Qt Designer.

                For more details about the tool see: https://github.com/3fon3fonov/trifon

                I have defined many QDoubleSpinBox entries and by default the Qt Designer sets their right-click menu policy to:

                setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
                

                Now I want to add few more actions to this menu, but I simply cannot understand how this works! There is nothing in the Qt Designer which will allow me to make a "CustomContextMenu". I understand that for this I may need some coding (with which I will need help, and thus I am asking for help here), but I also need to make it globally for all SpinBox-es.

                Sorry for not posting the code since it is fairly large for this form. If interested, please look at the github under "gui.py". However, there and in the .ui file there is no sign of any possibility to control the contextmenu policy for these buttons. Instead I am posting an image of the tool (sorry for the bad image but PrtSc does not seem to work when the right button in clicked and the menu is displayed)

                see GUI image here

                解決方案

                As we want to add a QAction to the default context menu we first overwrite the contextMenuEvent event and use a QTimer to call a function that filters the toplevels and get the QMenu that is displayed and there we add the QAction:

                doublespinbox.py

                from PyQt5 import QtCore, QtWidgets
                
                class DoubleSpinBox(QtWidgets.QDoubleSpinBox):
                    minimize_signal = QtCore.pyqtSignal()
                
                    def __init__(self, *args, **kwargs):
                        super(DoubleSpinBox, self).__init__(*args, **kwargs)
                        self.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
                
                    def contextMenuEvent(self, event):
                        QtCore.QTimer.singleShot(0, self.add_actions)
                        super(DoubleSpinBox, self).contextMenuEvent(event)
                
                    @QtCore.pyqtSlot()
                    def add_actions(self):
                        for w in QtWidgets.QApplication.topLevelWidgets():
                            if isinstance(w, QtWidgets.QMenu) and w.objectName() == "qt_edit_menu":
                                w.addSeparator()
                                minimize_action = w.addAction("minimize this parameter")
                                minimize_action.triggered.connect(self.minimize_signal)
                
                if __name__ == '__main__':
                    import sys
                    app = QtWidgets.QApplication(sys.argv)
                    w = DoubleSpinBox()
                    w.show()
                    sys.exit(app.exec_())
                


                To use DoubleSpinBox in Qt Designer, first place doublespinbox.py next to your .ui:

                ├── ..
                ├── rvmod_gui.ui
                ├── doublespinbox.py?? 
                ├── ...
                

                then you must promote the widget to do so right click on the QDoubleSpinBox and select the option "Promote to ..." by adding the following to the dialog:

                Then click on the Add button and then the Promote button.

                For the other QDoubleSpinBox, right click and select the new Promote To option where the DoubleSpinBox option is.


                You can find an example here

                這篇關于如何在右側 cilck 上的 Qdoublespinbox 上向 QtCore.Qt.DefaultContextMenu 添加操作?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                  <tbody id='ojKQD'></tbody>

                    <legend id='ojKQD'><style id='ojKQD'><dir id='ojKQD'><q id='ojKQD'></q></dir></style></legend>

                    <small id='ojKQD'></small><noframes id='ojKQD'>

                    • <bdo id='ojKQD'></bdo><ul id='ojKQD'></ul>

                          <tfoot id='ojKQD'></tfoot>
                        1. <i id='ojKQD'><tr id='ojKQD'><dt id='ojKQD'><q id='ojKQD'><span id='ojKQD'><b id='ojKQD'><form id='ojKQD'><ins id='ojKQD'></ins><ul id='ojKQD'></ul><sub id='ojKQD'></sub></form><legend id='ojKQD'></legend><bdo id='ojKQD'><pre id='ojKQD'><center id='ojKQD'></center></pre></bdo></b><th id='ojKQD'></th></span></q></dt></tr></i><div class="nzgryes" id='ojKQD'><tfoot id='ojKQD'></tfoot><dl id='ojKQD'><fieldset id='ojKQD'></fieldset></dl></div>
                        2. 主站蜘蛛池模板: 楼梯定制_楼梯设计施工厂家_楼梯扶手安装制作-北京凌步楼梯 | 手机存放柜,超市储物柜,电子储物柜,自动寄存柜,行李寄存柜,自动存包柜,条码存包柜-上海天琪实业有限公司 | 高尔夫球杆_高尔夫果岭_高尔夫用品-深圳市新高品体育用品有限公司 | MES系统工业智能终端_生产管理看板/安灯/ESOP/静电监控_讯鹏科技 | 细砂提取机,隔膜板框泥浆污泥压滤机,螺旋洗砂机设备,轮式洗砂机械,机制砂,圆锥颚式反击式破碎机,振动筛,滚筒筛,喂料机- 上海重睿环保设备有限公司 | 深圳3D打印服务-3D打印加工-手板模型加工厂-悟空打印坊 | 博医通医疗器械互联网供应链服务平台_博医通 | 定量包装秤,吨袋包装称,伸缩溜管,全自动包装秤,码垛机器人,无锡市邦尧机械工程有限公司 | 济南菜鸟驿站广告|青岛快递车车体|社区媒体-抖音|墙体广告-山东揽胜广告传媒有限公司 | 24位ADC|8位MCU-芯易德科技有限公司 | 双工位钻铣攻牙机-转换工作台钻攻中心-钻铣攻牙机一体机-浙江利硕自动化设备有限公司 | 台式核磁共振仪,玻璃软化点测定仪,旋转高温粘度计,测温锥和测温块-上海麟文仪器 | 澳威全屋定制官网|极简衣柜十大品牌|衣柜加盟代理|全屋定制招商 百度爱采购运营研究社社群-店铺托管-爱采购代运营-良言多米网络公司 | 微水泥_硅藻泥_艺术涂料_艺术漆_艺术漆加盟-青岛泥之韵环保壁材 武汉EPS线条_EPS装饰线条_EPS构件_湖北博欧EPS线条厂家 | 急救箱-应急箱-急救包厂家-北京红立方医疗设备有限公司 | 商用绞肉机-熟肉切片机-冻肉切丁机-猪肉开条机 - 广州市正盈机械设备有限公司 | 奥因-光触媒除甲醛公司-除甲醛加盟公司十大品牌 | MTK核心板|MTK开发板|MTK模块|4G核心板|4G模块|5G核心板|5G模块|安卓核心板|安卓模块|高通核心板-深圳市新移科技有限公司 | 大型低温冷却液循环泵-低温水槽冷阱「厂家品牌」京华仪器_京华仪器 | 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 超声波反应釜【百科】-以马内利仪器 | 回转炉,外热式回转窑,回转窑炉-淄博圣元窑炉工程有限公司 | 打包钢带,铁皮打包带,烤蓝打包带-高密市金和金属制品厂 | 网站优化公司_北京网站优化_抖音短视频代运营_抖音关键词seo优化排名-通则达网络 | 紫外可见光分光度计-紫外分光度计-分光光度仪-屹谱仪器制造(上海)有限公司 | 质构仪_鱼糜弹性仪-上海腾拔仪器科技有限公司 | 电磁铁_小型推拉电磁铁_电磁阀厂家-深圳市宗泰电机有限公司 | 成都思迪机电技术研究所-四川成都思迪编码器 | 齿轮减速机电机一体机_齿轮减速箱加电机一体化-德国BOSERL蜗轮蜗杆减速机电机生产厂家 | 欧必特空气能-商用空气能热水工程,空气能热水器,超低温空气源热泵生产厂家-湖南欧必特空气能公司 | 免费B2B信息推广发布平台 - 推发网| 好物生环保网、环保论坛 - 环保人的学习交流平台 | 泵阀展|阀门展|水泵展|流体机械展 -2025上海国际泵管阀展览会flowtech china | 别墅图纸超市|别墅设计图纸|农村房屋设计图|农村自建房|别墅设计图纸及效果图大全 | 食安观察网| 3d打印服务,3d打印汽车,三维扫描,硅胶复模,手板,快速模具,深圳市精速三维打印科技有限公司 | LHH药品稳定性试验箱-BPS系列恒温恒湿箱-意大利超低温冰箱-上海一恒科学仪器有限公司 | 丹佛斯变频器-Danfoss战略代理经销商-上海津信变频器有限公司 | 防渗土工膜|污水处理防渗膜|垃圾填埋场防渗膜-泰安佳路通工程材料有限公司 | 注塑模具_塑料模具_塑胶模具_范仕达【官网】_东莞模具设计与制造加工厂家 | 美侍宠物-专注宠物狗及宠物猫训练|喂养|医疗|繁育|品种|价格 |