久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <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="qwawimqqmiuu" 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="qwawimqqmiuu" 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="qwawimqqmiuu" id='ojKQD'><tfoot id='ojKQD'></tfoot><dl id='ojKQD'><fieldset id='ojKQD'></fieldset></dl></div>
                        2. 主站蜘蛛池模板: 最新国产福利在线 | 九九久久免费视频 | 日韩欧美一级精品久久 | 91麻豆精品国产91久久久久久久久 | 久久综合久色欧美综合狠狠 | 亚洲黄色av | 正在播放国产精品 | 国产激情视频在线 | 乱一性一乱一交一视频a∨ 色爱av | 国产综合精品一区二区三区 | 国产成人精品久久二区二区 | 亚洲免费成人 | 精品国产一区二区国模嫣然 | 久久国产视频网 | 在线男人天堂 | 91欧美精品成人综合在线观看 | 三级在线观看 | 插插宗合网 | 日韩一区二区在线播放 | 中文字幕一区二区三区不卡在线 | 久久激情视频 | 亚洲精品日韩精品 | 国产一区二区三区四区五区加勒比 | 精品国产一区二区三区久久影院 | 国产中的精品av涩差av | 国产精品福利网 | 日本不卡视频在线播放 | 久久丁香| 这里精品| 国产乱xxav | 亚洲精品久久久久久久久久久久久 | 国产精品一区二区在线免费观看 | 一级片免费视频 | 一区二区三区四区国产精品 | 日本在线免费观看 | 在线色网址 | 日韩精品一区二区三区中文在线 | 国产91丝袜在线播放 | 国产一区二区在线免费观看 | 欧美性视频在线播放 | 看片国产|