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

如何在 QGraphicsView 中平移圖像

how to pan images in QGraphicsView(如何在 QGraphicsView 中平移圖像)
本文介紹了如何在 QGraphicsView 中平移圖像的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問題描述

我目前能夠?qū)⑽业膱D像加載到 Graphics 場(chǎng)景中,然后再次加載到 QGraphicsViewer 中.

I am currently able to load my image into a grahpics scene, and then again into a QGraphicsViewer.

我可以通過檢測(cè) QEvent::Wheel 然后調(diào)用 graphicsViews 的 scale() 函數(shù)來(lái)實(shí)現(xiàn)縮放功能.

I am able to implement a zoom feature by dtecting a QEvent::Wheel and then calling the graphicsViews's scale() function.

但是,我似乎無(wú)法弄清楚如何使平移功能正常工作.我基本上想檢測(cè)鼠標(biāo)何時(shí)點(diǎn)擊了圖像,然后隨著鼠標(biāo)向左、向右、向上或向下移動(dòng)圖像.

However, I can't seem to figure out how to get the pan functionality working. I basically want to detect when a mouse has clicked down on the image, and then move the image left, right, up or down along with the mouse.

截至目前,我基本上有一個(gè) MouseFilter 類,用于檢測(cè)事件,并根據(jù)事件類型做不同的事情.我將該偵聽器附加到 QGraphicsView 對(duì)象

As of right now, I basically have a MouseFilter class that is detecting events, and doing different things depending on the event type. I attached that listener to the QGraphicsView object

推薦答案

QGraphicsView 具有內(nèi)置的鼠標(biāo)平移支持.設(shè)置正確的 DragMode 它將處理其余的.您確實(shí)需要啟用滾動(dòng)條才能工作.

QGraphicsView has build-in mouse-panning support. Set correct DragMode and it will handle the rest. You do need the enable scroll bars for that to work.

這篇關(guān)于如何在 QGraphicsView 中平移圖像的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 激情综合久久 | 天天做天天爱 | 丁香九月婷婷 | 一级黄片毛片 | 国产suv精品一区 | 亚洲精品免费观看 | 久久精品视频99 | 久久久久久亚洲精品 | 伊人网在线 | 日韩一区二区免费视频 | 日韩视频在线观看免费 | 亚洲免费久久 | 欧美一级在线视频 | 日韩超碰 | 日韩一区二区三区在线播放 | 亚洲www啪成人一区二区麻豆 | 欧美激情视频一区二区三区 | 国产精品一区在线播放 | 99久久久国产精品免费蜜臀 | 黄色成人在线视频 | 天天干天天操天天射 | 日本久久精品视频 | 在线观看国产小视频 | 免费性爱视频 | 精品视频在线免费 | 午夜精品久久久久久久99黑人 | 亚洲成人二区 | 日韩高清一区二区 | 欧美色综合天天久久综合精品 | 欧美性色网 | 91精品国产综合久久久蜜臀 | 日韩av影片 | 国产一区中文字幕 | 欧美日韩一区二区在线观看 | 欧美视频二区 | 色多多在线观看 | 伊人黄色 | 国产999在线观看 | 九九热在线播放 | 高清av在线 | 一级片免费视频 |