資源簡(jiǎn)介
一個(gè)簡(jiǎn)單的小例子來(lái)看一看如何用Qt實(shí)現(xiàn)類似QQ的截圖功能,詳情見(jiàn)博客 :http://blog.csdn.net/GoForwardToStep/article/details/54385140
代碼片段和文件信息
#include?“capturescreen.h“
#include?
#include?
#include?
#include?
//?選中矩形8個(gè)拖拽點(diǎn)小矩形的寬高;
#define?STRETCH_RECT_WIDTH?6
#define?STRETCH_RECT_HEIGHT?6
CaptureScreen::CaptureScreen(QWidget?*parent)
????:?QWidget(parent)
?????m_currentCaptureState(InitCapture)
{
????initWindow();
????initStretchRect();
????loadBackgroundPixmap();
}
CaptureScreen::~CaptureScreen()
{
}
void?CaptureScreen::initWindow()
{
????this->setMouseTracking(true);
????//?由于存在類似QQ這樣界面始終顯示在最頂層,設(shè)置屬性?Qt::WindowStaysOnTopHint;
????this->setWindowFlags(Qt::framelessWindowHint?|?Qt::WindowStaysOnTopHint);
????setWindowState(Qt::WindowActive?|?Qt::WindowFullScreen);
????this->setMouseTracking(true);
}
void?CaptureScreen::initStretchRect()
{
?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????15195??2017-01-22?14:53??Qt?之?簡(jiǎn)單截圖功能(三)實(shí)現(xiàn)可拖拽選中區(qū)域\capturescreen.cpp
?????文件???????1969??2017-01-20?09:23??Qt?之?簡(jiǎn)單截圖功能(三)實(shí)現(xiàn)可拖拽選中區(qū)域\capturescreen.h
?????目錄??????????0??2017-01-22?15:00??Qt?之?簡(jiǎn)單截圖功能(三)實(shí)現(xiàn)可拖拽選中區(qū)域
-----------?---------??----------?-----??----
????????????????17164????????????????????3
評(píng)論
共有 條評(píng)論