久久久久久久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 ()?環形?)
主站蜘蛛池模板: 国产一区二区三区久久久久久久久 | 国产伦精品一区二区三区照片91 | 欧美成人精品在线 | 九九热精品视频 | 欧美日韩亚洲国产 | 99久久精品免费看国产高清 | 玖玖在线精品 | 欧美成人精品一区二区男人看 | 国产精品久久久久免费 | 黄色一级电影在线观看 | 盗摄精品av一区二区三区 | 人人干在线视频 | 亚洲色综合 | 亚洲国产欧美日韩 | 91麻豆蜜桃一区二区三区 | 九九九久久国产免费 | 亚洲福利免费 | 日本中出视频 | 一区二区高清 | 中文字幕免费在线 | 日本一区二区高清不卡 | 真人女人一级毛片免费播放 | 精品国产一区二区三区四区在线 | 日韩欧美一区二区三区四区 | 91久久久久久久久久久久久 | 日日摸夜夜添夜夜添精品视频 | 午夜视频在线免费观看 | 中文字幕中文字幕 | 国产东北一级毛片 | 国产成人免费视频网站视频社区 | 中文字幕一区二区三区四区 | 欧美一级片中文字幕 | 国产精品视频一二三区 | 午夜影院在线视频 | 日韩精品在线播放 | 国产精品美女久久久免费 | 国产免费自拍 | 爱爱免费视频 | 国产亚洲第一页 | 亚洲精品久久久一区二区三区 | 天堂一区二区三区 |