新文件: HTYPaint
新文件: HTYPaint.desktop 新文件: HTYPaint.pro 新文件: MirrorHorizontal.png 新文件: MirrorVertical.png 新文件: README.md 新文件: blur.jpg 新文件: clip.png 新文件: color_picker.png 新文件: ellipse.png 新文件: eraser.png 新文件: filename.qrc 新文件: fill.png 新文件: gray.png 新文件: icon.png 新文件: imagewidget.cpp 新文件: imagewidget.h 新文件: invert.png 新文件: line.png 新文件: main.cpp 新文件: mainwindow.cpp 新文件: mainwindow.h 新文件: mainwindow.ui 新文件: move.png 新文件: pencil.png 新文件: preview.png 新文件: rect.png 新文件: rectselect.png 新文件: rl.png 新文件: rr.png 新文件: text.png 新文件: zoom1.png 新文件: zoomin.png 新文件: zoomout.png
|
@ -0,0 +1,10 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=HTYPaint
|
||||||
|
Comment=
|
||||||
|
Exec=/media/sonichy/job/HY/Linux/Qt/HTYPaint/HTYPaint
|
||||||
|
Icon=/media/sonichy/job/HY/Linux/Qt/HTYPaint/icon.png
|
||||||
|
Path=/media/sonichy/job/HY/Linux/Qt/HTYPaint
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
MimeType=
|
||||||
|
Categories=
|
|
@ -0,0 +1,25 @@
|
||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2016-12-13T09:09:45
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = HTYPaint
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += main.cpp\
|
||||||
|
mainwindow.cpp \
|
||||||
|
imagewidget.cpp
|
||||||
|
|
||||||
|
HEADERS += mainwindow.h \
|
||||||
|
imagewidget.h
|
||||||
|
|
||||||
|
FORMS += mainwindow.ui
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
filename.qrc
|
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
|
@ -0,0 +1,12 @@
|
||||||
|
# Qt 海天鹰画图
|
||||||
|

|
||||||
|
Linux 平台基于 Qt 的迷你画图程序。
|
||||||
|
已编译好的 HTYPaint 程序适用64位Linux系统Qt5环境,双击运行,其他版本自行编译。
|
||||||
|
|
||||||
|
### 1.4 新增绘制透明图形
|
||||||
|
### 1.3 新增模糊
|
||||||
|

|
||||||
|
### 1.2 新增导入图形
|
||||||
|
### 1.1 新增灰度和反色
|
||||||
|

|
||||||
|

|
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 554 B |
After Width: | Height: | Size: 830 B |
|
@ -0,0 +1,23 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>icon.png</file>
|
||||||
|
<file>clip.png</file>
|
||||||
|
<file>ellipse.png</file>
|
||||||
|
<file>eraser.png</file>
|
||||||
|
<file>line.png</file>
|
||||||
|
<file>move.png</file>
|
||||||
|
<file>pencil.png</file>
|
||||||
|
<file>rect.png</file>
|
||||||
|
<file>rectselect.png</file>
|
||||||
|
<file>text.png</file>
|
||||||
|
<file>fill.png</file>
|
||||||
|
<file>zoomin.png</file>
|
||||||
|
<file>zoomout.png</file>
|
||||||
|
<file>zoom1.png</file>
|
||||||
|
<file>rl.png</file>
|
||||||
|
<file>rr.png</file>
|
||||||
|
<file>MirrorHorizontal.png</file>
|
||||||
|
<file>MirrorVertical.png</file>
|
||||||
|
<file>color_picker.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -0,0 +1,651 @@
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
#include "imagewidget.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QShortcut>
|
||||||
|
#include <QRect>
|
||||||
|
//#include <QtGlobal>
|
||||||
|
|
||||||
|
QImage imgload,imgpaste;
|
||||||
|
int cundo=0;
|
||||||
|
|
||||||
|
ImageWidget::ImageWidget(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
labelFont=new QLabel;
|
||||||
|
//imgtemp=QImage(600,500,QImage::Format_RGB32);
|
||||||
|
//imgtemp.fill(Qt::white);
|
||||||
|
//image=imgtemp;
|
||||||
|
newfile();
|
||||||
|
pen.setColor(Qt::black);
|
||||||
|
pen.setWidth(1);
|
||||||
|
brush=QBrush(Qt::transparent,Qt::SolidPattern);
|
||||||
|
brush.setColor(Qt::black);
|
||||||
|
boolBorder=true;
|
||||||
|
boolFill=false;
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::ALT + Qt::Key_Up),this), SIGNAL(activated()),this, SLOT(moveUp()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::ALT + Qt::Key_Down),this), SIGNAL(activated()),this, SLOT(moveDown()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::ALT + Qt::Key_Left),this), SIGNAL(activated()),this, SLOT(moveLeft()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::ALT + Qt::Key_Right),this), SIGNAL(activated()),this, SLOT(moveRight()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up),this), SIGNAL(activated()),this, SLOT(moveTopUp()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down),this), SIGNAL(activated()),this, SLOT(moveTopDown()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left),this), SIGNAL(activated()),this, SLOT(moveLeftLeft()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right),this), SIGNAL(activated()),this, SLOT(moveLeftRight()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Left),this), SIGNAL(activated()),this, SLOT(moveRightLeft()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Right),this), SIGNAL(activated()),this, SLOT(moveRightRight()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Up),this), SIGNAL(activated()),this, SLOT(moveBottomUp()));
|
||||||
|
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Down),this), SIGNAL(activated()),this, SLOT(moveBottomDown()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageWidget::~ImageWidget()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
QPainter painter(this);
|
||||||
|
painter.drawImage(0,0,imgtemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::draw(QImage &img){
|
||||||
|
QPainter painter(&img);
|
||||||
|
painter.setPen(pen);
|
||||||
|
switch(draw_type){
|
||||||
|
case POINT_DRAW:
|
||||||
|
painter.drawLine(startPnt,endPnt);
|
||||||
|
break;
|
||||||
|
case LINE_DRAW:
|
||||||
|
painter.drawLine(startPnt,endPnt);
|
||||||
|
break;
|
||||||
|
case RECT_DRAW:{
|
||||||
|
if(boolFill){painter.setBrush(brush);}else{painter.setBrush(QBrush(Qt::transparent,Qt::SolidPattern));}
|
||||||
|
QRect rect(startPnt,endPnt);
|
||||||
|
if(!boolBorder){pen.setColor(Qt::transparent);}
|
||||||
|
painter.drawRect(rect);
|
||||||
|
break;}
|
||||||
|
case SELECT_DRAW:{
|
||||||
|
painter.setPen(QPen(Qt::black,1,Qt::DashLine));
|
||||||
|
painter.setBrush(QBrush(Qt::transparent,Qt::SolidPattern));
|
||||||
|
QRect rect(startPnt,endPnt);
|
||||||
|
painter.drawRect(rect);
|
||||||
|
break;}
|
||||||
|
case ELLIPSE_DRAW:{
|
||||||
|
QRect rect(startPnt,endPnt);
|
||||||
|
if(boolFill){painter.setBrush(brush);}else{painter.setBrush(QBrush(Qt::transparent,Qt::SolidPattern));}
|
||||||
|
painter.drawEllipse(rect);
|
||||||
|
break;}
|
||||||
|
case TEXT_DRAW:
|
||||||
|
painter.setFont(labelFont->font());
|
||||||
|
painter.drawText(startPnt.x(),startPnt.y(),text);
|
||||||
|
break;
|
||||||
|
case FILL_DRAW:
|
||||||
|
break;
|
||||||
|
case ERASE_DRAW:
|
||||||
|
//painter.setPen(QPen(Qt::white,1));
|
||||||
|
//painter.setBrush(QBrush(Qt::white,Qt::SolidPattern));
|
||||||
|
painter.setBrush(QBrush(brush));
|
||||||
|
painter.drawEllipse(endPnt.x(),endPnt.y(),20,20);
|
||||||
|
break;
|
||||||
|
case DEL_DRAW:{
|
||||||
|
painter.setPen(QPen(Qt::white,1,Qt::SolidLine));
|
||||||
|
painter.setBrush(QBrush(Qt::white,Qt::SolidPattern));
|
||||||
|
QRect rect(startPnt,endPnt);
|
||||||
|
painter.drawRect(rect);
|
||||||
|
painter.setPen(pen);
|
||||||
|
painter.setBrush(brush);
|
||||||
|
draw_type=SELECT_DRAW;
|
||||||
|
break;}
|
||||||
|
case MOVE_DRAW:{
|
||||||
|
QRect target(endPnt,imgmove.size());
|
||||||
|
QPoint p(0,0);
|
||||||
|
QRect source(p,imgmove.size());
|
||||||
|
painter.drawImage(target,imgmove,source);
|
||||||
|
break;}
|
||||||
|
case COLORPICKER_DRAW:
|
||||||
|
QRgb RGB = imgtemp.pixel(startPnt.x(),startPnt.y());
|
||||||
|
pen.setColor(RGB);
|
||||||
|
brush.setColor(RGB);
|
||||||
|
painter.setBrush(brush);
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::mousePressEvent(QMouseEvent *e){
|
||||||
|
startPnt = e->pos();
|
||||||
|
endPnt = e->pos();
|
||||||
|
//this->isPressed = true;
|
||||||
|
switch(draw_type){
|
||||||
|
case TEXT_DRAW:
|
||||||
|
draw(imgtemp);
|
||||||
|
image=imgtemp;
|
||||||
|
moveImgbuf();
|
||||||
|
cundo=0;
|
||||||
|
break;
|
||||||
|
case ERASE_DRAW:
|
||||||
|
draw(imgtemp);
|
||||||
|
image=imgtemp;
|
||||||
|
moveImgbuf();
|
||||||
|
cundo=0;
|
||||||
|
break;
|
||||||
|
case COLORPICKER_DRAW:
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::mouseMoveEvent(QMouseEvent *e){
|
||||||
|
//if(this->isPressed){
|
||||||
|
if(e->buttons() & Qt::LeftButton){
|
||||||
|
endPnt = e->pos();
|
||||||
|
switch(draw_type){
|
||||||
|
case TEXT_DRAW:
|
||||||
|
break;
|
||||||
|
case POINT_DRAW:
|
||||||
|
draw(imgtemp);
|
||||||
|
startPnt = endPnt;
|
||||||
|
cundo=0;
|
||||||
|
moveImgbuf();
|
||||||
|
break;
|
||||||
|
case ERASE_DRAW:
|
||||||
|
draw(imgtemp);
|
||||||
|
cundo=0;
|
||||||
|
moveImgbuf();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
imgtemp=image;
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if(draw_type==ERASE_DRAW){
|
||||||
|
//qDebug()<<"mouseMove"<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss:zzz");
|
||||||
|
// endPnt = e->pos();
|
||||||
|
// draw(imgtemp);
|
||||||
|
//ui->statusBar->showMessage(QString::number(e->pos().x())+","+QString::number(e->pos().y()));
|
||||||
|
//}
|
||||||
|
//static_cast<MainWindow*>(parent())->statusBar()->showMessage("mousemove");
|
||||||
|
//static_cast<MainWindow*>(parent())->statusBar()->showMessage("("+QString::number(startPnt.x())+","+QString::number(startPnt.y())+") - ("+QString::number(endPnt.x())+","+QString::number(endPnt.y())+")");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::mouseReleaseEvent(QMouseEvent *e){
|
||||||
|
//this->isPressed = false;
|
||||||
|
if(draw_type!=SELECT_DRAW && draw_type!=MOVE_DRAW){
|
||||||
|
image=imgtemp;
|
||||||
|
moveImgbuf();
|
||||||
|
cundo=0;
|
||||||
|
}
|
||||||
|
if(draw_type==MOVE_DRAW){
|
||||||
|
imgtemp=image;
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::zoomin()
|
||||||
|
{
|
||||||
|
QImage imgzoom=imgtemp.scaled(imgtemp.width()*1.2,imgtemp.height()*1.2);
|
||||||
|
imgtemp=imgzoom;
|
||||||
|
//setMinimumSize(imgzoom.size());
|
||||||
|
resize(imgzoom.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::zoomout()
|
||||||
|
{
|
||||||
|
QImage imgzoom=imgtemp.scaled(imgtemp.width()*0.8,imgtemp.height()*0.8);
|
||||||
|
imgtemp=imgzoom;
|
||||||
|
resize(imgzoom.size());
|
||||||
|
setMinimumSize(imgzoom.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::zoom1()
|
||||||
|
{
|
||||||
|
imgtemp=imgload;
|
||||||
|
setMinimumSize(imgload.size());
|
||||||
|
resize(imgload.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::scale(int width,int height)
|
||||||
|
{
|
||||||
|
QImage imgscale=imgtemp.scaled(width,height);
|
||||||
|
imgtemp=imgscale;
|
||||||
|
image=imgtemp;
|
||||||
|
resize(imgtemp.size());
|
||||||
|
setMinimumSize(imgtemp.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::rotate(qreal degrees)
|
||||||
|
{
|
||||||
|
QMatrix matrix;
|
||||||
|
matrix.rotate(degrees);
|
||||||
|
QImage imgrotate=imgtemp.transformed(matrix,Qt::SmoothTransformation);
|
||||||
|
imgtemp=imgrotate;
|
||||||
|
image=imgtemp;
|
||||||
|
resize(imgrotate.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::mirror(bool bh,bool bv)
|
||||||
|
{
|
||||||
|
QImage imgmirror=imgtemp.mirrored(bh,bv);
|
||||||
|
imgtemp=imgmirror;
|
||||||
|
image=imgtemp;
|
||||||
|
resize(imgmirror.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawPoint()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=POINT_DRAW;
|
||||||
|
pen.setJoinStyle(Qt::RoundJoin);
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/pencil.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
void ImageWidget::drawLine()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=LINE_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/line.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawRect()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=RECT_DRAW;
|
||||||
|
//pen.setJoinStyle(Qt::MiterJoin);
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/rect.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawEllipse()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=ELLIPSE_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/ellipse.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawText()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=TEXT_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/text.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawFill()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=FILL_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/fill.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawErase()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=ERASE_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/eraser.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
//spinbox->setValue(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawMove()
|
||||||
|
{
|
||||||
|
if(draw_type==SELECT_DRAW){
|
||||||
|
imgmove=imgtemp.copy(startPnt.x()+1,startPnt.y()+1,endPnt.x()-startPnt.x()-1,endPnt.y()-startPnt.y()-1);
|
||||||
|
}else{
|
||||||
|
imgmove=imgpaste;
|
||||||
|
}
|
||||||
|
draw_type=MOVE_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/move.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::drawRectselect()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=SELECT_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/rectselect.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::colorPicker()
|
||||||
|
{
|
||||||
|
draw_type=COLORPICKER_DRAW;
|
||||||
|
QCursor cursor;
|
||||||
|
QPixmap pixmap(":/color_picker.png");
|
||||||
|
cursor = QCursor(pixmap);
|
||||||
|
setCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::selectAll()
|
||||||
|
{
|
||||||
|
//image=imgtemp;
|
||||||
|
draw_type=SELECT_DRAW;
|
||||||
|
startPnt=QPoint(0,0);
|
||||||
|
endPnt=QPoint(imgtemp.width()-2,imgtemp.height()-2);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::delSelect()
|
||||||
|
{
|
||||||
|
image=imgtemp;
|
||||||
|
draw_type=DEL_DRAW;
|
||||||
|
draw(imgtemp);
|
||||||
|
image=imgtemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::newfile()
|
||||||
|
{
|
||||||
|
QImage imgnew=QImage(600,500,QImage::Format_ARGB32);
|
||||||
|
//imgnew.fill(Qt::transparent);
|
||||||
|
imgtemp=imgnew;
|
||||||
|
image=imgnew;
|
||||||
|
setMinimumSize(imgnew.size());
|
||||||
|
resize(imgnew.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::load(QString fileName)
|
||||||
|
{
|
||||||
|
imgload.load(fileName);
|
||||||
|
imgtemp=imgload;
|
||||||
|
image=imgload;
|
||||||
|
setMinimumSize(imgload.size());
|
||||||
|
update();
|
||||||
|
draw_type=NONE_DRAW;
|
||||||
|
setCursor(Qt::ArrowCursor);
|
||||||
|
cundo=0;
|
||||||
|
for(int i=0;i<10;i++){
|
||||||
|
imgbuf[i]=image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::save(QString path)
|
||||||
|
{
|
||||||
|
image.save(path,0,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::cutSelect()
|
||||||
|
{
|
||||||
|
imgtemp=imgtemp.copy(startPnt.x()+1,startPnt.y()+1,endPnt.x()-startPnt.x()-1,endPnt.y()-startPnt.y()-1);
|
||||||
|
image=imgtemp;
|
||||||
|
resize(imgtemp.size());
|
||||||
|
setMinimumSize(imgtemp.size());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::newsize(int width,int height)
|
||||||
|
{
|
||||||
|
imgtemp=QImage(width,height,QImage::Format_ARGB32);
|
||||||
|
imgtemp.fill(Qt::transparent);
|
||||||
|
QPainter painter(&imgtemp);
|
||||||
|
painter.drawImage(0,0,image);
|
||||||
|
resize(imgtemp.size());
|
||||||
|
setMinimumSize(imgtemp.size());
|
||||||
|
update();
|
||||||
|
image=imgtemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::copy()
|
||||||
|
{
|
||||||
|
if(draw_type==SELECT_DRAW){
|
||||||
|
QImage imgcopy=imgtemp.copy(startPnt.x()+1,startPnt.y()+1,endPnt.x()-startPnt.x()-1,endPnt.y()-startPnt.y()-1);
|
||||||
|
QApplication::clipboard()->setImage(imgcopy, QClipboard::Clipboard);
|
||||||
|
//ui->statusBar->showMessage("选区已复制到剪贴板");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::paste()
|
||||||
|
{
|
||||||
|
//image=imgtemp;
|
||||||
|
imgpaste=QApplication::clipboard()->image();
|
||||||
|
QPainter painter(&imgtemp);
|
||||||
|
painter.drawImage(0,0,imgpaste);
|
||||||
|
update();
|
||||||
|
//ui->statusBar->showMessage("剪贴板已粘贴");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveUp()
|
||||||
|
{
|
||||||
|
if(startPnt.y()>0 && endPnt.y()>0){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setY(startPnt.y()-1);
|
||||||
|
endPnt.setY(endPnt.y()-1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveDown()
|
||||||
|
{
|
||||||
|
if(endPnt.y()<imgtemp.height()){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setY(startPnt.y()+1);
|
||||||
|
endPnt.setY(endPnt.y()+1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveLeft()
|
||||||
|
{
|
||||||
|
if(startPnt.x()>0 && endPnt.x()>0){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setX(startPnt.x()-1);
|
||||||
|
endPnt.setX(endPnt.x()-1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveRight()
|
||||||
|
{
|
||||||
|
if(endPnt.x()<imgtemp.width()-2 && startPnt.x()<imgtemp.width()-2){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setX(startPnt.x()+1);
|
||||||
|
endPnt.setX(endPnt.x()+1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveTopUp()
|
||||||
|
{
|
||||||
|
if(startPnt.y()>0){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setY(startPnt.y()-1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveTopDown()
|
||||||
|
{
|
||||||
|
if(startPnt.y()<imgtemp.height()-1){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setY(startPnt.y()+1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveLeftLeft()
|
||||||
|
{
|
||||||
|
if(startPnt.x()>0){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setX(startPnt.x()-1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveLeftRight()
|
||||||
|
{
|
||||||
|
if(startPnt.x()<imgtemp.width()-1){
|
||||||
|
imgtemp=image;
|
||||||
|
startPnt.setX(startPnt.x()+1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveRightLeft()
|
||||||
|
{
|
||||||
|
if(endPnt.x()>0){
|
||||||
|
imgtemp=image;
|
||||||
|
endPnt.setX(endPnt.x()-1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveRightRight()
|
||||||
|
{
|
||||||
|
if(endPnt.x()<imgtemp.width()-1){
|
||||||
|
imgtemp=image;
|
||||||
|
endPnt.setX(endPnt.x()+1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveBottomUp()
|
||||||
|
{
|
||||||
|
if(endPnt.y()>0){
|
||||||
|
imgtemp=image;
|
||||||
|
endPnt.setY(endPnt.y()-1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveBottomDown()
|
||||||
|
{
|
||||||
|
if(endPnt.y()<imgtemp.height()-2){
|
||||||
|
imgtemp=image;
|
||||||
|
endPnt.setY(endPnt.y()+1);
|
||||||
|
draw(imgtemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::moveImgbuf()
|
||||||
|
{
|
||||||
|
for(int i=9;i>0;i--){
|
||||||
|
imgbuf[i]=imgbuf[i-1];
|
||||||
|
//qDebug() << "imgbuf" << i << "=" << i-1;
|
||||||
|
}
|
||||||
|
imgbuf[0]=imgtemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::undo()
|
||||||
|
{
|
||||||
|
qDebug() << "undo" << cundo;
|
||||||
|
if(cundo<10){
|
||||||
|
imgtemp=imgbuf[cundo];
|
||||||
|
image=imgtemp;
|
||||||
|
//draw(imgtemp);
|
||||||
|
update();
|
||||||
|
cundo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::redo()
|
||||||
|
{
|
||||||
|
qDebug() << "redo" << cundo;
|
||||||
|
if(cundo==10)cundo--;
|
||||||
|
if(cundo>=0){
|
||||||
|
imgtemp=imgbuf[cundo];
|
||||||
|
image=imgtemp;
|
||||||
|
//draw(imgtemp);
|
||||||
|
update();
|
||||||
|
cundo--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::gray()
|
||||||
|
{
|
||||||
|
int w,h;
|
||||||
|
w = imgtemp.width();
|
||||||
|
h = imgtemp.height();
|
||||||
|
QImage imgGray(w,h,QImage::Format_RGB32);
|
||||||
|
for(int x=0; x<w; x++){
|
||||||
|
for(int y=0;y<h; y++){
|
||||||
|
QRgb pixel = image.pixel(x,y);
|
||||||
|
int gray = qGray(pixel);
|
||||||
|
QRgb grayPixel = qRgb(gray,gray,gray);
|
||||||
|
imgGray.setPixel(x,y,grayPixel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imgtemp=imgGray;
|
||||||
|
image=imgGray;
|
||||||
|
update();
|
||||||
|
moveImgbuf();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::invert()
|
||||||
|
{
|
||||||
|
int w,h;
|
||||||
|
w = imgtemp.width();
|
||||||
|
h = imgtemp.height();
|
||||||
|
QImage imgInvert(w,h,QImage::Format_ARGB32);
|
||||||
|
for(int x=0; x<w; x++){
|
||||||
|
for(int y=0;y<h; y++){
|
||||||
|
QRgb RGB = image.pixel(x,y);
|
||||||
|
QRgb RGBi = qRgba(255-qRed(RGB),255-qGreen(RGB),255-qBlue(RGB),qAlpha(RGB));
|
||||||
|
imgInvert.setPixel(x,y,RGBi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imgtemp=imgInvert;
|
||||||
|
image=imgInvert;
|
||||||
|
update();
|
||||||
|
moveImgbuf();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageWidget::blur(int p)
|
||||||
|
{
|
||||||
|
int xs,xe,ys,ye;
|
||||||
|
if(startPnt.x()<endPnt.x() && startPnt.y()<endPnt.y()){xs=startPnt.x();ys=startPnt.y();xe=endPnt.x();ye=endPnt.y();}
|
||||||
|
if(startPnt.x()>endPnt.x() && startPnt.y()<endPnt.y()){xs=endPnt.x();ys=startPnt.y();xe=startPnt.x();ye=endPnt.y();}
|
||||||
|
if(startPnt.x()>endPnt.x() && startPnt.y()>endPnt.y()){xs=endPnt.x();ys=endPnt.y();xe=startPnt.x();ye=startPnt.y();}
|
||||||
|
if(startPnt.x()<endPnt.x() && startPnt.y()>endPnt.y()){xs=startPnt.x();ys=endPnt.y();xe=endPnt.x();ye=startPnt.y();}
|
||||||
|
QImage imgBlur(qAbs(endPnt.x()-startPnt.x())+2,qAbs(endPnt.y()-startPnt.y())+2,QImage::Format_RGB32);
|
||||||
|
for(int x=xs; x<xe+2; x++){
|
||||||
|
for(int y=ys;y<ye+2; y++){
|
||||||
|
int red=0,green=0,blue=0,pc=0;
|
||||||
|
for(int a=-p;a<=p;a++){
|
||||||
|
for(int b=-p;b<=p;b++){
|
||||||
|
int xa=x+a;
|
||||||
|
int yb=y+b;
|
||||||
|
if(xa>0 && yb>0 && xa<image.width() && yb<image.height()){
|
||||||
|
red += qRed(image.pixel(xa,yb));
|
||||||
|
green += qGreen(image.pixel(xa,yb));
|
||||||
|
blue += qBlue(image.pixel(xa,yb));
|
||||||
|
pc += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QRgb RGBblur = qRgb(red/pc,green/pc,blue/pc);
|
||||||
|
imgBlur.setPixel(x-xs,y-ys,RGBblur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QPainter painter(&imgtemp);
|
||||||
|
painter.drawImage(xs,ys,imgBlur);
|
||||||
|
update();
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
#ifndef IMAGEWIDGET_H
|
||||||
|
#define IMAGEWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QPen>
|
||||||
|
#include <QLabel>
|
||||||
|
//线段
|
||||||
|
//typedef struct myLine{
|
||||||
|
// QPoint startPnt;
|
||||||
|
// QPoint endPnt;
|
||||||
|
//}myLine;
|
||||||
|
|
||||||
|
class ImageWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum /*定义图形的类型 */
|
||||||
|
{
|
||||||
|
NONE_DRAW,
|
||||||
|
POINT_DRAW,
|
||||||
|
LINE_DRAW,
|
||||||
|
RECT_DRAW,
|
||||||
|
ELLIPSE_DRAW,
|
||||||
|
TEXT_DRAW,
|
||||||
|
FILL_DRAW,
|
||||||
|
ERASE_DRAW,
|
||||||
|
MOVE_DRAW,
|
||||||
|
SELECT_DRAW,
|
||||||
|
CLIP_DRAW,
|
||||||
|
IMAGE_DRAW,
|
||||||
|
DEL_DRAW,
|
||||||
|
COLORPICKER_DRAW
|
||||||
|
} draw_type;
|
||||||
|
ImageWidget(QWidget *parent = 0);
|
||||||
|
~ImageWidget();
|
||||||
|
QImage image,imgtemp,imgbuf[10],imgmove;
|
||||||
|
QPoint startPnt; //起点
|
||||||
|
QPoint endPnt; //终点
|
||||||
|
QPen pen;
|
||||||
|
QBrush brush;
|
||||||
|
QString text;
|
||||||
|
QLabel *labelFont;
|
||||||
|
bool boolBorder,boolFill;
|
||||||
|
void newfile();
|
||||||
|
void load(QString fileName);
|
||||||
|
void save(QString path);
|
||||||
|
void setAngle(qreal rotateAngle);
|
||||||
|
void zoomin();
|
||||||
|
void zoomout();
|
||||||
|
void zoom1();
|
||||||
|
void rotate(qreal degrees);
|
||||||
|
void mirror(bool bh,bool bv);
|
||||||
|
void drawPoint();
|
||||||
|
void drawLine();
|
||||||
|
void drawRect();
|
||||||
|
void drawEllipse();
|
||||||
|
void drawText();
|
||||||
|
void drawFill();
|
||||||
|
void drawErase();
|
||||||
|
void drawMove();
|
||||||
|
void drawRectselect();
|
||||||
|
void colorPicker();
|
||||||
|
void cutSelect();
|
||||||
|
void delSelect();
|
||||||
|
void copy();
|
||||||
|
void paste();
|
||||||
|
void draw(QImage &img);
|
||||||
|
void newsize(int width,int height);
|
||||||
|
void scale(int ratioW,int ratioH);
|
||||||
|
void moveImgbuf();
|
||||||
|
void selectAll();
|
||||||
|
void gray();
|
||||||
|
void invert();
|
||||||
|
void blur(int p);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void undo();
|
||||||
|
void redo();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void moveUp();
|
||||||
|
void moveDown();
|
||||||
|
void moveLeft();
|
||||||
|
void moveRight();
|
||||||
|
void moveTopUp();
|
||||||
|
void moveTopDown();
|
||||||
|
void moveLeftLeft();
|
||||||
|
void moveLeftRight();
|
||||||
|
void moveRightLeft();
|
||||||
|
void moveRightRight();
|
||||||
|
void moveBottomUp();
|
||||||
|
void moveBottomDown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
void mouseMoveEvent(QMouseEvent *e);
|
||||||
|
void mouseReleaseEvent(QMouseEvent *e);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IMAGEWIDGET_H
|
After Width: | Height: | Size: 1.3 MiB |
|
@ -0,0 +1,20 @@
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include <QApplication>
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||||
|
#include <QTextCodec>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||||
|
QTextCodec *tc = QTextCodec::codecForName("UTF-8");
|
||||||
|
QTextCodec::setCodecForTr(tc);
|
||||||
|
QTextCodec::setCodecForLocale(QTextCodec::codecForLocale());
|
||||||
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
|
@ -0,0 +1,560 @@
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QColorDialog>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QFont>
|
||||||
|
#include <QFontDialog>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QTime>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QWidgetAction>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QScrollArea>
|
||||||
|
#include <QTableWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
QToolButton *btnColorFill,*btnColorBorder;
|
||||||
|
QLineEdit *lineEdit;
|
||||||
|
QSpinBox *spinbox,*spinw,*spinwr,*spinh,*spinhr;
|
||||||
|
QString text="文字内容",path="";
|
||||||
|
QColor colorf;
|
||||||
|
QCheckBox *checkFill,*checkBorder;
|
||||||
|
QLabel *labelFont;
|
||||||
|
QString filename;
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
|
QMainWindow(parent),
|
||||||
|
ui(new Ui::MainWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
QDesktopWidget* desktop = QApplication::desktop();
|
||||||
|
move((desktop->width() - this->width())/2, (desktop->height() - this->height())/2);
|
||||||
|
imageWidget = new ImageWidget;
|
||||||
|
scrollArea = new QScrollArea;
|
||||||
|
scrollArea->setWidget(imageWidget);
|
||||||
|
scrollArea->widget()->setMinimumSize(600,500);
|
||||||
|
setCentralWidget(scrollArea);
|
||||||
|
|
||||||
|
QStyle* style = QApplication::style();
|
||||||
|
QIcon icon = style->standardIcon(QStyle::SP_FileDialogNewFolder);
|
||||||
|
ui->action_new->setIcon(icon);
|
||||||
|
icon = style->standardIcon(QStyle::SP_DialogOpenButton);
|
||||||
|
ui->action_open->setIcon(icon);
|
||||||
|
icon = style->standardIcon(QStyle::SP_DialogSaveButton);
|
||||||
|
ui->action_save->setIcon(icon);
|
||||||
|
icon = style->standardIcon(QStyle::SP_DialogCloseButton);
|
||||||
|
ui->action_quit->setIcon(icon);
|
||||||
|
icon = style->standardIcon(QStyle::SP_DialogCancelButton);
|
||||||
|
ui->action_undo->setIcon(icon);
|
||||||
|
icon = style->standardIcon(QStyle::SP_DialogCloseButton);
|
||||||
|
ui->action_quit->setIcon(icon);
|
||||||
|
icon = style->standardIcon(QStyle::SP_ComputerIcon);
|
||||||
|
ui->action_setWallpaper->setIcon(icon);
|
||||||
|
icon = style->standardIcon(QStyle::SP_DialogHelpButton);
|
||||||
|
ui->action_about->setIcon(icon);
|
||||||
|
btnColorBorder = new QToolButton(this);
|
||||||
|
btnColorBorder->setText("□");
|
||||||
|
btnColorBorder->setToolTip("边框");
|
||||||
|
ui->mainToolBar->addWidget(btnColorBorder);
|
||||||
|
checkBorder=new QCheckBox(this);
|
||||||
|
checkBorder->setCheckState(Qt::Checked);
|
||||||
|
ui->mainToolBar->addWidget(checkBorder);
|
||||||
|
btnColorFill = new QToolButton(this);
|
||||||
|
btnColorFill->setText("■");
|
||||||
|
btnColorFill->setToolTip("填充");
|
||||||
|
ui->mainToolBar->addWidget(btnColorFill);
|
||||||
|
checkFill=new QCheckBox(this);
|
||||||
|
ui->mainToolBar->addWidget(checkFill);
|
||||||
|
spinbox=new QSpinBox(this);
|
||||||
|
spinbox->setSingleStep(1);
|
||||||
|
spinbox->setRange(1,50);
|
||||||
|
spinbox->setValue(1);
|
||||||
|
ui->mainToolBar->addWidget(spinbox);
|
||||||
|
labelFont=new QLabel;
|
||||||
|
ui->actionFont->setText(labelFont->font().family()+","+QString::number(labelFont->font().pointSize()));
|
||||||
|
lineEdit = new QLineEdit(text,this);
|
||||||
|
lineEdit->setFixedWidth(60);
|
||||||
|
ui->mainToolBar->addWidget(lineEdit);
|
||||||
|
imageWidget->text=text;
|
||||||
|
connect(ui->action_quit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
|
connect(btnColorFill, SIGNAL(clicked()), this, SLOT(setColorFill()));
|
||||||
|
connect(btnColorBorder, SIGNAL(clicked()), this, SLOT(setColorBorder()));
|
||||||
|
connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(onSpinValueChanged(int)));
|
||||||
|
connect(lineEdit, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString)));
|
||||||
|
connect(checkBorder, SIGNAL(stateChanged(int)), this, SLOT(checkBorderChanged(int)));
|
||||||
|
connect(checkFill, SIGNAL(stateChanged(int)), this, SLOT(checkFillChanged(int)));
|
||||||
|
|
||||||
|
QStringList Largs=QApplication::arguments();
|
||||||
|
qDebug() << Largs;
|
||||||
|
if(Largs.length()>1){
|
||||||
|
path=Largs.at(1);
|
||||||
|
open(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::resizeEvent(QResizeEvent *)
|
||||||
|
{
|
||||||
|
//QRect childRect = scrollArea->childrenRect();
|
||||||
|
//imageWidget->resize(childRect.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_changelog_triggered()
|
||||||
|
{
|
||||||
|
QMessageBox aboutMB(QMessageBox::NoIcon, "更新历史", "1.6(2017-05)\n右键打开文件记忆文件路径。\n\n1.5 (2017-04)\n透明色反色不改变。\n增加取色工具,橡皮擦颜色不再固定为白色,而是填充色。\n\n1.4 (2017-03)\n支持命令行打开文件和打开方式打开文件。\n修复鼠标指针引用本地文件,没引用资源文件,引起启动path参数改变不能加载图标的问题。\n菜单的SIGNAL-SLOT改为on_action_triggered()\n修复PNG图片裁剪丢失透明度问题。\n新建图像为透明图像。\n\n1.3 (2017-03)\n实现选区模糊。\n加入模糊滤镜\n\n1.2 (2017-02)\n文件名显示在窗口标题栏。\n区别保存和另存为。\n增加导入图片。\n\n1.1 (2017-01)\n新增灰度、反色。\n\n1.0 (2017-01)\n解决删除选区后画不出选框的问题。\n恢复撤销。\n增加全选。\n实现选区或剪贴板移动!\n保存时自动获取打开文件的路径。\n增加按像素、比例缩放。\n实现在属性窗口设置画布大小。\n2016-12\n增加快捷键控制选框及其边框移动。\n绘图代码从MainWindow向imageWidget迁移。\n实现水平镜像、垂直镜像。\n实现放大、缩小、原始大小。\n为了增加滚动条,增加自定义imageWidget。\n状态栏显示绘图详情。\n复制选区到系统剪贴板,从系统剪贴板获取图像粘贴。\n优化颜色选择交互。\n增加撤销、重做功能,有BUG。\n设为壁纸。\n画选区,剪裁选区。\n新建图片,打开图片,保存图片。\n实现画点、线、框、圆、字。");
|
||||||
|
aboutMB.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_aboutQt_triggered()
|
||||||
|
{
|
||||||
|
QMessageBox::aboutQt(NULL, "关于 Qt");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_about_triggered()
|
||||||
|
{
|
||||||
|
QMessageBox aboutMB(QMessageBox::NoIcon, "关于", "海天鹰画图 1.6\n一款基于Qt的画图程序。\n作者:黄颖\nE-mail: sonichy@163.com\n主页:sonichy.96.lt\n参考文献:\n绘图:\nhttp://tzc.is-programmer.com/posts/534.html\nhttp://lizhigg.love.blog.163.com/blog/static/62611781201222105550184/\n滚动条:http://down.51cto.com/data/233634\n灰度图:http://www.cnblogs.com/xianglan/archive/2010/12/24/1915905.html");
|
||||||
|
aboutMB.setIconPixmap(QPixmap(":/icon.png"));
|
||||||
|
aboutMB.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setColorBorder()
|
||||||
|
{
|
||||||
|
QPalette plt = btnColorBorder->palette();
|
||||||
|
QBrush brushb = plt.color(QPalette::ButtonText);
|
||||||
|
QColor color = QColorDialog::getColor(brushb.color(), this);
|
||||||
|
imageWidget->pen.setColor(color);
|
||||||
|
plt.setColor(QPalette::ButtonText, color);
|
||||||
|
btnColorBorder->setPalette(plt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setColorFill()
|
||||||
|
{
|
||||||
|
QPalette plt = btnColorFill->palette();
|
||||||
|
QBrush brush = plt.color(QPalette::ButtonText);
|
||||||
|
colorf = QColorDialog::getColor(brush.color(), this);
|
||||||
|
imageWidget->brush.setColor(colorf);
|
||||||
|
plt.setColor(QPalette::ButtonText, colorf);
|
||||||
|
btnColorFill->setPalette(plt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onSpinValueChanged(int i)
|
||||||
|
{
|
||||||
|
imageWidget->pen.setWidth(i);
|
||||||
|
imageWidget->pen.setJoinStyle(Qt::MiterJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_actionPencil_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionLine_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionRect_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionEllipse_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawEllipse();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionText_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawText();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionFill_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawFill();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionErase_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawErase();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionMove_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawMove();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionRectselect_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->drawRectselect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_selectAll_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionCutSelect_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->cutSelect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionColorPicker_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->colorPicker();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_delete_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->delSelect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onTextChanged(QString s)
|
||||||
|
{
|
||||||
|
imageWidget->text=s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_new_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->newfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_open_triggered()
|
||||||
|
{
|
||||||
|
if(path==""){
|
||||||
|
path = QFileDialog::getOpenFileName(this,"打开图片", ".", "图片文件(*.jpg *.jpeg *.png *.bmp)");
|
||||||
|
}else{
|
||||||
|
path = QFileDialog::getOpenFileName(this,"打开图片", path, "图片文件(*.jpg *.jpeg *.png *.bmp)");
|
||||||
|
}
|
||||||
|
if(path.length() != 0){
|
||||||
|
open(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::open(QString path)
|
||||||
|
{
|
||||||
|
imageWidget->load(path);
|
||||||
|
filename=QFileInfo(path).fileName();
|
||||||
|
setWindowTitle(filename+" - 海天鹰画图");
|
||||||
|
ui->statusBar->showMessage("打开 "+path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_import_triggered(){
|
||||||
|
QString filenamei="";
|
||||||
|
if(path==""){
|
||||||
|
filenamei = QFileDialog::getOpenFileName(this,"导入图片", ".", "图片文件(*.jpg *.png *.bmp)");
|
||||||
|
}else{
|
||||||
|
filenamei = QFileDialog::getOpenFileName(this,"导入图片", path, "图片文件(*.jpg *.png *.bmp)");
|
||||||
|
}
|
||||||
|
ui->statusBar->showMessage("导入 "+filenamei);
|
||||||
|
if(path.length()!=0){
|
||||||
|
imageWidget->image=imageWidget->imgtemp;
|
||||||
|
QImage imgImport(filenamei);
|
||||||
|
QApplication::clipboard()->setImage(imgImport, QClipboard::Clipboard);
|
||||||
|
imageWidget->paste();
|
||||||
|
imageWidget->imgmove=imgImport;
|
||||||
|
//imageWidget->imgtemp=imgImport;
|
||||||
|
//imageWidget->imgbuf[0]=imgImport;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_save_triggered(){
|
||||||
|
qDebug() << "save path=" << path;
|
||||||
|
if(path.length() != 0){
|
||||||
|
ui->statusBar->showMessage("保存 "+path);
|
||||||
|
imageWidget->image=imageWidget->imgtemp;
|
||||||
|
imageWidget->save(path);
|
||||||
|
}else{
|
||||||
|
on_action_saveas_triggered();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_saveas_triggered()
|
||||||
|
{
|
||||||
|
if(path==""){
|
||||||
|
path = QFileDialog::getSaveFileName(this,"保存图片","./未命名.jpg","图片文件(*.jpg *.png *.bmp)");
|
||||||
|
}else{
|
||||||
|
path = QFileDialog::getSaveFileName(this,"保存图片",path,"图片文件(*.jpg *.png *.bmp)");
|
||||||
|
}
|
||||||
|
if(path.length() != 0){
|
||||||
|
ui->statusBar->showMessage("保存 "+path);
|
||||||
|
imageWidget->image=imageWidget->imgtemp;
|
||||||
|
imageWidget->save(path);
|
||||||
|
filename=QFileInfo(path).fileName();
|
||||||
|
setWindowTitle(filename+" - 海天鹰画图");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionFont_triggered()
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QFont font = QFontDialog::getFont(&ok, labelFont->font(), this, "选择字体");
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
labelFont->setFont(font);
|
||||||
|
imageWidget->labelFont->setFont(font);
|
||||||
|
ui->actionFont->setText(labelFont->font().family()+","+QString::number(labelFont->font().pointSize()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_undo_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_redo_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_setWallpaper_triggered()
|
||||||
|
{
|
||||||
|
QString str="gsettings set org.gnome.desktop.background picture-uri file://"+path;
|
||||||
|
QByteArray ba = str.toLocal8Bit();
|
||||||
|
qDebug() << ba.data();
|
||||||
|
system(ba.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_property_triggered()
|
||||||
|
{
|
||||||
|
//qDebug() << image.width() << "X" << image.height();
|
||||||
|
QDialog *dialog=new QDialog(this);
|
||||||
|
dialog->setWindowTitle("属性");
|
||||||
|
QVBoxLayout *vbox=new QVBoxLayout;
|
||||||
|
QHBoxLayout *hbox=new QHBoxLayout;
|
||||||
|
QLabel *label=new QLabel("宽度:");
|
||||||
|
QSpinBox *spinw=new QSpinBox;
|
||||||
|
spinw->setRange(0,10000);
|
||||||
|
spinw->setValue(imageWidget->imgtemp.width());
|
||||||
|
hbox->addWidget(label,0,Qt::AlignCenter);
|
||||||
|
hbox->addWidget(spinw);
|
||||||
|
vbox->addLayout(hbox);
|
||||||
|
label=new QLabel("高度:");
|
||||||
|
QSpinBox *spinh=new QSpinBox;
|
||||||
|
spinh->setRange(0,10000);
|
||||||
|
spinh->setValue(imageWidget->imgtemp.height());
|
||||||
|
hbox=new QHBoxLayout;
|
||||||
|
hbox->addWidget(label,0,Qt::AlignCenter);
|
||||||
|
hbox->addWidget(spinh);
|
||||||
|
vbox->addLayout(hbox);
|
||||||
|
QPushButton *btnConfirm=new QPushButton("确定");
|
||||||
|
QPushButton *btnCancel=new QPushButton("取消");
|
||||||
|
hbox=new QHBoxLayout;
|
||||||
|
hbox->addWidget(btnConfirm);
|
||||||
|
hbox->addWidget(btnCancel);
|
||||||
|
vbox->addLayout(hbox);
|
||||||
|
dialog->setLayout(vbox);
|
||||||
|
connect(btnConfirm, SIGNAL(clicked()), dialog, SLOT(accept()));
|
||||||
|
connect(btnCancel, SIGNAL(clicked()), dialog, SLOT(reject()));
|
||||||
|
if(dialog->exec()==QDialog::Accepted){
|
||||||
|
imageWidget->newsize(spinw->value(),spinh->value());
|
||||||
|
}
|
||||||
|
dialog->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_excude_triggered()
|
||||||
|
{ int wo=imageWidget->imgtemp.width();
|
||||||
|
int ho=imageWidget->imgtemp.height();
|
||||||
|
QDialog *dialog=new QDialog(this);
|
||||||
|
dialog->setWindowTitle("缩放");
|
||||||
|
|
||||||
|
QVBoxLayout *vbox=new QVBoxLayout;
|
||||||
|
QHBoxLayout *hbox=new QHBoxLayout;
|
||||||
|
QLabel *label=new QLabel("宽度:");
|
||||||
|
spinw=new QSpinBox;
|
||||||
|
spinw->setRange(1,10000);
|
||||||
|
spinw->setValue(wo);
|
||||||
|
hbox->addWidget(label,0,Qt::AlignCenter);
|
||||||
|
hbox->addWidget(spinw);
|
||||||
|
label=new QLabel("px");
|
||||||
|
hbox->addWidget(label);
|
||||||
|
spinwr=new QSpinBox;
|
||||||
|
spinwr->setRange(10,1000);
|
||||||
|
spinwr->setValue(100);
|
||||||
|
hbox->addWidget(spinwr);
|
||||||
|
label=new QLabel("%");
|
||||||
|
hbox->addWidget(label);
|
||||||
|
vbox->addLayout(hbox);
|
||||||
|
|
||||||
|
hbox=new QHBoxLayout;
|
||||||
|
label=new QLabel("高度:");
|
||||||
|
hbox->addWidget(label,0,Qt::AlignCenter);
|
||||||
|
spinh=new QSpinBox;
|
||||||
|
spinh->setRange(1,10000);
|
||||||
|
spinh->setValue(ho);
|
||||||
|
hbox->addWidget(spinh);
|
||||||
|
label=new QLabel("px");
|
||||||
|
hbox->addWidget(label);
|
||||||
|
spinhr=new QSpinBox;
|
||||||
|
spinhr->setRange(10,1000);
|
||||||
|
spinhr->setValue(100);
|
||||||
|
hbox->addWidget(spinhr);
|
||||||
|
label=new QLabel("%");
|
||||||
|
hbox->addWidget(label);
|
||||||
|
vbox->addLayout(hbox);
|
||||||
|
|
||||||
|
QPushButton *btnConfirm=new QPushButton("确定");
|
||||||
|
QPushButton *btnCancel=new QPushButton("取消");
|
||||||
|
hbox=new QHBoxLayout;
|
||||||
|
hbox->addStretch();
|
||||||
|
hbox->addWidget(btnConfirm);
|
||||||
|
hbox->addWidget(btnCancel);
|
||||||
|
hbox->addStretch();
|
||||||
|
vbox->addLayout(hbox);
|
||||||
|
dialog->setLayout(vbox);
|
||||||
|
|
||||||
|
connect(spinw, SIGNAL(valueChanged(int)), this, SLOT(onSpinwChanged(int)));
|
||||||
|
connect(spinh, SIGNAL(valueChanged(int)), this, SLOT(onSpinhChanged(int)));
|
||||||
|
connect(spinwr, SIGNAL(valueChanged(int)), this, SLOT(onSpinwrChanged(int)));
|
||||||
|
connect(spinhr, SIGNAL(valueChanged(int)), this, SLOT(onSpinhrChanged(int)));
|
||||||
|
connect(btnConfirm, SIGNAL(clicked()), dialog, SLOT(accept()));
|
||||||
|
connect(btnCancel, SIGNAL(clicked()), dialog, SLOT(reject()));
|
||||||
|
if(dialog->exec()==QDialog::Accepted){
|
||||||
|
imageWidget->scale(spinw->value(),spinh->value());
|
||||||
|
}
|
||||||
|
dialog->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onSpinwChanged(int i)
|
||||||
|
{
|
||||||
|
disconnect(spinwr, SIGNAL(valueChanged(int)), this, SLOT(onSpinwrChanged(int)));
|
||||||
|
spinwr->setValue(i*100/imageWidget->image.width());
|
||||||
|
connect(spinwr, SIGNAL(valueChanged(int)), this, SLOT(onSpinwrChanged(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onSpinhChanged(int i)
|
||||||
|
{
|
||||||
|
disconnect(spinhr, SIGNAL(valueChanged(int)), this, SLOT(onSpinhrChanged(int)));
|
||||||
|
spinhr->setValue(i*100/imageWidget->image.height());
|
||||||
|
connect(spinhr, SIGNAL(valueChanged(int)), this, SLOT(onSpinhrChanged(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onSpinwrChanged(int i)
|
||||||
|
{
|
||||||
|
disconnect(spinw, SIGNAL(valueChanged(int)), this, SLOT(onSpinwChanged(int)));
|
||||||
|
spinw->setValue(imageWidget->image.width()*i/100);
|
||||||
|
connect(spinw, SIGNAL(valueChanged(int)), this, SLOT(onSpinwChanged(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onSpinhrChanged(int i)
|
||||||
|
{
|
||||||
|
disconnect(spinh, SIGNAL(valueChanged(int)), this, SLOT(onSpinhChanged(int)));
|
||||||
|
spinh->setValue(imageWidget->image.height()*i/100);
|
||||||
|
connect(spinh, SIGNAL(valueChanged(int)), this, SLOT(onSpinhChanged(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_copy_triggered()
|
||||||
|
{
|
||||||
|
if(imageWidget->draw_type==imageWidget->SELECT_DRAW){
|
||||||
|
imageWidget->copy();
|
||||||
|
ui->statusBar->showMessage("选区已复制到剪贴板");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_paste_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->paste();
|
||||||
|
ui->statusBar->showMessage("剪贴板已粘贴");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionZoomin_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->zoomin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionZoomout_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->zoomout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionZoom1_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->zoom1();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionRotateLeft_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->rotate(-90);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionRotateRight_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->rotate(90);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionMirrorHorizontal_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->mirror(true,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionMirrorVertical_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->mirror(false,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_help_triggered()
|
||||||
|
{
|
||||||
|
QMessageBox MBHelp(QMessageBox::NoIcon, "帮助", "选区上移\tAlt + ↑\n选区下移\tAlt + ↓\n选区左移\tAlt + ←\n选区右移\tAlt + →\n选区上边上移\tCtrl + ↑\n选区上边下移\tCtrl + ↓\n选区左边左移\tCtrl + ←\n选区左边右移\tCtrl + →\n选区下边上移\tShift + ↑\n选区下边下移\tShift + ↓\n选区右边左移\tShift + ←\n选区右边右移\tShift + →");
|
||||||
|
MBHelp.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::checkBorderChanged(int state)
|
||||||
|
{
|
||||||
|
if (state == Qt::Checked) // "选中"
|
||||||
|
{
|
||||||
|
imageWidget->boolBorder=true;
|
||||||
|
}
|
||||||
|
else if(state == Qt::PartiallyChecked) // "半选"
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else // 未选中 - Qt::Unchecked
|
||||||
|
{
|
||||||
|
imageWidget->boolBorder=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::checkFillChanged(int state)
|
||||||
|
{
|
||||||
|
if (state == Qt::Checked) // "选中"
|
||||||
|
{
|
||||||
|
imageWidget->boolFill=true;
|
||||||
|
}
|
||||||
|
else if(state == Qt::PartiallyChecked) // "半选"
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else // 未选中 - Qt::Unchecked
|
||||||
|
{
|
||||||
|
imageWidget->boolFill=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_gray_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->gray();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_invert_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->invert();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_action_blur_triggered()
|
||||||
|
{
|
||||||
|
imageWidget->blur(spinbox->value());
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <vector>
|
||||||
|
#include <QScrollArea>
|
||||||
|
#include <imagewidget.h>
|
||||||
|
using namespace std;
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
|
~MainWindow();
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScrollArea *scrollArea;
|
||||||
|
ImageWidget *imageWidget;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_action_new_triggered();
|
||||||
|
void on_action_open_triggered();
|
||||||
|
void on_action_changelog_triggered();
|
||||||
|
void on_action_aboutQt_triggered();
|
||||||
|
void on_action_about_triggered();
|
||||||
|
void on_action_selectAll_triggered();
|
||||||
|
void on_action_delete_triggered();
|
||||||
|
void on_action_undo_triggered();
|
||||||
|
void on_action_redo_triggered();
|
||||||
|
void on_action_copy_triggered();
|
||||||
|
void on_action_paste_triggered();
|
||||||
|
void on_action_setWallpaper_triggered();
|
||||||
|
void on_action_property_triggered();
|
||||||
|
void on_action_help_triggered();
|
||||||
|
void on_action_excude_triggered();
|
||||||
|
void on_action_gray_triggered();
|
||||||
|
void on_action_invert_triggered();
|
||||||
|
void on_action_save_triggered();
|
||||||
|
void on_action_saveas_triggered();
|
||||||
|
void on_action_import_triggered();
|
||||||
|
void on_action_blur_triggered();
|
||||||
|
|
||||||
|
void on_actionPencil_triggered();
|
||||||
|
void on_actionLine_triggered();
|
||||||
|
void on_actionRect_triggered();
|
||||||
|
void on_actionEllipse_triggered();
|
||||||
|
void on_actionText_triggered();
|
||||||
|
void on_actionFill_triggered();
|
||||||
|
void on_actionErase_triggered();
|
||||||
|
void on_actionMove_triggered();
|
||||||
|
void on_actionRectselect_triggered();
|
||||||
|
void on_actionCutSelect_triggered();
|
||||||
|
void on_actionRotateLeft_triggered();
|
||||||
|
void on_actionRotateRight_triggered();
|
||||||
|
void on_actionMirrorHorizontal_triggered();
|
||||||
|
void on_actionMirrorVertical_triggered();
|
||||||
|
void on_actionZoomin_triggered();
|
||||||
|
void on_actionZoomout_triggered();
|
||||||
|
void on_actionZoom1_triggered();
|
||||||
|
void on_actionFont_triggered();
|
||||||
|
void on_actionColorPicker_triggered();
|
||||||
|
|
||||||
|
void setColorFill();
|
||||||
|
void setColorBorder();
|
||||||
|
void onSpinValueChanged(int i);
|
||||||
|
void onTextChanged(QString text);
|
||||||
|
void onSpinwChanged(int i);
|
||||||
|
void onSpinhChanged(int i);
|
||||||
|
void onSpinwrChanged(int i);
|
||||||
|
void onSpinhrChanged(int i);
|
||||||
|
void checkBorderChanged(int state);
|
||||||
|
void checkFillChanged(int state);
|
||||||
|
void open(QString path);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
|
@ -0,0 +1,549 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1000</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>海天鹰画图</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralWidget"/>
|
||||||
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1000</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menu_file">
|
||||||
|
<property name="title">
|
||||||
|
<string>文件</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_new"/>
|
||||||
|
<addaction name="action_open"/>
|
||||||
|
<addaction name="action_import"/>
|
||||||
|
<addaction name="action_save"/>
|
||||||
|
<addaction name="action_saveas"/>
|
||||||
|
<addaction name="action_quit"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_edit">
|
||||||
|
<property name="title">
|
||||||
|
<string>编辑</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_undo"/>
|
||||||
|
<addaction name="action_redo"/>
|
||||||
|
<addaction name="action_copy"/>
|
||||||
|
<addaction name="action_cut"/>
|
||||||
|
<addaction name="action_paste"/>
|
||||||
|
<addaction name="action_selectAll"/>
|
||||||
|
<addaction name="action_delete"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_image">
|
||||||
|
<property name="title">
|
||||||
|
<string>图像</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_flip"/>
|
||||||
|
<addaction name="action_excude"/>
|
||||||
|
<addaction name="action_property"/>
|
||||||
|
<addaction name="action_setWallpaper"/>
|
||||||
|
<addaction name="action_gray"/>
|
||||||
|
<addaction name="action_invert"/>
|
||||||
|
<addaction name="action_blur"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_about">
|
||||||
|
<property name="title">
|
||||||
|
<string>帮助</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="action_help"/>
|
||||||
|
<addaction name="action_changelog"/>
|
||||||
|
<addaction name="action_aboutQt"/>
|
||||||
|
<addaction name="action_about"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menu_file"/>
|
||||||
|
<addaction name="menu_edit"/>
|
||||||
|
<addaction name="menu_image"/>
|
||||||
|
<addaction name="menu_about"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="mainToolBar">
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<addaction name="actionPencil"/>
|
||||||
|
<addaction name="actionLine"/>
|
||||||
|
<addaction name="actionRect"/>
|
||||||
|
<addaction name="actionEllipse"/>
|
||||||
|
<addaction name="actionText"/>
|
||||||
|
<addaction name="actionColorPicker"/>
|
||||||
|
<addaction name="actionFill"/>
|
||||||
|
<addaction name="actionErase"/>
|
||||||
|
<addaction name="actionMove"/>
|
||||||
|
<addaction name="actionRectselect"/>
|
||||||
|
<addaction name="actionCutSelect"/>
|
||||||
|
<addaction name="actionRotateLeft"/>
|
||||||
|
<addaction name="actionRotateRight"/>
|
||||||
|
<addaction name="actionMirrorHorizontal"/>
|
||||||
|
<addaction name="actionMirrorVertical"/>
|
||||||
|
<addaction name="actionZoomin"/>
|
||||||
|
<addaction name="actionZoomout"/>
|
||||||
|
<addaction name="actionZoom1"/>
|
||||||
|
<addaction name="actionFont"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
|
<action name="action_open">
|
||||||
|
<property name="text">
|
||||||
|
<string>打开</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+O</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_save">
|
||||||
|
<property name="text">
|
||||||
|
<string>保存</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+S</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_saveas">
|
||||||
|
<property name="text">
|
||||||
|
<string>另存为</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_quit">
|
||||||
|
<property name="text">
|
||||||
|
<string>退出</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Q</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_undo">
|
||||||
|
<property name="text">
|
||||||
|
<string>撤销</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Z</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_redo">
|
||||||
|
<property name="text">
|
||||||
|
<string>重做</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Y</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_copy">
|
||||||
|
<property name="text">
|
||||||
|
<string>复制</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+C</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_cut">
|
||||||
|
<property name="text">
|
||||||
|
<string>剪切</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+X</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_paste">
|
||||||
|
<property name="text">
|
||||||
|
<string>粘贴</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+V</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_selectAll">
|
||||||
|
<property name="text">
|
||||||
|
<string>全选</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+A</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_delete">
|
||||||
|
<property name="text">
|
||||||
|
<string>删除</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Del</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_flip">
|
||||||
|
<property name="text">
|
||||||
|
<string>翻转/旋转</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>翻转/旋转</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+R</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_excude">
|
||||||
|
<property name="text">
|
||||||
|
<string>拉伸/扭曲</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>拉伸/扭曲</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+W</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_property">
|
||||||
|
<property name="text">
|
||||||
|
<string>属性</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+E</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_setWallpaper">
|
||||||
|
<property name="text">
|
||||||
|
<string>设为壁纸</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_help">
|
||||||
|
<property name="text">
|
||||||
|
<string>帮助</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>F1</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_changelog">
|
||||||
|
<property name="text">
|
||||||
|
<string>更新日志</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_about">
|
||||||
|
<property name="text">
|
||||||
|
<string>关于</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_new">
|
||||||
|
<property name="text">
|
||||||
|
<string>新建</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+N</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPencil">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/pencil.png</normaloff>:/pencil.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>铅笔</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>铅笔</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionLine">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/line.png</normaloff>:/line.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>直线</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>直线</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionEllipse">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/ellipse.png</normaloff>:/ellipse.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>椭圆</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>椭圆</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionRect">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/rect.png</normaloff>:/rect.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>矩形</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>矩形</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionText">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/text.png</normaloff>:/text.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>文本</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>文本</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionErase">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/eraser.png</normaloff>:/eraser.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>擦子</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>擦子</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMove">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/move.png</normaloff>:/move.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>move</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>移动</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionRectselect">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/rectselect.png</normaloff>:/rectselect.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>rectselect</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>框选</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionColorFill">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>■</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>填充</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>13</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionColorBorder">
|
||||||
|
<property name="text">
|
||||||
|
<string>□</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>边框</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>13</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionFont">
|
||||||
|
<property name="text">
|
||||||
|
<string>字体</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>字体</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionCutSelect">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/clip.png</normaloff>:/clip.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>剪切选区</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>剪切选区</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionFill">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/fill.png</normaloff>:/fill.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fill</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>填充</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_aboutQt">
|
||||||
|
<property name="text">
|
||||||
|
<string>关于Qt</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionZoomin">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/zoomin.png</normaloff>:/zoomin.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>+</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>放大</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionZoomout">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/zoomout.png</normaloff>:/zoomout.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>-</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>缩小</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionZoom1">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/zoom1.png</normaloff>:/zoom1.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>实际大小</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionRotateRight">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/rr.png</normaloff>:/rr.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>rotateRight</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>右转90°</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionRotateLeft">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/rl.png</normaloff>:/rl.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>RotateLeft</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>左转90°</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMirrorHorizontal">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/MirrorHorizontal.png</normaloff>:/MirrorHorizontal.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>MirrorHorizontal</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>水平镜像</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMirrorVertical">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/MirrorVertical.png</normaloff>:/MirrorVertical.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>MirrorVertical</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>垂直镜像</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_gray">
|
||||||
|
<property name="text">
|
||||||
|
<string>灰度</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_invert">
|
||||||
|
<property name="text">
|
||||||
|
<string>反色</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_import">
|
||||||
|
<property name="text">
|
||||||
|
<string>导入图片</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_blur">
|
||||||
|
<property name="text">
|
||||||
|
<string>模糊</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionColorPicker">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="filename.qrc">
|
||||||
|
<normaloff>:/color_picker.png</normaloff>:/color_picker.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>颜色拾取</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>颜色拾取</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources>
|
||||||
|
<include location="filename.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
After Width: | Height: | Size: 820 B |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.6 KiB |