久久久久久久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久久久精品 | 久久久久国产精品视频 | 日韩精品在线一区 | 黄色资源在线观看 | 国产又粗又大又硬 | 国产三级在线观看视频 | 午夜国产视频 | 国产精品久久久久久久成人午夜 | 97视频国产 | 亚洲精品久久久久久久久久久 | 亚洲精品视频免费在线观看 | 久久久网站 | 一区在线观看 | 国产一级免费 | 欧美一区二区三区在线观看 | 欧美日韩免费在线观看 | 亚洲免费观看视频 | 免费一区| 一区二区毛片 | 欧美一级在线 | 日本黄色免费网站 | 黄色免费毛片 | 亚洲视频色 | 日本黄色免费看 | 久久久久国产 | 久久免费视频观看 | 人人草人人草 | 免费国产一区 | 国产精品国产三级国产专区52 | 久久国产99| 免费的黄色小视频 | 欧美日韩精品久久久免费观看 | 精品一二区 | 日本中文字幕网站 | 在线看片a | 日韩欧美中文字幕在线观看 |