资源简介
适用于windows和linux下的抓图
基本功能已完成,还有一些小细节问题以后慢慢解决
代码片段和文件信息
#include “grabwindows.h“
#include “screenshotpart.h“
GrabWindows::GrabWindows(QWidget *parent)
: QDialog(parent Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint)
{
setWindowIcon(QIcon(“:/applets-screenshooter.png“));
setWindowtitle(tr(“screenshot“));
iconPix = QPixmap(“:/applets-screenshooter.png“);
buttonGroup = new QButtonGroup(this);
QRadioButton *grabDeskTop = new QRadioButton(this);
// grabDeskTop->setShortcut(QKeySequence(tr(“Alt+D“)));
grabDeskTop->setText(tr(“Grab Qll &Desktop“));
grabDeskTop->move(70 30);
grabDeskTop->setChecked(true);
buttonGroup->addButton(grabDeskTop 0);
QRadioButton *grabCurrentWindow = new QRadioButton(this);
grabCurrentWindow->setText(tr(“Grab Current &Window“));
grabCurrentWindow->move(70 55);
buttonGroup->addButton(grabCurrentWindow 1);
QRadioButton *grabPartArea = new QRadioButton(this);
grabPartArea->setText(tr(“Choose Part &Area“));
grabPartArea->move(70 85);
buttonGroup->addButton(grabPartArea 2);
timeDelayLabel = new QLabel(tr(“DelyBefore&Grab“) this);
timeDelayLabel->setGeometry(70 120 100 20);
timeComBox = new QSpinBox(this);
timeComBox->setGeometry(175 118 55 25);
timeComBox->setRange(0 99);
timeDelayLabel->setBuddy(timeComBox);
QLabel *secondLabel = new QLabel(tr(“s“) this);
secondLabel->setGeometry(235 120 20 20);
QPushButton *cacelBtn = new QPushButton(this);
cacelBtn->resize(85 30);
cacelBtn->move(60 160);
cacelBtn->setText(tr(“&Cancel“));
connect(cacelBtn SIGNAL(clicked()) this SLOT(hide()));
QPushButton *grabBtn = new QPushButton(this);
grabBtn->resize(85 30);
grabBtn->move(160 160);
grabBtn->setText(tr(“&Screenshot“));
connect(grabBtn SIGNAL(clicked()) this SLOT(slotGrabWindows()));
connect(buttonGroup SIGNAL(buttonclicked(int)) this SLOT(slotButtonGroup(int)));
initTrayiconMenu();
resize(290 210);
move((QApplication::desktop()->width() - width())/2 (QApplication::desktop()->height() - height())/2);
}
GrabWindows::~GrabWindows()
{
}
void GrabWindows::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setPen(QPen(QColor(“#000000“) 2 Qt::SolidLine Qt::RoundCap Qt::RoundJoin));
painter.setFont(QFont(“arial“ 10 QFont::Black));
painter.drawText(QRect(10 10 60 60) QString(tr(“Grabwindow“)));
painter.drawPixmap(QRect(10 30 iconPix.width() iconPix.height()) iconPix);
}
void GrabWindows::slotSaveFullScreen()
{
timer->stop();
fullScreenPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
savePix = new ScreenShotSave(fullScreenPixmap);
savePix->exec();
delete savePix;
savePix = NULL;
show();
}
void GrabWindows::slotSaveCurrentScreen()
{
show();
if (QApplication::activeWindow()) {
timer->stop();
currentScreenPixmap = QPixmap::grabWindow( QApplication::activeWindow()->winId()
- 上一篇:连分数与历法 初等数论
- 下一篇:SDH基本原理讲解,相信看了你对SDH立刻明白
相关资源
-
将xm
l内容显示Qt界面 - qt 设计菜单图标qt 设计菜单图标
- CameraHDR.rar
- qt ftp上传
- Qt窗体间传递数据的三种模型
- Qt 写的http 请求使用POST Json
- YUV420在qt5下显示
- qt 压缩解压缩文件和文件夹源码
- Quectel_EC2x&EG9x;&EM05;_MQTT_Application_Note
- 基于QT的聊天小程序实现注册登录,传
- 地图抓图小软件
- Qt中国象棋项目 毕业设计
- qt的各个版本和qt-vs-addin各个版本的链
- qt用QCustomPlot实现鼠标实时回调xy轴数
- 桌面精灵桌面精灵桌面精灵
- 基于 QT5 百度语音API 图灵机器人API 的
- vert.x结合springboot开发mqtt服务,真实可
- QT实现视频监控开发画面分割
- qt usb通信
- 关于QT的数字时钟含闹钟
- 基于v4l2的qt视频实时显示
- Qt5.4编写的图书管理系统
- qt通讯录实验
- QT5.5 动态刷新tabview
- DynamicChart.zip
- 基于Qt的以串口接收的温度显示界面,
- QT项目添加外部库详细步骤和
- TMS MQTT_v1.1.0.2.rar
- testRoll.7z
- Qt输入法事件 QInputMethodEvent
评论
共有 条评论