久久久久久久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' 對(duì)象沒(méi)有屬性 'pos'

      QMouseEvent#39; object has no attribute #39;pos#39;(QMouseEvent 對(duì)象沒(méi)有屬性 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' 對(duì)象沒(méi)有屬性 'pos'的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                當(dāng)我嘗試將圖像標(biāo)簽移動(dòng)到屏幕上時(shí),我在使用 PyQT6 時(shí)遇到了一些問(wèn)題.

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

                我試圖將 Scrollabel 區(qū)域中的標(biāo)簽移動(dòng)到框架中,但出現(xiàn)以下錯(cuò)誤: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 重構(gòu)了事件輸入 API 以適應(yīng)新技術(shù)(閱讀 https://www.qt.io/blog/input-events-in-qt-6 了解更多信息)所以它引入了新的基礎(chǔ)諸如 QSinglePointEvent 之類(lèi)的 QMouseEvent 繼承自的類(lèi)具有返回事件位置(在本例中為鼠標(biāo))的 position() 方法.即便如此,Qt6 有 pos() 方法是多余的,但為了兼容性而維護(hù),但似乎 PyQt6 已經(jīng)消除了它,這似乎是一個(gè)錯(cuò)誤,因?yàn)?PySide6 仍然保持它與 Qt6 的兼容性.所以在這種情況下,你應(yīng)該使用 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().

                這篇關(guān)于QMouseEvent' 對(duì)象沒(méi)有屬性 'pos'的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                PyQt progress jumps to 100% after it starts(PyQt 啟動(dòng)后進(jìn)度躍升至 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 刻度標(biāo)簽設(shè)置在固定位置,以便當(dāng)我向左或向右滾動(dòng)時(shí),yaxis 刻度標(biāo)簽應(yīng)該可見(jiàn)
                `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時(shí)顯示進(jìn)度條?)

                <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>
                          主站蜘蛛池模板: 久久麻豆精品 | 亚洲成人免费视频在线 | 麻豆国产精品777777在线 | 国产精品一区在线观看你懂的 | 精品一区二区久久久久久久网站 | 欧美性jizz18性欧美 | 欧美激情一区二区 | 久久91 | 欧美黄色大片在线观看 | 中文字幕一区二区三区精彩视频 | 欧美激情一区二区三区 | 久久精品久久久久久 | 91精品国产综合久久福利软件 | 伊人久久免费视频 | 色婷婷av一区二区三区软件 | 日本一区不卡 | 欧美a√| 一区二区三区在线 | 成人国内精品久久久久一区 | 天堂综合| www日本高清视频 | 少妇一区在线观看 | 青青草社区| 亚洲一区二区av | 婷婷久久久久 | 激情五月婷婷综合 | 午夜精品久久久久99蜜 | 免费色网址| 五月婷婷激情 | 欧美一区二区三区在线观看视频 | 国产高清精品一区二区三区 | 国产成人精品一区二区三区在线 | 久久久网 | 免费一级片 | 亚洲精品女优 | 国产农村妇女精品一区 | 91操操操| 精品亚洲一区二区三区 | 欧美精品国产一区二区 | 欧美天堂 | 伊人中文网|