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

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

    <tfoot id='p9DoD'></tfoot>
      <legend id='p9DoD'><style id='p9DoD'><dir id='p9DoD'><q id='p9DoD'></q></dir></style></legend>

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

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

      QMouseEvent' 對象沒有屬性 'pos'

      QMouseEvent#39; object has no attribute #39;pos#39;(QMouseEvent 對象沒有屬性 pos)

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

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

            <bdo id='NYR1r'></bdo><ul id='NYR1r'></ul>
            • <tfoot id='NYR1r'></tfoot>
                <tbody id='NYR1r'></tbody>

              1. <i id='NYR1r'><tr id='NYR1r'><dt id='NYR1r'><q id='NYR1r'><span id='NYR1r'><b id='NYR1r'><form id='NYR1r'><ins id='NYR1r'></ins><ul id='NYR1r'></ul><sub id='NYR1r'></sub></form><legend id='NYR1r'></legend><bdo id='NYR1r'><pre id='NYR1r'><center id='NYR1r'></center></pre></bdo></b><th id='NYR1r'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NYR1r'><tfoot id='NYR1r'></tfoot><dl id='NYR1r'><fieldset id='NYR1r'></fieldset></dl></div>
              2. 本文介紹了QMouseEvent' 對象沒有屬性 'pos'的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                當我嘗試將圖像標簽移動到屏幕上時,我在使用 PyQT6 時遇到了一些問題.

                I'm having some problems here with PyQT6 while i try to move a image label trought the screen.

                我試圖將 Scrollabel 區域中的標簽移動到框架中,但出現以下錯誤:PyQT6: 'QMouseEvent' object has no attribute 'pos'"

                I'm trying to move a label that is in a Scrollabel Area to a frame, and i get the following error: "PyQT6: 'QMouseEvent' object has no attribute 'pos' "

                代碼如下:

                class DraggableLabel(QLabel):
                    def init(self, parent, image):
                        super(QLabel, self).init(parent)
                        pixmap = QPixmap(image)
                        pixmap = pixmap.scaled(120, 120)
                
                        self.setPixmap(pixmap)
                        # self.show()
                
                    def mousePressEvent(self, event):
                        if event.button() == Qt.MouseButtons.LeftButton:
                            # print('Evento: ', event.screenPos())
                            self.drag_start_position = event.pos()
                
                    def mouseMoveEvent(self, event):
                        if not (event.buttons() & Qt.MouseButtons.LeftButton):
                            return
                        if (event.pos() - self.drag_startposition).manhattanLength() < QApplication.startDragDistance():
                            return
                
                        drag = QDrag(self)
                        mimedata = QMimeData()
                        mimedata.setText(self.text())
                        mimedata.setImageData(self.pixmap().toImage())
                
                        drag.setMimeData(mimedata)
                        pixmap = QPixmap(self.size())
                        painter = QPainter(pixmap)
                        painter.drawPixmap(self.rect(), self.grab())
                        painter.end()
                        drag.setPixmap(pixmap)
                        drag.setHotSpot(event.pos())
                        drag.exec(Qt.CopyAction | Qt.MoveAction)
                

                編輯

                追溯:

                PS C:UsersdougProjetos> & C:/Python/python.exe c:/Users/doug/Projetos/main.py
                qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
                Traceback (most recent call last):
                  File "c:Usersdoug_Projetoslibsys_functions.py", line 25, in mousePressEvent
                    self.drag_start_position = event.pos()
                AttributeError: 'QMouseEvent' object has no attribute 'pos'
                

                推薦答案

                Qt6 重構了事件輸入 API 以適應新技術(閱讀 https://www.qt.io/blog/input-events-in-qt-6 了解更多信息)所以它引入了新的基礎諸如 QSinglePointEvent 之類的 QMouseEvent 繼承自的類具有返回事件位置(在本例中為鼠標)的 position() 方法.即便如此,Qt6 有 pos() 方法是多余的,但為了兼容性而維護,但似乎 PyQt6 已經消除了它,這似乎是一個錯誤,因為 PySide6 仍然保持它與 Qt6 的兼容性.所以在這種情況下,你應該使用 position() 而不是 pos().

                Qt6 has refactored the event inputs API to adapt to new technologies (read https://www.qt.io/blog/input-events-in-qt-6 for more information) so it has introduced new base classes such as QSinglePointEvent from which QMouseEvent inherits that have the position() method that returns the position of the event (in this case the mouse). Even so, Qt6 has the pos() method that is redundant but is maintained for compatibility but it seems that PyQt6 has eliminated it which seems like a bug since PySide6 still maintains it having compatibility with Qt6. So in this case you should use position() instead of pos().

                這篇關于QMouseEvent' 對象沒有屬性 'pos'的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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時顯示進度條?)

                <tfoot id='doptm'></tfoot>
                  <bdo id='doptm'></bdo><ul id='doptm'></ul>

                        <tbody id='doptm'></tbody>

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

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

                      2. <i id='doptm'><tr id='doptm'><dt id='doptm'><q id='doptm'><span id='doptm'><b id='doptm'><form id='doptm'><ins id='doptm'></ins><ul id='doptm'></ul><sub id='doptm'></sub></form><legend id='doptm'></legend><bdo id='doptm'><pre id='doptm'><center id='doptm'></center></pre></bdo></b><th id='doptm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='doptm'><tfoot id='doptm'></tfoot><dl id='doptm'><fieldset id='doptm'></fieldset></dl></div>
                          主站蜘蛛池模板: 国产精品视频久久久 | 伊人天堂网 | www.av在线视频 | 天天插天天爽 | 国产精品久久免费 | 久久久精品一区二区三区 | 久久国产精品一区二区三区 | 91久久久久久久久 | 免费视频毛片 | 97免费在线视频 | 欧美在线视频播放 | 国产无遮挡又黄又爽免费网站 | 日本一区二区不卡视频 | 看毛片网站 | 自拍偷拍欧美 | 国产精品一区二区三区不卡 | 免费看一级黄色片 | 国产日韩欧美综合 | 欧美在线网址 | 久久久综合网 | 日韩一区在线视频 | 欧美日韩啪啪 | 国产成人综合网 | 欧美在线激情 | 国产区一区 | 欧美成人精品欧美一级私黄 | 美日韩丰满少妇在线观看 | 成人三级小说 | 日韩国产一区二区 | 一区二区三区视频在线 | 久久久夜 | 亚洲精品一区二三区 | 国产免费一级 | 91精品国产乱码久久久久久 | 国产午夜在线 | eeuss一区二区 | 黄色成年人网站 | 日本亚洲精品 | 香蕉福利视频 | 亚洲综合三区 | 成人性色生活片 |