久久久久久久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>
                          主站蜘蛛池模板: 成人黄色在线 | 欧美一级在线免费观看 | 日韩在线中文字幕 | 国产精品久久久亚洲 | 国产资源视频 | 国产精品久久一区 | 亚洲不卡在线观看 | 亚洲欧美一区二区三区国产精品 | 日韩av在线一区二区 | 99成人 | 欧美国产精品一区二区三区 | 久久久国产精品一区 | 曰批视频在线观看 | 99在线国产 | 精品国产青草久久久久福利 | 亚洲国产精品久久久久 | 欧美日韩成人一区二区 | 91免费高清视频 | 色网站在线| 欧美黄色片 | 99热国产精品 | 免费的av网站 | 2018国产精品| 国产二区在线播放 | 日韩高清三区 | 911精品美国片911久久久 | 99热精品在线 | 精品久久香蕉国产线看观看亚洲 | 日韩三级在线 | 国产精品毛片无码 | 日韩资源 | 久久9视频 | 色爱区综合 | 国产一区二区在线免费 | 一区二区在线 | 国产精品欧美精品日韩精品 | 久久精品一区二区三区四区 | 天天操网 | 亚洲精品国产综合区久久久久久久 | 一区二区三区四区视频 | 孰女乱色一区二区三区 |