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

Qt中單擊和雙擊事件的區別

Distinguish between single and double click events in Qt(Qt中單擊和雙擊事件的區別)
本文介紹了Qt中單擊和雙擊事件的區別的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 QAbstractItemView 需要對單擊和雙擊事件做出反應.根據是單擊還是雙擊,操作會有所不同.出現的問題是在雙擊事件之前接收到單擊事件.

I have a QAbstractItemView that needs to react to single and double click events. The actions are different depending on whether it was single clicked or double clicked. The problem that is occurring is that the single click event is received prior to the double click event.

是否有推薦的方法/最佳實踐來區分兩者?當用戶實際雙擊時,我不想執行單擊操作.

Is there a recommended way/best practice for distinguishing between the two? I don't want to perform the single click action when the user has actually double clicked.

我使用的是 Qt 4.6

I am using Qt 4.6

推薦答案

您可以在標題為 在 QtCentre 論壇上的雙擊捕獲

You can find answer in the thread titled Double Click Capturing on QtCentre forum;

你可以有一個計時器.啟動releaseEvent 處理程序中的計時器和確保超時時間足夠長首先處理雙擊.然后,在雙擊事件中處理程序,您可以停止計時器和防止它開火.如果雙單擊處理程序未觸發,計時器將超時并調用一個插槽您的選擇,您可以在哪里處理單擊.這當然是一個討厭的黑客,但有機會工作.

You could have a timer. Start the timer in the releaseEvent handler and make sure the timeout is long enough to handle the double click first. Then, in the double click event handler you can stop the timer and prevent it from firing. If a double click handler is not triggered, the timer will timeout and call a slot of your choice, where you can handle the single click. This is of course a nasty hack, but has a chance to work.

威索塔

這篇關于Qt中單擊和雙擊事件的區別的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 国产香蕉视频 | 成人网视频| 激情a | 国产在线视频一区 | 日韩中文字幕第一页 | 青青草国产在线观看 | 69xxx免费| 中文字幕一区二区三区精彩视频 | 国产精品久久精品 | 亚洲精品免费视频 | 国产精品99久久久久久久久 | 日本特黄a级高清免费大片 国产精品久久性 | 国产精品一区二区三区在线 | 国产一区二区毛片 | 99热热| 草久网| 超碰导航| 伊人春色成人 | 亚洲精品乱码久久久久久蜜桃91 | 91综合网| 最新午夜综合福利视频 | 日韩在线观看中文字幕 | 国产精品1 | 在线成人福利 | 久久久精品高清 | 亚洲高清久久 | 综合久久av | 精品国产成人 | 国际精品鲁一鲁一区二区小说 | 精品国产一区二区在线 | 亚洲一二三区免费 | 国产欧美在线播放 | 99re国产视频 | 天天操天天玩 | 亚洲一区二区三区久久 | 久久精品福利 | 成人av一区 | 国产欧美日韩精品一区 | 九九综合| 久草青青草 | 国产精品一区一区 |