cost 338 ms
QGraphicsPixmapItem 的縮放旋轉功能

[英]Scaling-Rotating functionality on QGraphicsPixmapItem

如果 QGraphicView 具有旋轉/縮放圖像的功能,我在 inte.net 上搜索了很多次,但我沒有成功。 我想要的就像每個圖表程序一樣,每個圖像/形狀都有邊界點,因此用戶可以縮放或旋轉形狀/圖像。 如下所示: 到目前為止,我所擁有的是: 那么如何才能有效地做到這一點呢? 我在 QGraph ...

PyQt5 QGraphicsPixmapItem 旋轉中心

[英]PyQt5 QGraphicsPixmapItem center of rotation

我正在嘗試使用 PyQt5 和 Qt Designer 制作一個簡單的速度計。 由於速度表箭頭self.arrow的旋轉,我遇到了問題。 這是代碼: class MyWin(QtWidgets.QMainWindow): def __init__(self, parent=None): ...

為已經轉換的 QGraphicsItem 設置轉換原點

[英]Set transform origin point for an already transformed QGraphicsItem

我有一個機械手,其中包含兩個連接的移動臂。 當 arm1 旋轉時,arm2 也圍繞 arm1 的相同原點旋轉。 當 arm2 旋轉時 arm1 不應移動,arm2 應圍繞 arm2 原點旋轉。 以下代碼用於圍繞 arm1 原點旋轉 arm1 和 arm2。 這非常有效。 但是當我只想旋轉 a ...

單擊相應的 QGraphicsPixmapItem 時如何打開圖像?

[英]How to open image when corresponding QGraphicsPixmapItem is clicked?

我正在構建一個 GUI,用於使用QGraphicsScene和QGraphicsPixmapItem (下面的代碼)在網格中顯示照片(來自文件夾)。 現在我想在點擊QGraphicsPixmapItems之一時打開相​​應的原始圖像。 如果我在QGraphicsScene內部單擊,我會覆蓋 Mous ...

QGraphicsPixmapItem 旋轉不正確

[英]QGraphicsPixmapItem is not rotating correctly

我需要通過一個圓圈旋轉QGraphicsPixmapItem 。 也就是說,圓圈總是需要在圖像的左上角,當我拖動圓圈時,圖像必須旋轉。 我使用setRotation設置旋轉角度,使用setTransformOriginPoint設置旋轉點。 但是,旋轉不能正常工作。 有人能指出我正確的方向嗎? im ...

QGraphicsPixmapItem 未正確定位

[英]QGraphicsPixmapItem is not being positioned correctly

我需要通過位於圖像左上角的圓圈移動QGraphicsPixmapItem 。 也就是說,當我用鼠標抓住圓圈時,我需要圖像的左上角跟隨圓圈。 我itemChange了QGraphicsEllipseItem並重新實現了itemChange方法,但是當我將圖像的位置設置為該值時,圖像沒有被正確定位。 我 ...

PyQt5 像素級碰撞檢測

[英]PyQt5 pixel level collision detection

我正在學習 Python 並想用 PyQ5t 制作一個簡單的平台游戲。 目前,當我想在游戲中的形狀之間進行像素級碰撞檢測時,我遇到了麻煩。 我已將 QPixMap 設置為透明,並嘗試使用 QGraphicsPixmapItem.HeuristicMaskShape 形狀模式,但碰撞檢測不起作用。 如 ...

是否可以將一個 QGraphicsPixmapItem 附加到另一個?

[英]Is it possible to attach one QGraphicsPixmapItem to another?

我目前正在 Python 中使用 PyQt4,但我無法在網上找到任何關於將 PyQt UI 上的 GraphicsView 類中的 2 個不同項目組合在一起的任何信息。 這可能嗎? 目標是將一個 QGraphicsPixmapItem 錨定到 GraphicsView 類中的另一個,這樣當一個位置 ...

QGraphicsPixmapItem - 僅觸發頂部 object 的事件

[英]QGraphicsPixmapItem - trigger only event of the top object

我正在嘗試制作紙牌游戲。 玩家有卡片和(手)的向量,它在 GUI 中表示。 我的卡片繼承自 QGraphicsPixmapItem 和 QObject。 我想要實現的是在 Card 上設置 MouseEvent 並僅為一張卡觸發此事件。 現在如果我點擊卡片就會出現問題,會出現關閉的情況(如圖所示) ...

在pyqt5中使用QPainterPath填充繪制的路徑

[英]Filling a drawn path using QPainterPath in pyqt5

我有一個QGraphicsView圖像被加載到其中。 然后創建它,這樣您就可以用QPainterPath用指針繪制圖像,然后通過連接起點和終點來關閉路徑。 我想知道如何在釋放鼠標后填充該區域,然后使該對象可選但不可移動。 我嘗試使用QPaint並填充路徑,如addGraphicsIte ...

將端口添加到QGraphicsPixmapItem對象

[英]Add ports to the QGraphicsPixmapItem object

我已經創建了這樣的東西。 我創建了一個QGraphicsPixmapItem對象,可以將其添加到QGraphicsView中。 我想向我創建的這些對象添加端口。 我想在這些端口和我創建的對象之間建立連接。 我不知道該怎么做。 你能幫助我嗎 ? 我的代碼 class Part ...

如何重新實現QGraphicsPixmapItem的itemChange和mouseMoveEvent?

[英]How do I reimplement the itemChange and mouseMoveEvent of a QGraphicsPixmapItem?

我正在使用PySide構建T恤設計器。 為此,我在場景中將T恤的圖像設置為QGraphicsScene作為QPixmapItem。 為了將設計覆蓋在T恤上,我從用戶那里獲得了設計圖像PNG,並將其設置為另一個QPixmapItem。 我使用setPos()方法將它們對齊,然后使用setZV ...

Qt:如何使QGraphicsPixmapItem自動在重復路線中移動

[英]Qt: how to make QGraphicsPixmapItem automatically move in a repeating route

我現在正在制作游戲,並且我希望QGraphicsPixmapItem在同一視圖中在視圖之間反復從左向右和從右向左自動移動。 更加具體: 我的敵人從(0,0)開始,然后向右(x()+ 3)開始。 當它到達最右邊(800,0)時,它會向左轉到並繼續移動(x()-3)直到它到達最左邊 ...

圖形項的QGraphicsScene中的可拖動像素圖

[英]Draggable pixmaps inside a QGraphicsScene of graphic items

我有一個場景,其中包含一個12 * 4的網格和QGraphicsItems塊,當我右鍵單擊這些塊時,我有一個contexmenu可以在塊內添加圖標,我的難題是我無法確定如何使這些圖標可拖動對於圖形場景中的其他塊,我知道有“可拖動圖標示例”,但是如何將代碼實現到圖形場景中。 這是mainwi ...

調整QGraphicsPixmapItem的大小

[英]Resize QGraphicsPixmapItem

我需要在QGraphicsScene上放置一個可點擊的圖片。 這是我的方法: 但是我不知道如何縮小尺寸。 請告訴我,如何制作較小的QGraphicsPixmapItem或是否有另一種方法在QGraphicsScene上放置可單擊和可調整大小的圖片? ...

Qt QGraphicsProxyWidget隱藏其他QGraphicsProxyWidgets

[英]Qt QGraphicsProxyWidget hiding other QGraphicsProxyWidgets

我正在使用QGraphicsScene和-View開發一台老虎機,並且該項目即將結束。 但是,現在我想在獲勝線上添加一個小矩形,以顯示該行中獲勝積分的數量。 rect是QGraphicsProxyWidget中的QLabel。 我不知道這是否是解決此問題的最佳方法,但目前無法找到更好的解決 ...

Qt:QGraphicsPixmapItem類中的信號和插槽

[英]Qt: Signals and Slots in QGraphicsPixmapItem class

我已經從QGraphicsPixmapItem繼承了一個稱為GraphicsPixmapItem的類,以覆蓋/創建一些鼠標事件。 問題是我想在執行一些計算后發出信號,但是除非進行了一些修改,否則看起來是不可能的,因為此類不是QObject 。 為此,我也嘗試從QObject繼承上述新類, ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM