refactor(代码同步): 合入通用问题解决方案和标注功能
|
@ -24,8 +24,8 @@ QString KylinImageCodec::saveWay(const QString &savepath, bool replace)
|
|||
QString tmpPath = savepath;
|
||||
int num = 1;
|
||||
while (QFileInfo::exists(tmpPath)) {
|
||||
tmpPath = tmpFileInfo.absolutePath() + "/" + tmpFileInfo.completeBaseName() + "(" + QString::number(num) + ")"
|
||||
+ "." + tmpFileInfo.completeSuffix();
|
||||
tmpPath = tmpPath.mid(0, tmpPath.lastIndexOf(".")) + "(" + QString::number(num) + ")"
|
||||
+ tmpPath.mid(tmpPath.lastIndexOf("."), -1);
|
||||
num++;
|
||||
}
|
||||
return tmpPath;
|
||||
|
@ -84,7 +84,7 @@ bool KylinImageCodec::save(const Mat &mat, const QString &savepath, const QStrin
|
|||
}
|
||||
//如果是freeimage库的图片
|
||||
if (m_freeimageSupportFormats.contains(type)) {
|
||||
if (type == "xpm" || type == "xbm" || type == "wbmp") {
|
||||
if (type == "xpm" || type == "xbm" || type == "wbmp" || type == "webp") {
|
||||
QPixmap pix = converFormat(mat);
|
||||
return pix.save(savepath);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <libkyocr.hpp>
|
||||
|
||||
#include "kylinocr.h"
|
||||
|
||||
#include <QDebug>
|
||||
KylinOCR::KylinOCR() {}
|
||||
|
||||
void KylinOCR::getText(QString imgPath)
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
kylin-photo-viewer (1.3.0.3-ok6) yangtze; urgency=medium
|
||||
|
||||
* BUG号:无
|
||||
* 需求号:无
|
||||
* 其他改动说明:同步代码,合入通用bug解决方案,合入标注功能
|
||||
* 影响域:仅影响自身,合入通用bug解决方案和标注功能
|
||||
|
||||
-- zoujunnan <zoujunnan@kylinos.cn> Thu, 24 Nov 2022 18:43:28 +0800
|
||||
|
||||
kylin-photo-viewer (1.3.0.3-ok5) yangtze; urgency=medium
|
||||
|
||||
* BUG号:无
|
||||
|
|
|
@ -32,3 +32,4 @@ icons.path = /usr/share/pixmaps/
|
|||
|
||||
INSTALLS +=desktop settings icons qm_files guide
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ Item {
|
|||
property int angleDeltaY: 0
|
||||
|
||||
onWheel: {
|
||||
|
||||
var combo = ""
|
||||
|
||||
angleDeltaX += wheel.angleDelta.x
|
||||
|
@ -47,12 +48,10 @@ Item {
|
|||
|
||||
angleDeltaX = 0
|
||||
angleDeltaY = 0
|
||||
if (variables.operateWay != 9 && variables.operateWay != 10) {
|
||||
if (variables.operateImageWay != 9 && variables.operateImageWay != 10) {
|
||||
variables.wheelChange = !variables.wheelChange
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,6 +156,38 @@ Item {
|
|||
imageNormal.imagePath = imagePath
|
||||
theImage.source = imageNormal.imagePath
|
||||
}
|
||||
function changeImage(imageUrl,imageWidth,imageHeight) {
|
||||
if (variables.operateImageWay === 12) {
|
||||
theImage.source = ""
|
||||
startAni = false
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2
|
||||
theImage.y = variables.curWidH / 2 - imageHeight / 2
|
||||
imageNormal.imagePath = imageUrl
|
||||
theImage.source = imageNormal.imagePath
|
||||
startAni = true
|
||||
}
|
||||
if (variables.operateImageWay === 17) {
|
||||
theImage.source = ""
|
||||
startAni = false
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2 + imageWidth + 10
|
||||
theImage.y = variables.curWidH / 2 - imageHeight / 2
|
||||
imageNormal.imagePath = imageUrl
|
||||
theImage.source = imageNormal.imagePath
|
||||
startAni = true
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2
|
||||
}
|
||||
if (variables.operateImageWay === 18) {
|
||||
theImage.source = ""
|
||||
startAni = false
|
||||
theImage.x = - imageWidth - 10
|
||||
theImage.y = variables.curWidH / 2 - imageHeight / 2
|
||||
imageNormal.imagePath = imageUrl
|
||||
theImage.source = imageNormal.imagePath
|
||||
startAni = true
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: variables
|
||||
|
@ -178,18 +210,22 @@ Item {
|
|||
onPinchStarted: {
|
||||
initialScale = theImage.curScale
|
||||
buriedPoint()
|
||||
|
||||
}
|
||||
|
||||
onPinchUpdated: {
|
||||
|
||||
// 关闭动画
|
||||
startAni = false
|
||||
|
||||
if (!imageNeedCenterZoom) {
|
||||
imageBase.performZoom(theImage,theImage.mapFromItem(pincharea,pinch.center.x, pinch.center.y), undefined, false, false, true, (initialScale*pinch.scale)/theImage.curScale)
|
||||
} else {
|
||||
imageBase.performZoom(theImage,theImage.mapFromItem(pincharea, mainWindow.width/2, mainWindow.height/2), undefined, false, false, true,(initialScale*pinch.scale)/theImage.curScale)
|
||||
theImage.imagePostionReset()
|
||||
}
|
||||
|
||||
|
||||
// 开启动画
|
||||
startAni = true
|
||||
}
|
||||
|
@ -202,6 +238,7 @@ Item {
|
|||
drag.target: theImage
|
||||
|
||||
hoverEnabled: false // 必须设置为false,否则,鼠标的坐标抓取的就不是全局的
|
||||
propagateComposedEvents:true //设置鼠标穿透,双击的事件需要传到底层
|
||||
|
||||
onPressAndHold: {
|
||||
variables.mousePos = mousearea.mapToItem(bgimage, Qt.point(mouse.x, mouse.y))
|
||||
|
@ -332,7 +369,7 @@ Item {
|
|||
if (container.imageType === 0) {
|
||||
return
|
||||
}
|
||||
variables.operateWay = operateWay
|
||||
variables.operateImageWay = operateWay
|
||||
if (operateWay === 1) {
|
||||
//放大
|
||||
container.zoomIn(undefined)
|
||||
|
@ -368,7 +405,7 @@ Item {
|
|||
needWheelReact = true
|
||||
}
|
||||
//切图
|
||||
if (operateWay === 12) {
|
||||
if (operateWay === 12 || operateWay === 17 || operateWay === 18) {
|
||||
newImageLoaded = true
|
||||
startAni = false
|
||||
theImage.rotateTo = 0
|
||||
|
@ -467,6 +504,11 @@ Item {
|
|||
mouseDragType = -1
|
||||
}
|
||||
}
|
||||
if(!variables.navigatorState) {
|
||||
mousearea.enabled = false
|
||||
} else {
|
||||
mousearea.enabled = true
|
||||
}
|
||||
}
|
||||
function adjustImagePostion() {
|
||||
setDrogLimit()
|
||||
|
|
|
@ -77,8 +77,15 @@ Item {
|
|||
}
|
||||
|
||||
var curZoomfactor = theImage.curScale * zoomfactor
|
||||
if (curZoomfactor > 100 || curZoomfactor < 0.05) {
|
||||
zoomfactor = 1
|
||||
if (curZoomfactor > 100) {
|
||||
if (zoom_in || zoom_pinch) {
|
||||
zoomfactor = 100 / theImage.curScale
|
||||
}
|
||||
}
|
||||
if (curZoomfactor < 0.05) {
|
||||
if (!zoom_in) {
|
||||
zoomfactor = 0.05 / theImage.curScale
|
||||
}
|
||||
}
|
||||
// update x/y position of image
|
||||
var realX = (pos.x - theImage.width/2) * theImage.curScale
|
||||
|
@ -112,14 +119,7 @@ Item {
|
|||
}
|
||||
|
||||
var curScale = theImage.curScale * zoomfactor
|
||||
|
||||
if (curScale > 100 ) {
|
||||
theImage.curScale = 100
|
||||
} else if (curScale < 0.05) {
|
||||
theImage.curScale = 0.05
|
||||
} else {
|
||||
theImage.curScale = curScale
|
||||
}
|
||||
theImage.parent.sendScale(theImage.curScale * 100)
|
||||
imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ Item {
|
|||
theImage.parent.imageVisibleLeftUpY = -actualY
|
||||
}
|
||||
|
||||
// makeSureNavigatorNeedShow(theImage)
|
||||
// makeSureNavigatorNeedShow(theImage)
|
||||
}
|
||||
function makeSureNavigatorNeedShow(theImage) {
|
||||
|
||||
|
@ -192,13 +192,10 @@ Item {
|
|||
}
|
||||
//超出窗口大小需要显示导航栏
|
||||
if (theImage.parent.imageLeftUpX < 0 || theImage.parent.imageLeftUpY < 0 || theImage.parent.imageLeftUpX + visibleW > variables.curWidW || theImage.parent.imageLeftUpY + visibleH > variables.curWidH) {
|
||||
// if (!xani.running && !yani.running && !scaleani.running && !rotani.running) {
|
||||
theImage.parent.mouseareaEnabeled = true
|
||||
variables.navigatorState = true
|
||||
theImage.parent.imageNeedCenterZoom = false
|
||||
theImage.parent.needShowNavigator(theImage.curScale,theImage.parent.imageVisibleLeftUpX,theImage.parent.imageVisibleLeftUpY,getVisibleSizeAccordingWidW(theImage),getVisibleSizeAccordingWidH(theImage))
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
//返回所需要相对于窗口的在当前缩放比下的可视区域的高度和宽度
|
||||
|
@ -493,4 +490,23 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function resetSignArgs() {
|
||||
|
||||
variables.painterType = -1 //记录画笔类型
|
||||
variables.painterThickness = -1 //记录画笔粗细
|
||||
variables.painterColor = -1 //记录画笔颜色
|
||||
variables.isBold =false //加粗
|
||||
variables.isDeleteLine = false //删除
|
||||
variables.isUnderLine =false //下划线
|
||||
variables.isItalics =false //斜体
|
||||
variables.fontType = "" //字体
|
||||
variables.fontSize = 6 //字号
|
||||
|
||||
variables.objList = []
|
||||
variables.operateTime = 0
|
||||
|
||||
variables.mouseqX = 0
|
||||
variables.mouseqY = 0
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
**************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
|
||||
//import "../signcanvas"
|
||||
Item {
|
||||
objectName: "imageItemLower"
|
||||
id: imageNormal
|
||||
|
@ -38,13 +38,30 @@ Item {
|
|||
property double imageVisibleLeftUpY: 0
|
||||
property double imageLeftUpX: 0 //缩放后的图片的左上角相对于窗口的位置
|
||||
property double imageLeftUpY: 0
|
||||
property double imageRealLeftX: 0 == imageVisibleLeftUpX ? imageLeftUpX : -imageVisibleLeftUpX
|
||||
property double imageRealLeftY: 0 == imageVisibleLeftUpY ? imageLeftUpY : -imageVisibleLeftUpY
|
||||
signal needShowNavigator(var scale, var leftUpImageX, var leftUpImageY, var visibleWidth, var visibleHeight)
|
||||
signal closeNavigator()
|
||||
property bool imageNeedCenterZoom: true
|
||||
property bool mouseareaEnabeled: false
|
||||
property int mouseDragType: -1
|
||||
property bool startAni: true
|
||||
|
||||
signal sendRectInfo(var rect)
|
||||
signal sendCircleInfo(var leftX, var leftY, var painterW, var painterH)
|
||||
signal sendLineInfo(var startPos, var endPos)
|
||||
signal sendArrowInfo(var startPos, var endPos, var arrowStartPos, var arrowEndPos)
|
||||
signal sendPencilInfo(var pointList)
|
||||
signal sendMarkInfo(var startPos, var endPos,var alpha)
|
||||
signal sendTextInfo(var textContent, var startPos,var type)
|
||||
signal sendBlurInfot(var blurRect)
|
||||
property double curMouseX: 0
|
||||
property double curMouseY: 0
|
||||
property double backScale
|
||||
property double backX
|
||||
property double backY
|
||||
property double realWidth : 0
|
||||
property double realHeight : 0
|
||||
property rect paintblurRect
|
||||
signal buriedPoint()
|
||||
|
||||
Image {
|
||||
|
@ -52,6 +69,9 @@ Item {
|
|||
id: theImage
|
||||
property real curX: imageNormal.width/2 - width/2
|
||||
property real curY: imageNormal.height/2 - height/2
|
||||
property real realCurX
|
||||
property real realCurY
|
||||
|
||||
x: curX
|
||||
y: curY
|
||||
focus: true
|
||||
|
@ -72,6 +92,7 @@ Item {
|
|||
//旋转--参数:real,角度。默认0 degree
|
||||
rotation: 0
|
||||
property real rotateTo: 0
|
||||
|
||||
onRotateToChanged: {
|
||||
rotation = rotateTo
|
||||
}
|
||||
|
@ -83,6 +104,7 @@ Item {
|
|||
property real curScale: 1
|
||||
scale: curScale
|
||||
|
||||
|
||||
Behavior on x {
|
||||
PropertyAnimation {
|
||||
id: xani
|
||||
|
@ -149,6 +171,198 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: variables
|
||||
onPainterTypeChanged: {
|
||||
if (variables.painterType == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
theImage.paintCanvas()
|
||||
}
|
||||
onPainterReleaseChanged:{
|
||||
theImage.paintCanvas()
|
||||
}
|
||||
onCoreNeedPaintChanged: {
|
||||
theImage.paintCanvas()
|
||||
}
|
||||
onNeedExitPaintChanged: {
|
||||
exitSign()
|
||||
}
|
||||
|
||||
onOperateImageWayChanged: {
|
||||
if (variables.operateImageWay == 0) {
|
||||
//放开拖拽和缩放
|
||||
pincharea.enabled = true
|
||||
mousearea.enabled = true
|
||||
needWheelReact = true
|
||||
}
|
||||
if (variables.operateImageWay == 15 || variables.operateImageWay == 9 || variables.operateImageWay == 10) {
|
||||
mousearea.enabled = true
|
||||
} /*else {
|
||||
area.enabled = false
|
||||
}*/
|
||||
}
|
||||
}
|
||||
function createTextObj(mx,my) {
|
||||
if (variables.painterType === 6) {
|
||||
var component61 = Qt.createComponent("qrc:/signcanvas/TextEditPage.qml");
|
||||
if (component61.status === Component.Ready) {
|
||||
var rect61 = component61.createObject(imageNormal,{imageText:theImage});
|
||||
variables.objList[variables.operateTime++] = rect61
|
||||
variables.objList[variables.objList.length - 1].setProptyReact(mx,my)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
variables.painterRectSignal.connect(sendRectInfo)
|
||||
variables.painterCircleSignal.connect(sendCircleInfo)
|
||||
variables.painterLinePaint.connect(sendLineInfo)
|
||||
variables.painterArrowPaint.connect(sendArrowInfo)
|
||||
variables.painterPencilPaint.connect(sendPencilInfo)
|
||||
variables.painterMarkPaint.connect(sendMarkInfo)
|
||||
variables.painterTextPaint.connect(sendTextInfo)
|
||||
variables.painterBlurPaint.connect(sendBlurInfot)
|
||||
variables.painterTextChanged.connect(createTextObj)
|
||||
backScale = theImage.scale
|
||||
// backX = theImage.realCurX
|
||||
// backY = theImage.realCurY
|
||||
backX = imageRealLeftX
|
||||
backY = imageRealLeftY
|
||||
}
|
||||
|
||||
function paintCanvas() {
|
||||
|
||||
if (variables.painterType == -1) {
|
||||
mousearea.enabled = true
|
||||
return
|
||||
} else {
|
||||
mousearea.enabled = false
|
||||
}
|
||||
|
||||
if (variables.objList.length > 0) {
|
||||
if (variables.objList[variables.objList.length - 1].hasPaint === false) {
|
||||
variables.objList[variables.objList.length - 1].clearMask()
|
||||
if (variables.operateTime !== 0) {
|
||||
--variables.operateTime
|
||||
}
|
||||
}
|
||||
}
|
||||
//避免最后一个text没有将绘制的信号发出
|
||||
if (variables.painterType !== 6) {
|
||||
if (variables.objList.length > 0) {
|
||||
if (variables.objList[variables.objList.length - 1].objectName === "textEditPage") {
|
||||
variables.objList[variables.objList.length - 1].sendTextOperate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (variables.painterType === 0) {
|
||||
var component0 = Qt.createComponent("qrc:/signcanvas/RectanglePage.qml");
|
||||
if (component0.status === Component.Ready) {
|
||||
var rect0 = component0.createObject(imageNormal,{imageTarget:theImage});
|
||||
variables.objList[variables.operateTime++] = rect0
|
||||
variables.objList[variables.objList.length - 1].forceActiveFocus()
|
||||
}
|
||||
}
|
||||
if (variables.painterType === 1) {
|
||||
var component1 = Qt.createComponent("qrc:/signcanvas/CirclePage.qml");
|
||||
if (component1.status === Component.Ready) {
|
||||
var rect1 = component1.createObject(imageNormal,{imageTarget:theImage});
|
||||
variables.objList[variables.operateTime++] = rect1
|
||||
variables.objList[variables.objList.length - 1].forceActiveFocus()
|
||||
}
|
||||
}
|
||||
if (variables.painterType === 2) {
|
||||
var component2 = Qt.createComponent("qrc:/signcanvas/StraightLinePage.qml");
|
||||
if (component2.status === Component.Ready) {
|
||||
var rect2 = component2.createObject(imageNormal,{imageTarget:theImage});
|
||||
variables.objList[variables.operateTime++] = rect2
|
||||
variables.objList[variables.objList.length - 1].forceActiveFocus()
|
||||
}
|
||||
}
|
||||
if (variables.painterType === 3) {
|
||||
var component3 = Qt.createComponent("qrc:/signcanvas/LineArrowPage.qml");
|
||||
if (component3.status === Component.Ready) {
|
||||
var rect3 = component3.createObject(imageNormal,{imageTarget:theImage});
|
||||
variables.objList[variables.operateTime++] = rect3
|
||||
variables.objList[variables.objList.length - 1].forceActiveFocus()
|
||||
}
|
||||
}
|
||||
if (variables.painterType === 4) {
|
||||
var component4 = Qt.createComponent("qrc:/signcanvas/PainterPenPage.qml");
|
||||
if (component4.status === Component.Ready) {
|
||||
var rect4 = component4.createObject(imageNormal,{imageTarget:theImage});
|
||||
variables.objList[variables.operateTime++] = rect4
|
||||
variables.objList[variables.objList.length - 1].forceActiveFocus()
|
||||
}
|
||||
}
|
||||
if (variables.painterType === 5) {
|
||||
var component5 = Qt.createComponent("qrc:/signcanvas/LinePage.qml");
|
||||
if (component5.status === Component.Ready) {
|
||||
var rect5 = component5.createObject(imageNormal,{imageTarget:theImage});
|
||||
variables.objList[variables.operateTime++] = rect5
|
||||
variables.objList[variables.objList.length - 1].forceActiveFocus()
|
||||
}
|
||||
}
|
||||
if (variables.painterType === 6) {
|
||||
var component6 = Qt.createComponent("qrc:/signcanvas/TextEditPage.qml");
|
||||
if (component6.status === Component.Ready) {
|
||||
var rect6 = component6.createObject(imageNormal,{imageText:theImage});
|
||||
variables.objList[variables.operateTime++] = rect6
|
||||
}
|
||||
}
|
||||
if (variables.painterType === 7) {
|
||||
var component7 = Qt.createComponent("qrc:/signcanvas/FuzzyPage.qml");
|
||||
if (component7.status === Component.Ready) {
|
||||
var rect7 = component7.createObject(imageNormal,{imageTarget:theImage});
|
||||
variables.objList[variables.operateTime++] = rect7
|
||||
variables.objList[variables.objList.length - 1].forceActiveFocus()
|
||||
// variables.objList[variables.objList.length - 1].setProptyReact(curMouseX,curMouseY)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeImage(imageUrl,imageWidth,imageHeight) {
|
||||
realWidth = imageWidth
|
||||
realHeight = imageHeight
|
||||
if (realWidth <= variables.curWidW && realHeight <= variables.curWidH) {
|
||||
imageLeftUpX = variables.curWidW / 2 - realWidth / 2
|
||||
imageLeftUpY = variables.curWidH / 2 - realHeight / 2
|
||||
backX = imageRealLeftX
|
||||
backY = imageRealLeftY
|
||||
}
|
||||
|
||||
if (variables.operateImageWay === 12) {
|
||||
theImage.source = ""
|
||||
startAni = false
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2
|
||||
theImage.y = variables.curWidH / 2 - imageHeight / 2
|
||||
theImage.source = imageUrl
|
||||
startAni = true
|
||||
}
|
||||
if (variables.operateImageWay === 17) {
|
||||
theImage.source = ""
|
||||
startAni = false
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2 + imageWidth + 10
|
||||
theImage.y = variables.curWidH / 2 - imageHeight / 2
|
||||
theImage.source = imageUrl
|
||||
startAni = true
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2
|
||||
}
|
||||
if (variables.operateImageWay === 18) {
|
||||
theImage.source = ""
|
||||
startAni = false
|
||||
theImage.x = - imageWidth - 10
|
||||
theImage.y = variables.curWidH / 2 - imageHeight / 2
|
||||
theImage.source = imageUrl
|
||||
startAni = true
|
||||
theImage.x = variables.curWidW / 2 - imageWidth / 2
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Connections {
|
||||
target: variables
|
||||
|
@ -173,10 +387,13 @@ Item {
|
|||
onPinchUpdated: {
|
||||
// 关闭动画
|
||||
startAni = false
|
||||
|
||||
if (!imageNeedCenterZoom) {
|
||||
imageBase.performZoom(theImage,theImage.mapFromItem(pincharea,pinch.center.x, pinch.center.y), undefined, false, false, true, (initialScale*pinch.scale)/theImage.curScale)
|
||||
} else {
|
||||
imageBase.performZoom(theImage,theImage.mapFromItem(pincharea, mainWindow.width/2, mainWindow.height/2), undefined, false, false, true,(initialScale*pinch.scale)/theImage.curScale)
|
||||
theImage.realCurX = mainWindow.width/2 - theImage.width*theImage.scale/2
|
||||
theImage.realCurY = mainWindow.height/2 - theImage.height*theImage.scale/2
|
||||
theImage.imagePostionReset()
|
||||
}
|
||||
// 开启动画
|
||||
|
@ -189,11 +406,12 @@ Item {
|
|||
anchors.fill: parent
|
||||
drag.target: theImage
|
||||
hoverEnabled: false // 必须设置为false,否则,鼠标的坐标抓取的就不是全局的
|
||||
propagateComposedEvents:true //设置鼠标穿透,双击的事件需要传到底层
|
||||
|
||||
onPressAndHold: {
|
||||
variables.mousePos = mousearea.mapToItem(bgimage, Qt.point(mouse.x, mouse.y))
|
||||
}
|
||||
onReleased: {
|
||||
|
||||
theImage.curX = theImage.x
|
||||
theImage.curY = theImage.y
|
||||
theImage.x = Qt.binding(function() { return theImage.curX })
|
||||
|
@ -207,7 +425,6 @@ Item {
|
|||
imageBase.imageActuralLeftUpPos(theImage,theImage.x ,theImage.y)
|
||||
imageBase.makeSureNavigatorNeedShow(theImage)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: variables
|
||||
onMousePosChanged: {
|
||||
|
@ -238,6 +455,8 @@ Item {
|
|||
imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, variables.mousePos.x, variables.mousePos.y), undefined, true, false, false)
|
||||
} else {
|
||||
imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, mainWindow.width/2, mainWindow.height/2), undefined, true, false, false)
|
||||
theImage.realCurX = mainWindow.width/2 - theImage.width*theImage.scale/2
|
||||
theImage.realCurY = mainWindow.height/2 - theImage.height*theImage.scale/2
|
||||
theImage.imagePostionReset()
|
||||
}
|
||||
imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
|
||||
|
@ -256,6 +475,8 @@ Item {
|
|||
imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, variables.mousePos.x, variables.mousePos.y), undefined, false, false, false)
|
||||
} else {
|
||||
imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, mainWindow.width/2, mainWindow.height/2), undefined, false, false, false)
|
||||
theImage.realCurX = mainWindow.width/2 - theImage.width*theImage.scale/2
|
||||
theImage.realCurY = mainWindow.height/2 - theImage.height*theImage.scale/2
|
||||
theImage.imagePostionReset()
|
||||
}
|
||||
imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
|
||||
|
@ -302,7 +523,7 @@ Item {
|
|||
if (container.imageType === 1) {
|
||||
return
|
||||
}
|
||||
variables.operateWay = operateWay
|
||||
variables.operateImageWay = operateWay
|
||||
if (operateWay === 1) {
|
||||
//放大
|
||||
container.zoomIn(undefined)
|
||||
|
@ -339,7 +560,7 @@ Item {
|
|||
needWheelReact = true
|
||||
}
|
||||
//切图
|
||||
if (operateWay === 12) {
|
||||
if (operateWay === 12 || operateWay === 17 || operateWay === 18) {
|
||||
startAni = false
|
||||
theImage.rotateTo = 0
|
||||
startAni = true
|
||||
|
@ -437,6 +658,11 @@ Item {
|
|||
mouseDragType = -1
|
||||
}
|
||||
}
|
||||
if(!variables.navigatorState) {
|
||||
mousearea.enabled = false
|
||||
} else {
|
||||
mousearea.enabled = true
|
||||
}
|
||||
}
|
||||
function adjustImagePostion() {
|
||||
setDrogLimit()
|
||||
|
@ -446,4 +672,40 @@ Item {
|
|||
imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
|
||||
imageBase.makeSureNavigatorNeedShow(theImage)
|
||||
}
|
||||
|
||||
function undoSignOperate() {
|
||||
if (variables.objList.length == 0) {
|
||||
variables.coreNeedPaint = !variables.coreNeedPaint
|
||||
return
|
||||
}
|
||||
for (var i = variables.objList.length - 1; i >= 0; i--) {
|
||||
if (variables.objList[i].hasPaint == false) {
|
||||
variables.objList[i].clearMask()
|
||||
variables.objList.pop()
|
||||
variables.operateTime -= 1
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (variables.objList.length == 0) {
|
||||
variables.coreNeedPaint = !variables.coreNeedPaint
|
||||
return
|
||||
}
|
||||
variables.objList[variables.objList.length - 1].clearMask()
|
||||
variables.objList.pop()
|
||||
variables.operateTime -= 1
|
||||
variables.coreNeedPaint = !variables.coreNeedPaint
|
||||
|
||||
}
|
||||
function exitSign() {
|
||||
if (variables.objList.length == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
for (var i = variables.objList.length - 1; i >= 0; i--) {
|
||||
variables.objList[i].clearMask()
|
||||
variables.objList.pop()
|
||||
variables.operateTime -= 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,47 @@ Item {
|
|||
property int angle180: 180
|
||||
property int angle270: 270
|
||||
property int angle360: 360
|
||||
property int operateImageWay:12
|
||||
property bool wheelChange: false
|
||||
property int operateWay: 0
|
||||
property var signPaintList: []
|
||||
|
||||
property int painterType : -1 //记录画笔类型
|
||||
property int painterThickness : 12 //记录画笔粗细
|
||||
property color painterColor : Qt.rgba(255,0,0) //记录画笔颜色
|
||||
property bool isBold : false; //加粗
|
||||
property bool isDeleteLine : false //删除
|
||||
property bool isUnderLine :false //下划线
|
||||
property bool isItalics : false //斜体
|
||||
property string fontType : "" //字体
|
||||
property int fontSize : 12 //字号
|
||||
|
||||
property var objList:[]
|
||||
property int operateTime: 0
|
||||
|
||||
property double mouseqX: 0
|
||||
property double mouseqY: 0
|
||||
property double acturalWidth: 0
|
||||
property double acturalHeight: 0
|
||||
property double acturalX: 0
|
||||
property double acturalY: 0
|
||||
property double acturalRotate: 0
|
||||
|
||||
property bool painterRelease: false
|
||||
property bool coreNeedPaint: false
|
||||
property bool needExitPaint: false
|
||||
signal painterRectSignal(var rect)
|
||||
signal painterCircleSignal(var leftX, var leftY, var painterW, var painterH)
|
||||
signal painterLinePaint(var startPos, var endPos);
|
||||
signal painterArrowPaint(var startPos, var endPos, var arrowStartPos, var arrowEndPos);
|
||||
signal painterPencilPaint(var pointList)
|
||||
signal painterMarkPaint(var startPos, var endPos,var alpha)
|
||||
signal painterTextPaint(var textContent, var startPos, var type)
|
||||
signal painterBlurPaint(var blurRect)
|
||||
|
||||
property bool createNewTextobj: false
|
||||
signal painterTextChanged(var mx,var my)
|
||||
property double textMouseX: -1000
|
||||
property double textMouseY: -1000
|
||||
|
||||
// "jpg", "jpe", "jpeg", "pbm", "pgm", "ppm", "sr", "ras", "png", "tga", "svg", "gif", "apng", "ico", "xpm", "exr", "psd", "jfi", "jif", "j2k", "jp2", "jng", "wbmp", "xbm", "tiff", "tif", "webp", "pnm", "bmp", "dib"
|
||||
|
||||
|
|
56
res.qrc
|
@ -182,6 +182,53 @@
|
|||
<file>res/sp1damaged/1ocr_damaged.png</file>
|
||||
<file>res/ocrCancel_W.png</file>
|
||||
<file>res/ocrCancel_B.png</file>
|
||||
<file>res/mark/undo.png</file>
|
||||
<file>res/mark/underLine.png</file>
|
||||
<file>res/mark/underLine_selected.png</file>
|
||||
<file>res/mark/text.png</file>
|
||||
<file>res/mark/text_selected.png</file>
|
||||
<file>res/mark/segment.png</file>
|
||||
<file>res/mark/segment_selected.png</file>
|
||||
<file>res/mark/rectangle.png</file>
|
||||
<file>res/mark/rectangle_selected.png</file>
|
||||
<file>res/mark/paintBrush.png</file>
|
||||
<file>res/mark/paintBrush_selected.png</file>
|
||||
<file>res/mark/markArticle.png</file>
|
||||
<file>res/mark/markArticle_selected.png</file>
|
||||
<file>res/mark/italics.png</file>
|
||||
<file>res/mark/italics_selected.png</file>
|
||||
<file>res/mark/exit.png</file>
|
||||
<file>res/mark/ellipse.png</file>
|
||||
<file>res/mark/ellipse_selected.png</file>
|
||||
<file>res/mark/deleteLine.png</file>
|
||||
<file>res/mark/deleteLine_selected.png</file>
|
||||
<file>res/mark/bold.png</file>
|
||||
<file>res/mark/bold_selected.png</file>
|
||||
<file>res/mark/blur.png</file>
|
||||
<file>res/mark/blur_selected.png</file>
|
||||
<file>res/mark/arrow.png</file>
|
||||
<file>res/mark/arrow_selected.png</file>
|
||||
<file>res/mark/1undo.png</file>
|
||||
<file>res/mark/1underLine.png</file>
|
||||
<file>res/mark/1text.png</file>
|
||||
<file>res/mark/1segment.png</file>
|
||||
<file>res/mark/1rectangle.png</file>
|
||||
<file>res/mark/1paintBrush.png</file>
|
||||
<file>res/mark/1markArticle.png</file>
|
||||
<file>res/mark/1italics.png</file>
|
||||
<file>res/mark/1ellipse.png</file>
|
||||
<file>res/mark/1deleteLine.png</file>
|
||||
<file>res/mark/1bold.png</file>
|
||||
<file>res/mark/1blur.png</file>
|
||||
<file>res/mark/1arrow.png</file>
|
||||
<file>res/labelbar_hover.png</file>
|
||||
<file>res/labelbar.png</file>
|
||||
<file>res/1labelbar_hover.png</file>
|
||||
<file>res/1labelbar.png</file>
|
||||
<file>res/right.svg</file>
|
||||
<file>res/left.svg</file>
|
||||
<file>res/1right.svg</file>
|
||||
<file>res/1left.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/">
|
||||
<file>showImageComponent.qml</file>
|
||||
|
@ -192,5 +239,14 @@
|
|||
<file>part/ImageBaseFunction.qml</file>
|
||||
<file>mousebase/MouseAreaBase.js</file>
|
||||
<file>mousebase/MouseAreaEvent.qml</file>
|
||||
<file>signcanvas/TextEditPage.qml</file>
|
||||
<file>signcanvas/StraightLinePage.qml</file>
|
||||
<file>signcanvas/LinePage.qml</file>
|
||||
<file>signcanvas/RectanglePage.qml</file>
|
||||
<file>signcanvas/PainterPenPage.qml</file>
|
||||
<file>signcanvas/LineArrowPage.qml</file>
|
||||
<file>signcanvas/FuzzyPage.qml</file>
|
||||
<file>signcanvas/CirclePage.qml</file>
|
||||
<file>signcanvas/SignBase.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
After Width: | Height: | Size: 528 B |
After Width: | Height: | Size: 512 B |
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="56px" height="56px" viewBox="0 0 56 56" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>dark/arrow-l-dark</title>
|
||||
<g id="dark/arrow-l-dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M10.2555408,3.90809465e-17 L45.7444592,-1.13556947e-15 C49.3105342,6.59798564e-16 50.6036791,0.371302445 51.9073828,1.06853082 C53.2110865,1.76575919 54.2342408,2.78891348 54.9314692,4.09261719 C55.6286976,5.39632089 56,6.68946584 56,10.2555408 L56,45.7444592 C56,49.3105342 55.6286976,50.6036791 54.9314692,51.9073828 C54.2342408,53.2110865 53.2110865,54.2342408 51.9073828,54.9314692 C50.6036791,55.6286976 49.3105342,56 45.7444592,56 L10.2555408,56 C6.68946584,56 5.39632089,55.6286976 4.09261719,54.9314692 C2.78891348,54.2342408 1.76575919,53.2110865 1.06853082,51.9073828 C0.371302445,50.6036791 1.06103393e-15,49.3105342 -1.82612968e-15,45.7444592 L7.29641152e-16,10.2555408 C-4.23942521e-16,6.68946584 0.371302445,5.39632089 1.06853082,4.09261719 C1.76575919,2.78891348 2.78891348,1.76575919 4.09261719,1.06853082 C5.39632089,0.371302445 6.68946584,-2.27071554e-17 10.2555408,3.90809465e-17 Z" id="矩形" fill="#262626" opacity="0.400000006" transform="translate(28.000000, 28.000000) scale(-1, 1) translate(-28.000000, -28.000000) "></path>
|
||||
<path d="M39.7610495,23.4827745 L28.5125948,34.1254451 C28.4348064,34.1993963 28.1848383,34.3814709 28.1423335,34.438701 C27.7232492,35.0006173 27.1206618,35.1692885 26.7956403,34.8134999 L16.2019603,23.2260851 C15.8769388,22.8699648 15.9519922,22.1250117 16.3711039,21.5618014 C16.7902155,20.9988897 17.3927756,20.830849 17.7188912,21.1866375 L27.3601814,31.731934 L38.3677216,21.3167903 C38.7136944,20.9901642 39.3052592,21.2107239 39.6890323,21.8084381 C40.0736532,22.4064841 40.1059283,23.1561483 39.7610495,23.4827745 Z" id="下拉" fill="#FFFFFF" fill-rule="nonzero" opacity="0.847762468" transform="translate(28.000000, 28.000000) rotate(-270.000000) translate(-28.000000, -28.000000) "></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="56px" height="56px" viewBox="0 0 56 56" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>dark/arrow-r-dark</title>
|
||||
<g id="dark/arrow-r-dark" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M10.2555408,3.90809465e-17 L45.7444592,-1.13556947e-15 C49.3105342,6.59798564e-16 50.6036791,0.371302445 51.9073828,1.06853082 C53.2110865,1.76575919 54.2342408,2.78891348 54.9314692,4.09261719 C55.6286976,5.39632089 56,6.68946584 56,10.2555408 L56,45.7444592 C56,49.3105342 55.6286976,50.6036791 54.9314692,51.9073828 C54.2342408,53.2110865 53.2110865,54.2342408 51.9073828,54.9314692 C50.6036791,55.6286976 49.3105342,56 45.7444592,56 L10.2555408,56 C6.68946584,56 5.39632089,55.6286976 4.09261719,54.9314692 C2.78891348,54.2342408 1.76575919,53.2110865 1.06853082,51.9073828 C0.371302445,50.6036791 1.06103393e-15,49.3105342 -1.82612968e-15,45.7444592 L7.29641152e-16,10.2555408 C-4.23942521e-16,6.68946584 0.371302445,5.39632089 1.06853082,4.09261719 C1.76575919,2.78891348 2.78891348,1.76575919 4.09261719,1.06853082 C5.39632089,0.371302445 6.68946584,-2.27071554e-17 10.2555408,3.90809465e-17 Z" id="矩形" fill="#262626" opacity="0.400000006" transform="translate(28.000000, 28.000000) scale(-1, 1) translate(-28.000000, -28.000000) "></path>
|
||||
<path d="M39.7610495,23.4827745 L28.5125948,34.1254451 C28.4348064,34.1993963 28.1848383,34.3814709 28.1423335,34.438701 C27.7232492,35.0006173 27.1206618,35.1692885 26.7956403,34.8134999 L16.2019603,23.2260851 C15.8769388,22.8699648 15.9519922,22.1250117 16.3711039,21.5618014 C16.7902155,20.9988897 17.3927756,20.830849 17.7188912,21.1866375 L27.3601814,31.731934 L38.3677216,21.3167903 C38.7136944,20.9901642 39.3052592,21.2107239 39.6890323,21.8084381 C40.0736532,22.4064841 40.1059283,23.1561483 39.7610495,23.4827745 Z" id="下拉" fill="#FFFFFF" fill-rule="nonzero" opacity="0.847762468" transform="translate(28.000000, 28.000000) scale(-1, 1) rotate(-270.000000) translate(-28.000000, -28.000000) "></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 512 B |
After Width: | Height: | Size: 485 B |
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="56px" height="56px" viewBox="0 0 56 56" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>light/arrow-l</title>
|
||||
<g id="light/arrow-l" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M10.2555408,3.90809465e-17 L45.7444592,-1.13556947e-15 C49.3105342,6.59798564e-16 50.6036791,0.371302445 51.9073828,1.06853082 C53.2110865,1.76575919 54.2342408,2.78891348 54.9314692,4.09261719 C55.6286976,5.39632089 56,6.68946584 56,10.2555408 L56,45.7444592 C56,49.3105342 55.6286976,50.6036791 54.9314692,51.9073828 C54.2342408,53.2110865 53.2110865,54.2342408 51.9073828,54.9314692 C50.6036791,55.6286976 49.3105342,56 45.7444592,56 L10.2555408,56 C6.68946584,56 5.39632089,55.6286976 4.09261719,54.9314692 C2.78891348,54.2342408 1.76575919,53.2110865 1.06853082,51.9073828 C0.371302445,50.6036791 1.06103393e-15,49.3105342 -1.82612968e-15,45.7444592 L7.29641152e-16,10.2555408 C-4.23942521e-16,6.68946584 0.371302445,5.39632089 1.06853082,4.09261719 C1.76575919,2.78891348 2.78891348,1.76575919 4.09261719,1.06853082 C5.39632089,0.371302445 6.68946584,-2.27071554e-17 10.2555408,3.90809465e-17 Z" id="矩形" fill="#FFFFFF" opacity="0.4"></path>
|
||||
<path d="M39.7610495,23.4827745 L28.5125948,34.1254451 C28.4348064,34.1993963 28.1848383,34.3814709 28.1423335,34.438701 C27.7232492,35.0006173 27.1206618,35.1692885 26.7956403,34.8134999 L16.2019603,23.2260851 C15.8769388,22.8699648 15.9519922,22.1250117 16.3711039,21.5618014 C16.7902155,20.9988897 17.3927756,20.830849 17.7188912,21.1866375 L27.3601814,31.731934 L38.3677216,21.3167903 C38.7136944,20.9901642 39.3052592,21.2107239 39.6890323,21.8084381 C40.0736532,22.4064841 40.1059283,23.1561483 39.7610495,23.4827745 Z" id="下拉" fill="#262626" fill-rule="nonzero" opacity="0.849999964" transform="translate(28.000000, 28.000000) rotate(-270.000000) translate(-28.000000, -28.000000) "></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 571 B |
After Width: | Height: | Size: 429 B |
After Width: | Height: | Size: 321 B |
After Width: | Height: | Size: 454 B |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 186 B |
After Width: | Height: | Size: 341 B |
After Width: | Height: | Size: 191 B |
After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 621 B |
After Width: | Height: | Size: 441 B |
After Width: | Height: | Size: 453 B |
After Width: | Height: | Size: 588 B |
After Width: | Height: | Size: 711 B |
After Width: | Height: | Size: 571 B |
After Width: | Height: | Size: 519 B |
After Width: | Height: | Size: 337 B |
After Width: | Height: | Size: 327 B |
After Width: | Height: | Size: 526 B |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 439 B |
After Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 469 B |
After Width: | Height: | Size: 312 B |
After Width: | Height: | Size: 327 B |
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 590 B |
After Width: | Height: | Size: 289 B |
After Width: | Height: | Size: 359 B |
After Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 543 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 218 B |
After Width: | Height: | Size: 370 B |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 592 B |
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="56px" height="56px" viewBox="0 0 56 56" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>light/arrow-r</title>
|
||||
<g id="light/arrow-r" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M10.2555408,3.90809465e-17 L45.7444592,-1.13556947e-15 C49.3105342,6.59798564e-16 50.6036791,0.371302445 51.9073828,1.06853082 C53.2110865,1.76575919 54.2342408,2.78891348 54.9314692,4.09261719 C55.6286976,5.39632089 56,6.68946584 56,10.2555408 L56,45.7444592 C56,49.3105342 55.6286976,50.6036791 54.9314692,51.9073828 C54.2342408,53.2110865 53.2110865,54.2342408 51.9073828,54.9314692 C50.6036791,55.6286976 49.3105342,56 45.7444592,56 L10.2555408,56 C6.68946584,56 5.39632089,55.6286976 4.09261719,54.9314692 C2.78891348,54.2342408 1.76575919,53.2110865 1.06853082,51.9073828 C0.371302445,50.6036791 1.06103393e-15,49.3105342 -1.82612968e-15,45.7444592 L7.29641152e-16,10.2555408 C-4.23942521e-16,6.68946584 0.371302445,5.39632089 1.06853082,4.09261719 C1.76575919,2.78891348 2.78891348,1.76575919 4.09261719,1.06853082 C5.39632089,0.371302445 6.68946584,-2.27071554e-17 10.2555408,3.90809465e-17 Z" id="矩形" fill="#FFFFFF" opacity="0.4" transform="translate(28.000000, 28.000000) scale(-1, 1) translate(-28.000000, -28.000000) "></path>
|
||||
<path d="M39.7610495,23.4827745 L28.5125948,34.1254451 C28.4348064,34.1993963 28.1848383,34.3814709 28.1423335,34.438701 C27.7232492,35.0006173 27.1206618,35.1692885 26.7956403,34.8134999 L16.2019603,23.2260851 C15.8769388,22.8699648 15.9519922,22.1250117 16.3711039,21.5618014 C16.7902155,20.9988897 17.3927756,20.830849 17.7188912,21.1866375 L27.3601814,31.731934 L38.3677216,21.3167903 C38.7136944,20.9901642 39.3052592,21.2107239 39.6890323,21.8084381 C40.0736532,22.4064841 40.1059283,23.1561483 39.7610495,23.4827745 Z" id="下拉" fill="#262626" fill-rule="nonzero" opacity="0.849999964" transform="translate(28.000000, 28.000000) scale(-1, 1) rotate(-270.000000) translate(-28.000000, -28.000000) "></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
|
@ -2,6 +2,8 @@ import QtQuick 2.12
|
|||
import QtQuick.Window 2.0
|
||||
import "./part"
|
||||
import "./mousebase"
|
||||
import "./signcanvas"
|
||||
|
||||
Rectangle {
|
||||
objectName: "mainRect"
|
||||
id: mainWindow
|
||||
|
@ -14,13 +16,24 @@ Rectangle {
|
|||
property bool mouseIsDoubleClick: false
|
||||
signal changeImage(var nextOrBack)
|
||||
signal doubleSignal()
|
||||
Variables { id: variables }
|
||||
property int signListLength: variables.operateTime
|
||||
|
||||
|
||||
Variables {
|
||||
id: variables
|
||||
onOperateTimeChanged: {
|
||||
signListLength = variables.operateTime
|
||||
}
|
||||
}
|
||||
|
||||
ImageBaseFunction {id: imageBase}
|
||||
SignBase {id: signBase}
|
||||
|
||||
onWidthChanged: {
|
||||
variables.curWidW = width
|
||||
variables.curWidW = width + 1
|
||||
}
|
||||
onHeightChanged: {
|
||||
variables.curWidH = height
|
||||
variables.curWidH = height + 1
|
||||
}
|
||||
|
||||
//鼠标事件响应区域
|
||||
|
@ -42,14 +55,19 @@ Rectangle {
|
|||
mouseIsDoubleClick = false
|
||||
return
|
||||
}
|
||||
if (variables.operateImageWay == 15 || variables.operateImageWay == 9 || variables.operateImageWay == 10) {
|
||||
return
|
||||
}
|
||||
releasePoint = Qt.point(mouseX, mouseY)
|
||||
mouseMoveDistance = releasePoint.x - startPressPoint.x
|
||||
|
||||
if (mouseMoveDistance > 100) {
|
||||
variables.operateImageWay = 18
|
||||
//切换图图片
|
||||
changeImage(true)
|
||||
}
|
||||
if (mouseMoveDistance < -100) {
|
||||
variables.operateImageWay = 17
|
||||
//切换图图片
|
||||
changeImage(false)
|
||||
}
|
||||
|
@ -85,9 +103,12 @@ Rectangle {
|
|||
height: mainWindow.height
|
||||
}
|
||||
//拖拽文件打开图片
|
||||
DropArea{
|
||||
DropArea {
|
||||
anchors.fill: parent
|
||||
onDropped: {
|
||||
if (variables.operateImageWay == 15 || variables.operateImageWay == 9 || variables.operateImageWay == 10) {
|
||||
return
|
||||
}
|
||||
if (drop.hasUrls) {
|
||||
if (drop.urls.length > 0) {
|
||||
dropImagePath = drop.urls[0]
|
||||
|
@ -96,6 +117,48 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
function setOperateWay(way) {
|
||||
variables.operateImageWay = way
|
||||
}
|
||||
//sign
|
||||
function setpainterType(type) {
|
||||
variables.painterType = type
|
||||
}
|
||||
function setpainterThickness(thickness) {
|
||||
variables.painterThickness = thickness
|
||||
}
|
||||
function setpainterColor(color) {
|
||||
variables.painterColor = color
|
||||
}
|
||||
function setBold(isBold) {
|
||||
variables.isBold = isBold
|
||||
}
|
||||
function setDeleteLine(isDeleteLine) {
|
||||
variables.isDeleteLine = isDeleteLine
|
||||
}
|
||||
function setUnderLine(isUnderLine) {
|
||||
variables.isUnderLine = isUnderLine
|
||||
}
|
||||
function setItalics(isItalics) {
|
||||
variables.isItalics = isItalics
|
||||
}
|
||||
function setFontType(fontType) {
|
||||
variables.fontType = fontType
|
||||
}
|
||||
function setFontSize(fontSize) {
|
||||
variables.fontSize = fontSize
|
||||
}
|
||||
function getOperateTime() {
|
||||
if (variables.objList.length > 0) {
|
||||
if ( variables.objList[variables.objList.length - 1].objectName == "textEditPage") {
|
||||
variables.objList[variables.objList.length - 1].sendTextOperate()
|
||||
}
|
||||
}
|
||||
return variables.operateTime
|
||||
}
|
||||
function exitOperate() {
|
||||
variables.needExitPaint = !variables.needExitPaint
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
objectName: "circlePage"
|
||||
property var imageTarget
|
||||
anchors.fill: imageTarget
|
||||
scale: imageTarget.scale
|
||||
rotation: imageTarget.rotation
|
||||
|
||||
//鼠标点击坐标位置---画矩形
|
||||
property real startX :0 //储存鼠标开始时的坐标
|
||||
property real startY :0
|
||||
property real stopX :0 //储存鼠标结束时的坐标
|
||||
property real stopY :0
|
||||
property bool isMouseMoveEnable: false //是否允许鼠标移动绘制事件
|
||||
property var ctx
|
||||
property bool hasReleased: true
|
||||
property bool hasPaint: false
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: parent
|
||||
onPaint: {
|
||||
//画圆
|
||||
ctx = getContext("2d")
|
||||
ctx.lineWidth = variables.painterThickness
|
||||
ctx.strokeStyle = variables.painterColor
|
||||
|
||||
if (!isMouseMoveEnable) {
|
||||
ctx.clearRect(0,0,width,height) //清空所画图形
|
||||
return
|
||||
}
|
||||
if (isMouseMoveEnable){
|
||||
ctx.clearRect(0,0,width,height)
|
||||
}
|
||||
//开始绘制
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(startX,startY)
|
||||
|
||||
//记录移动终点
|
||||
stopX = area.mouseX
|
||||
stopY = area.mouseY
|
||||
|
||||
//画圆/椭圆
|
||||
ctx.ellipse(startX,startY,(stopX-startX) ,(stopY-startY),false)
|
||||
ctx.stroke()
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
enabled: true
|
||||
onPressed: {
|
||||
if (variables.painterType != 1) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画圆
|
||||
startX = mouse.x
|
||||
startY = mouse.y
|
||||
isMouseMoveEnable = true
|
||||
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (variables.painterType != 1) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画圆
|
||||
if (isMouseMoveEnable){
|
||||
hasPaint = true
|
||||
canvas.requestPaint() //绘制函数
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
if (stopX != 0 || stopY != 0) {
|
||||
variables.painterCircleSignal(startX,startY,(stopX-startX) ,(stopY-startY))
|
||||
}
|
||||
hasReleased = false
|
||||
area.enabled = false
|
||||
variables.painterRelease = !variables.painterRelease
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
function clearMask (){
|
||||
root.destroy()
|
||||
}
|
||||
function acturalType() {
|
||||
return root.objectName
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
import QtQuick 2.0
|
||||
import QtGraphicalEffects 1.0
|
||||
Rectangle{
|
||||
id:root1
|
||||
clip: true
|
||||
objectName: "fuzzyPage"
|
||||
color: "transparent"
|
||||
anchors.fill: imageTarget
|
||||
scale: imageTarget.scale
|
||||
// 属性
|
||||
property Item imageTarget // 模糊源
|
||||
property bool hasPaint: false
|
||||
property rect blurRect
|
||||
|
||||
property real startX: 0 //储存鼠标开始时的坐标
|
||||
property real startY: 0
|
||||
property real stopX: 0 //储存鼠标结束时的坐标
|
||||
property real stopY: 0
|
||||
|
||||
// 毛玻璃效果
|
||||
Rectangle {
|
||||
id: root
|
||||
objectName: "fuzzyPage1"
|
||||
x:startX
|
||||
y:startY
|
||||
width: stopX - startX
|
||||
height: stopY - startY
|
||||
color: "transparent"
|
||||
clip:true
|
||||
|
||||
FastBlur {
|
||||
id: blur
|
||||
source: parent.parent.imageTarget
|
||||
x: -startX
|
||||
y: -startY
|
||||
width: source.width
|
||||
height: source.height
|
||||
radius: 30
|
||||
}
|
||||
}
|
||||
|
||||
function acturalType() {
|
||||
return root1.objectName
|
||||
}
|
||||
function clearMask (){
|
||||
root1.destroy()
|
||||
}
|
||||
|
||||
function getRect() {
|
||||
blurRect.x = startX
|
||||
blurRect.y = startY
|
||||
blurRect.width = root.width
|
||||
blurRect.height = root.height
|
||||
return blurRect
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
if (variables.painterType != 7) {
|
||||
return
|
||||
}
|
||||
startX = mouseX
|
||||
startY = mouseY
|
||||
stopX = mouseX
|
||||
stopY = mouseY
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (variables.painterType != 7) {
|
||||
return
|
||||
}
|
||||
stopX = mouseX
|
||||
stopY = mouseY
|
||||
hasPaint = true
|
||||
}
|
||||
onReleased: {
|
||||
variables.painterBlurPaint(getRect())
|
||||
imageTarget.paintCanvas()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
objectName: "LineArrowPage"
|
||||
property var imageTarget
|
||||
anchors.fill: imageTarget
|
||||
scale: imageTarget.scale
|
||||
rotation: imageTarget.rotation
|
||||
property bool hasPaint: false
|
||||
|
||||
|
||||
//鼠标点击坐标位置---画矩形
|
||||
property real startX:0 //储存鼠标开始时的坐标
|
||||
property real startY:0
|
||||
property real stopX :0 //储存鼠标结束时的坐标
|
||||
property real stopY:0
|
||||
property bool isMouseMoveEnable: false //是否允许鼠标移动绘制事件
|
||||
property bool hasReleased: true
|
||||
|
||||
property var ctx
|
||||
property point arrowStart
|
||||
property point arrowEnd
|
||||
property point lineStop
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: parent
|
||||
onPaint: {
|
||||
//画矩形方框
|
||||
ctx = getContext("2d")
|
||||
ctx.lineWidth = variables.painterThickness
|
||||
//设置边框色
|
||||
ctx.strokeStyle = variables.painterColor;
|
||||
// 设置填充色
|
||||
ctx.fillStyle = variables.painterColor
|
||||
|
||||
if (!isMouseMoveEnable) {
|
||||
ctx.clearRect(0,0,width,height) //清空所画图形
|
||||
return
|
||||
}
|
||||
if (isMouseMoveEnable){
|
||||
ctx.clearRect(0,0,width,height)
|
||||
}
|
||||
//记录移动终点
|
||||
stopX = area.mouseX
|
||||
stopY = area.mouseY
|
||||
const dx = stopX - startX
|
||||
const dy = stopY - startY
|
||||
// const headlen = Math.sqrt(dx * dx + dy * dy) * 0.1
|
||||
const headlen = variables.painterThickness * 6
|
||||
const angle = Math.atan2(dy, dx);
|
||||
|
||||
ctx.lineWidth = 1
|
||||
//三角箭头
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(stopX - headlen * Math.cos(angle - Math.PI / 6), stopY - headlen * Math.sin(angle - Math.PI / 6))
|
||||
ctx.lineTo(stopX, stopY )
|
||||
ctx.lineTo(stopX - headlen * Math.cos(angle + Math.PI / 6), stopY - headlen * Math.sin(angle + Math.PI / 6))
|
||||
ctx.lineTo(stopX - headlen * Math.cos(angle - Math.PI / 6), stopY - headlen * Math.sin(angle - Math.PI / 6))
|
||||
ctx.closePath()
|
||||
//赋值
|
||||
arrowStart = Qt.point(stopX - headlen * Math.cos(angle - Math.PI / 6), stopY - headlen * Math.sin(angle - Math.PI / 6))
|
||||
arrowEnd = Qt.point(stopX - headlen * Math.cos(angle + Math.PI / 6), stopY - headlen * Math.sin(angle + Math.PI / 6))
|
||||
//使用之前设置好的填充色进行填充
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
//绘制线段
|
||||
var a1 = (arrowStart.y - arrowEnd.y) / (arrowStart.x - arrowEnd.x)
|
||||
var b1 = arrowStart.y - a1 * arrowStart.x
|
||||
var a2 =(startY - stopY) /(startX - stopX)
|
||||
var b2 = startY - a2 * startX
|
||||
lineStop = Qt.point((b2-b1) / (a1-a2),(b2-b1) / (a1-a2) * a1 + b1)
|
||||
ctx.lineWidth = variables.painterThickness
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(startX,startY)
|
||||
ctx.lineTo(lineStop.x,lineStop.y)
|
||||
ctx.stroke()
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
enabled: true
|
||||
onPressed: {
|
||||
if (variables.painterType != 3) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//起始点
|
||||
startX = mouse.x
|
||||
startY = mouse.y
|
||||
isMouseMoveEnable = true
|
||||
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (variables.painterType != 3) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画图
|
||||
if (isMouseMoveEnable){
|
||||
hasPaint = true
|
||||
canvas.requestPaint() //绘制函数
|
||||
}
|
||||
|
||||
}
|
||||
onReleased: {
|
||||
if (stopX != 0 || stopY != 0) {
|
||||
variables.painterArrowPaint(Qt.point(startX,startY),Qt.point(mouseX,mouseY),arrowStart,arrowEnd)
|
||||
}
|
||||
hasReleased = false
|
||||
area.enabled = false
|
||||
variables.painterRelease = !variables.painterRelease
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
function clearMask (){
|
||||
root.destroy()
|
||||
}
|
||||
function acturalType() {
|
||||
return root.objectName
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
//mark条
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
objectName: "linePage"
|
||||
property var imageTarget
|
||||
anchors.fill: imageTarget
|
||||
scale: imageTarget.scale
|
||||
rotation: imageTarget.rotation
|
||||
property bool hasPaint: false
|
||||
|
||||
|
||||
//鼠标点击坐标位置---画矩形
|
||||
property real startX: 0 //储存鼠标开始时的坐标
|
||||
property real startY: 0
|
||||
property real stopX: 0 //储存鼠标结束时的坐标
|
||||
property real stopY: 0
|
||||
property bool isMouseMoveEnable: false //是否允许鼠标移动绘制事件
|
||||
property var ctx
|
||||
property bool hasReleased: true
|
||||
property double globalAlpha: 0.3
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: parent
|
||||
onPaint: {
|
||||
//画矩形方框
|
||||
ctx = getContext("2d")
|
||||
ctx.lineWidth = variables.painterThickness
|
||||
ctx.strokeStyle = variables.painterColor
|
||||
//设置透明度
|
||||
ctx.globalAlpha = globalAlpha
|
||||
|
||||
if (!isMouseMoveEnable) {
|
||||
ctx.clearRect(0,0,width,height) //清空所画图形
|
||||
return;
|
||||
}
|
||||
if (isMouseMoveEnable){
|
||||
ctx.clearRect(0,0,width,height)
|
||||
}
|
||||
//开始绘制
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(startX,startY)
|
||||
|
||||
//记录移动终点
|
||||
stopX = area.mouseX
|
||||
stopY = area.mouseY
|
||||
|
||||
//绘制直线
|
||||
ctx.lineTo(stopX,stopY)
|
||||
ctx.stroke()
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
|
||||
if (variables.painterType != 5) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画矩形
|
||||
startX = mouse.x
|
||||
startY = mouse.y
|
||||
isMouseMoveEnable = true
|
||||
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (variables.painterType != 5) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画矩形
|
||||
if (isMouseMoveEnable){
|
||||
hasPaint = true
|
||||
canvas.requestPaint() //绘制函数
|
||||
}
|
||||
|
||||
}
|
||||
onReleased: {
|
||||
if (stopX != 0 || stopY != 0) {
|
||||
variables.painterMarkPaint(Qt.point(startX,startY),Qt.point(mouseX,mouseY),globalAlpha)
|
||||
}
|
||||
hasReleased = false
|
||||
area.enabled = false
|
||||
variables.painterRelease = !variables.painterRelease
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
function clearMask (){
|
||||
root.destroy()
|
||||
}
|
||||
function acturalType() {
|
||||
return root.objectName
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
objectName: "painterPenPage"
|
||||
property var imageTarget
|
||||
anchors.fill: imageTarget
|
||||
scale: imageTarget.scale
|
||||
rotation: imageTarget.rotation
|
||||
property int mouseqX: 0
|
||||
property int mouseqY: 0
|
||||
property var ctx
|
||||
property bool hasPaint: false
|
||||
property bool isMouseMoveEnable: false //是否允许鼠标移动绘制事件
|
||||
property bool hasReleased: true
|
||||
property var pointList: []
|
||||
property int changeNum: 0
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: parent
|
||||
|
||||
property real lastX
|
||||
property real lastY
|
||||
|
||||
onPaint: {
|
||||
//画曲线-自定义
|
||||
ctx = getContext('2d')
|
||||
if (!isMouseMoveEnable) {
|
||||
ctx.clearRect(0,0,width,height) //清空所画图形
|
||||
return
|
||||
}
|
||||
ctx.lineWidth = 1
|
||||
ctx.strokeStyle = variables.painterColor
|
||||
ctx.fillStyle = variables.painterColor
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(lastX, lastY)
|
||||
ctx.arc(lastX,lastY,variables.painterThickness / 2,0,Math.PI* 2)
|
||||
ctx.fill();
|
||||
ctx.stroke()
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(lastX, lastY)
|
||||
lastX = area.mouseX
|
||||
lastY = area.mouseY
|
||||
ctx.lineWidth = variables.painterThickness
|
||||
ctx.lineTo(lastX, lastY)
|
||||
ctx.stroke()
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
enabled: true
|
||||
onPressed: {
|
||||
if (variables.painterType != 4) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画笔画线
|
||||
canvas.lastX = mouseX
|
||||
canvas.lastY = mouseY
|
||||
isMouseMoveEnable = true
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (variables.painterType != 4) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
pointList[changeNum++] = Qt.point(mouseX,mouseY)
|
||||
//画笔画线
|
||||
hasPaint = true
|
||||
canvas.requestPaint()
|
||||
}
|
||||
onReleased: {
|
||||
variables.painterPencilPaint(pointList)
|
||||
hasReleased = false
|
||||
area.enabled = false
|
||||
variables.painterRelease = !variables.painterRelease
|
||||
|
||||
pointList = []
|
||||
changeNum = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
function clearMask (){
|
||||
root.destroy()
|
||||
}
|
||||
function acturalType() {
|
||||
return root.objectName
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
objectName: "rectanglePage"
|
||||
|
||||
property var imageTarget
|
||||
anchors.fill: imageTarget
|
||||
scale: imageTarget.scale
|
||||
rotation: imageTarget.rotation
|
||||
|
||||
//鼠标点击坐标位置---画矩形
|
||||
property real startX: 0 //储存鼠标开始时的坐标
|
||||
property real startY: 0
|
||||
property real stopX: 0 //储存鼠标结束时的坐标
|
||||
property real stopY: 0
|
||||
property bool isMouseMoveEnable: false //是否允许鼠标移动绘制事件
|
||||
property var ctx
|
||||
property bool hasReleased: true
|
||||
property bool hasPaint: false
|
||||
|
||||
property double rectWidth: 0
|
||||
property double rectHeight: 0
|
||||
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: parent
|
||||
onPaint: {
|
||||
//画矩形方框
|
||||
ctx = getContext("2d")
|
||||
ctx.lineWidth = variables.painterThickness
|
||||
ctx.strokeStyle = variables.painterColor
|
||||
|
||||
if (!isMouseMoveEnable) {
|
||||
ctx.clearRect(0,0,width,height) //清空所画图形
|
||||
return
|
||||
}
|
||||
if (isMouseMoveEnable){
|
||||
ctx.clearRect(0,0,width,height)
|
||||
}
|
||||
//开始绘制
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(startX,startY)
|
||||
|
||||
//记录移动终点
|
||||
stopX = area.mouseX
|
||||
stopY = area.mouseY
|
||||
|
||||
//绘制长方形
|
||||
ctx.strokeRect(startX,startY,stopX-startX,stopY-startY)
|
||||
ctx.stroke()
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
enabled: true
|
||||
|
||||
onPressed: {
|
||||
root.forceActiveFocus()
|
||||
if (variables.painterType != 0 ) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
|
||||
//画矩形
|
||||
startX = mouse.x
|
||||
startY = mouse.y
|
||||
isMouseMoveEnable = true
|
||||
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (variables.painterType != 0) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画矩形
|
||||
if (isMouseMoveEnable){
|
||||
hasPaint = true
|
||||
canvas.requestPaint() //绘制函数
|
||||
}
|
||||
|
||||
}
|
||||
onReleased: {
|
||||
if (stopX != 0 || stopY != 0) {
|
||||
variables.painterRectSignal(Qt.rect(startX,startY,stopX-startX,stopY-startY))
|
||||
}
|
||||
hasReleased = false
|
||||
area.enabled = false
|
||||
variables.painterRelease = !variables.painterRelease
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function clearMask (){
|
||||
root.destroy()
|
||||
}
|
||||
function acturalType() {
|
||||
return root.objectName
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import QtQuick 2.12
|
||||
|
||||
Item {
|
||||
function clearMask (obj){
|
||||
obj.destroy()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "transparent"
|
||||
objectName: "straightLinePage"
|
||||
property var imageTarget
|
||||
anchors.fill: imageTarget
|
||||
scale: imageTarget.scale
|
||||
rotation: imageTarget.rotation
|
||||
property bool hasPaint: false
|
||||
property var ctx
|
||||
|
||||
//鼠标点击坐标位置---画矩形
|
||||
property real startX //储存鼠标开始时的坐标
|
||||
property real startY
|
||||
property real stopX //储存鼠标结束时的坐标
|
||||
property real stopY
|
||||
property bool isMouseMoveEnable: false //是否允许鼠标移动绘制事件
|
||||
property bool hasReleased: true
|
||||
|
||||
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: parent
|
||||
onPaint: {
|
||||
//画矩形方框
|
||||
ctx = getContext("2d")
|
||||
ctx.lineWidth = variables.painterThickness
|
||||
ctx.strokeStyle = variables.painterColor
|
||||
|
||||
if (!isMouseMoveEnable) {
|
||||
ctx.clearRect(0,0,width,height) //清空所画图形
|
||||
return
|
||||
}
|
||||
if (isMouseMoveEnable){
|
||||
ctx.clearRect(0,0,width,height)
|
||||
}
|
||||
//开始绘制
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(startX,startY)
|
||||
|
||||
//记录移动终点
|
||||
stopX = area.mouseX
|
||||
stopY = area.mouseY
|
||||
|
||||
//绘制直线
|
||||
ctx.lineTo(stopX,stopY)
|
||||
ctx.stroke()
|
||||
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
enabled: true
|
||||
onPressed: {
|
||||
if (variables.painterType != 2) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画矩形
|
||||
startX = mouse.x
|
||||
startY = mouse.y
|
||||
isMouseMoveEnable = true
|
||||
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (variables.painterType != 2) {
|
||||
return
|
||||
}
|
||||
if (!hasReleased) {
|
||||
return
|
||||
}
|
||||
//画矩形
|
||||
if (isMouseMoveEnable){
|
||||
hasPaint = true
|
||||
canvas.requestPaint() //绘制函数
|
||||
}
|
||||
|
||||
}
|
||||
onReleased: {
|
||||
if (stopX != 0 || stopY != 0) {
|
||||
variables.painterLinePaint(Qt.point(startX,startY),Qt.point(mouseX,mouseY))
|
||||
}
|
||||
hasReleased = false
|
||||
area.enabled = false
|
||||
variables.painterRelease = !variables.painterRelease
|
||||
}
|
||||
}
|
||||
}
|
||||
function clearMask (){
|
||||
root.destroy()
|
||||
}
|
||||
function acturalType() {
|
||||
return root.objectName
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Rectangle {
|
||||
id: root
|
||||
objectName: "textEditPage"
|
||||
visible: true
|
||||
color: "transparent"
|
||||
property var imageText
|
||||
anchors.fill: imageText
|
||||
scale: imageText.scale
|
||||
rotation: imageText.rotation
|
||||
//鼠标点击坐标位置---画矩形
|
||||
property real startX:-1 //储存鼠标开始时的坐标
|
||||
property real startY:-1
|
||||
property real stopX //储存鼠标结束时的坐标
|
||||
property real stopY
|
||||
property bool isMouseMoveEnable: false //是否允许鼠标移动绘制事件
|
||||
property bool hasPaint: false
|
||||
|
||||
Rectangle{
|
||||
id:maskRect
|
||||
anchors.fill: parent
|
||||
color:"transparent"
|
||||
// visible: false
|
||||
|
||||
TextEdit {
|
||||
id: textInput
|
||||
wrapMode: TextEdit.Wrap
|
||||
font.bold: variables.isBold
|
||||
font.italic: variables.isItalics
|
||||
font.pointSize: variables.fontSize
|
||||
font.family: variables.fontType
|
||||
font.underline: variables.isUnderLine
|
||||
font.strikeout: variables.isDeleteLine
|
||||
selectByMouse:true
|
||||
focus: true
|
||||
clip: true
|
||||
color: variables.painterColor
|
||||
|
||||
onTextChanged: {
|
||||
if (textInput.text == "") {
|
||||
hasPaint = false
|
||||
} else {
|
||||
hasPaint = true
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: textRectArea
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
//每次按下时,需要重新创建一个text画布
|
||||
if (hasPaint) {
|
||||
sendTextOperate()
|
||||
variables.textMouseX = mouseX
|
||||
variables.textMouseY = mouseY
|
||||
textInput.focus = false
|
||||
textInput.cursorVisible = false
|
||||
variables.painterTextChanged(mouseX,mouseY)
|
||||
return;
|
||||
}
|
||||
setProptyReact(mouseX,mouseY)
|
||||
startX = mouseX
|
||||
startY = mouseY
|
||||
variables.textMouseX = mouseX
|
||||
variables.textMouseY = mouseY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearMask (){
|
||||
root.destroy()
|
||||
}
|
||||
function acturalType() {
|
||||
return root.objectName
|
||||
}
|
||||
function setProptyReact(actualMouseX,actualMouseY) {
|
||||
textInput.x = actualMouseX
|
||||
textInput.y = actualMouseY
|
||||
textInput.forceActiveFocus()
|
||||
textInput.cursorVisible = true
|
||||
}
|
||||
function sendTextOperate() {
|
||||
if (textInput.text == "" ) {
|
||||
return
|
||||
}
|
||||
|
||||
variables.painterTextPaint(textInput.text,Qt.point(variables.textMouseX,variables.textMouseY),6)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -17,6 +17,8 @@
|
|||
#include "model/processing/processing.h"
|
||||
#include "albumthumbnail.h"
|
||||
#include <buried_point.hpp>
|
||||
#include "global/interactiveqml.h"
|
||||
#include "model/marktool/marktool.h"
|
||||
class Enums
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -43,6 +43,8 @@ void Core::initCore()
|
|||
|
||||
m_fileWatcher = new QFileSystemWatcher();
|
||||
connect(m_fileWatcher, &QFileSystemWatcher::fileChanged, this, &Core::fileChangedNeedUpdated);
|
||||
|
||||
connect(&m_markTool, &Mark::MarkTool::saveFinish, this, &Core::openSaveImage);
|
||||
}
|
||||
|
||||
QString Core::initDbus(const QStringList &arguments)
|
||||
|
@ -233,6 +235,8 @@ void Core::openImage(QString fullPath)
|
|||
if (m_isclose == true) {
|
||||
return;
|
||||
}
|
||||
Variable::g_hasRotation = false;
|
||||
m_rotateRecord.clear();
|
||||
//判断图片状态
|
||||
QFlags<QFileDevice::Permission> power = QFile::permissions(fullPath);
|
||||
//判断文件所有者是否可写和是否可删除
|
||||
|
@ -247,7 +251,9 @@ void Core::openImage(QString fullPath)
|
|||
}
|
||||
|
||||
m_willProcess.clear();
|
||||
if (!Variable::g_needEnterSign) {
|
||||
needSave();
|
||||
}
|
||||
|
||||
MatAndFileinfo maf = File::loadImage(fullPath);
|
||||
m_openSuccess = maf.openSuccess; //判断是否打开失败-损坏
|
||||
|
@ -260,6 +266,8 @@ void Core::openImage(QString fullPath)
|
|||
}
|
||||
setHighLight(fullPath); //设置相册选中
|
||||
m_nowImage = Processing::converFormat(maf.mat);
|
||||
m_origPix = m_nowImage;
|
||||
|
||||
//记录状态
|
||||
changeMat(maf.mat);
|
||||
m_info = maf.info;
|
||||
|
@ -478,8 +486,10 @@ void Core::qmlCreatNavigation(QSizeF displaySize)
|
|||
{
|
||||
//导航栏背景
|
||||
QSize navigationSize = Variable::NAVIGATION_SIZE;
|
||||
if (m_naviBackPixPath != m_nowpath) {
|
||||
m_navigationImage = Processing::resizePix(m_nowImage, navigationSize).toImage();
|
||||
|
||||
m_naviBackPixPath = m_nowpath;
|
||||
}
|
||||
//记录空白区域
|
||||
m_spaceWidth = (navigationSize.width() - m_navigationImage.width()) / 2;
|
||||
m_spaceHeight = (navigationSize.height() - m_navigationImage.height()) / 2;
|
||||
|
@ -700,7 +710,7 @@ void Core::flipImage(const Processing::FlipWay &way)
|
|||
if (m_thisImageIsSaving) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_rotateRecord.append(way);
|
||||
m_processed = true;
|
||||
|
||||
processNewLoadImage();
|
||||
|
@ -897,13 +907,11 @@ QStandardItemModel *Core::getAlbumModel()
|
|||
|
||||
void Core::changeImage(const int &type)
|
||||
{
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
//如果错误不处理
|
||||
if (type == ERROR_IMAGE) {
|
||||
Q_EMIT updateSideNum(m_albumModel->rowCount());
|
||||
return;
|
||||
}
|
||||
|
||||
//如果图片队列小于1,不处理。小于2时,相册文件清空时,会一直显示当前图片
|
||||
if (m_albumModel->rowCount() < 2) {
|
||||
m_backpath = m_nowpath;
|
||||
|
@ -941,12 +949,12 @@ void Core::changeImageFromClick(QModelIndex modelIndex)
|
|||
MyStandardItem *item = dynamic_cast<MyStandardItem *>(m_albumModel->itemFromIndex(modelIndex));
|
||||
if (item == nullptr) {
|
||||
changeImage(modelIndex.row());
|
||||
//切换图片-埋点
|
||||
kdk::kabase::BuriedPoint buriedPointSwitchPicture;
|
||||
if (buriedPointSwitchPicture.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
|
||||
kdk::kabase::BuriedPoint::PT::KylinPhotoViewerSwitchPicture)) {
|
||||
qCritical() << "Error : buried point fail SwitchPicture!";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (item->getPath() == m_nowpath) {
|
||||
|
@ -963,6 +971,7 @@ void Core::changeImageFromClick(QModelIndex modelIndex)
|
|||
kdk::kabase::BuriedPoint::PT::KylinPhotoViewerSwitchPicture)) {
|
||||
qCritical() << "Error : buried point fail SwitchPicture!";
|
||||
}
|
||||
|
||||
changeImage(modelIndex.row());
|
||||
// openImage(item->getPath());
|
||||
}
|
||||
|
@ -1403,6 +1412,68 @@ void Core::cutFullViableImage()
|
|||
cutRegion(QPoint(m_origCutImage.width(), m_origCutImage.height()));
|
||||
realsePos(QPoint(0, 0));
|
||||
}
|
||||
|
||||
void Core::startMark()
|
||||
{
|
||||
m_markTool.setPixmap(m_origPix);
|
||||
}
|
||||
|
||||
void Core::markImage(QVariant var)
|
||||
{
|
||||
MarkPainterSet markImage = var.value<MarkPainterSet>();
|
||||
if (7 == markImage.type) {
|
||||
auto *mob = new Mark::MarkOperatioBlur(markImage.painterColor, markImage.rectInfo, 1, markImage.thickness);
|
||||
m_markTool.setMarkOperatio(mob);
|
||||
} else if (6 == markImage.type) {
|
||||
auto *mot = new Mark::MarkOperatioText(
|
||||
markImage.painterColor, markImage.m_textSet.textContent, markImage.recordStartPos,
|
||||
markImage.m_textSet.fontSize, 1, markImage.m_textSet.fontType, markImage.m_textSet.isBold,
|
||||
markImage.m_textSet.isItalics, markImage.m_textSet.isUnderLine, markImage.m_textSet.isDeleteLine);
|
||||
m_markTool.setMarkOperatio(mot);
|
||||
} else if (5 == markImage.type) {
|
||||
auto *mom = new Mark::MarkOperatioMarker(markImage.painterColor, markImage.recordStartPos,
|
||||
markImage.recordEndPos, 1, markImage.thickness, markImage.opactity);
|
||||
m_markTool.setMarkOperatio(mom);
|
||||
} else if (4 == markImage.type) {
|
||||
auto *mop = new Mark::MarkOperatioPencil(markImage.painterColor, markImage.vp, 1, markImage.thickness);
|
||||
m_markTool.setMarkOperatio(mop);
|
||||
} else if (3 == markImage.type) {
|
||||
auto *moa =
|
||||
new Mark::MarkOperatioArrow(markImage.painterColor, markImage.recordStartPos, markImage.recordEndPos, 1,
|
||||
markImage.thickness, markImage.arrowStartPos, markImage.arrowEndPos);
|
||||
m_markTool.setMarkOperatio(moa);
|
||||
} else if (2 == markImage.type) {
|
||||
auto *mol = new Mark::MarkOperatioLine(markImage.painterColor, markImage.recordStartPos, markImage.recordEndPos,
|
||||
1, markImage.thickness);
|
||||
m_markTool.setMarkOperatio(mol);
|
||||
} else if (1 == markImage.type) {
|
||||
auto *moc = new Mark::MarkOperatioCircle(markImage.painterColor, markImage.circleLeftX, markImage.circleLeftY,
|
||||
markImage.paintWidth, markImage.paintHeight, 1, markImage.thickness);
|
||||
m_markTool.setMarkOperatio(moc);
|
||||
} else if (0 == markImage.type) {
|
||||
auto *mor = new Mark::MarkOperatioRectangle(markImage.painterColor, markImage.rectInfo, 1, markImage.thickness);
|
||||
m_markTool.setMarkOperatio(mor);
|
||||
} else {
|
||||
qDebug() << "标注类型错误";
|
||||
}
|
||||
// m_markTool.undo();
|
||||
// m_markTool.save("/home/zou/桌面/test.png");
|
||||
}
|
||||
|
||||
void Core::markUndo()
|
||||
{
|
||||
m_markTool.undo();
|
||||
}
|
||||
|
||||
void Core::markSave(QString savePath)
|
||||
{
|
||||
m_markTool.save(savePath, m_rotateRecord, false);
|
||||
}
|
||||
|
||||
void Core::markClear()
|
||||
{
|
||||
m_markTool.clear();
|
||||
}
|
||||
//裁剪区域
|
||||
void Core::cutRegion(const QPoint &point)
|
||||
{
|
||||
|
|
|
@ -90,6 +90,13 @@ public:
|
|||
//裁剪-显示区域全图
|
||||
void cutFullViableImage();
|
||||
|
||||
//标注
|
||||
void startMark();
|
||||
void markImage(QVariant var); //按下后,图片标注
|
||||
void markUndo();
|
||||
void markSave(QString savePath);
|
||||
void markClear();
|
||||
|
||||
private:
|
||||
void initCore(); //初始化核心
|
||||
Dbus *m_dbus = nullptr; // DBus模块对象
|
||||
|
@ -188,6 +195,11 @@ private:
|
|||
double m_qmlProportion = 0;
|
||||
QPointF m_backHightLight = QPointF(-1, -1);
|
||||
QList<QImage> m_tiffImageList;
|
||||
Mark::MarkTool m_markTool;
|
||||
QPixmap m_origPix;
|
||||
QList<Processing::FlipWay> m_rotateRecord;
|
||||
QString m_naviBackPixPath = "";
|
||||
// QTimer *m_time = nullptr;
|
||||
};
|
||||
|
||||
#endif // CORE_H
|
||||
|
|
|
@ -96,6 +96,14 @@ void CoreInteraction::initConnect()
|
|||
connect(m_core, &Core::getLeftUpPosAccordingImage, this, &CoreInteraction::getLeftUpPosAccordingImage);
|
||||
//裁剪-显示区域全图
|
||||
connect(this, &CoreInteraction::coreCutFullViableImage, m_core, &Core::cutFullViableImage);
|
||||
//标注
|
||||
connect(this, &CoreInteraction::coreMarkImage, m_core, &Core::markImage); //按下标注
|
||||
connect(this, &CoreInteraction::coreStartMark, m_core, &Core::startMark); //进入标注
|
||||
connect(this, &CoreInteraction::coreMarkClear, m_core, &Core::markClear); //清除
|
||||
connect(this, &CoreInteraction::coreMarkSave, m_core, &Core::markSave); //保存
|
||||
connect(this, &CoreInteraction::coreMarkUndo, m_core, &Core::markUndo); //撤销
|
||||
|
||||
connect(m_canProcess, &QTimer::timeout, this, &CoreInteraction::dealEndPointNaviReact);
|
||||
}
|
||||
|
||||
bool CoreInteraction::coreOperateTooOften()
|
||||
|
@ -107,6 +115,16 @@ bool CoreInteraction::coreOperateTooOften()
|
|||
return false;
|
||||
}
|
||||
|
||||
void CoreInteraction::dealEndPointNaviReact()
|
||||
{
|
||||
if (m_isNaviFromQml) {
|
||||
m_isNaviFromQml = false;
|
||||
if (m_imageScale != 0) {
|
||||
Q_EMIT coreQmlStartNaviDisplay(m_naviPointFromQml, m_displaySize, m_imageScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CoreInteraction::initUiFinish()
|
||||
{
|
||||
Q_EMIT startWithOpenImage(m_needStartWithOpenImagePath);
|
||||
|
@ -128,6 +146,8 @@ void CoreInteraction::changeImage(const int &type)
|
|||
if (coreOperateTooOften()) {
|
||||
return;
|
||||
}
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Q_EMIT coreChangeImage(type);
|
||||
//切换图片-埋点
|
||||
kdk::kabase::BuriedPoint buriedPointSwitchPicture;
|
||||
|
@ -139,9 +159,14 @@ void CoreInteraction::changeImage(const int &type)
|
|||
|
||||
void CoreInteraction::nextImage()
|
||||
{
|
||||
if (!Variable::g_allowChangeImage) {
|
||||
return;
|
||||
}
|
||||
if (coreOperateTooOften()) {
|
||||
return;
|
||||
}
|
||||
// operayteMode = OperayteMode::NextImage;
|
||||
// InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Q_EMIT coreChangeImage(Enums::NEXT_IMAGE);
|
||||
//切换图片-埋点
|
||||
kdk::kabase::BuriedPoint buriedPointSwitchPicture;
|
||||
|
@ -153,9 +178,14 @@ void CoreInteraction::nextImage()
|
|||
|
||||
void CoreInteraction::backImage()
|
||||
{
|
||||
if (!Variable::g_allowChangeImage) {
|
||||
return;
|
||||
}
|
||||
if (coreOperateTooOften()) {
|
||||
return;
|
||||
}
|
||||
// operayteMode = OperayteMode::BackImage;
|
||||
// InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Q_EMIT coreChangeImage(Enums::BACK_IMAGE);
|
||||
//切换图片-埋点
|
||||
kdk::kabase::BuriedPoint buriedPointSwitchPicture;
|
||||
|
@ -449,7 +479,13 @@ void CoreInteraction::qmlStartCutDisplay(QPointF startPos, QSizeF displaySize, d
|
|||
|
||||
void CoreInteraction::qmlStartNaviDisplay(QPointF leftUpPosAccordingShowImage, QSizeF displaySize, double imageScale)
|
||||
{
|
||||
|
||||
m_isNaviFromQml = true;
|
||||
m_naviPointFromQml = leftUpPosAccordingShowImage;
|
||||
m_displaySize = displaySize;
|
||||
m_imageScale = imageScale;
|
||||
if (coreOperateTooOften()) {
|
||||
return;
|
||||
}
|
||||
Q_EMIT coreQmlStartNaviDisplay(leftUpPosAccordingShowImage, displaySize, imageScale);
|
||||
}
|
||||
|
||||
|
@ -463,3 +499,28 @@ void CoreInteraction::clickCutFullViableImage()
|
|||
{
|
||||
Q_EMIT coreCutFullViableImage();
|
||||
}
|
||||
|
||||
void CoreInteraction::startMark()
|
||||
{
|
||||
Q_EMIT coreStartMark();
|
||||
}
|
||||
|
||||
void CoreInteraction::toMarkImage(QVariant var)
|
||||
{
|
||||
Q_EMIT coreMarkImage(var);
|
||||
}
|
||||
|
||||
void CoreInteraction::markUndo()
|
||||
{
|
||||
Q_EMIT coreMarkUndo();
|
||||
}
|
||||
|
||||
void CoreInteraction::markSave(QString savePath)
|
||||
{
|
||||
Q_EMIT coreMarkSave(savePath);
|
||||
}
|
||||
|
||||
void CoreInteraction::markClear()
|
||||
{
|
||||
Q_EMIT coreMarkClear();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,13 @@ Q_SIGNALS:
|
|||
//裁剪-显示区域全图
|
||||
void coreCutFullViableImage();
|
||||
|
||||
//标注
|
||||
void coreMarkImage(QVariant var); //按下标注
|
||||
void coreStartMark();
|
||||
void coreMarkUndo();
|
||||
void coreMarkSave(QString savePath);
|
||||
void coreMarkClear();
|
||||
|
||||
|
||||
public:
|
||||
CoreInteraction();
|
||||
|
@ -94,6 +101,13 @@ protected:
|
|||
//裁剪-显示区域全图
|
||||
virtual void clickCutFullViableImage();
|
||||
|
||||
//标注
|
||||
virtual void startMark();
|
||||
virtual void toMarkImage(QVariant var);
|
||||
virtual void markUndo();
|
||||
virtual void markSave(QString savePath);
|
||||
virtual void markClear();
|
||||
|
||||
private:
|
||||
void initConnect(); //初始化绑定
|
||||
bool coreOperateTooOften(); //操作过于频繁
|
||||
|
@ -101,6 +115,11 @@ private:
|
|||
QString m_needStartWithOpenImagePath = ""; // UI未初始化时设置,使其初始化完成立即加载图片
|
||||
QTimer *m_canProcess = nullptr; //限制操作频率,降低cpu占用
|
||||
Core *m_core = nullptr; //核心对象
|
||||
bool m_isNaviFromQml = false;
|
||||
QPointF m_naviPointFromQml = QPointF(-1, -1);
|
||||
QSizeF m_displaySize = QSizeF(0, 0);
|
||||
double m_imageScale = 0;
|
||||
void dealEndPointNaviReact();
|
||||
};
|
||||
|
||||
#endif // CoreINTERACTIONCoreH
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <QVariant>
|
||||
#include <QFileInfo>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
class coreinteraction;
|
||||
|
||||
class Interaction : public QObject
|
||||
|
@ -395,6 +396,13 @@ public:
|
|||
*/
|
||||
virtual void clickCutFullViableImage() = 0;
|
||||
|
||||
//标注
|
||||
virtual void startMark() = 0;
|
||||
virtual void toMarkImage(QVariant var) = 0;
|
||||
virtual void markUndo() = 0;
|
||||
virtual void markSave(QString savePath) = 0;
|
||||
virtual void markClear() = 0;
|
||||
|
||||
private:
|
||||
static Interaction *m_interaction; //单例指针
|
||||
};
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#include "interactiveqml.h"
|
||||
InteractiveQml *InteractiveQml::m_interactionQml(nullptr);
|
||||
InteractiveQml::InteractiveQml(QObject *parent) : QObject(parent) {}
|
||||
InteractiveQml *InteractiveQml::getInstance()
|
||||
{
|
||||
if (m_interactionQml == nullptr) {
|
||||
m_interactionQml = new InteractiveQml;
|
||||
}
|
||||
return m_interactionQml;
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
#ifndef INTERACTIVEQML_H
|
||||
#define INTERACTIVEQML_H
|
||||
|
||||
#include <QObject>
|
||||
#include "global/variable.h"
|
||||
#include <QDebug>
|
||||
class InteractiveQml : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InteractiveQml(QObject *parent = nullptr);
|
||||
Q_PROPERTY(int operateWay READ getOperateWay WRITE setOperateWay NOTIFY operateWayChanged)
|
||||
int getOperateWay()
|
||||
{
|
||||
return m_operateWay;
|
||||
}
|
||||
void setOperateWay(int way)
|
||||
{
|
||||
m_operateWay = way;
|
||||
Q_EMIT operateWayChanged(m_operateWay);
|
||||
}
|
||||
static InteractiveQml *getInstance();
|
||||
|
||||
void setPainterType(int type)
|
||||
{
|
||||
m_painterType = type;
|
||||
Q_EMIT painterTypeChanged(m_painterType);
|
||||
}
|
||||
void setPainterColor(QColor color)
|
||||
{
|
||||
m_painterColor = color;
|
||||
Q_EMIT painterColorChanged(color);
|
||||
}
|
||||
void setPainterThickness(int thickness)
|
||||
{
|
||||
m_painterThickness = thickness;
|
||||
Q_EMIT painterThicknessChanged(m_painterThickness);
|
||||
}
|
||||
void setPainterTextBold(bool isBold)
|
||||
{
|
||||
m_isBold = isBold;
|
||||
Q_EMIT textBoldChanged(m_isBold);
|
||||
}
|
||||
void setPainterTextDeleteLine(bool isDeleteLine)
|
||||
{
|
||||
m_isDeleteLine = isDeleteLine;
|
||||
Q_EMIT textDeleteLineChanged(m_isDeleteLine);
|
||||
}
|
||||
void setPainterTextUnderLine(bool isUnderLine)
|
||||
{
|
||||
m_isUnderLine = isUnderLine;
|
||||
Q_EMIT textUnderLineChanged(m_isUnderLine);
|
||||
}
|
||||
void setPainterTextItalics(bool isItalics)
|
||||
{
|
||||
m_isItalics = isItalics;
|
||||
Q_EMIT textItalicsChanged(m_isItalics);
|
||||
}
|
||||
void setPainterTextFontType(QString isFontType)
|
||||
{
|
||||
m_fontType = isFontType;
|
||||
Q_EMIT textFontTypeChanged(m_fontType);
|
||||
}
|
||||
void setPainterTextFontSize(int isFontSize)
|
||||
{
|
||||
m_fontSize = isFontSize;
|
||||
Q_EMIT textFontSizeChanged(m_fontSize);
|
||||
}
|
||||
|
||||
|
||||
int getPainterType()
|
||||
{
|
||||
return m_painterType;
|
||||
}
|
||||
QColor getPainterColor()
|
||||
{
|
||||
return m_painterColor;
|
||||
}
|
||||
int getPainterThickness()
|
||||
{
|
||||
return m_painterThickness;
|
||||
}
|
||||
bool getPainterTextBold()
|
||||
{
|
||||
return m_isBold;
|
||||
}
|
||||
bool getPainterTextDeleteLine()
|
||||
{
|
||||
return m_isDeleteLine;
|
||||
}
|
||||
bool getPainterTextUnderLine()
|
||||
{
|
||||
return m_isUnderLine;
|
||||
}
|
||||
bool getPainterTextItalics()
|
||||
{
|
||||
return m_isItalics;
|
||||
}
|
||||
QString getPainterTextFontType()
|
||||
{
|
||||
return m_fontType;
|
||||
}
|
||||
int getPainterTextFontSize()
|
||||
{
|
||||
return m_fontSize;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
int m_operateWay = 0;
|
||||
int m_painterType = -1; //记录画笔类型
|
||||
int m_painterThickness = 12; //记录画笔粗细
|
||||
QColor m_painterColor = QColor(255, 0, 0); //记录画笔颜色
|
||||
bool m_isBold = false; //加粗
|
||||
bool m_isDeleteLine = false; //删除
|
||||
bool m_isUnderLine = false; //下划线
|
||||
bool m_isItalics = false; //斜体
|
||||
QString m_fontType = ""; //字体
|
||||
int m_fontSize = 12; //字号
|
||||
static InteractiveQml *m_interactionQml; //单例指针
|
||||
Q_SIGNALS:
|
||||
|
||||
void operateWayChanged(QVariant);
|
||||
// sign
|
||||
void painterTypeChanged(QVariant);
|
||||
void painterThicknessChanged(QVariant);
|
||||
void painterColorChanged(QVariant);
|
||||
void textBoldChanged(QVariant);
|
||||
void textDeleteLineChanged(QVariant);
|
||||
void textUnderLineChanged(QVariant);
|
||||
void textItalicsChanged(QVariant);
|
||||
void textFontTypeChanged(QVariant);
|
||||
void textFontSizeChanged(QVariant);
|
||||
};
|
||||
|
||||
#endif // INTERACTIVE_H
|
|
@ -107,8 +107,13 @@ OperayteMode operayteMode = OperayteMode::NoOperate;
|
|||
const double Variable::PERCENTAGE = 0.01; //百分比转换
|
||||
QString Variable::startAppName = "";
|
||||
QStringList Variable::startAppNameList = {"kylin-gallery"};
|
||||
QString Variable::platForm = Variable::platFormType();
|
||||
QString Variable::platForm = QString("normal");
|
||||
const QString Variable::SIGN_APP_NAME = "kolourpaint ";
|
||||
//标注
|
||||
bool Variable::g_allowChangeImage = true;
|
||||
bool Variable::g_needImageSaveTip = false;
|
||||
bool Variable::g_needEnterSign = false;
|
||||
bool Variable::g_hasRotation = false;
|
||||
QGSettings *Variable::getSettings()
|
||||
{
|
||||
QGSettings *mysetting = nullptr;
|
||||
|
|
|
@ -44,11 +44,43 @@ struct cutBoxColor
|
|||
int key = 50; //透明度
|
||||
};
|
||||
|
||||
|
||||
struct MarkPainterSet
|
||||
{
|
||||
QPoint recordStartPos = QPoint(-1, -1); //记录开始位置--标注
|
||||
QPoint recoedMovePos = QPoint(-1, -1); //记录移动位置--标注
|
||||
QPoint recordEndPos = QPoint(-1, -1); //记录结束位置
|
||||
int arrowWidth = 10; //记录箭头的宽度
|
||||
int arrowHeight = 18; //记录箭头的高度
|
||||
QPoint arrowStartPos = QPoint(-1, -1); //记录箭头的第一个点
|
||||
QPoint arrowEndPos = QPoint(-1, -1); //记录箭头的第三个点
|
||||
double opactity = 0.5; //记录透明度
|
||||
int type = -1; //记录画笔类型--标注:0,1,2,3,4,5,6,7
|
||||
int thickness = -1; //记录画笔粗细--标注:
|
||||
QColor painterColor = QColor(255, 0, 0); //记录画笔颜色--标注-默认红色
|
||||
QVector<QPoint> vp; //记录自由绘制的点的集合
|
||||
QRect rectInfo = QRect(0, 0, 100, 100); //记录矩形和马赛克的方块
|
||||
double circleLeftX = 0; //记录圆/椭圆的左上角的x
|
||||
double circleLeftY = 0; //记录圆/椭圆的左上角的y
|
||||
int paintWidth = 100; //记录绘图的宽度
|
||||
int paintHeight = 100; //记录绘图的高度
|
||||
//文字设置保存
|
||||
struct TextSet
|
||||
{
|
||||
bool isBold = false;
|
||||
bool isDeleteLine = false;
|
||||
bool isUnderLine = false;
|
||||
bool isItalics = false;
|
||||
QString fontType = "华文宋体";
|
||||
int fontSize = 6;
|
||||
QString textContent = QString("测试文字");
|
||||
} m_textSet;
|
||||
};
|
||||
Q_DECLARE_METATYPE(MarkPainterSet) // QVarant 注册自定义类型
|
||||
enum class DisplayMode : int {
|
||||
NormalMode = 0,
|
||||
CuttingMode, //剪裁模式
|
||||
OCRMode // OCR模式
|
||||
OCRMode, // OCR模式
|
||||
SignMode //标注模式
|
||||
};
|
||||
extern DisplayMode displayMode;
|
||||
|
||||
|
@ -68,6 +100,10 @@ enum class OperayteMode : int {
|
|||
ChangeImage = 12, //切图
|
||||
ExitCut = 13, //退出裁剪
|
||||
ExitOcr = 14, //退出裁剪
|
||||
Sign = 15, //进入标注
|
||||
ExitSign = 16, //退出标注
|
||||
NextImage = 17, //下一张
|
||||
BackImage = 18 //上一张
|
||||
};
|
||||
extern OperayteMode operayteMode;
|
||||
|
||||
|
@ -133,6 +169,12 @@ public:
|
|||
static QString startAppName; //启动看图的应用名称
|
||||
static QStringList startAppNameList; //启动看图的应用名称列表
|
||||
static const QString SIGN_APP_NAME; //
|
||||
//标注
|
||||
static bool g_allowChangeImage; //标注的时候是否允许切换图片
|
||||
static bool g_needImageSaveTip; //是否需要弹窗提示图片保存
|
||||
static bool g_needEnterSign;
|
||||
static bool g_hasRotation;
|
||||
|
||||
private:
|
||||
static const QStringList opencvCanSupportFormats; // opencv支持的格式列表
|
||||
static const QStringList opencvCannotSupportFormats; // opencv不支持的格式列表
|
||||
|
|
|
@ -0,0 +1,337 @@
|
|||
#include "marktool.h"
|
||||
#include <QPainter>
|
||||
#include <QLine>
|
||||
#include <QGraphicsBlurEffect>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsPixmapItem>
|
||||
Mark::MarkTool::MarkTool() {}
|
||||
|
||||
void Mark::MarkTool::setPixmap(const QPixmap &pix)
|
||||
{
|
||||
clear();
|
||||
m_pix = pix;
|
||||
}
|
||||
|
||||
void Mark::MarkTool::setMarkOperatio(Mark::MarkOperatio *mo)
|
||||
{
|
||||
m_operationList.append(mo);
|
||||
}
|
||||
|
||||
void Mark::MarkTool::undo()
|
||||
{
|
||||
if (m_operationList.length() == 0) {
|
||||
return;
|
||||
}
|
||||
MarkOperatio *mo = m_operationList.last();
|
||||
m_operationList.removeLast();
|
||||
if (mo) {
|
||||
delete mo;
|
||||
mo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Mark::MarkTool::clear()
|
||||
{
|
||||
for (MarkOperatio *mo : m_operationList) {
|
||||
if (mo) {
|
||||
delete mo;
|
||||
mo = nullptr;
|
||||
}
|
||||
}
|
||||
m_operationList.clear();
|
||||
}
|
||||
|
||||
bool Mark::MarkTool::save(const QString &path, QList<ProcessingBase::FlipWay> flipList, bool backup)
|
||||
{
|
||||
if (m_operationList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
QString filePath = path;
|
||||
|
||||
QPixmap pix = m_pix.copy();
|
||||
for (MarkOperatio *mo : m_operationList) {
|
||||
QPainter painter(&pix);
|
||||
double trueProportion = 1;
|
||||
if (!trueProportion) {
|
||||
continue;
|
||||
}
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
painter.setPen(QPen(mo->color, mo->thickness));
|
||||
switch (mo->markType) {
|
||||
case RECTANGLE: {
|
||||
MarkOperatioRectangle *mos = static_cast<MarkOperatioRectangle *>(mo);
|
||||
painter.drawRect(QRect(mos->rect.topLeft() / trueProportion, mos->rect.size() / trueProportion));
|
||||
break;
|
||||
}
|
||||
case CIRCLE: {
|
||||
MarkOperatioCircle *mos = static_cast<MarkOperatioCircle *>(mo);
|
||||
painter.drawEllipse(mos->rLeftX / trueProportion, mos->rLeftY / trueProportion, mos->rx / trueProportion,
|
||||
mos->ry / trueProportion);
|
||||
break;
|
||||
}
|
||||
case LINE: {
|
||||
MarkOperatioLine *mos = static_cast<MarkOperatioLine *>(mo);
|
||||
painter.drawLine(mos->startPoint / trueProportion, mos->endPoint / trueProportion);
|
||||
break;
|
||||
}
|
||||
case ARROW: {
|
||||
MarkOperatioArrow *mos = static_cast<MarkOperatioArrow *>(mo);
|
||||
QPoint startPoint = mos->startPoint / trueProportion;
|
||||
QPoint endPoint = mos->endPoint / trueProportion;
|
||||
int thickness = mos->thickness / trueProportion;
|
||||
QLineF line(startPoint, endPoint);
|
||||
double cSqrt =
|
||||
pow(mos->arrowStartPoint.x() - endPoint.x(), 2) + pow(mos->arrowStartPoint.y() - endPoint.y(), 2);
|
||||
double aSqrt = pow(mos->arrowStartPoint.x() - mos->arrowEndPoint.x(), 2)
|
||||
+ pow(mos->arrowStartPoint.y() - mos->arrowEndPoint.y(), 2);
|
||||
double b = sqrt(cSqrt - aSqrt / 2);
|
||||
line.setLength(line.length() - b);
|
||||
painter.drawLine(line);
|
||||
QPainterPath path;
|
||||
path.moveTo(mos->arrowStartPoint);
|
||||
path.lineTo(endPoint);
|
||||
path.lineTo(mos->arrowEndPoint);
|
||||
path.lineTo(mos->arrowStartPoint);
|
||||
painter.fillPath(path, QBrush(mos->color));
|
||||
break;
|
||||
}
|
||||
case PENCIL: {
|
||||
MarkOperatioPencil *mos = static_cast<MarkOperatioPencil *>(mo);
|
||||
QVector<QPoint> tmp;
|
||||
for (QPoint p : mos->pointList) {
|
||||
tmp.append(p / trueProportion);
|
||||
}
|
||||
painter.drawPolyline(tmp.data(), tmp.length());
|
||||
break;
|
||||
}
|
||||
case MARKER: {
|
||||
MarkOperatioMarker *mos = static_cast<MarkOperatioMarker *>(mo);
|
||||
painter.setCompositionMode(QPainter::CompositionMode_Multiply);
|
||||
painter.setOpacity(mos->alpha);
|
||||
painter.drawLine(mos->startPoint / trueProportion, mos->endPoint / trueProportion);
|
||||
break;
|
||||
}
|
||||
case TEXT: {
|
||||
MarkOperatioText *mos = static_cast<MarkOperatioText *>(mo);
|
||||
QFont ft;
|
||||
ft.setPointSize(mos->thickness / trueProportion);
|
||||
ft.setFamily(mos->family);
|
||||
ft.setBold(mos->blod);
|
||||
ft.setItalic(mos->italic);
|
||||
ft.setUnderline(mos->underline);
|
||||
ft.setStrikeOut(mos->strikeout);
|
||||
painter.setFont(ft);
|
||||
QPoint start = mos->startPoint / trueProportion;
|
||||
painter.drawText(QRect(start, QSize(pix.width() - start.x(), pix.height() - start.y())), mos->text);
|
||||
break;
|
||||
}
|
||||
case BLUR: {
|
||||
int radius = 8;
|
||||
int tmpRadius = radius * 2;
|
||||
MarkOperatioBlur *mos = static_cast<MarkOperatioBlur *>(mo);
|
||||
QRect selectionOrig(mos->rect.topLeft() / trueProportion, mos->rect.size() / trueProportion);
|
||||
QRect selection = orderRect(selectionOrig);
|
||||
QRect tmpSelection(selection.topLeft() - QPoint(tmpRadius, tmpRadius),
|
||||
selection.size() + QSize(tmpRadius * 2, tmpRadius * 2));
|
||||
QGraphicsBlurEffect *blur = new QGraphicsBlurEffect();
|
||||
blur->setBlurRadius(radius);
|
||||
QGraphicsPixmapItem *item = new QGraphicsPixmapItem();
|
||||
item->setPixmap(pix.copy(tmpSelection));
|
||||
item->setGraphicsEffect(blur);
|
||||
QGraphicsScene scene;
|
||||
scene.addItem(item);
|
||||
QPixmap p(tmpSelection.size());
|
||||
p.fill();
|
||||
QPainter pai(&p);
|
||||
scene.render(&pai);
|
||||
scene.clear();
|
||||
painter.drawPixmap(selection, p, QRect(QPoint(tmpRadius, tmpRadius), selection.size()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return saveMat(path, pix, flipList, backup);
|
||||
}
|
||||
|
||||
QRect Mark::MarkTool::orderRect(const QRect &orig)
|
||||
{
|
||||
QRect selection = orig;
|
||||
if (orig.width() < 0) {
|
||||
selection.setX(orig.x() + orig.width());
|
||||
selection.setWidth(orig.width() * -1);
|
||||
}
|
||||
if (orig.height() < 0) {
|
||||
selection.setY(orig.y() + orig.height());
|
||||
selection.setHeight(orig.height() * -1);
|
||||
}
|
||||
QRect tmp = selection;
|
||||
if (tmp.x() < 0) {
|
||||
selection.setX(0);
|
||||
selection.setWidth(tmp.x() + tmp.width());
|
||||
}
|
||||
if (tmp.y() < 0) {
|
||||
selection.setY(0);
|
||||
selection.setHeight(tmp.y() + tmp.height());
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
||||
bool Mark::MarkTool::saveMat(const QString &path, QPixmap pix, QList<ProcessingBase::FlipWay> flipList, bool backup)
|
||||
{
|
||||
QImage imageTemp = pix.toImage();
|
||||
Mat src;
|
||||
switch (imageTemp.format()) {
|
||||
case QImage::Format_ARGB32:
|
||||
case QImage::Format_RGB32:
|
||||
case QImage::Format_ARGB32_Premultiplied:
|
||||
src =
|
||||
cv::Mat(imageTemp.height(), imageTemp.width(), CV_8UC4, (void *)imageTemp.bits(), imageTemp.bytesPerLine());
|
||||
break;
|
||||
case QImage::Format_RGB888:
|
||||
src =
|
||||
cv::Mat(imageTemp.height(), imageTemp.width(), CV_8UC3, (void *)imageTemp.bits(), imageTemp.bytesPerLine());
|
||||
cv::cvtColor(src, src, cv::COLOR_BGR2RGB);
|
||||
break;
|
||||
case QImage::Format_Indexed8:
|
||||
src =
|
||||
cv::Mat(imageTemp.height(), imageTemp.width(), CV_8UC1, (void *)imageTemp.bits(), imageTemp.bytesPerLine());
|
||||
break;
|
||||
}
|
||||
|
||||
// if (flipList.length() > 0) {
|
||||
// for (int i = 0; i < flipList.length(); i++) {
|
||||
// src = Processing::processingImage(Processing::flip, src, QVariant(flipList.at(i)));
|
||||
// }
|
||||
// }
|
||||
QString realPath = path;
|
||||
realPath = realPath.mid(0, realPath.lastIndexOf(".")) + ".png";
|
||||
if (!File::saveImage(src, realPath, backup)) {
|
||||
qDebug() << "保存失败";
|
||||
Q_EMIT saveFinish();
|
||||
return false;
|
||||
}
|
||||
Q_EMIT saveFinish();
|
||||
return true;
|
||||
}
|
||||
|
||||
QPainterPath Mark::MarkOperatioArrow::getArrowHead(QPoint p1, QPoint p2, const int thickness)
|
||||
{
|
||||
// QLineF base(p1, p2);
|
||||
// // Create the vector for the position of the base of the arrowhead
|
||||
// QLineF temp(QPoint(0, 0), p2 - p1);
|
||||
// int val = arrowWidth + thickness * 4;
|
||||
// if (base.length() < val) {
|
||||
// val = (base.length() + thickness * 2);
|
||||
// }
|
||||
// temp.setLength(base.length() + thickness * 2 - val);
|
||||
// // Move across the line up to the head
|
||||
// QPointF bottonTranslation(temp.p2());
|
||||
|
||||
// // Rotate base of the arrowhead
|
||||
// base.setLength(arrowWidth + thickness * 2);
|
||||
// base.setAngle(base.angle() + 90);
|
||||
// // Move to the correct point
|
||||
// QPointF temp2 = p1 - base.p2();
|
||||
// // Center it
|
||||
// QPointF centerTranslation((temp2.x() / 2), (temp2.y() / 2));
|
||||
|
||||
// base.translate(bottonTranslation);
|
||||
// base.translate(centerTranslation);
|
||||
|
||||
// QPainterPath path;
|
||||
// path.moveTo(p2);
|
||||
// path.lineTo(base.p1());
|
||||
// path.lineTo(base.p2());
|
||||
// path.lineTo(p2);
|
||||
// return path;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioRectangle::MarkOperatioRectangle(QColor c, QRect rec, double p, int t)
|
||||
{
|
||||
markType = RECTANGLE;
|
||||
color = c;
|
||||
thickness = t;
|
||||
proportion = p;
|
||||
rect = rec;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioCircle::MarkOperatioCircle(QColor c, double leftX, double leftY, int x, int y, double p, int t)
|
||||
{
|
||||
markType = CIRCLE;
|
||||
color = c;
|
||||
thickness = t;
|
||||
proportion = p;
|
||||
rLeftX = leftX;
|
||||
rLeftY = leftY;
|
||||
rx = x;
|
||||
ry = y;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioLine::MarkOperatioLine(QColor c, QPoint start, QPoint end, double p, int t)
|
||||
{
|
||||
markType = LINE;
|
||||
color = c;
|
||||
thickness = t;
|
||||
proportion = p;
|
||||
startPoint = start;
|
||||
endPoint = end;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioArrow::MarkOperatioArrow(QColor c, QPoint start, QPoint end, double p, int t, QPoint arrowStart,
|
||||
QPoint arrowEnd)
|
||||
{
|
||||
markType = ARROW;
|
||||
color = c;
|
||||
thickness = t;
|
||||
proportion = p;
|
||||
startPoint = start;
|
||||
endPoint = end;
|
||||
arrowStartPoint = arrowStart;
|
||||
arrowEndPoint = arrowEnd;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioPencil::MarkOperatioPencil(QColor c, QVector<QPoint> pl, double p, int t)
|
||||
{
|
||||
markType = PENCIL;
|
||||
color = c;
|
||||
thickness = t;
|
||||
proportion = p;
|
||||
pointList = pl;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioMarker::MarkOperatioMarker(QColor c, QPoint start, QPoint end, double p, int t, double a)
|
||||
{
|
||||
markType = MARKER;
|
||||
color = c;
|
||||
thickness = t;
|
||||
proportion = p;
|
||||
startPoint = start;
|
||||
endPoint = end;
|
||||
alpha = a;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioText::MarkOperatioText(QColor c, QString t, QPoint start, int fs, double p, QString f, bool b, bool i,
|
||||
bool u, bool s)
|
||||
{
|
||||
markType = TEXT;
|
||||
color = c;
|
||||
thickness = fs;
|
||||
proportion = p;
|
||||
startPoint = start;
|
||||
text = t;
|
||||
family = f;
|
||||
blod = b;
|
||||
italic = i;
|
||||
underline = u;
|
||||
strikeout = s;
|
||||
}
|
||||
|
||||
Mark::MarkOperatioBlur::MarkOperatioBlur(QColor c, QRect rec, double p, int t)
|
||||
{
|
||||
markType = BLUR;
|
||||
color = c;
|
||||
thickness = t;
|
||||
proportion = p;
|
||||
rect = rec;
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
#ifndef MARKTOOL_H
|
||||
#define MARKTOOL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QList>
|
||||
#include <QPixmap>
|
||||
#include <QDebug>
|
||||
#include "global/variable.h"
|
||||
#include "model/processing/processing.h"
|
||||
#include "model/processing/flip.h"
|
||||
#include "model/file/file.h"
|
||||
using namespace cv;
|
||||
namespace Mark
|
||||
{
|
||||
|
||||
enum MarkType {
|
||||
RECTANGLE = 0, //矩形
|
||||
CIRCLE, //椭圆
|
||||
LINE, //直线
|
||||
ARROW, //箭头
|
||||
PENCIL, //画笔
|
||||
MARKER, //标注
|
||||
TEXT, //文字
|
||||
BLUR, //模糊
|
||||
};
|
||||
|
||||
class MarkOperatio
|
||||
{
|
||||
public:
|
||||
virtual ~MarkOperatio() {}
|
||||
MarkType markType; //类型
|
||||
double proportion; //缩放比
|
||||
QColor color; //颜色
|
||||
int thickness; //厚度,也用作字号大小
|
||||
};
|
||||
|
||||
class MarkOperatioRectangle : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioRectangle(QColor c, QRect rec, double p = 1, int t = 5);
|
||||
QRect rect;
|
||||
};
|
||||
|
||||
class MarkOperatioCircle : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioCircle(QColor c, double leftX, double leftY, int x, int y, double p = 1, int t = 5);
|
||||
double rLeftX;
|
||||
double rLeftY;
|
||||
double rx;
|
||||
double ry;
|
||||
};
|
||||
|
||||
class MarkOperatioLine : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioLine(QColor c, QPoint start, QPoint end, double p = 1, int t = 5);
|
||||
QPoint startPoint;
|
||||
QPoint endPoint;
|
||||
};
|
||||
|
||||
class MarkOperatioArrow : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioArrow(QColor c, QPoint start, QPoint end, double p = 1, int t = 5, QPoint arrowStart = QPoint(-1, -1),
|
||||
QPoint arrowEnd = QPoint(-1, -1));
|
||||
QPainterPath getArrowHead(QPoint p1, QPoint p2, const int thickness);
|
||||
QPoint startPoint;
|
||||
QPoint endPoint;
|
||||
QPoint arrowStartPoint;
|
||||
QPoint arrowEndPoint;
|
||||
};
|
||||
|
||||
class MarkOperatioPencil : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioPencil(QColor c, QVector<QPoint> pl, double p = 1, int t = 5);
|
||||
QVector<QPoint> pointList;
|
||||
};
|
||||
|
||||
class MarkOperatioMarker : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioMarker(QColor c, QPoint start, QPoint end, double p = 1, int t = 10, double a = 0.5);
|
||||
QPoint startPoint;
|
||||
QPoint endPoint;
|
||||
double alpha;
|
||||
};
|
||||
|
||||
class MarkOperatioText : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioText(QColor c, QString t, QPoint start, int fs = 12, double p = 1, QString f = "", bool b = false,
|
||||
bool i = false, bool u = false, bool s = false);
|
||||
QPoint startPoint;
|
||||
QString text;
|
||||
QString family;
|
||||
bool blod;
|
||||
bool italic;
|
||||
bool underline;
|
||||
bool strikeout;
|
||||
};
|
||||
|
||||
class MarkOperatioBlur : public MarkOperatio
|
||||
{
|
||||
public:
|
||||
MarkOperatioBlur(QColor c, QRect rec, double p = 1, int t = 5);
|
||||
QRect rect;
|
||||
};
|
||||
|
||||
class MarkTool : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MarkTool();
|
||||
void setPixmap(const QPixmap &pix);
|
||||
void setMarkOperatio(MarkOperatio *mo);
|
||||
void undo();
|
||||
void clear();
|
||||
bool save(const QString &path, QList<Processing::FlipWay> flipList, bool backup = true);
|
||||
|
||||
private:
|
||||
QList<MarkOperatio *> m_operationList;
|
||||
QPixmap m_pix;
|
||||
bool saveMat(const QString &path, QPixmap pix, QList<Processing::FlipWay> flipList, bool backup = true);
|
||||
QRect orderRect(const QRect &orig);
|
||||
Q_SIGNALS:
|
||||
void saveFinish();
|
||||
};
|
||||
|
||||
} // namespace Mark
|
||||
#endif // MARKTOOL_H
|
12
src/src.pro
|
@ -11,7 +11,7 @@ CONFIG += link_pkgconfig
|
|||
VERSION = 1.3.0.3
|
||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
||||
##定义一个字符串,可以将版本号数字之后的部分添加进去
|
||||
DEFINES += APP_VERSION_DETAIL=\\\"$$VERSION-ok5\\\"
|
||||
DEFINES += APP_VERSION_DETAIL=\\\"$$VERSION-ok6\\\"
|
||||
|
||||
QMAKE_CXXFLAGS += -g
|
||||
|
||||
|
@ -70,12 +70,16 @@ SOURCES += main.cpp \
|
|||
controller/core/albumthumbnail.cpp \
|
||||
global/computingtime.cpp \
|
||||
global/horizontalorverticalmode.cpp \
|
||||
global/interactiveqml.cpp \
|
||||
global/log.cpp \
|
||||
model/dbus.cpp \
|
||||
controller/core/core.cpp \
|
||||
model/file/file.cpp \
|
||||
model/marktool/marktool.cpp \
|
||||
model/processing/flip.cpp \
|
||||
model/processing/processing.cpp \
|
||||
view/brushsettings.cpp \
|
||||
view/marking.cpp \
|
||||
view/ocrresultwidget.cpp \
|
||||
view/cutwidget.cpp \
|
||||
view/edit.cpp \
|
||||
|
@ -85,6 +89,7 @@ SOURCES += main.cpp \
|
|||
view/menumodule.cpp \
|
||||
view/navigator.cpp \
|
||||
view/openimage.cpp \
|
||||
view/painterthick.cpp \
|
||||
view/showimagewidget.cpp \
|
||||
view/sidebar.cpp \
|
||||
view/sidebardelegate.cpp \
|
||||
|
@ -97,15 +102,19 @@ HEADERS += \
|
|||
controller/core/base.h \
|
||||
global/computingtime.h \
|
||||
global/horizontalorverticalmode.h \
|
||||
global/interactiveqml.h \
|
||||
global/log.h \
|
||||
imageproviderthumb.h \
|
||||
model/dbus.h \
|
||||
controller/interaction.h \
|
||||
controller/core/core.h \
|
||||
model/file/file.h \
|
||||
model/marktool/marktool.h \
|
||||
model/processing/processingbase.h \
|
||||
model/processing/flip.h \
|
||||
model/processing/processing.h \
|
||||
view/brushsettings.h \
|
||||
view/marking.h \
|
||||
view/ocrresultwidget.h \
|
||||
view/cutwidget.h \
|
||||
view/edit.h \
|
||||
|
@ -115,6 +124,7 @@ HEADERS += \
|
|||
view/menumodule.h \
|
||||
view/navigator.h \
|
||||
view/openimage.h \
|
||||
view/painterthick.h \
|
||||
view/showimagewidget.h \
|
||||
view/sidebar.h \
|
||||
view/sidebardelegate.h \
|
||||
|
|
|
@ -0,0 +1,415 @@
|
|||
#include "brushsettings.h"
|
||||
#include <QFontDatabase>
|
||||
#include "global/interactiveqml.h"
|
||||
BrushSettings::BrushSettings(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
|
||||
m_triangleWidth = TRIANGLE_WIDTH;
|
||||
m_triangleHeight = TRIANGLE_HEIGHT;
|
||||
|
||||
this->init();
|
||||
this->setButtonGroup();
|
||||
this->initConnect();
|
||||
this->setComboxSize();
|
||||
this->initGsetting();
|
||||
}
|
||||
//初始化控件
|
||||
void BrushSettings::init()
|
||||
{
|
||||
//按钮组
|
||||
m_buttonGroupLeft = new QButtonGroup(this);
|
||||
m_buttonGroupRight = new QButtonGroup(this);
|
||||
//画笔粗细
|
||||
m_smallest = new PainterThick(3, false, QColor(), this);
|
||||
m_thin = new PainterThick(5, false, QColor(), this);
|
||||
m_medium = new PainterThick(9, false, QColor(), this);
|
||||
m_medium->setChecked(true);
|
||||
m_thick = new PainterThick(13, false, QColor(), this);
|
||||
//左边文字控件
|
||||
m_fontComBox = new QComboBox(this);
|
||||
m_fontSizeComBox = new QSpinBox(this);
|
||||
m_deleteLine = new QCheckBox(this);
|
||||
m_deleteLine->setFixedSize(34, 18);
|
||||
m_underLine = new QCheckBox(this);
|
||||
m_underLine->setFixedSize(33, 18);
|
||||
m_bold = new QCheckBox(this);
|
||||
m_bold->setFixedSize(32, 18);
|
||||
m_italics = new QCheckBox(this);
|
||||
m_italics->setFixedSize(32, 18);
|
||||
//分割线
|
||||
m_line = new QLabel(this);
|
||||
m_line->setFixedSize(TOOL_LINE.width(), TOOL_LINE.height() - 4);
|
||||
//画笔颜色
|
||||
m_red = new PainterThick(14, true, QColor(219, 2, 15), this);
|
||||
m_red->setChecked(true);
|
||||
m_blue = new PainterThick(14, true, QColor(36, 87, 217), this);
|
||||
m_green = new PainterThick(14, true, QColor(85, 209, 57), this);
|
||||
m_yellow = new PainterThick(14, true, QColor(211, 154, 44), this);
|
||||
m_pink = new PainterThick(14, true, QColor(251, 66, 136), this);
|
||||
m_black = new PainterThick(14, true, QColor(25, 25, 25), this);
|
||||
m_grey = new PainterThick(14, true, QColor(98, 102, 113), this);
|
||||
m_white = new PainterThick(14, true, QColor(255, 255, 255), this);
|
||||
}
|
||||
//布局
|
||||
void BrushSettings::initLayout(bool isTextOrNot)
|
||||
{
|
||||
if (isTextOrNot) {
|
||||
m_fontComBox->move(10, 9);
|
||||
m_fontSizeComBox->move(m_fontComBox->width() + m_fontComBox->x() + 5, m_fontComBox->y());
|
||||
m_deleteLine->move(m_fontComBox->x(), m_fontComBox->y() + m_fontComBox->height() + 6);
|
||||
m_underLine->move(m_deleteLine->width() + m_deleteLine->x(), m_deleteLine->y());
|
||||
m_bold->move(m_underLine->width() + m_underLine->x(), m_underLine->y());
|
||||
m_italics->move(m_bold->width() + m_bold->x(), m_bold->y());
|
||||
|
||||
m_line->move(150, 20);
|
||||
m_red->move(m_line->width() + CONTROL_INTERVAL + 1 + m_line->x(), m_line->y() - 9);
|
||||
m_blue->move(m_red->width() + CONTROL_INTERVAL + m_red->x(), m_red->y());
|
||||
m_green->move(m_blue->width() + CONTROL_INTERVAL + m_blue->x(), m_blue->y());
|
||||
m_yellow->move(m_green->width() + CONTROL_INTERVAL + m_green->x(), m_green->y());
|
||||
m_pink->move(m_red->x(), m_red->height() + m_red->y() + 5);
|
||||
m_black->move(m_pink->width() + CONTROL_INTERVAL + m_pink->x(), m_pink->y());
|
||||
m_grey->move(m_black->width() + CONTROL_INTERVAL + m_black->x(), m_black->y());
|
||||
m_white->move(m_grey->width() + CONTROL_INTERVAL + m_grey->x(), m_grey->y());
|
||||
} else {
|
||||
m_smallest->move(CONTROL_INTERVAL, 24);
|
||||
m_thin->move(m_smallest->width() + m_smallest->x() + CONTROL_INTERVAL - 2, m_smallest->y() - 1);
|
||||
m_medium->move(m_thin->width() + m_thin->x() + CONTROL_INTERVAL - 2, m_thin->y() - 2);
|
||||
m_thick->move(m_medium->width() + m_medium->x() + CONTROL_INTERVAL - 2, m_medium->y() - 2);
|
||||
|
||||
m_line->move(m_thick->width() + CONTROL_INTERVAL + 1 + m_thick->x(), m_thick->y() - 1);
|
||||
m_red->move(m_line->width() + CONTROL_INTERVAL + 1 + m_line->x(), m_line->y() - 9);
|
||||
m_blue->move(m_red->width() + CONTROL_INTERVAL + m_red->x(), m_red->y());
|
||||
m_green->move(m_blue->width() + CONTROL_INTERVAL + m_blue->x(), m_blue->y());
|
||||
m_yellow->move(m_green->width() + CONTROL_INTERVAL + m_green->x(), m_green->y());
|
||||
m_pink->move(m_red->x(), m_red->height() + m_red->y() + 5);
|
||||
m_black->move(m_pink->width() + CONTROL_INTERVAL + m_pink->x(), m_pink->y());
|
||||
m_grey->move(m_black->width() + CONTROL_INTERVAL + m_black->x(), m_black->y());
|
||||
m_white->move(m_grey->width() + CONTROL_INTERVAL + m_grey->x(), m_grey->y());
|
||||
}
|
||||
}
|
||||
//左边的布局
|
||||
void BrushSettings::leftWidChange(bool isTextOrNot)
|
||||
{
|
||||
//判断是画笔粗细还是字体字号
|
||||
if (isTextOrNot) {
|
||||
m_smallest->hide();
|
||||
m_thin->hide();
|
||||
m_medium->hide();
|
||||
m_thick->hide();
|
||||
m_fontComBox->show();
|
||||
m_fontSizeComBox->show();
|
||||
m_deleteLine->show();
|
||||
m_underLine->show();
|
||||
m_bold->show();
|
||||
m_italics->show();
|
||||
} else {
|
||||
m_smallest->show();
|
||||
m_thin->show();
|
||||
m_medium->show();
|
||||
m_thick->show();
|
||||
m_fontComBox->hide();
|
||||
m_fontSizeComBox->hide();
|
||||
m_deleteLine->hide();
|
||||
m_underLine->hide();
|
||||
m_bold->hide();
|
||||
m_italics->hide();
|
||||
}
|
||||
}
|
||||
//设置互斥按钮组
|
||||
void BrushSettings::setButtonGroup()
|
||||
{
|
||||
//左边按钮组
|
||||
m_buttonGroupLeft->addButton(m_smallest);
|
||||
m_buttonGroupLeft->addButton(m_thin);
|
||||
m_buttonGroupLeft->addButton(m_medium);
|
||||
m_buttonGroupLeft->addButton(m_thick);
|
||||
//右边按钮组
|
||||
m_buttonGroupRight->addButton(m_red);
|
||||
m_buttonGroupRight->addButton(m_blue);
|
||||
m_buttonGroupRight->addButton(m_green);
|
||||
m_buttonGroupRight->addButton(m_yellow);
|
||||
m_buttonGroupRight->addButton(m_pink);
|
||||
m_buttonGroupRight->addButton(m_black);
|
||||
m_buttonGroupRight->addButton(m_grey);
|
||||
m_buttonGroupRight->addButton(m_white);
|
||||
}
|
||||
//初始化信号槽
|
||||
void BrushSettings::initConnect()
|
||||
{
|
||||
connect(m_smallest, &PainterThick::clicked, this, &BrushSettings::smallestClicked);
|
||||
connect(m_thin, &PainterThick::clicked, this, &BrushSettings::thinClicked);
|
||||
connect(m_medium, &PainterThick::clicked, this, &BrushSettings::mediumClicked);
|
||||
connect(m_thick, &PainterThick::clicked, this, &BrushSettings::thickClicked);
|
||||
connect(m_deleteLine, &PainterThick::clicked, this, &BrushSettings::deleteLineClicked);
|
||||
connect(m_underLine, &PainterThick::clicked, this, &BrushSettings::underLineClicked);
|
||||
connect(m_bold, &PainterThick::clicked, this, &BrushSettings::boldClicked);
|
||||
connect(m_italics, &PainterThick::clicked, this, &BrushSettings::italicsClicked);
|
||||
connect(m_red, &PainterThick::clicked, this, &BrushSettings::redClicked);
|
||||
connect(m_blue, &PainterThick::clicked, this, &BrushSettings::blueClicked);
|
||||
connect(m_green, &PainterThick::clicked, this, &BrushSettings::greenClicked);
|
||||
connect(m_yellow, &PainterThick::clicked, this, &BrushSettings::yellowClicked);
|
||||
connect(m_pink, &PainterThick::clicked, this, &BrushSettings::pinkClicked);
|
||||
connect(m_black, &PainterThick::clicked, this, &BrushSettings::blackClicked);
|
||||
connect(m_grey, &PainterThick::clicked, this, &BrushSettings::greyClicked);
|
||||
connect(m_white, &PainterThick::clicked, this, &BrushSettings::whiteClicked);
|
||||
connect(m_fontComBox, &QComboBox::currentTextChanged, this, &BrushSettings::currFontCombox);
|
||||
|
||||
// connect(m_fontSizeComBox,&QSpinBox::valueChanged,this,&BrushSettings::currFontSizeCombox);
|
||||
// connect(m_fontSizeComBox, SIGNAL(valueChanged(int)), this, SLOT(currFontSizeCombox(int)));
|
||||
// connect(m_fontSizeComBox, &QSpinBox::valueChanged, this, &BrushSettings::currFontSizeCombox);
|
||||
connect(m_fontSizeComBox, SIGNAL(valueChanged(int)), this, SLOT(currFontSizeCombox(int)));
|
||||
}
|
||||
//极细--4px
|
||||
void BrushSettings::smallestClicked()
|
||||
{
|
||||
recordPaintThick(4, m_smallest->isChecked());
|
||||
}
|
||||
//细--8px
|
||||
void BrushSettings::thinClicked()
|
||||
{
|
||||
recordPaintThick(8, m_thin->isChecked());
|
||||
}
|
||||
//粗--12px
|
||||
void BrushSettings::mediumClicked()
|
||||
{
|
||||
recordPaintThick(12, m_medium->isChecked());
|
||||
}
|
||||
//最粗--16px
|
||||
void BrushSettings::thickClicked()
|
||||
{
|
||||
recordPaintThick(16, m_thick->isChecked());
|
||||
}
|
||||
//红色
|
||||
void BrushSettings::redClicked()
|
||||
{
|
||||
recordPaintColor(0, m_red->isChecked(), QColor(219, 2, 15));
|
||||
}
|
||||
//蓝色
|
||||
void BrushSettings::blueClicked()
|
||||
{
|
||||
recordPaintColor(1, m_blue->isChecked(), QColor(36, 87, 217));
|
||||
}
|
||||
//绿色
|
||||
void BrushSettings::greenClicked()
|
||||
{
|
||||
recordPaintColor(2, m_green->isChecked(), QColor(85, 209, 57));
|
||||
}
|
||||
//黄色
|
||||
void BrushSettings::yellowClicked()
|
||||
{
|
||||
recordPaintColor(3, m_yellow->isChecked(), QColor(211, 154, 44));
|
||||
}
|
||||
//粉色
|
||||
void BrushSettings::pinkClicked()
|
||||
{
|
||||
recordPaintColor(4, m_pink->isChecked(), QColor(251, 66, 136));
|
||||
}
|
||||
//黑色
|
||||
void BrushSettings::blackClicked()
|
||||
{
|
||||
recordPaintColor(5, m_black->isChecked(), QColor(25, 25, 25));
|
||||
}
|
||||
//灰色
|
||||
void BrushSettings::greyClicked()
|
||||
{
|
||||
recordPaintColor(6, m_grey->isChecked(), QColor(98, 102, 113));
|
||||
}
|
||||
//白色
|
||||
void BrushSettings::whiteClicked()
|
||||
{
|
||||
recordPaintColor(7, m_white->isChecked(), QColor(255, 255, 255));
|
||||
}
|
||||
//删除线
|
||||
void BrushSettings::deleteLineClicked()
|
||||
{
|
||||
|
||||
recordDate.m_textSet.isDeleteLine = m_deleteLine->isChecked();
|
||||
InteractiveQml::getInstance()->setPainterTextDeleteLine(recordDate.m_textSet.isDeleteLine);
|
||||
}
|
||||
//下划线
|
||||
void BrushSettings::underLineClicked()
|
||||
{
|
||||
recordDate.m_textSet.isUnderLine = m_underLine->isChecked();
|
||||
InteractiveQml::getInstance()->setPainterTextUnderLine(recordDate.m_textSet.isUnderLine);
|
||||
}
|
||||
//加粗
|
||||
void BrushSettings::boldClicked()
|
||||
{
|
||||
recordDate.m_textSet.isBold = m_bold->isChecked();
|
||||
InteractiveQml::getInstance()->setPainterTextBold(recordDate.m_textSet.isBold);
|
||||
}
|
||||
//斜体
|
||||
void BrushSettings::italicsClicked()
|
||||
{
|
||||
recordDate.m_textSet.isItalics = m_italics->isChecked();
|
||||
InteractiveQml::getInstance()->setPainterTextItalics(recordDate.m_textSet.isItalics);
|
||||
}
|
||||
//当前字体
|
||||
void BrushSettings::currFontCombox(QString currentFont)
|
||||
{
|
||||
recordDate.m_textSet.fontType = currentFont;
|
||||
InteractiveQml::getInstance()->setPainterTextFontType(recordDate.m_textSet.fontType);
|
||||
}
|
||||
//当前字号
|
||||
void BrushSettings::currFontSizeCombox(int currentFontSize)
|
||||
{
|
||||
// recordDate.m_textSet.fontSize = currentFontSize;
|
||||
recordDate.m_textSet.fontSize = m_fontSizeComBox->value();
|
||||
InteractiveQml::getInstance()->setPainterTextFontSize(recordDate.m_textSet.fontSize);
|
||||
}
|
||||
//小三角位置
|
||||
void BrushSettings::setStartPos(int startX)
|
||||
{
|
||||
m_startX = startX;
|
||||
}
|
||||
//气泡弹窗位置
|
||||
void BrushSettings::setShowPos(int showPosX, int showPosY)
|
||||
{
|
||||
this->move(showPosX, showPosY);
|
||||
}
|
||||
//设置弹窗尺寸
|
||||
void BrushSettings::setSize(bool isTextOrNot)
|
||||
{
|
||||
m_showType = isTextOrNot;
|
||||
if (isTextOrNot) {
|
||||
this->setFixedSize(BRUSHSETTINGTEXT_SIZE);
|
||||
} else {
|
||||
this->setFixedSize(BRUSHSETTING_SIZE);
|
||||
}
|
||||
this->initLayout(isTextOrNot);
|
||||
this->leftWidChange(isTextOrNot);
|
||||
}
|
||||
//字号字体设置
|
||||
void BrushSettings::setComboxSize()
|
||||
{
|
||||
m_font.setPixelSize(10);
|
||||
//添加字体
|
||||
QFontDatabase database;
|
||||
QStringList fontFamilies;
|
||||
fontFamilies = database.families();
|
||||
if (fontFamilies.length() > 0) {
|
||||
for (int i = 0; i < fontFamilies.length(); i++) {
|
||||
m_fontComBox->addItem(fontFamilies.at(i));
|
||||
}
|
||||
}
|
||||
m_fontComBox->setFont(m_font);
|
||||
m_fontComBox->setFixedSize(65, 18);
|
||||
m_fontComBox->view()->setFixedWidth(240);
|
||||
//设置字号
|
||||
m_fontSizeComBox->setFixedSize(60, 18);
|
||||
m_fontSizeComBox->setValue(12);
|
||||
m_fontSizeComBox->setMinimum(6);
|
||||
m_fontSizeComBox->setMaximum(99);
|
||||
m_fontSizeComBox->setSingleStep(1);
|
||||
m_fontSizeComBox->setFont(m_font);
|
||||
}
|
||||
//画气泡型弹窗
|
||||
void BrushSettings::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(Qt::NoPen);
|
||||
if ("ukui-dark" == m_themeChange || "ukui-black" == m_themeChange) {
|
||||
painter.setBrush(QColor(0, 0, 0, 0.68 * 255));
|
||||
} else {
|
||||
painter.setBrush(QColor(255, 255, 255, 0.62 * 255));
|
||||
}
|
||||
// 小三角区域;
|
||||
QPainterPath drawPath;
|
||||
QPolygon trianglePolygon;
|
||||
trianglePolygon << QPoint(m_startX, TRIANGLE_POINTY);
|
||||
trianglePolygon << QPoint(m_startX + m_triangleWidth / 2, TRIANGLE_POINTY + m_triangleHeight);
|
||||
trianglePolygon << QPoint(m_startX + m_triangleWidth, TRIANGLE_POINTY);
|
||||
//判断尺寸
|
||||
if (m_showType) {
|
||||
drawPath.addRoundedRect(BRUSHSETTINGTEXT_PAINT, BORDER_RADIUS, BORDER_RADIUS);
|
||||
} else {
|
||||
drawPath.addRoundedRect(BRUSHSETTING_PAINT, BORDER_RADIUS, BORDER_RADIUS);
|
||||
}
|
||||
drawPath.addPolygon(trianglePolygon);
|
||||
painter.drawPath(drawPath);
|
||||
}
|
||||
//监听主题
|
||||
void BrushSettings::initGsetting()
|
||||
{
|
||||
if (QGSettings::isSchemaInstalled(FITTHEMEWINDOWA)) {
|
||||
m_pGsettingThemeData = new QGSettings(FITTHEMEWINDOWA);
|
||||
connect(m_pGsettingThemeData, &QGSettings::changed, this, &BrushSettings::dealSystemGsettingChange);
|
||||
}
|
||||
}
|
||||
//记录画笔粗细
|
||||
void BrushSettings::recordPaintThick(int type, bool isChecked)
|
||||
{
|
||||
if (isChecked) {
|
||||
recordDate.thickness = type;
|
||||
InteractiveQml::getInstance()->setPainterThickness(type);
|
||||
}
|
||||
}
|
||||
//记录画笔颜色
|
||||
void BrushSettings::recordPaintColor(int type, bool isChecked, QColor painterColor)
|
||||
{
|
||||
if (isChecked) {
|
||||
recordDate.painterColor = type;
|
||||
InteractiveQml::getInstance()->setPainterColor(painterColor);
|
||||
}
|
||||
}
|
||||
|
||||
void BrushSettings::dealSystemGsettingChange(const QString key)
|
||||
{
|
||||
if (key == "styleName") {
|
||||
setTextSettings();
|
||||
}
|
||||
}
|
||||
//主题变化
|
||||
void BrushSettings::setTextSettings()
|
||||
{
|
||||
QString nowThemeStyle = m_pGsettingThemeData->get("styleName").toString();
|
||||
m_themeChange = nowThemeStyle;
|
||||
m_smallest->m_themeChange = nowThemeStyle;
|
||||
m_thin->m_themeChange = nowThemeStyle;
|
||||
m_medium->m_themeChange = nowThemeStyle;
|
||||
m_thick->m_themeChange = nowThemeStyle;
|
||||
if ("ukui-dark" == nowThemeStyle || "ukui-black" == nowThemeStyle) {
|
||||
m_line->setStyleSheet("QLabel{border: 1px solid rgba(255, 255, 255, 0.36);background-color: #393939;}");
|
||||
m_deleteLine->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/mark/1deleteLine.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/deleteLine_selected.png);}");
|
||||
m_underLine->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1underLine.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/underLine_selected.png);}");
|
||||
m_bold->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1bold.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/bold_selected.png);}");
|
||||
m_italics->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1italics.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/italics_selected.png);}");
|
||||
} else {
|
||||
|
||||
m_line->setStyleSheet("QLabel{border: 1px solid rgba(0, 0, 0, 1);background-color: #393939;}");
|
||||
m_deleteLine->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/mark/deleteLine.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/deleteLine_selected.png);}");
|
||||
m_underLine->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/underLine.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/underLine_selected.png);}");
|
||||
m_bold->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/bold.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/bold_selected.png);}");
|
||||
m_italics->setStyleSheet("QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/italics.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/italics_selected.png);}");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
#ifndef BRUSHSETTINGS_H
|
||||
#define BRUSHSETTINGS_H
|
||||
#define FITTHEMEWINDOWA "org.ukui.style"
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QButtonGroup>
|
||||
#include <QDebug>
|
||||
#include <QPoint>
|
||||
#include <QComboBox>
|
||||
#include <QGSettings>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <QFontDatabase>
|
||||
#include <QListView>
|
||||
#include <QSpinBox>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QVector4D>
|
||||
#include <QVariant>
|
||||
#include "sizedate.h"
|
||||
#include "painterthick.h"
|
||||
#include "global/variable.h"
|
||||
class BrushSettings : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BrushSettings(QWidget *parent = nullptr);
|
||||
void setStartPos(int startX); // 设置小三角起始位置;
|
||||
void setShowPos(int showPosX, int showPosY); //设置弹出位置
|
||||
void setSize(bool isTextOrNot); //设置窗口尺寸--text窗口
|
||||
void setTextSettings(); //设置text设置栏的qss
|
||||
MarkPainterSet recordDate;
|
||||
|
||||
private:
|
||||
QGSettings *m_pGsettingThemeData = nullptr;
|
||||
//左边按钮组
|
||||
QButtonGroup *m_buttonGroupLeft;
|
||||
//右边按钮组
|
||||
QButtonGroup *m_buttonGroupRight;
|
||||
//画笔粗细
|
||||
PainterThick *m_smallest; //最细
|
||||
PainterThick *m_thin; //细
|
||||
PainterThick *m_medium; //中等
|
||||
PainterThick *m_thick; //粗
|
||||
//画笔颜色
|
||||
PainterThick *m_red;
|
||||
PainterThick *m_blue;
|
||||
PainterThick *m_green;
|
||||
PainterThick *m_yellow;
|
||||
PainterThick *m_pink;
|
||||
PainterThick *m_black;
|
||||
PainterThick *m_grey;
|
||||
PainterThick *m_white;
|
||||
QLabel *m_line; //分割线
|
||||
QGraphicsDropShadowEffect *shadowEffect; //阴影
|
||||
QComboBox *m_fontComBox; //字体下拉框
|
||||
QSpinBox *m_fontSizeComBox; //字号下拉框
|
||||
QCheckBox *m_deleteLine; //删除线
|
||||
QCheckBox *m_underLine; //下划线
|
||||
QCheckBox *m_bold; //加粗
|
||||
QCheckBox *m_italics; //斜体
|
||||
QFont m_font; //设置字号
|
||||
QString m_themeChange;
|
||||
int m_startX; // 小三角起始位置;
|
||||
int m_triangleWidth; // 小三角的宽度;
|
||||
int m_triangleHeight; // 小三角高度;
|
||||
bool m_showType = false; //显示类型--区分text和其他按钮弹窗
|
||||
|
||||
void setComboxSize(); //设置字号字体
|
||||
void init(); //初始化控件
|
||||
void initLayout(bool isTextOrNot); //布局
|
||||
void leftWidChange(bool isTextOrNot); //改变左边布局
|
||||
void setButtonGroup(); //设置互斥组
|
||||
void initConnect(); //初始化信号槽
|
||||
//主题
|
||||
void dealSystemGsettingChange(const QString);
|
||||
void initGsetting();
|
||||
void recordPaintThick(int type, bool isChecked); //记录画笔粗细
|
||||
void recordPaintColor(int type, bool isChecked, QColor painterColor); //记录画笔颜色
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
void smallestClicked(); //极细-3px
|
||||
void thinClicked(); //细-5px
|
||||
void mediumClicked(); //粗-9px
|
||||
void thickClicked(); //最粗-13px
|
||||
void redClicked(); //红色
|
||||
void blueClicked(); //蓝色
|
||||
void greenClicked(); //绿色
|
||||
void yellowClicked(); //黄色
|
||||
void pinkClicked(); //粉色
|
||||
void blackClicked(); //黑色
|
||||
void greyClicked(); //灰色
|
||||
void whiteClicked(); //白色
|
||||
void deleteLineClicked(); //删除线
|
||||
void underLineClicked(); //下划线
|
||||
void boldClicked(); //加粗
|
||||
void italicsClicked(); //斜体
|
||||
void currFontCombox(QString currentFont); //当前字体
|
||||
void currFontSizeCombox(int currentFontSize); //当前字号
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
Q_SIGNALS:
|
||||
};
|
||||
|
||||
#endif // BRUSHSETTINGS_H
|
|
@ -3,20 +3,12 @@
|
|||
#include "X11/Xlib.h"
|
||||
#include <QX11Info>
|
||||
#include "windowmanage.hpp"
|
||||
#include "global/interactiveqml.h"
|
||||
KyView *KyView::mutual = nullptr;
|
||||
KyView::KyView(const QStringList &args)
|
||||
{
|
||||
Interaction::getInstance()->creatCore(args);
|
||||
//检查系统平台
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
toolbarHeightValue = TOOLBAR_HEIGHT_INTEL;
|
||||
titlebarHeightValue = BAR_HEIGHT_INTEL;
|
||||
m_miniSize = MINI_SIZE_INTEL;
|
||||
} else {
|
||||
toolbarHeightValue = BAR_HEIGHT;
|
||||
titlebarHeightValue = BAR_HEIGHT;
|
||||
m_miniSize = MINI_SIZE;
|
||||
}
|
||||
|
||||
mutual = this;
|
||||
/* 初始化横竖屏的初值start */
|
||||
hOrVMode = new HorizontalOrVerticalMode;
|
||||
|
@ -57,6 +49,15 @@ KyView::KyView(const QStringList &args)
|
|||
m_toolbar = new ToolBar(this);
|
||||
m_toolbar->move(int((this->width() - m_toolbar->width()) / 2), this->height() - m_toolbar->height() + 4 - 10);
|
||||
m_toolbar->hide();
|
||||
// 0910
|
||||
//标记工具栏
|
||||
m_markWid = new Marking(this);
|
||||
m_markWid->move(int((this->width() - m_markWid->width()) / 2), this->height() - m_markWid->height() - 16);
|
||||
m_markWid->hide();
|
||||
//画笔设置弹窗
|
||||
m_brushSettings = new BrushSettings(this);
|
||||
m_brushSettings->hide();
|
||||
|
||||
//设置置顶
|
||||
m_titlebar->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
//图片展示界面
|
||||
|
@ -69,7 +70,7 @@ KyView::KyView(const QStringList &args)
|
|||
//导航器
|
||||
m_navigator = new Navigator(this);
|
||||
// m_navigator->resize(NAVI_SIZE);
|
||||
m_navigator->move(this->width() - 7 - m_navigator->width(), this->height() - 52 - m_navigator->height());
|
||||
m_navigator->move(this->width() - 7 - m_navigator->width(), this->height() - 70 - m_navigator->height());
|
||||
m_navigator->hide();
|
||||
|
||||
//信息栏
|
||||
|
@ -83,9 +84,9 @@ KyView::KyView(const QStringList &args)
|
|||
}
|
||||
m_inforSize = m_information->size();
|
||||
m_information->move(this->width() - m_information->width(), titlebarHeightValue);
|
||||
this->installEventFilter(this);
|
||||
m_information->installEventFilter(this);
|
||||
m_titlebar->installEventFilter(this);
|
||||
m_information->setMouseTracking(true);
|
||||
//设置鼠标穿透-解决鼠标移动到顶栏位置,顶栏不弹出的问题
|
||||
m_information->setAttribute(Qt::WA_TransparentForMouseEvents, true);
|
||||
m_information->hide();
|
||||
//相册
|
||||
m_sideBar = new SideBar(this);
|
||||
|
@ -121,12 +122,12 @@ KyView::~KyView()
|
|||
void KyView::slotIntelHVModeChanged(deviceMode sig)
|
||||
{
|
||||
hLayoutFlag = hOrVMode->defaultModeCapture();
|
||||
if (hLayoutFlag == PADHorizontalMode) {
|
||||
m_isResponseDbClick = false;
|
||||
} else if (hLayoutFlag == PADVerticalMode) {
|
||||
if (hLayoutFlag == PADHorizontalMode || hLayoutFlag == PADVerticalMode) {
|
||||
m_isResponseDbClick = false;
|
||||
Variable::platForm = "pc";
|
||||
} else {
|
||||
m_isResponseDbClick = true;
|
||||
Variable::platForm = "normal";
|
||||
}
|
||||
|
||||
this->setTitleBtnHide();
|
||||
|
@ -221,7 +222,109 @@ void KyView::initconnect()
|
|||
connect(m_navigator, &Navigator::needUpdateQmlImagePos, m_showImageWidget,
|
||||
&ShowImageWidget::noticeQmlAdjustImagePos);
|
||||
connect(m_showImageWidget, &ShowImageWidget::doubleEventToMainWid, this, &KyView::dealMouseDouble);
|
||||
//展示标注工具栏
|
||||
connect(m_toolbar, &ToolBar::showMarkingWid, this, &KyView::toShowMarkWid);
|
||||
//展示画笔设置小窗口
|
||||
connect(m_markWid, &Marking::showSetBar, this, &KyView::toShowBrushWid);
|
||||
//设置画笔设置小窗口的位置和小三角位置--保持与按钮一一对应
|
||||
connect(m_markWid, &Marking::showSetPos, this, &KyView::toSetBrushPos);
|
||||
connect(m_markWid, &Marking::undoSignal, this, &KyView::undoOperate);
|
||||
connect(m_markWid, &Marking::exitSign, this, &KyView::exitSign);
|
||||
connect(m_markWid, &Marking::finishSign, this, &KyView::finshSign);
|
||||
connect(m_toolbar, &ToolBar::markUpdateImage, m_showImageWidget, &ShowImageWidget::openImage);
|
||||
connect(m_showImageWidget, &ShowImageWidget::enterSign, m_toolbar, &ToolBar::enterSign);
|
||||
connect(m_showImageWidget, &ShowImageWidget::startSignToToolbar, m_toolbar, &ToolBar::labelbar);
|
||||
}
|
||||
|
||||
//展示标注工具栏
|
||||
void KyView::toShowMarkWid()
|
||||
{
|
||||
Interaction::getInstance()->startMark();
|
||||
InteractiveQml::getInstance()->setPainterType(-1);
|
||||
m_markWid->clearButtonState();
|
||||
m_markWid->show();
|
||||
m_toolbar->hide();
|
||||
if (!m_information->isHidden()) {
|
||||
m_information->hide();
|
||||
}
|
||||
if (!m_sideBar->isHidden()) {
|
||||
m_sideBar->hide();
|
||||
}
|
||||
if (!m_showImageWidget->g_back->isHidden()) {
|
||||
m_showImageWidget->g_back->hide();
|
||||
m_showImageWidget->g_next->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void KyView::exitSign()
|
||||
{
|
||||
m_markWid->hide();
|
||||
m_brushSettings->hide();
|
||||
//给showimage界面发信号,去检查是否需要弹窗提示,进行下一步的操作
|
||||
m_showImageWidget->exitSign();
|
||||
Interaction::getInstance()->markClear();
|
||||
}
|
||||
|
||||
void KyView::finshSign()
|
||||
{
|
||||
m_markWid->hide();
|
||||
m_brushSettings->hide();
|
||||
// qDebug() << "完成标注";
|
||||
//给showimage界面发出信号,去检查是否需要弹窗提示,进行下一步的操作
|
||||
m_showImageWidget->finishSign();
|
||||
}
|
||||
|
||||
void KyView::undoOperate()
|
||||
{
|
||||
// qDebug() << "撤销操作";
|
||||
//给showimage界面发出信号,撤销上一步的操作
|
||||
m_showImageWidget->undoOperate();
|
||||
Interaction::getInstance()->markUndo();
|
||||
}
|
||||
|
||||
void KyView::exitSignComplete()
|
||||
{
|
||||
// qDebug() << "真正的退出了标注";
|
||||
// core::发送给前端显示的图片
|
||||
// showimagewid::只有在图片其实什么都没有被改变的时候,调用这个函数,其余情况需要由后端来给前端发信号
|
||||
// Variable::g_allowChangeImage = true;
|
||||
// Variable::g_needImageSaveTip = false;
|
||||
// m_markWid->hide();
|
||||
}
|
||||
//标注工具栏位置变化
|
||||
void KyView::markChange()
|
||||
{
|
||||
m_markWid->move(int((this->width() - m_markWid->width()) / 2), this->height() - m_markWid->height() - 16);
|
||||
m_recordMarkNowPos = m_markWid->pos();
|
||||
m_recordMarkMovePos = m_recordMarkNowPos - m_recordMarkOldPos;
|
||||
}
|
||||
//展示画笔设置小弹窗
|
||||
void KyView::toShowBrushWid(bool isShow, bool isText)
|
||||
{
|
||||
if (isShow) {
|
||||
m_brushSettings->setSize(isText);
|
||||
m_brushSettings->show();
|
||||
} else {
|
||||
m_brushSettings->hide();
|
||||
}
|
||||
}
|
||||
//设置画笔设置小弹窗的小三角起始位置和弹出位置--与按钮一一对应
|
||||
void KyView::toSetBrushPos(int startPos, int showPosX)
|
||||
{
|
||||
m_recordBrushStartPos = startPos;
|
||||
m_brushSettings->setStartPos(startPos);
|
||||
m_brushSettings->setShowPos(m_markWid->x() - 45 + showPosX, m_markWid->y() - 6 - m_brushSettings->height());
|
||||
m_recordMarkOldPos = m_markWid->pos();
|
||||
}
|
||||
|
||||
//画笔设置小窗口位置变化
|
||||
void KyView::brushSettingsChange()
|
||||
{
|
||||
m_brushSettings->setStartPos(m_recordBrushStartPos);
|
||||
m_brushSettings->setShowPos(m_brushSettings->x() + m_recordMarkMovePos.x(),
|
||||
m_brushSettings->y() + m_recordMarkMovePos.y());
|
||||
}
|
||||
|
||||
//打开首先检测是否需要展示工具栏
|
||||
void KyView::openState()
|
||||
{
|
||||
|
@ -255,6 +358,11 @@ void KyView::aboutShow()
|
|||
|
||||
void KyView::startRename()
|
||||
{
|
||||
if (!m_markWid->isHidden()) {
|
||||
m_titlebar->show();
|
||||
m_toolbar->hide();
|
||||
return;
|
||||
}
|
||||
m_titlebar->show();
|
||||
m_toolbar->show();
|
||||
}
|
||||
|
@ -295,7 +403,7 @@ void KyView::naviChange()
|
|||
if (m_navigator->isHidden()) {
|
||||
return;
|
||||
}
|
||||
m_navigator->move(this->width() - 7 - m_navigator->width(), this->height() - 52 - m_navigator->height());
|
||||
m_navigator->move(this->width() - 7 - m_navigator->width(), this->height() - 70 - m_navigator->height());
|
||||
}
|
||||
//信息栏随顶栏位置变化而变化
|
||||
void KyView::inforChange()
|
||||
|
@ -522,7 +630,9 @@ void KyView::hoverChange(int y)
|
|||
}
|
||||
m_timestart = true;
|
||||
}
|
||||
if (m_markWid->isHidden()) {
|
||||
m_toolbar->show();
|
||||
}
|
||||
m_titlebar->show();
|
||||
|
||||
//顶栏和标题栏位置的变化
|
||||
|
@ -562,9 +672,11 @@ void KyView::hoverChange(int y)
|
|||
this->m_showImageWidget->g_next->hide();
|
||||
this->m_showImageWidget->g_back->hide();
|
||||
} else {
|
||||
if (m_markWid->isHidden()) {
|
||||
this->m_showImageWidget->g_next->show();
|
||||
this->m_showImageWidget->g_back->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
//读取主题配置文件
|
||||
void KyView::initGsetting()
|
||||
|
@ -588,8 +700,8 @@ void KyView::themeChange()
|
|||
"QWidget{background-color:rgba(0,0,0,0.80);border-top-left-radius:0px;border-top-right-radius:0px;border-"
|
||||
"bottom-left-radius:4px;border-bottom-right-radius:0px;}");
|
||||
m_titlebar->g_menu->setThemeDark();
|
||||
m_showImageWidget->g_next->setIcon(QIcon(":/res/res/1right.png"));
|
||||
m_showImageWidget->g_back->setIcon(QIcon(":/res/res/1left.png"));
|
||||
m_showImageWidget->g_next->setIcon(QIcon(":/res/res/1right.svg"));
|
||||
m_showImageWidget->g_back->setIcon(QIcon(":/res/res/1left.svg"));
|
||||
m_sideBar->setStyleSheet("QListView{border:1px "
|
||||
";border-top-left-radius:0px;border-top-right-radius:4px;border-bottom-left-radius:"
|
||||
"0px;border-bottom-right-radius:4px;outline:none;background:rgba(63, 69, 77, 1)}"
|
||||
|
@ -610,12 +722,14 @@ void KyView::themeChange()
|
|||
"0.9);border-radius:4px;}"
|
||||
"QListView::item:hover{background:rgba(255, 255, 255, 0.9);border-radius:4px;}");
|
||||
m_titlebar->g_menu->setThemeLight();
|
||||
m_showImageWidget->g_next->setIcon(QIcon(":/res/res/right.png"));
|
||||
m_showImageWidget->g_back->setIcon(QIcon(":/res/res/left.png"));
|
||||
m_showImageWidget->g_next->setIcon(QIcon(":/res/res/right.svg"));
|
||||
m_showImageWidget->g_back->setIcon(QIcon(":/res/res/left.svg"));
|
||||
}
|
||||
Interaction::getInstance()->changeOpenIcon(themeStyle);
|
||||
m_toolbar->changeStyle();
|
||||
m_markWid->changeStyle();
|
||||
m_showImageWidget->cutBtnWidChange(themeStyle);
|
||||
m_brushSettings->setTextSettings();
|
||||
}
|
||||
void KyView::lable2SetFontSizeSlot(int size)
|
||||
{
|
||||
|
@ -713,6 +827,15 @@ void KyView::avoidChange()
|
|||
}
|
||||
}
|
||||
|
||||
void KyView::markToolChange()
|
||||
{
|
||||
if (m_markWid != nullptr) {
|
||||
if (!m_markWid->isHidden()) {
|
||||
m_markWid->move(int((this->width() - m_markWid->width()) / 2), this->height() - m_markWid->height() - 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//最大化和还原
|
||||
void KyView::changOrigSize()
|
||||
{
|
||||
|
@ -855,7 +978,7 @@ void KyView::mouseReleaseEvent(QMouseEvent *event)
|
|||
//拖拽主窗口--各控件需要改变位置或尺寸
|
||||
void KyView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
|
||||
m_recordMarkOldPos = m_markWid->pos();
|
||||
titlebarChange();
|
||||
openImageChange();
|
||||
showImageChange();
|
||||
|
@ -863,7 +986,8 @@ void KyView::resizeEvent(QResizeEvent *event)
|
|||
naviChange();
|
||||
inforChange();
|
||||
albumChange();
|
||||
|
||||
markChange();
|
||||
brushSettingsChange();
|
||||
if (this->isMaximized() || this->isFullScreen()) {
|
||||
m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的全屏图标
|
||||
m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
|
||||
|
@ -903,9 +1027,11 @@ void KyView::enterEvent(QEvent *event)
|
|||
return;
|
||||
}
|
||||
if (m_sideBar->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
|
||||
if (m_markWid->isHidden()) {
|
||||
m_showImageWidget->g_back->show();
|
||||
m_showImageWidget->g_next->show();
|
||||
}
|
||||
}
|
||||
if ((m_timer->remainingTime() < 2000 && m_timer->isActive()) || !(m_timer->isActive())) {
|
||||
m_timer->stop();
|
||||
m_timer->start(2500);
|
||||
|
@ -1006,34 +1132,12 @@ void KyView::mouseDoubleClickEvent(QMouseEvent *event)
|
|||
}
|
||||
this->dealMouseDouble();
|
||||
}
|
||||
//检测鼠标在信息栏上方进入,顶栏和工具栏要展示
|
||||
bool KyView::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == m_information) {
|
||||
//如果信息栏show并且,鼠标在信息栏上
|
||||
if (!m_information->isHidden() && m_information->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
|
||||
int infor_y = m_information->mapFromGlobal(QCursor().pos()).y();
|
||||
//判断鼠标在信息栏的位置
|
||||
if (infor_y <= BAR_HEIGHT) {
|
||||
if (m_timernavi->isActive()) {
|
||||
m_timernavi->stop();
|
||||
}
|
||||
if ((m_timer->remainingTime() < 2000 && m_timer->isActive()) || !(m_timer->isActive())) {
|
||||
m_timer->stop();
|
||||
m_timer->start(2500);
|
||||
}
|
||||
m_titlebar->show();
|
||||
m_toolbar->show();
|
||||
inforChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
//拖文件进界面
|
||||
void KyView::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (operayteMode == OperayteMode::Cut || operayteMode == OperayteMode::Ocr || operayteMode == OperayteMode::Sign) {
|
||||
return;
|
||||
}
|
||||
//获得所有可被查看的图片格式
|
||||
QStringList formatList;
|
||||
QString format;
|
||||
|
@ -1348,14 +1452,20 @@ bool KyView::touchRotate(const qreal &lastAngle)
|
|||
|
||||
void KyView::setWindowSize()
|
||||
{
|
||||
if (hLayoutFlag == PADHorizontalMode) {
|
||||
if (hLayoutFlag == PADHorizontalMode || hLayoutFlag == PADVerticalMode) {
|
||||
m_isResponseDbClick = false;
|
||||
this->resize(DEFAULT_HORIZONTAL_WIDTH, DEFAULT_HORIZONTAL_HEIGHT);
|
||||
} else if (hLayoutFlag == PADVerticalMode) {
|
||||
m_isResponseDbClick = false;
|
||||
this->resize(DEFAULT_VERTICAL_WIDTH, DEFAULT_VERTICAL_HEIGHT);
|
||||
Variable::platForm = "pc";
|
||||
toolbarHeightValue = TOOLBAR_HEIGHT_INTEL;
|
||||
titlebarHeightValue = BAR_HEIGHT_INTEL;
|
||||
m_miniSize = MINI_SIZE_INTEL;
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
this->resize(screen->geometry().width(), screen->geometry().height());
|
||||
} else {
|
||||
m_isResponseDbClick = true;
|
||||
Variable::platForm = "normal";
|
||||
toolbarHeightValue = BAR_HEIGHT;
|
||||
titlebarHeightValue = BAR_HEIGHT;
|
||||
m_miniSize = MINI_SIZE;
|
||||
this->resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
@ -1371,6 +1481,14 @@ void KyView::setTitleBtnHide()
|
|||
m_titlebar->setBtnShowOrHide(false);
|
||||
}
|
||||
}
|
||||
//同时处理工具栏的显示
|
||||
if (m_toolbar != nullptr) {
|
||||
m_toolbar->platformType();
|
||||
m_toolbar->initControlQss();
|
||||
}
|
||||
if (m_markWid != nullptr) {
|
||||
m_markWid->resetMarkWidQss();
|
||||
}
|
||||
}
|
||||
|
||||
void KyView::initAboutDialog()
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include "showimagewidget.h"
|
||||
#include "navigator.h"
|
||||
#include "information.h"
|
||||
#include "marking.h"
|
||||
#include "brushsettings.h"
|
||||
#include "sidebar.h"
|
||||
#include "global/variable.h"
|
||||
#include "controller/interaction.h"
|
||||
|
@ -72,6 +74,8 @@ private:
|
|||
ShowImageWidget *m_showImageWidget = nullptr; //展示图片
|
||||
Information *m_information = nullptr; //信息窗口
|
||||
SideBar *m_sideBar = nullptr; //相册
|
||||
Marking *m_markWid = nullptr; //标注
|
||||
BrushSettings *m_brushSettings = nullptr; //画笔设置窗口
|
||||
QGSettings *m_pGsettingThemeData = nullptr; //主题
|
||||
QGSettings *m_pGsettingControlTrans = nullptr; //控制面板透明度
|
||||
HorizontalOrVerticalMode *hOrVMode = nullptr; //横竖屏Dbus接口和信号监听
|
||||
|
@ -108,6 +112,13 @@ private:
|
|||
bool m_isMaxScreen = false; //上一次动作非最大化
|
||||
bool m_isCutting = false; //裁剪模式
|
||||
bool m_isResponseDbClick = false; //判断是否需要响应双击最大化
|
||||
|
||||
//标注-0910
|
||||
QPoint m_recordMarkOldPos; //记录标注栏起始位置
|
||||
QPoint m_recordMarkNowPos; //记录标注栏当前位置
|
||||
QPoint m_recordMarkMovePos; //记录标注栏移动间隔
|
||||
int m_recordBrushStartPos; //记录标注栏小三角位置
|
||||
|
||||
void initconnect(); //初始化连接
|
||||
void titlebarChange(); //改变顶栏位置和大小
|
||||
void openImageChange(); //改变中间打开图片位置和大小
|
||||
|
@ -121,10 +132,17 @@ private:
|
|||
void themeChange(); //主题变化
|
||||
void transChange(); //控制面板变化
|
||||
void avoidChange(); //防止点击即切换的情况
|
||||
void markToolChange();
|
||||
//字体变化
|
||||
void lable2SetFontSizeSlot(int size);
|
||||
void initFontSize();
|
||||
void fullScreen();
|
||||
//标注-0910
|
||||
void markChange(); //改变标注栏位置
|
||||
void brushSettingsChange(); //改变画笔设置弹窗位置
|
||||
void toSetBrushPos(int startPos, int showPosX); //设置画笔设置窗口位置
|
||||
void toShowBrushWid(bool isShow, bool isText); //点击标记工具栏按钮显示画笔设置窗口
|
||||
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *event); // hover态时两栏和按钮状态--检测鼠标所在区域
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
@ -135,7 +153,6 @@ private:
|
|||
void paintEvent(QPaintEvent *event); // 解决毛玻璃特效的问题
|
||||
void keyPressEvent(QKeyEvent *event); // 键盘响应事件--f1
|
||||
void mouseDoubleClickEvent(QMouseEvent *event); //双击响应--全屏和还原
|
||||
bool eventFilter(QObject *obj, QEvent *event); //事件过滤器--信息栏响应两栏show
|
||||
void dragEnterEvent(QDragEnterEvent *event); //文件拖拽显示事件--判断是否响应dropevent
|
||||
void dropEvent(QDropEvent *event); //文件拖拽响应
|
||||
void dealMouseDouble(); //鼠标双击事件处理
|
||||
|
@ -181,6 +198,12 @@ private Q_SLOTS:
|
|||
void viewOCRMode(); //隐藏其他栏,进入OCR模式
|
||||
void exitOCRMode(); //退出OCR模式
|
||||
void setWidDisplay(bool isDefaultDisplay); //设置界面显示
|
||||
// 0910-标注
|
||||
void toShowMarkWid(); //打开标注工具栏--隐藏工具栏,信息栏,相册,左右按钮
|
||||
void exitSign();
|
||||
void finshSign();
|
||||
void undoOperate();
|
||||
void exitSignComplete(); //完全退出标注
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -0,0 +1,447 @@
|
|||
#include "marking.h"
|
||||
#include "global/interactiveqml.h"
|
||||
Marking::Marking(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||
this->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
|
||||
//布局
|
||||
m_layoutWid = new QWidget(this);
|
||||
m_layout = new QHBoxLayout(this);
|
||||
m_buttonGroup = new QButtonGroup(this);
|
||||
|
||||
//矩形
|
||||
m_rectangle = new QCheckBox(this);
|
||||
|
||||
m_rectangle->setFocusPolicy(Qt::NoFocus);
|
||||
m_rectangle->setAttribute(Qt::WA_TranslucentBackground);
|
||||
m_list.append(m_rectangle);
|
||||
// m_map.insert(m_rectangle,"rectangle");
|
||||
//椭圆形
|
||||
m_ellipse = new QCheckBox(this);
|
||||
|
||||
m_ellipse->setFocusPolicy(Qt::NoFocus);
|
||||
m_list.append(m_ellipse);
|
||||
// m_map.insert(m_ellipse,"ellipse");
|
||||
//线段
|
||||
m_segment = new QCheckBox(this);
|
||||
|
||||
m_segment->setFocusPolicy(Qt::NoFocus);
|
||||
m_list.append(m_segment);
|
||||
// m_map.insert(m_segment,"segment");
|
||||
//箭头
|
||||
m_arrow = new QCheckBox(this);
|
||||
|
||||
m_arrow->setFocusPolicy(Qt::NoFocus);
|
||||
m_list.append(m_arrow);
|
||||
// m_map.insert(m_arrow,"arrow");
|
||||
//画笔
|
||||
m_paintBrush = new QCheckBox(this);
|
||||
|
||||
m_paintBrush->setFocusPolicy(Qt::NoFocus);
|
||||
m_list.append(m_paintBrush);
|
||||
// m_map.insert(m_paintBrush,"paintBrush");
|
||||
// mark条
|
||||
m_markArticle = new QCheckBox(this);
|
||||
|
||||
m_markArticle->setFocusPolicy(Qt::NoFocus);
|
||||
m_list.append(m_markArticle);
|
||||
// m_map.insert(m_markArticle,"markArticle");
|
||||
//文字
|
||||
m_text = new QCheckBox(this);
|
||||
|
||||
m_text->setFocusPolicy(Qt::NoFocus);
|
||||
m_list.append(m_text);
|
||||
// m_map.insert(m_text,"text");
|
||||
//模糊
|
||||
m_blur = new QCheckBox(this);
|
||||
|
||||
m_blur->setFocusPolicy(Qt::NoFocus);
|
||||
m_list.append(m_blur);
|
||||
// m_map.insert(m_blur,"blur");
|
||||
//撤销
|
||||
m_undo = new QPushButton(this);
|
||||
|
||||
m_undo->setFocusPolicy(Qt::NoFocus);
|
||||
//退出标注栏
|
||||
m_exit = new QPushButton(this);
|
||||
|
||||
m_exit->setFocusPolicy(Qt::NoFocus);
|
||||
//完成
|
||||
m_finish = new QPushButton(this);
|
||||
m_finish->setFixedSize(62, 26);
|
||||
m_finish->setFocusPolicy(Qt::NoFocus);
|
||||
m_finish->setText("完成");
|
||||
//竖线
|
||||
m_line = new QLabel(this);
|
||||
m_line->setFixedSize(TOOL_LINE);
|
||||
//绘制阴影
|
||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
|
||||
effect->setOffset(0, 0); //设置向哪个方向产生阴影效果(dx,dy),特别地,(0,0)代表向四周发散
|
||||
effect->setColor(TOOL_COLOR); //设置阴影颜色,也可以setColor(QColor(220,220,220))
|
||||
effect->setBlurRadius(BLUR_RADIUS); //设定阴影的模糊半径,数值越大越模糊
|
||||
this->setGraphicsEffect(effect);
|
||||
this->initGsetting();
|
||||
this->resetMarkWidQss();
|
||||
// this->buttonGroup();
|
||||
this->initConnect();
|
||||
// this->toSetLayout();
|
||||
}
|
||||
//布局
|
||||
void Marking::toSetLayout()
|
||||
{
|
||||
int spaceSize = 20;
|
||||
int lineSpace = spaceSize / 4;
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
spaceSize = 16;
|
||||
lineSpace = 16;
|
||||
m_layout->setContentsMargins(10, 8, 8, 10);
|
||||
} else {
|
||||
spaceSize = 20;
|
||||
lineSpace = spaceSize / 4;
|
||||
m_layout->setContentsMargins(18, 12, 18, 18);
|
||||
}
|
||||
|
||||
m_layout->addWidget(m_rectangle, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_ellipse, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_segment, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_arrow, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_paintBrush, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_markArticle, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_text, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_blur, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(lineSpace);
|
||||
m_layout->addWidget(m_line, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(lineSpace);
|
||||
m_layout->addWidget(m_undo, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_exit, 0, Qt::AlignCenter);
|
||||
m_layout->setSpacing(spaceSize);
|
||||
m_layout->addWidget(m_finish, 0, Qt::AlignCenter);
|
||||
|
||||
m_layoutWid->setLayout(m_layout);
|
||||
m_layoutWid->resize(this->width(), this->height());
|
||||
m_layoutWid->move(0, 0);
|
||||
}
|
||||
//初始化信号槽
|
||||
void Marking::initConnect()
|
||||
{
|
||||
connect(m_rectangle, &QCheckBox::clicked, this, &Marking::rectangle);
|
||||
connect(m_ellipse, &QCheckBox::clicked, this, &Marking::ellipse);
|
||||
connect(m_segment, &QCheckBox::clicked, this, &Marking::segment);
|
||||
connect(m_arrow, &QCheckBox::clicked, this, &Marking::arrow);
|
||||
connect(m_paintBrush, &QCheckBox::clicked, this, &Marking::paintBrush);
|
||||
connect(m_markArticle, &QCheckBox::clicked, this, &Marking::markArticle);
|
||||
connect(m_text, &QCheckBox::clicked, this, &Marking::text);
|
||||
connect(m_blur, &QCheckBox::clicked, this, &Marking::blur);
|
||||
connect(m_undo, &QPushButton::clicked, this, &Marking::undo);
|
||||
connect(m_exit, &QPushButton::clicked, this, &Marking::exit);
|
||||
connect(m_finish, &QPushButton::clicked, this, &Marking::finish);
|
||||
}
|
||||
//点击某个按钮,另外的按钮清除选中状态
|
||||
void Marking::buttonGroup(bool isChecked, const QCheckBox *checkbox)
|
||||
{
|
||||
for (int i = 0; i < m_list.length(); i++) {
|
||||
if (checkbox != m_list[i]) {
|
||||
m_list[i]->setChecked(isChecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存选中的按钮
|
||||
void Marking::recordButtonState(int type, bool buttonState)
|
||||
{
|
||||
if (buttonState) {
|
||||
recordDate.type = type;
|
||||
InteractiveQml::getInstance()->setPainterType(type);
|
||||
} else {
|
||||
recordDate.type = -1;
|
||||
InteractiveQml::getInstance()->setPainterType(-1);
|
||||
}
|
||||
}
|
||||
//矩形
|
||||
void Marking::rectangle()
|
||||
{
|
||||
buttonGroup(false, m_rectangle);
|
||||
recordButtonState(0, m_rectangle->isChecked());
|
||||
Q_EMIT showSetBar(m_rectangle->isChecked(), false);
|
||||
Q_EMIT showSetPos(TRIANGLE_STARTX, 20);
|
||||
}
|
||||
//椭圆
|
||||
void Marking::ellipse()
|
||||
{
|
||||
buttonGroup(false, m_ellipse);
|
||||
recordButtonState(1, m_ellipse->isChecked());
|
||||
Q_EMIT showSetBar(m_ellipse->isChecked(), false);
|
||||
Q_EMIT showSetPos(TRIANGLE_STARTX + TRIANGLE_WIDTH, 50);
|
||||
}
|
||||
//线段
|
||||
void Marking::segment()
|
||||
{
|
||||
buttonGroup(false, m_segment);
|
||||
recordButtonState(2, m_segment->isChecked());
|
||||
Q_EMIT showSetBar(m_segment->isChecked(), false);
|
||||
Q_EMIT showSetPos(TRIANGLE_STARTX + TRIANGLE_WIDTH * 2, 80);
|
||||
}
|
||||
//箭头
|
||||
void Marking::arrow()
|
||||
{
|
||||
buttonGroup(false, m_arrow);
|
||||
recordButtonState(3, m_arrow->isChecked());
|
||||
Q_EMIT showSetBar(m_arrow->isChecked(), false);
|
||||
Q_EMIT showSetPos(TRIANGLE_STARTX + TRIANGLE_WIDTH * 3, 105);
|
||||
}
|
||||
//画笔
|
||||
void Marking::paintBrush()
|
||||
{
|
||||
buttonGroup(false, m_paintBrush);
|
||||
recordButtonState(4, m_paintBrush->isChecked());
|
||||
Q_EMIT showSetBar(m_paintBrush->isChecked(), false);
|
||||
Q_EMIT showSetPos(TRIANGLE_STARTX + TRIANGLE_WIDTH * 4, 135);
|
||||
}
|
||||
// mark条
|
||||
void Marking::markArticle()
|
||||
{
|
||||
buttonGroup(false, m_markArticle);
|
||||
recordButtonState(5, m_markArticle->isChecked());
|
||||
Q_EMIT showSetBar(m_markArticle->isChecked(), false);
|
||||
Q_EMIT showSetPos(TRIANGLE_STARTX + TRIANGLE_WIDTH * 5, 165);
|
||||
}
|
||||
//文字
|
||||
void Marking::text()
|
||||
{
|
||||
buttonGroup(false, m_text);
|
||||
recordButtonState(6, m_text->isChecked());
|
||||
Q_EMIT showSetBar(m_text->isChecked(), true);
|
||||
Q_EMIT showSetPos(TRIANGLE_STARTX + TRIANGLE_WIDTH * 6, 195);
|
||||
}
|
||||
//模糊
|
||||
void Marking::blur()
|
||||
{
|
||||
buttonGroup(false, m_blur);
|
||||
recordButtonState(7, m_blur->isChecked());
|
||||
Q_EMIT showSetBar(false, false);
|
||||
}
|
||||
//撤销
|
||||
void Marking::undo()
|
||||
{
|
||||
// InteractiveQml::getInstance()->setPainterType(8);
|
||||
Q_EMIT undoSignal();
|
||||
}
|
||||
//退出标注
|
||||
void Marking::exit()
|
||||
{
|
||||
// InteractiveQml::getInstance()->setPainterType(9);
|
||||
Variable::g_needEnterSign = false;
|
||||
Q_EMIT exitSign();
|
||||
}
|
||||
//完成
|
||||
void Marking::finish()
|
||||
{
|
||||
Variable::g_needEnterSign = false;
|
||||
// InteractiveQml::getInstance()->setPainterType(10);
|
||||
Q_EMIT finishSign();
|
||||
}
|
||||
|
||||
//监听主题
|
||||
void Marking::initGsetting()
|
||||
{
|
||||
if (QGSettings::isSchemaInstalled(FITTHEMEWINDOWB)) {
|
||||
m_pGsettingThemeData = new QGSettings(FITTHEMEWINDOWB);
|
||||
connect(m_pGsettingThemeData, &QGSettings::changed, this, &Marking::dealSystemGsettingChange);
|
||||
}
|
||||
}
|
||||
|
||||
void Marking::dealSystemGsettingChange(const QString key)
|
||||
{
|
||||
if (key == "styleName") {
|
||||
changeStyle();
|
||||
}
|
||||
}
|
||||
void Marking::changeStyle()
|
||||
{
|
||||
QString nowThemeStyle = m_pGsettingThemeData->get("styleName").toString();
|
||||
if ("ukui-dark" == nowThemeStyle || "ukui-black" == nowThemeStyle) {
|
||||
m_layoutWid->setStyleSheet("QWidget{background-color:rgba(0,0,0,1);border-radius:" + widRadius + ";}");
|
||||
m_line->setStyleSheet("QLabel{border: 1px solid #393939;background-color: #393939;}");
|
||||
m_rectangle->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1rectangle.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/rectangle_selected.png);}");
|
||||
m_ellipse->setStyleSheet("QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1ellipse.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/ellipse_selected.png);}");
|
||||
m_segment->setStyleSheet("QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1segment.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/segment_selected.png);}");
|
||||
m_arrow->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1arrow.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image:"
|
||||
" url(:/res/res/mark/arrow_selected.png);}");
|
||||
m_paintBrush->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/mark/1paintBrush.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/paintBrush_selected.png);}");
|
||||
m_markArticle->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/mark/1markArticle.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/markArticle_selected.png);}");
|
||||
m_text->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1text.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/text_selected.png);}");
|
||||
m_blur->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/1blur.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/blur_selected.png);}");
|
||||
m_undo->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;image: url(:/res/res/mark/1undo.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/1undo.png);}");
|
||||
m_exit->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;image: url(:/res/res/mark/exit.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/exit.png);}");
|
||||
} else {
|
||||
m_layoutWid->setStyleSheet("QWidget{background-color:rgba(255,255,255,1);border-radius:" + widRadius + ";}");
|
||||
m_line->setStyleSheet("QLabel{border: 1px solid #393939;background-color: #393939;}");
|
||||
m_rectangle->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/rectangle.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/rectangle_selected.png);}");
|
||||
m_ellipse->setStyleSheet("QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/ellipse.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/ellipse_selected.png);}");
|
||||
m_segment->setStyleSheet("QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/segment.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/segment_selected.png);}");
|
||||
m_arrow->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/arrow.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image:"
|
||||
" url(:/res/res/mark/arrow_selected.png);}");
|
||||
m_paintBrush->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/mark/paintBrush.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/paintBrush_selected.png);}");
|
||||
m_markArticle->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/mark/markArticle.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/markArticle_selected.png);}");
|
||||
m_text->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/text.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/text_selected.png);}");
|
||||
m_blur->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "background-color:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/mark/blur.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/blur_selected.png);}");
|
||||
m_undo->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;image: url(:/res/res/mark/undo.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/undo.png);}");
|
||||
m_exit->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;image: url(:/res/res/mark/exit.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/mark/exit.png);}");
|
||||
m_finish->setStyleSheet("QPushButton{border:0px;border-radius:6px;background:#0062F0;color:white;}"
|
||||
"QPushButton::pressed{border:0px;border-radius:6px;background:#0062F0;color:white;}");
|
||||
}
|
||||
}
|
||||
|
||||
void Marking::clearButtonState()
|
||||
{
|
||||
for (int i = 0; i < m_list.length(); i++) {
|
||||
m_list[i]->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Marking::setWidAndBtnSize()
|
||||
{
|
||||
QSize widSize = MARK_SIZE;
|
||||
QSize btnSize = MARK_BUTTON;
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
checkBtnSize = "width: 48px; height: 48px;";
|
||||
widRadius = "12px";
|
||||
widSize = MARK_SIZE_TM;
|
||||
btnSize = MARK_BUTTON_TM;
|
||||
} else {
|
||||
checkBtnSize = "width: 24px; height: 24px;";
|
||||
widRadius = "4px";
|
||||
widSize = MARK_SIZE;
|
||||
btnSize = MARK_BUTTON;
|
||||
}
|
||||
this->setFixedSize(widSize);
|
||||
m_rectangle->setFixedSize(btnSize);
|
||||
m_ellipse->setFixedSize(btnSize);
|
||||
m_segment->setFixedSize(btnSize);
|
||||
m_arrow->setFixedSize(btnSize);
|
||||
m_paintBrush->setFixedSize(btnSize);
|
||||
m_markArticle->setFixedSize(btnSize);
|
||||
m_text->setFixedSize(btnSize);
|
||||
m_blur->setFixedSize(btnSize);
|
||||
m_undo->setFixedSize(btnSize);
|
||||
m_exit->setFixedSize(btnSize);
|
||||
}
|
||||
|
||||
void Marking::resetMarkWidQss()
|
||||
{
|
||||
this->setWidAndBtnSize();
|
||||
this->toSetLayout();
|
||||
this->changeStyle();
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
#ifndef MARKING_H
|
||||
#define MARKING_H
|
||||
#define FITTHEMEWINDOWB "org.ukui.style"
|
||||
#include <QWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QVariant>
|
||||
#include <QDebug>
|
||||
#include <QGSettings>
|
||||
#include <QCheckBox>
|
||||
#include <QRadioButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QMap>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include "sizedate.h"
|
||||
#include "global/variable.h"
|
||||
class Marking : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Marking(QWidget *parent = nullptr);
|
||||
void changeStyle();
|
||||
QList<QCheckBox *> m_list; //存每一个按钮,设置按钮互斥
|
||||
MarkPainterSet recordDate;
|
||||
// QMap<QCheckBox*,QString> m_map;//方便判断每个按钮的状态
|
||||
void clearButtonState(); //清除按钮状态
|
||||
|
||||
void resetMarkWidQss();
|
||||
|
||||
private:
|
||||
QGSettings *m_pGsettingThemeData = nullptr;
|
||||
QHBoxLayout *m_layout; //水平布局
|
||||
QWidget *m_layoutWid;
|
||||
QButtonGroup *m_buttonGroup;
|
||||
QCheckBox *m_rectangle; //矩形
|
||||
QCheckBox *m_ellipse; //椭圆形
|
||||
QCheckBox *m_segment; //线段
|
||||
QCheckBox *m_arrow; //箭头
|
||||
QCheckBox *m_paintBrush; //画笔
|
||||
QCheckBox *m_markArticle; // mark条
|
||||
QCheckBox *m_text; //文字
|
||||
QCheckBox *m_blur; //模糊
|
||||
QPushButton *m_undo; //撤销
|
||||
QPushButton *m_exit; //退出标注栏
|
||||
QPushButton *m_finish; //完成
|
||||
QLabel *m_line; //竖线
|
||||
QString checkBtnSize = "width: 24px; height: 24px;";
|
||||
QString widRadius = "4px;";
|
||||
bool isSelected = false;
|
||||
void dealSystemGsettingChange(const QString);
|
||||
void initGsetting();
|
||||
|
||||
void toSetLayout(); //设置布局
|
||||
void setWidAndBtnSize();
|
||||
void initConnect(); //初始化信号槽
|
||||
void setQSS(); //设置样式
|
||||
void buttonGroup(bool isChecked, const QCheckBox *checkbox); //设置为单选按钮组
|
||||
void recordButtonState(int type, bool buttonState);
|
||||
Q_SIGNALS:
|
||||
void showSetBar(bool isShow, bool isText); //显示画笔设置窗口
|
||||
void showSetPos(int startPos, int showPosX); //显示画笔设置窗口位置
|
||||
void exitSign();
|
||||
void finishSign();
|
||||
void undoSignal();
|
||||
|
||||
private Q_SLOTS:
|
||||
void rectangle(); //矩形
|
||||
void ellipse(); //椭圆
|
||||
void segment(); //线段
|
||||
void arrow(); //箭头
|
||||
void paintBrush(); //画笔
|
||||
void markArticle(); // mark条
|
||||
void text(); //文字
|
||||
void blur(); //模糊
|
||||
void undo(); //撤销
|
||||
void exit(); //退出标注
|
||||
void finish(); //完成
|
||||
};
|
||||
|
||||
#endif // MARKING_H
|
|
@ -38,11 +38,11 @@ void menuModule::initAction()
|
|||
menuButton->setProperty("useIconHighlightEffect", 0x2);
|
||||
menuButton->setIconSize(MICON_SIZES);
|
||||
menuButton->setPopupMode(QToolButton::InstantPopup);
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
menuButton->setFixedSize(MBTN_SIZE_INTEL);
|
||||
} else {
|
||||
// if (platForm.contains(Variable::platForm)) {
|
||||
// menuButton->setFixedSize(MBTN_SIZE_INTEL);
|
||||
// } else {
|
||||
menuButton->setFixedSize(MBTN_SIZE);
|
||||
}
|
||||
// }
|
||||
|
||||
menuButton->setAutoRaise(true);
|
||||
menuButton->setFocusPolicy(Qt::NoFocus);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "openimage.h"
|
||||
#include "kyview.h"
|
||||
#include "sizedate.h"
|
||||
#include "global/interactiveqml.h"
|
||||
OpenImage::OpenImage(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
initInteraction();
|
||||
|
@ -107,6 +108,7 @@ void OpenImage::openImagePath()
|
|||
return;
|
||||
}
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
//写入配置
|
||||
QFileInfo info(file_path);
|
||||
Variable::setSettings("imagePath", info.absolutePath());
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
#include "painterthick.h"
|
||||
PainterThick::PainterThick(int diameter, bool type, QColor color, QWidget *parent) : QCheckBox(parent)
|
||||
{
|
||||
m_diameter = diameter;
|
||||
m_color = color;
|
||||
m_type = type;
|
||||
this->setFixedSize(diameter + 4, diameter + 4);
|
||||
}
|
||||
void PainterThick::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter paint(this);
|
||||
QPainterPath path;
|
||||
paint.setPen(Qt::NoPen);
|
||||
if (m_type == false) {
|
||||
//圆形
|
||||
if (!this->isChecked()) {
|
||||
if ("ukui-dark" == m_themeChange || "ukui-black" == m_themeChange) {
|
||||
paint.setBrush(QColor(255, 255, 255));
|
||||
paint.setOpacity(0);
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.drawEllipse(QRect(0, 0, m_diameter + 4, m_diameter + 4));
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.setBrush(QColor(153, 153, 153)); //设置画刷形式
|
||||
paint.setOpacity(1);
|
||||
path.addEllipse(2, 2, m_diameter, m_diameter);
|
||||
paint.drawPath(path);
|
||||
} else {
|
||||
paint.setBrush(QColor(255, 255, 255));
|
||||
paint.setOpacity(0);
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.drawEllipse(QRect(0, 0, m_diameter + 4, m_diameter + 4));
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.setBrush(QColor(78, 78, 78)); //设置画刷形式
|
||||
paint.setOpacity(1);
|
||||
path.addEllipse(2, 2, m_diameter, m_diameter);
|
||||
paint.drawPath(path);
|
||||
}
|
||||
} else {
|
||||
paint.setBrush(QColor(255, 255, 255));
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.drawEllipse(QRect(0, 0, m_diameter + 4, m_diameter + 4));
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.setBrush(QColor(0, 0, 0));
|
||||
paint.drawEllipse(2, 2, m_diameter, m_diameter);
|
||||
paint.drawPath(path);
|
||||
}
|
||||
} else {
|
||||
//方形
|
||||
if (!this->isChecked()) {
|
||||
paint.setBrush(QColor(0, 0, 0));
|
||||
paint.setOpacity(0);
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.drawRoundRect(QRect(0, 0, m_diameter + 4, m_diameter + 4), 30, 30);
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.setBrush(m_color); //设置画刷形式
|
||||
paint.setOpacity(1);
|
||||
paint.drawRoundRect(2, 2, m_diameter, m_diameter, 30, 30);
|
||||
paint.drawPath(path);
|
||||
} else {
|
||||
paint.setBrush(QColor(255, 255, 255));
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.drawRoundRect(0, 0, m_diameter + 4, m_diameter + 4, 30, 30);
|
||||
paint.setRenderHint(QPainter::Antialiasing);
|
||||
paint.setBrush(m_color);
|
||||
paint.drawRoundRect(2, 2, m_diameter, m_diameter, 30, 30);
|
||||
paint.drawPath(path);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef PAINTERTHICK_H
|
||||
#define PAINTERTHICK_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QPainter>
|
||||
class PainterThick : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PainterThick(int diameter, bool type, QColor color, QWidget *parent = nullptr);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
int m_diameter;//按钮直径或长宽
|
||||
bool m_type = false;//判断是圆形粗细设置还是方形颜色设置--默认为圆形
|
||||
QColor m_color;//按钮颜色
|
||||
QString m_themeChange;//主题变化
|
||||
};
|
||||
|
||||
#endif // PAINTERTHICK_H
|
|
@ -2,7 +2,7 @@
|
|||
#include "kyview.h"
|
||||
#include "sizedate.h"
|
||||
#include "global/variable.h"
|
||||
|
||||
#include "global/interactiveqml.h"
|
||||
ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
this->initInteraction();
|
||||
|
@ -28,8 +28,8 @@ ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent)
|
|||
m_rightPageBtn = new QPushButton(m_imagePageWid);
|
||||
m_pageNum = new QLabel(m_imagePageWid);
|
||||
|
||||
m_leftPageBtn->setIcon(QIcon(":/res/res/left.png"));
|
||||
m_rightPageBtn->setIcon(QIcon(":/res/res/right.png"));
|
||||
m_leftPageBtn->setIcon(QIcon(":/res/res/left.svg"));
|
||||
m_rightPageBtn->setIcon(QIcon(":/res/res/right.svg"));
|
||||
m_leftPageBtn->setFlat(true);
|
||||
m_rightPageBtn->setFlat(true);
|
||||
|
||||
|
@ -41,9 +41,9 @@ ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent)
|
|||
m_imagePageWid->setLayout(m_pageLayout);
|
||||
|
||||
m_imagePageWid->hide();
|
||||
|
||||
m_timer = new QTimer(this);
|
||||
m_timer->setSingleShot(true);
|
||||
|
||||
//绘制阴影
|
||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
|
||||
effect->setOffset(0, 0); //设置向哪个方向产生阴影效果(dx,dy),特别地,(0,0)代表向四周发散
|
||||
|
@ -117,7 +117,7 @@ bool ShowImageWidget::imageNum(int number)
|
|||
g_buttonState = false;
|
||||
} else {
|
||||
//删除时逻辑导致item总是比实际多一张,暂时先在前端进行判断来解决相关问题
|
||||
if (number == 3 && m_isDelete == true) {
|
||||
if (number == 3) {
|
||||
g_buttonState = false;
|
||||
} else {
|
||||
g_buttonState = true;
|
||||
|
@ -142,24 +142,35 @@ void ShowImageWidget::imageNUll()
|
|||
QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_OPERATE.toLatin1().data(), Q_ARG(QVariant, way));
|
||||
return;
|
||||
}
|
||||
//初始化信号槽连接
|
||||
this->qmlAndWidgetConnectNormal(imageItemLower);
|
||||
|
||||
QObject::connect(imageItemLower, SIGNAL(sendScale(QVariant)), this, SLOT(setScale(QVariant)));
|
||||
QObject::connect(imageItemLower, SIGNAL(needShowNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)), this,
|
||||
SLOT(showNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)));
|
||||
QObject::connect(imageItemLower, SIGNAL(closeNavigator()), this, SLOT(needCloseNavigator()));
|
||||
QObject::connect(imageItemLower, SIGNAL(buriedPoint()), this, SLOT(zoomBuriedPoint()));
|
||||
if (m_imageSize != "0x0" || m_imageSize != "-") {
|
||||
int tempWidth = m_imageSize.mid(0, m_imageSize.indexOf("x")).toInt();
|
||||
int tempHeight = m_imageSize.mid(m_imageSize.indexOf("x") + 1, -1).toInt();
|
||||
if ((m_paperFormat == "tiff" || m_paperFormat == "tif") && m_imagePageList.length() > 1) {
|
||||
QMetaObject::invokeMethod(targatImage, "changeImage",
|
||||
Q_ARG(QVariant, "image://thumb/" + m_imagePath + QString::number(0)),
|
||||
Q_ARG(QVariant, tempWidth), Q_ARG(QVariant, tempHeight));
|
||||
|
||||
} else {
|
||||
QMetaObject::invokeMethod(targatImage, "changeImage", Q_ARG(QVariant, "image://thumb/" + m_imagePath),
|
||||
Q_ARG(QVariant, tempWidth), Q_ARG(QVariant, tempHeight));
|
||||
}
|
||||
} else {
|
||||
if ((m_paperFormat == "tiff" || m_paperFormat == "tif") && m_imagePageList.length() > 1) {
|
||||
//更换显示界面
|
||||
// m_imagePageWid->show();
|
||||
// m_pageNum->setText("1");
|
||||
//更新图片--先更新第一张-tiff格式
|
||||
targatImage->setProperty(IMAGE_SOURCE.toLatin1().data(), "image://thumb/" + m_imagePath + QString::number(0));
|
||||
|
||||
targatImage->setProperty(IMAGE_SOURCE.toLatin1().data(),
|
||||
"image://thumb/" + m_imagePath + QString::number(0));
|
||||
} else {
|
||||
//更新图片
|
||||
targatImage->setProperty(IMAGE_SOURCE.toLatin1().data(), "image://thumb/" + m_imagePath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int way = int(operayteMode);
|
||||
//判断传入方式进行缩放显示
|
||||
|
@ -177,9 +188,11 @@ void ShowImageWidget::imageNUll()
|
|||
QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_POSRESET.toLatin1().data());
|
||||
}
|
||||
//切图
|
||||
if (operayteMode == OperayteMode::ChangeImage || operayteMode == OperayteMode::LifeSize
|
||||
if (operayteMode == OperayteMode::ChangeImage || operayteMode == OperayteMode::NextImage
|
||||
|| operayteMode == OperayteMode::BackImage || operayteMode == OperayteMode::LifeSize
|
||||
|| operayteMode == OperayteMode::RotateN || operayteMode == OperayteMode::RotateS
|
||||
|| operayteMode == OperayteMode::FlipH || operayteMode == OperayteMode::FlipV) {
|
||||
|| operayteMode == OperayteMode::FlipH || operayteMode == OperayteMode::FlipV
|
||||
|| operayteMode == OperayteMode::Sign) {
|
||||
if (operayteMode != OperayteMode::LifeSize) {
|
||||
//如果切换图片,则关闭导航栏
|
||||
this->needCloseNavigator();
|
||||
|
@ -196,6 +209,9 @@ void ShowImageWidget::imageNUll()
|
|||
m_proportion = var.toInt();
|
||||
//发送给工具栏
|
||||
setScale(var);
|
||||
if (Variable::g_needEnterSign) {
|
||||
Q_EMIT enterSign();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -211,6 +227,7 @@ void ShowImageWidget::showMovieImage()
|
|||
if (!m_movieImage || !MOVIE_IMAGE_FORMAT.contains(m_paperFormat)) {
|
||||
m_recordMovieBefore = true;
|
||||
operayteMode = OperayteMode::NoOperate;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
imageNUll();
|
||||
return;
|
||||
}
|
||||
|
@ -222,15 +239,21 @@ void ShowImageWidget::showMovieImage()
|
|||
if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 1, &imageLoader, &imageItemLower, &targatImage)) {
|
||||
return;
|
||||
}
|
||||
QObject::connect(imageItemLower, SIGNAL(sendScale(QVariant)), this, SLOT(setScale(QVariant)));
|
||||
//初始化信号槽连接
|
||||
this->qmlAndWidgetConnectMovie(imageItemLower);
|
||||
|
||||
QString path = "file://" + m_imagePath;
|
||||
if (m_imageSize != "0x0" || m_imageSize != "-") {
|
||||
int tempWidth = m_imageSize.mid(0, m_imageSize.indexOf("x")).toInt();
|
||||
int tempHeight = m_imageSize.mid(m_imageSize.indexOf("x") + 1, -1).toInt();
|
||||
QMetaObject::invokeMethod(targatImage, "changeImage", Q_ARG(QVariant, path), Q_ARG(QVariant, tempWidth),
|
||||
Q_ARG(QVariant, tempHeight));
|
||||
|
||||
} else {
|
||||
QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_SETSOURCE.toLatin1().data(), Q_ARG(QVariant, path));
|
||||
QObject::connect(imageItemLower, SIGNAL(needShowNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)), this,
|
||||
SLOT(showNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)));
|
||||
QObject::connect(imageItemLower, SIGNAL(closeNavigator()), this, SLOT(needCloseNavigator()));
|
||||
QObject::connect(imageItemLower, SIGNAL(buriedPoint()), this, SLOT(zoomBuriedPoint()));
|
||||
}
|
||||
|
||||
|
||||
int way = int(operayteMode);
|
||||
//判断传入方式进行缩放显示
|
||||
QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_OPERATE.toLatin1().data(), Q_ARG(QVariant, way));
|
||||
|
@ -248,7 +271,8 @@ void ShowImageWidget::showMovieImage()
|
|||
}
|
||||
|
||||
//切图
|
||||
if (operayteMode == OperayteMode::ChangeImage || operayteMode == OperayteMode::LifeSize
|
||||
if (operayteMode == OperayteMode::ChangeImage || operayteMode == OperayteMode::NextImage
|
||||
|| operayteMode == OperayteMode::BackImage || operayteMode == OperayteMode::LifeSize
|
||||
|| operayteMode == OperayteMode::RotateN || operayteMode == OperayteMode::RotateS
|
||||
|| operayteMode == OperayteMode::FlipH || operayteMode == OperayteMode::FlipV) {
|
||||
if (operayteMode != OperayteMode::LifeSize) {
|
||||
|
@ -263,6 +287,7 @@ void ShowImageWidget::showMovieImage()
|
|||
}
|
||||
m_recordMovieBefore = true;
|
||||
operayteMode = OperayteMode::NormalMode;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
//返回当前缩放比
|
||||
QVariant var;
|
||||
QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_SENDSCALE.toLatin1().data(), Q_RETURN_ARG(QVariant, var));
|
||||
|
@ -343,12 +368,16 @@ void ShowImageWidget::albumChangeImage(bool isChange)
|
|||
//下一张
|
||||
void ShowImageWidget::nextImage()
|
||||
{
|
||||
operayteMode = OperayteMode::NextImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
m_canSet = true;
|
||||
Interaction::getInstance()->nextImage();
|
||||
}
|
||||
//上一张
|
||||
void ShowImageWidget::backImage()
|
||||
{
|
||||
operayteMode = OperayteMode::BackImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
m_canSet = true;
|
||||
Interaction::getInstance()->backImage();
|
||||
}
|
||||
|
@ -445,6 +474,7 @@ void ShowImageWidget::getDropImagePath(QVariant pathUrl)
|
|||
if (formatList.contains(info.suffix().toLower())) {
|
||||
Variable::setSettings("imagePath", info.absolutePath());
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
this->openImage(imagePath);
|
||||
}
|
||||
}
|
||||
|
@ -584,6 +614,7 @@ void ShowImageWidget::setGetTextResult(QVector<QString> result)
|
|||
void ShowImageWidget::exitGetText()
|
||||
{
|
||||
operayteMode = OperayteMode::NormalMode;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
m_ocrWid->clear();
|
||||
m_ocrWid->hide();
|
||||
m_ocrBtnWid->hide();
|
||||
|
@ -711,7 +742,7 @@ void ShowImageWidget::reName()
|
|||
|
||||
void ShowImageWidget::signImage()
|
||||
{
|
||||
Interaction::getInstance()->startSignImageApp();
|
||||
Q_EMIT startSignToToolbar();
|
||||
}
|
||||
|
||||
void ShowImageWidget::abnormalJudgBeforeClick()
|
||||
|
@ -774,7 +805,7 @@ void ShowImageWidget::setMenuEnable()
|
|||
m_reName->setEnabled(m_isOpenSuccess);
|
||||
m_deleteImage->setEnabled(m_isOpenSuccess);
|
||||
}
|
||||
if (SIGN_APP_NOT_SUPPORT.contains(m_paperFormat.toLower())) {
|
||||
if (SIGN_NOT_SUPPORT.contains(m_paperFormat.toLower()) || m_movieImage) {
|
||||
m_signImage->setEnabled(false);
|
||||
} else {
|
||||
m_signImage->setEnabled(true);
|
||||
|
@ -808,6 +839,7 @@ void ShowImageWidget::startWithOpenImage(QString path)
|
|||
} else {
|
||||
Q_EMIT decideMainWidDisplay(false);
|
||||
}
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
//双击和右键打开图片,将路径写入
|
||||
QFileInfo info(path);
|
||||
Variable::setSettings("imagePath", info.absolutePath());
|
||||
|
@ -841,6 +873,7 @@ int ShowImageWidget::positionCorrection(int windowSize, int pictureSize)
|
|||
void ShowImageWidget::exitCut()
|
||||
{
|
||||
operayteMode = OperayteMode::ExitCut;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
m_cutWid->hide();
|
||||
m_btnWid->hide();
|
||||
Interaction::getInstance()->exitCut();
|
||||
|
@ -852,6 +885,7 @@ void ShowImageWidget::exitCut()
|
|||
void ShowImageWidget::needSave()
|
||||
{
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
m_cutWid->hide();
|
||||
m_btnWid->hide();
|
||||
m_showImage->hide();
|
||||
|
@ -895,7 +929,7 @@ void ShowImageWidget::openFinish(QVariant var)
|
|||
QFileInfo info = package.info; //详情信息
|
||||
int proportion = package.proportion; //比例
|
||||
m_proportion = proportion;
|
||||
QString imageSize = package.imageSize;
|
||||
m_imageSize = package.imageSize;
|
||||
QString colorSpace = package.colorSpace;
|
||||
QString num;
|
||||
int number = package.imageNumber; //在队列中的标签
|
||||
|
@ -904,6 +938,7 @@ void ShowImageWidget::openFinish(QVariant var)
|
|||
if (MOVIE_IMAGE_FORMAT.contains(m_paperFormat)) {
|
||||
m_movieImage = true;
|
||||
}
|
||||
|
||||
m_imagePageList = package.imageList;
|
||||
if (m_imagePageList.length() > 1 && (m_paperFormat == "tiff" || m_paperFormat == " tif")) {
|
||||
tempImage = m_imagePageList.at(0);
|
||||
|
@ -932,7 +967,7 @@ void ShowImageWidget::openFinish(QVariant var)
|
|||
Q_EMIT toShowImage(); //给主界面--展示图片
|
||||
|
||||
//根据图片类型刷新右键菜单内容
|
||||
imageMenu(info, imageSize, colorSpace);
|
||||
imageMenu(info, m_imageSize, colorSpace);
|
||||
sideState(m_typeNum);
|
||||
m_isDelete = false;
|
||||
// qml加载图片前的判断
|
||||
|
@ -1051,9 +1086,9 @@ void ShowImageWidget::stateUpdate()
|
|||
int ShowImageWidget::makeSureHeightState()
|
||||
{
|
||||
int widHeight = BAR_HEIGHT;
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
widHeight = BAR_HEIGHT_INTEL;
|
||||
}
|
||||
// if (platForm.contains(Variable::platForm)) {
|
||||
// widHeight = BAR_HEIGHT_INTEL;
|
||||
// }
|
||||
return widHeight;
|
||||
}
|
||||
|
||||
|
@ -1063,6 +1098,10 @@ void ShowImageWidget::initQmlObject()
|
|||
m_showImageQml = new QQuickWidget(this);
|
||||
QQmlEngine *engine = m_showImageQml->engine();
|
||||
engine->addImageProvider(QLatin1String("thumb"), new ScreenImageProvider);
|
||||
qmlRegisterType<InteractiveQml>("Interactive", 1, 0, "Interactive");
|
||||
// qmlRegisterSingletonType<InteractiveQml>("InteractiveQml", 1, 0, "interactiveQml",
|
||||
// InteractiveQml::getInstance());
|
||||
|
||||
m_showImageQml->setSource(QUrl(QStringLiteral("qrc:/showImageComponent.qml")));
|
||||
|
||||
m_showImageQml->setClearColor(Qt::transparent);
|
||||
|
@ -1070,12 +1109,35 @@ void ShowImageWidget::initQmlObject()
|
|||
m_showImageQml->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
m_showImageQml->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_showImageQml->lower();
|
||||
// bug 146268的规避方案
|
||||
connect(m_showImageQml->quickWindow(), &QQuickWindow::activeFocusItemChanged, this,
|
||||
&ShowImageWidget::qmlActiveFocusChanged);
|
||||
|
||||
m_qmlObj = new QObject(this);
|
||||
m_qmlObj = m_showImageQml->rootObject();
|
||||
QObject::connect(m_qmlObj, SIGNAL(sendDropImagePath(QVariant)), this, SLOT(getDropImagePath(QVariant)));
|
||||
QObject::connect(m_qmlObj, SIGNAL(changeImage(QVariant)), this, SLOT(needChangeImage(QVariant)));
|
||||
QObject::connect(m_qmlObj, SIGNAL(doubleSignal()), this, SIGNAL(doubleEventToMainWid()));
|
||||
//操作方式
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(operateWayChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setOperateWay(QVariant)));
|
||||
//画笔类型及其各种参数
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(painterTypeChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setpainterType(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(painterThicknessChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setpainterThickness(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(painterColorChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setpainterColor(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(textBoldChanged(QVariant)), m_qmlObj, SLOT(setBold(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(textDeleteLineChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setDeleteLine(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(textUnderLineChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setUnderLine(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(textItalicsChanged(QVariant)), m_qmlObj, SLOT(setItalics(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(textFontTypeChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setFontType(QVariant)));
|
||||
connect(InteractiveQml::getInstance(), SIGNAL(textFontSizeChanged(QVariant)), m_qmlObj,
|
||||
SLOT(setFontSize(QVariant)));
|
||||
|
||||
connect(Interaction::getInstance(), &Interaction::getLeftUpPosAccordingImage, this, &ShowImageWidget::setImagePos);
|
||||
changeQmlSizePos(this->width(), this->height(), 0, 0);
|
||||
|
@ -1280,7 +1342,6 @@ bool ShowImageWidget::getQmlObjAndJudgeNullptr(QObject *objParent, QObject **obj
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShowImageWidget::realBuriedPoint()
|
||||
{
|
||||
//缩放图片-埋点
|
||||
|
@ -1291,6 +1352,57 @@ void ShowImageWidget::realBuriedPoint()
|
|||
}
|
||||
}
|
||||
|
||||
void ShowImageWidget::qmlActiveFocusChanged()
|
||||
{
|
||||
QQuickItem *focusItem = m_showImageQml->quickWindow()->activeFocusItem();
|
||||
if (focusItem && focusItem->inherits("QQuickTextEdit")) {
|
||||
disconnect(m_showImageQml->quickWindow(), &QQuickWindow::activeFocusItemChanged, this,
|
||||
&ShowImageWidget::qmlActiveFocusChanged);
|
||||
clearFocus();
|
||||
focusItem->forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void ShowImageWidget::qmlAndWidgetConnectNormal(QObject *obj)
|
||||
{
|
||||
if (m_hasConnectedNormal) {
|
||||
return;
|
||||
}
|
||||
m_hasConnectedNormal = true;
|
||||
connect(this, SIGNAL(undoSign()), obj, SLOT(undoSignOperate()));
|
||||
connect(obj, SIGNAL(sendScale(QVariant)), this, SLOT(setScale(QVariant)));
|
||||
connect(obj, SIGNAL(needShowNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)), this,
|
||||
SLOT(showNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)));
|
||||
connect(obj, SIGNAL(closeNavigator()), this, SLOT(needCloseNavigator()));
|
||||
connect(obj, SIGNAL(sendRectInfo(QVariant)), this, SLOT(rectPaint(QVariant)));
|
||||
connect(obj, SIGNAL(sendCircleInfo(QVariant, QVariant, QVariant, QVariant)), this,
|
||||
SLOT(circlePaint(QVariant, QVariant, QVariant, QVariant)));
|
||||
|
||||
connect(obj, SIGNAL(sendLineInfo(QVariant, QVariant)), this, SLOT(linePaint(QVariant, QVariant)));
|
||||
connect(obj, SIGNAL(sendArrowInfo(QVariant, QVariant, QVariant, QVariant)), this,
|
||||
SLOT(arrowPaint(QVariant, QVariant, QVariant, QVariant)));
|
||||
connect(obj, SIGNAL(sendPencilInfo(QVariant)), this, SLOT(pencilPaint(QVariant)));
|
||||
connect(obj, SIGNAL(sendMarkInfo(QVariant, QVariant, QVariant)), this,
|
||||
SLOT(markPaint(QVariant, QVariant, QVariant)));
|
||||
connect(obj, SIGNAL(sendTextInfo(QVariant, QVariant, QVariant)), this,
|
||||
SLOT(textPaint(QVariant, QVariant, QVariant)));
|
||||
connect(obj, SIGNAL(sendBlurInfot(QVariant)), this, SLOT(blurPaint(QVariant)));
|
||||
connect(obj, SIGNAL(buriedPoint()), this, SLOT(zoomBuriedPoint()));
|
||||
}
|
||||
|
||||
void ShowImageWidget::qmlAndWidgetConnectMovie(QObject *obj)
|
||||
{
|
||||
if (m_hasConnectedMovie) {
|
||||
return;
|
||||
}
|
||||
m_hasConnectedMovie = true;
|
||||
connect(obj, SIGNAL(sendScale(QVariant)), this, SLOT(setScale(QVariant)));
|
||||
connect(obj, SIGNAL(needShowNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)), this,
|
||||
SLOT(showNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)));
|
||||
connect(obj, SIGNAL(closeNavigator()), this, SLOT(needCloseNavigator()));
|
||||
connect(obj, SIGNAL(buriedPoint()), this, SLOT(zoomBuriedPoint()));
|
||||
}
|
||||
|
||||
void ShowImageWidget::zoomBuriedPoint()
|
||||
{
|
||||
if (m_timer->isActive()) {
|
||||
|
@ -1316,8 +1428,10 @@ void ShowImageWidget::needChangeImage(QVariant needChangeImage)
|
|||
}
|
||||
m_canSet = true;
|
||||
if (needChangeImage.toBool()) {
|
||||
operayteMode = OperayteMode::BackImage;
|
||||
Interaction::getInstance()->backImage();
|
||||
} else {
|
||||
operayteMode = OperayteMode::NextImage;
|
||||
Interaction::getInstance()->nextImage();
|
||||
}
|
||||
}
|
||||
|
@ -1346,6 +1460,146 @@ void ShowImageWidget::noticeQmlAdjustImagePos()
|
|||
QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_ADJUSTIMAGEPOS.toLatin1().data());
|
||||
}
|
||||
}
|
||||
|
||||
void ShowImageWidget::rectPaint(QVariant rect)
|
||||
{
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = InteractiveQml::getInstance()->getPainterType();
|
||||
recordDate.rectInfo = rect.toRect();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
}
|
||||
|
||||
void ShowImageWidget::circlePaint(QVariant leftX, QVariant leftY, QVariant painterW, QVariant painterH)
|
||||
{
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = InteractiveQml::getInstance()->getPainterType();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
recordDate.circleLeftX = leftX.toDouble();
|
||||
recordDate.circleLeftY = leftY.toDouble();
|
||||
recordDate.paintWidth = painterW.toDouble();
|
||||
recordDate.paintHeight = painterH.toDouble();
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
}
|
||||
|
||||
void ShowImageWidget::linePaint(QVariant startPos, QVariant endPos)
|
||||
{
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = InteractiveQml::getInstance()->getPainterType();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
|
||||
recordDate.recordStartPos = startPos.toPoint();
|
||||
recordDate.recordEndPos = endPos.toPoint();
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
}
|
||||
|
||||
void ShowImageWidget::arrowPaint(QVariant startPos, QVariant endPos, QVariant arrowStartPos, QVariant arrowEndPos)
|
||||
{
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = InteractiveQml::getInstance()->getPainterType();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
|
||||
recordDate.recordStartPos = startPos.toPoint();
|
||||
recordDate.recordEndPos = endPos.toPoint();
|
||||
recordDate.arrowStartPos = arrowStartPos.toPoint();
|
||||
recordDate.arrowEndPos = arrowEndPos.toPoint();
|
||||
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
}
|
||||
|
||||
void ShowImageWidget::pencilPaint(QVariant pointList)
|
||||
{
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = InteractiveQml::getInstance()->getPainterType();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
|
||||
QVector<QPoint> vp;
|
||||
QList<QVariant> lp = pointList.toList();
|
||||
if (lp.length() > 0) {
|
||||
for (int i = 0; i < lp.length(); i++) {
|
||||
vp.append(lp.at(i).toPoint());
|
||||
}
|
||||
recordDate.vp = vp;
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
} else {
|
||||
qDebug() << "绘图失败";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ShowImageWidget::markPaint(QVariant startPos, QVariant endPos, QVariant alpha)
|
||||
{
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = InteractiveQml::getInstance()->getPainterType();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
|
||||
recordDate.recordStartPos = startPos.toPoint();
|
||||
recordDate.recordEndPos = endPos.toPoint();
|
||||
recordDate.opactity = alpha.toDouble();
|
||||
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
}
|
||||
|
||||
void ShowImageWidget::textPaint(QVariant textContent, QVariant startPos, QVariant type)
|
||||
{
|
||||
if ("" == textContent.toString()) {
|
||||
qDebug() << "文字内容为空";
|
||||
return;
|
||||
}
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = type.toInt();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
|
||||
recordDate.m_textSet.textContent = textContent.toString();
|
||||
recordDate.recordStartPos = startPos.toPoint();
|
||||
recordDate.m_textSet.fontSize = InteractiveQml::getInstance()->getPainterTextFontSize();
|
||||
if ("" == InteractiveQml::getInstance()->getPainterTextFontType()) {
|
||||
QFont f;
|
||||
recordDate.m_textSet.fontType = f.family();
|
||||
} else {
|
||||
recordDate.m_textSet.fontType = InteractiveQml::getInstance()->getPainterTextFontType();
|
||||
}
|
||||
recordDate.m_textSet.isBold = InteractiveQml::getInstance()->getPainterTextBold();
|
||||
recordDate.m_textSet.isItalics = InteractiveQml::getInstance()->getPainterTextItalics();
|
||||
recordDate.m_textSet.isUnderLine = InteractiveQml::getInstance()->getPainterTextUnderLine();
|
||||
recordDate.m_textSet.isDeleteLine = InteractiveQml::getInstance()->getPainterTextDeleteLine();
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
}
|
||||
|
||||
void ShowImageWidget::blurPaint(QVariant blurRect)
|
||||
{
|
||||
MarkPainterSet recordDate;
|
||||
recordDate.type = InteractiveQml::getInstance()->getPainterType();
|
||||
recordDate.painterColor = InteractiveQml::getInstance()->getPainterColor();
|
||||
recordDate.thickness = InteractiveQml::getInstance()->getPainterThickness();
|
||||
|
||||
recordDate.rectInfo = blurRect.toRect();
|
||||
QVariant var;
|
||||
var.setValue<MarkPainterSet>(recordDate);
|
||||
Interaction::getInstance()->toMarkImage(var);
|
||||
}
|
||||
void ShowImageWidget::showNavigator(QVariant scale, QVariant leftUpImageX, QVariant leftUpImageY, QVariant visibleWidth,
|
||||
QVariant visibleHeight)
|
||||
{
|
||||
|
@ -1372,6 +1626,55 @@ void ShowImageWidget::changeQmlcomponentColor(QColor color, double opacity)
|
|||
{
|
||||
m_qmlObj->setProperty(IMAGE_COLOR.toLatin1().data(), color);
|
||||
}
|
||||
|
||||
void ShowImageWidget::undoOperate()
|
||||
{
|
||||
Q_EMIT undoSign();
|
||||
}
|
||||
|
||||
void ShowImageWidget::exitSign()
|
||||
{
|
||||
Variable::g_allowChangeImage = true;
|
||||
Variable::g_needImageSaveTip = false;
|
||||
displayMode = DisplayMode::NormalMode;
|
||||
operayteMode = OperayteMode::NormalMode;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
//返回当前缩放比
|
||||
//暂时不需要,下一个阶段需要,目前阶段直接退出不保存即可
|
||||
QMetaObject::invokeMethod(m_qmlObj, IMAGE_FUNC_SIGN_EXITSIGN.toLatin1().data());
|
||||
// Interaction::getInstance()->markClear();
|
||||
// QVariant var;
|
||||
// QMetaObject::invokeMethod(m_qmlObj, IMAGE_FUNC_SIGN_GETOPERATETIME.toLatin1().data(), Q_RETURN_ARG(QVariant,
|
||||
// var)); if (var.toInt() != 0) {
|
||||
// qDebug() << "弹出弹窗询问是否保存";
|
||||
// cutQueryWid();
|
||||
// }
|
||||
}
|
||||
|
||||
void ShowImageWidget::finishSign()
|
||||
{
|
||||
//具体需不需要弹窗提示,需要和设计讨论-当前默认备份保存
|
||||
QVariant var;
|
||||
QMetaObject::invokeMethod(m_qmlObj, IMAGE_FUNC_SIGN_GETOPERATETIME.toLatin1().data(), Q_RETURN_ARG(QVariant, var));
|
||||
if (var.toInt() != 0) {
|
||||
//发送给后端进行图片编辑
|
||||
//拿到图片操作队列
|
||||
Interaction::getInstance()->markSave(m_imagePath);
|
||||
} else {
|
||||
Q_EMIT exitSignComplete();
|
||||
}
|
||||
Variable::g_allowChangeImage = true;
|
||||
Variable::g_needImageSaveTip = false;
|
||||
displayMode = DisplayMode::NormalMode;
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
QMetaObject::invokeMethod(m_qmlObj, IMAGE_FUNC_SIGN_EXITSIGN.toLatin1().data());
|
||||
}
|
||||
|
||||
// bool ShowImageWidget::signSaveQuery()
|
||||
//{
|
||||
// m_qmlObj->property("signListLength").toInt();
|
||||
//}
|
||||
//裁剪的工具栏窗口样式设置
|
||||
void ShowImageWidget::cutBtnWidChange(QString themeTyep)
|
||||
{
|
||||
|
@ -1386,9 +1689,10 @@ void ShowImageWidget::cutBtnWidChange(QString themeTyep)
|
|||
}
|
||||
}
|
||||
//备用-目前不需要-以后可能会用到
|
||||
void ShowImageWidget::cutQueryWid()
|
||||
int ShowImageWidget::cutQueryWid()
|
||||
{
|
||||
m_queryMsg->warning(this, tr("Warning"), tr("是否保存对此图片的更改?"), QMessageBox::Ok);
|
||||
return m_queryMsg->warning(this, tr("Warning"), tr("是否保存对此图片的更改?"), tr("覆盖保存"), tr("备份保存"),
|
||||
tr("不保存"));
|
||||
}
|
||||
|
||||
void ShowImageWidget::cutFinishUi()
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "ocrresultwidget.h"
|
||||
#include <buried_point.hpp>
|
||||
|
||||
|
||||
class ShowImageWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -50,6 +49,12 @@ public:
|
|||
bool btnWidState(); //按钮栏状态,方便主界面判断按键是否响应的状态
|
||||
void changeQmlcomponentColor(QColor color, double opacity);
|
||||
|
||||
//标注
|
||||
void undoOperate();
|
||||
void exitSign();
|
||||
void finishSign();
|
||||
// bool signSaveQuery();
|
||||
|
||||
public Q_SLOTS:
|
||||
void albumSlot(bool isOpen); //判断是否发送相册展示的事件
|
||||
void isDelete(bool isDel); //判断是删除
|
||||
|
@ -63,7 +68,7 @@ public Q_SLOTS:
|
|||
void exportToTxt(); // OCR识别结果导出为txt
|
||||
void saveAsOther(); //另存为
|
||||
void cutBtnWidChange(QString themeTyep);
|
||||
void cutQueryWid(); //裁剪还未保存弹窗
|
||||
int cutQueryWid(); //裁剪还未保存弹窗
|
||||
void cutFinishUi(); //裁剪完成界面变量重置
|
||||
void navigatorState(bool state);
|
||||
void navigatorMove(bool isDrageImage);
|
||||
|
@ -79,6 +84,15 @@ public Q_SLOTS:
|
|||
void needUpdateImagePosFromMainWid(bool needUpdate);
|
||||
void needChangeImage(QVariant needChangeImage);
|
||||
void noticeQmlAdjustImagePos();
|
||||
|
||||
void rectPaint(QVariant rect);
|
||||
void circlePaint(QVariant leftX, QVariant leftY, QVariant painterW, QVariant painterH);
|
||||
void linePaint(QVariant startPos, QVariant endPos);
|
||||
void arrowPaint(QVariant startPos, QVariant endPos, QVariant arrowStartPos, QVariant arrowEndPos);
|
||||
void pencilPaint(QVariant pointList);
|
||||
void markPaint(QVariant startPos, QVariant endPos, QVariant alpha);
|
||||
void textPaint(QVariant textContent, QVariant startPos, QVariant type);
|
||||
void blurPaint(QVariant blurRect);
|
||||
void zoomBuriedPoint();
|
||||
|
||||
|
||||
|
@ -104,7 +118,7 @@ private:
|
|||
QString m_path = ""; //打开文件夹的路径
|
||||
QString m_imagePath = ""; //打开的图片文件的路径
|
||||
QPixmap m_copyImage; //留着复制可能用
|
||||
QString m_paperFormat; //用来判断可设置为壁纸的样式
|
||||
QString m_paperFormat;
|
||||
QPrintDialog *m_printDialog;
|
||||
QMovie *m_loadingMovie = nullptr;
|
||||
int m_imageShowWay = 3; //图片显示方式,默认为自适应查看
|
||||
|
@ -218,8 +232,15 @@ private:
|
|||
bool getQmlObjAndJudgeNullptr(QObject *objParent, QObject **objFirst, int isNormal = -1,
|
||||
QObject **objSecond = nullptr, QObject **objThird = nullptr,
|
||||
QObject **objFourth = nullptr);
|
||||
|
||||
QTimer *m_timer;
|
||||
void realBuriedPoint();
|
||||
QString m_imageSize = "0x0";
|
||||
void qmlActiveFocusChanged();
|
||||
void qmlAndWidgetConnectNormal(QObject *obj);
|
||||
void qmlAndWidgetConnectMovie(QObject *obj);
|
||||
bool m_hasConnectedNormal = false;
|
||||
bool m_hasConnectedMovie = false;
|
||||
|
||||
Q_SIGNALS:
|
||||
void perRate(QString num, QString path); //改变工具栏的缩小的百分比
|
||||
|
@ -250,6 +271,12 @@ Q_SIGNALS:
|
|||
void needGrabGestureOut(bool needGrabGestureOut);
|
||||
void toCloseNavigator(QPixmap image);
|
||||
void doubleEventToMainWid();
|
||||
|
||||
//标注
|
||||
void exitSignComplete(); //退出标注
|
||||
void undoSign();
|
||||
void enterSign();
|
||||
void startSignToToolbar();
|
||||
};
|
||||
|
||||
#endif // SHOWIMAGEWIDGET_H
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "sidebar.h"
|
||||
|
||||
#include "global/interactiveqml.h"
|
||||
#include "global/variable.h"
|
||||
SideBar::SideBar(QWidget *parent) : QListView(parent)
|
||||
{
|
||||
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //设置无水平滑动条
|
||||
|
@ -64,6 +65,9 @@ void SideBar::mouseReleaseEvent(QMouseEvent *e)
|
|||
{
|
||||
//处理滑动,或拖出相册时,相册选中态和主界面显示的图片保持一致
|
||||
Interaction::getInstance()->changeImageFromClick(this->currentIndex());
|
||||
this->setCurrentIndex(this->currentIndex());
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
QListView::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,25 @@
|
|||
#include <QSize>
|
||||
#include <QColor>
|
||||
#include <QImage>
|
||||
/*struct MarkPainterSet
|
||||
{
|
||||
QPoint recordStartPos; //记录开始位置--标注
|
||||
QPoint recoedMovePos; //记录移动位置--标注
|
||||
int type = -1; //记录画笔类型--标注:0,1,2,3,4,5,6,7
|
||||
int thickness = -1; //记录画笔粗细--标注:
|
||||
int painterColor = -1; //记录画笔颜色--标注
|
||||
//文字设置保存
|
||||
struct TextSet
|
||||
{
|
||||
bool isBold = false;
|
||||
bool isDeleteLine = false;
|
||||
bool isUnderLine = false;
|
||||
bool isItalics = false;
|
||||
QString fontType = "";
|
||||
int fontSize = 6;
|
||||
} m_textSet;
|
||||
};
|
||||
Q_DECLARE_METATYPE(MarkPainterSet) */ // QVarant 注册自定义类型
|
||||
static const int DEFAULT_WIDTH = 1080; //主界面默认宽度
|
||||
static const int DEFAULT_HEIGHT = 720; //主界面默认高度
|
||||
static const int DEFAULT_HORIZONTAL_WIDTH = 1920; //主界面横屏默认宽度
|
||||
|
@ -11,7 +30,7 @@ static const int DEFAULT_HORIZONTAL_HEIGHT = 1080; //主界面横屏
|
|||
static const int DEFAULT_VERTICAL_WIDTH = 1080; //主界面竖屏默认宽度
|
||||
static const int DEFAULT_VERTICAL_HEIGHT = 1920; //主界面竖屏默认高度
|
||||
static const QSize MINI_SIZE = QSize(682, 682); //主界面最小尺寸
|
||||
static const QSize MINI_SIZE_INTEL = QSize(760, 678); //主界面最小尺寸
|
||||
static const QSize MINI_SIZE_INTEL = QSize(780, 780); //主界面最小尺寸
|
||||
static const QSize LOGO_BTN = QSize(24, 24); //标题栏logo按钮尺寸
|
||||
static const QSize ICON_SIZE = QSize(30, 30); //图标大小
|
||||
static const QSize OPEN_IMAGESIZE = QSize(128, 128 + 50 + 10); //打开图片界面尺寸
|
||||
|
@ -21,14 +40,31 @@ static const int OPEN_IMAGEFIX = 128; //打开图片界面的
|
|||
static const QSize NAVI_SIZE = QSize(200, 40); //导航栏尺寸
|
||||
static const QSize INFOR_SIZE = QSize(207 + 6, 197 + 18 + 20 + 8); //信息栏尺寸
|
||||
|
||||
static const QSize TOOLBAR_SIZE_INTEL = QSize(700 + 4 + 40 + 16 + 40, 56); //工具栏尺寸-intel
|
||||
static const QSize TOOLBAR_SIZE = QSize(540 + 4 + 40 + 16 + 40, 40 + 4); //工具栏尺寸
|
||||
static const QSize TOOL_BUTTON_INTEL = QSize(56, 56); //工具栏按钮尺寸-intel
|
||||
static const QSize MARK_SIZE = QSize(558, 48); //标注栏尺寸
|
||||
static const QSize MARK_BUTTON = QSize(24, 24); //标注栏尺寸
|
||||
static const QSize MARK_SIZE_TM = QSize(760, 64); //标注栏尺寸
|
||||
static const QSize MARK_BUTTON_TM = QSize(48, 48); //标注栏尺寸
|
||||
|
||||
static const QSize BRUSHSETTING_SIZE = QSize(187, 57 + 15); //画笔设置弹窗尺寸
|
||||
static const QSize BRUSHSETTINGTEXT_SIZE = QSize(261, 57 + 15); //画笔设置弹窗--字体设置窗口尺寸
|
||||
static const int SHADOW_WIDTH = 15; // 画笔设置弹窗阴影宽度;
|
||||
static const int TRIANGLE_WIDTH = 15; // 画笔设置弹窗小三角的宽度;
|
||||
static const int TRIANGLE_HEIGHT = 10; // 画笔设置弹窗小三角的高度;
|
||||
static const int TRIANGLE_POINTY = 57; // 画笔设置弹窗边角的弧度;
|
||||
static const int BORDER_RADIUS = 5; // 画笔设置弹窗边角的弧度;
|
||||
static const int TRIANGLE_STARTX = 48; // 弹窗小三角起始位置
|
||||
static const QRect BRUSHSETTING_PAINT = QRect(0, 0, 187, 57); //画笔设置弹窗rect
|
||||
static const QRect BRUSHSETTINGTEXT_PAINT = QRect(0, 0, 261, 57); //画笔设置弹窗--字体设置rect
|
||||
static const int CONTROL_INTERVAL = 7; //画笔设置弹窗控件间隔
|
||||
|
||||
static const QSize TOOLBAR_SIZE_INTEL = QSize(700 + 4 + 40 + 16 + 40 + 40 + 25, 64); //工具栏尺寸-intel
|
||||
static const QSize TOOLBAR_SIZE = QSize(540 + 4 + 40 + 16 + 40 + 16 + 40, 40 + 4); //工具栏尺寸
|
||||
static const QSize TOOL_BUTTON_INTEL = QSize(48, 48); //工具栏按钮尺寸-intel
|
||||
static const QSize TOOL_BUTTON = QSize(24, 24); //工具栏按钮尺寸
|
||||
static const QSize TOOLZOOM_SIZE_INTEL = QSize(187, 56); //工具栏缩放widget尺寸 (123,24) -intel
|
||||
static const QSize TOOLZOOM_SIZE_INTEL = QSize(175, 48); //工具栏缩放widget尺寸 (123,24) -intel
|
||||
static const QSize TOOLZOOM_SIZE = QSize(123, 24); //工具栏缩放widget尺寸
|
||||
static const int TOOLBAR_HEIGHT_INTEL = 56; // intel
|
||||
static const int BAR_HEIGHT_INTEL = 48; //标题栏和工具栏的高度-intel
|
||||
static const int TOOLBAR_HEIGHT_INTEL = 72; // intel
|
||||
static const int BAR_HEIGHT_INTEL = 40; //标题栏和工具栏的高度-intel
|
||||
static const int BAR_HEIGHT = 40; //标题栏和工具栏的高度
|
||||
static const QSize TITLE_BTN_INTEL = QSize(35, 35); //标题栏按钮尺寸-intel
|
||||
static const QSize TITLE_BTN = QSize(32, 32); //标题栏按钮尺寸
|
||||
|
@ -65,7 +101,7 @@ static const int WIDGETSIZE_MAX = 16777215; //删除固定窗口约束,需设
|
|||
static const int TITLE_TRANSPARENT = 178; //标题栏透明度
|
||||
static QImage tempImage = QImage();
|
||||
static QColor tempColor = QColor(255, 255, 255, 0);
|
||||
static QStringList platForm = {"V10SP1-edu"}; //当前平台
|
||||
static QStringList platForm = {"pc"}; //当前模式 /*"V10SP1-edu"*/"normal"
|
||||
static const QStringList EXTERNAL_START_APP = {"kylin-gallery"}; //外部启动的应用名
|
||||
static const QString SIGN_APP_NAME = "kolourpaint";
|
||||
static int recordCurrentProportion = 100; //记录当前图片缩放比例,默认为100
|
||||
|
@ -102,4 +138,12 @@ static const QString IMAGE_FUNC_NAVICHANGEIMAGEPOS = "operateNavigatorChangeImag
|
|||
static const QString IMAGE_FUNC_ADJUSTIMAGEPOS = "adjustImagePostion";
|
||||
|
||||
static const QString IMAGE_FUNC_UPDATE_POS_ACCORD_WIDSIZE_CHANGE = "updatePosAccordingToWidSizeChange";
|
||||
|
||||
//标注
|
||||
static const QString IMAGE_FUNC_SIGN_GETOPERATETIME = "getOperateTime";
|
||||
static const QString IMAGE_FUNC_SIGN_EXITSIGN = "exitOperate";
|
||||
// static const QStringList SIGN_NOT_SUPPORT = {"apng", "gif", "wbmp", "tiff", "tif", "sr",
|
||||
// "exr", "pgm", "ras", "pbm", "svg", "xbm"};
|
||||
static const QStringList SIGN_NOT_SUPPORT = {"apng", "gif", "tiff", "tif", "svg", "xbm"};
|
||||
|
||||
#endif // SIZEDATE_H
|
||||
|
|
|
@ -134,12 +134,8 @@ void TitleBar::setRenameEnable(bool isOpenSucess, bool isCanOpertate)
|
|||
void TitleBar::setBtnShowOrHide(bool needHide)
|
||||
{
|
||||
if (needHide) {
|
||||
m_closebtn->hide();
|
||||
m_minibtn->hide();
|
||||
g_fullscreen->hide();
|
||||
} else {
|
||||
m_closebtn->show();
|
||||
m_minibtn->show();
|
||||
g_fullscreen->show();
|
||||
}
|
||||
}
|
||||
|
@ -172,25 +168,25 @@ void TitleBar::longText(QLabel *nameC, QString text)
|
|||
//初始化顶栏布局
|
||||
void TitleBar::initControlQss()
|
||||
{
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
m_titleLayout->addSpacing(4);
|
||||
m_titleLayout->addWidget(m_backButton); // logo
|
||||
m_titleLayout->addWidget(m_logoBtn); // logo
|
||||
m_titleLayout->addSpacing(4);
|
||||
m_titleLayout->addWidget(m_logolb); //标签
|
||||
m_titleLayout->addStretch(); //添加伸缩
|
||||
m_titleLayout->addSpacing(40);
|
||||
m_titleLayout->addWidget(g_imageName);
|
||||
m_titleLayout->addWidget(g_myEdit);
|
||||
m_titleLayout->addStretch(); //添加伸缩
|
||||
m_titleLayout->addWidget(g_menu->menuButton); //设置按钮
|
||||
m_titleLayout->addWidget(m_minibtn);
|
||||
m_titleLayout->addWidget(g_fullscreen);
|
||||
m_titleLayout->addWidget(m_closebtn);
|
||||
m_titleLayout->setSpacing(4);
|
||||
m_titleLayout->setMargin(4);
|
||||
this->setLayout(m_titleLayout);
|
||||
} else {
|
||||
// if (platForm.contains(Variable::platForm)) {
|
||||
// m_titleLayout->addSpacing(4);
|
||||
// m_titleLayout->addWidget(m_backButton); // logo
|
||||
// m_titleLayout->addWidget(m_logoBtn); // logo
|
||||
// m_titleLayout->addSpacing(4);
|
||||
// m_titleLayout->addWidget(m_logolb); //标签
|
||||
// m_titleLayout->addStretch(); //添加伸缩
|
||||
// m_titleLayout->addSpacing(40);
|
||||
// m_titleLayout->addWidget(g_imageName);
|
||||
// m_titleLayout->addWidget(g_myEdit);
|
||||
// m_titleLayout->addStretch(); //添加伸缩
|
||||
// m_titleLayout->addWidget(g_menu->menuButton); //设置按钮
|
||||
// m_titleLayout->addWidget(m_minibtn);
|
||||
// m_titleLayout->addWidget(g_fullscreen);
|
||||
// m_titleLayout->addWidget(m_closebtn);
|
||||
// m_titleLayout->setSpacing(4);
|
||||
// m_titleLayout->setMargin(4);
|
||||
// this->setLayout(m_titleLayout);
|
||||
// } else {
|
||||
m_titleLayout->setSpacing(0);
|
||||
m_titleLayout->setMargin(0);
|
||||
m_titleLayout->addSpacing(12);
|
||||
|
@ -212,7 +208,7 @@ void TitleBar::initControlQss()
|
|||
m_titleLayout->addWidget(m_closebtn);
|
||||
m_titleLayout->addSpacing(4);
|
||||
this->setLayout(m_titleLayout);
|
||||
}
|
||||
// }
|
||||
}
|
||||
//信号和槽
|
||||
void TitleBar::initConnect()
|
||||
|
@ -239,17 +235,17 @@ void TitleBar::initFontSize()
|
|||
}
|
||||
void TitleBar::platformType()
|
||||
{
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
m_closebtn->setFixedSize(TITLE_BTN_INTEL);
|
||||
m_minibtn->setFixedSize(TITLE_BTN_INTEL);
|
||||
g_fullscreen->setFixedSize(TITLE_BTN_INTEL);
|
||||
this->setFixedHeight(BAR_HEIGHT_INTEL);
|
||||
} else {
|
||||
// if (platForm.contains(Variable::platForm)) {
|
||||
// m_closebtn->setFixedSize(TITLE_BTN_INTEL);
|
||||
// m_minibtn->setFixedSize(TITLE_BTN_INTEL);
|
||||
// g_fullscreen->setFixedSize(TITLE_BTN_INTEL);
|
||||
// this->setFixedHeight(BAR_HEIGHT_INTEL);
|
||||
// } else {
|
||||
m_closebtn->setFixedSize(TITLE_BTN);
|
||||
m_minibtn->setFixedSize(TITLE_BTN);
|
||||
g_fullscreen->setFixedSize(TITLE_BTN);
|
||||
this->setFixedHeight(BAR_HEIGHT);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
void TitleBar::dealEditState()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "toolbar.h"
|
||||
#include "kyview.h"
|
||||
#include "sizedate.h"
|
||||
#include "global/interactiveqml.h"
|
||||
ToolBar::ToolBar(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
|
@ -13,6 +14,7 @@ ToolBar::ToolBar(QWidget *parent) : QWidget(parent)
|
|||
m_toolLayout = new QHBoxLayout(this);
|
||||
//缩放widget
|
||||
m_zoomWid = new QWidget(this);
|
||||
|
||||
//缩小
|
||||
m_reduce = new QPushButton(m_zoomWid);
|
||||
|
||||
|
@ -60,6 +62,7 @@ ToolBar::ToolBar(QWidget *parent) : QWidget(parent)
|
|||
m_rotate = new QPushButton(this);
|
||||
m_rotate->setFocusPolicy(Qt::NoFocus);
|
||||
m_rotate->setAttribute(Qt::WA_TranslucentBackground);
|
||||
m_rotate->setToolTip(tr("Rorate right"));
|
||||
// m_rotate->setToolTip(tr("旋转"));
|
||||
//水平翻转
|
||||
m_flipH = new QPushButton(this);
|
||||
|
@ -98,11 +101,10 @@ ToolBar::ToolBar(QWidget *parent) : QWidget(parent)
|
|||
// filter->setToolTip(tr("Filter"));
|
||||
// filter->setToolTip(tr("滤镜"));
|
||||
//标注
|
||||
// labelbar = new QPushButton(this);//
|
||||
// labelbar->setFixedSize(TOOL_BUTTON);
|
||||
// labelbar->setFocusPolicy(Qt::NoFocus);
|
||||
// labelbar->setToolTip(tr("Label"));
|
||||
// labelbar->setToolTip(tr("标注"));
|
||||
m_labelbar = new QPushButton(this); //
|
||||
m_labelbar->setFocusPolicy(Qt::NoFocus);
|
||||
m_labelbar->setToolTip(tr("Markup"));
|
||||
// m_labelbar->setToolTip(tr("标注"));
|
||||
|
||||
m_line2 = new QLabel(this);
|
||||
m_line2->setFixedSize(TOOL_LINE);
|
||||
|
@ -134,7 +136,6 @@ ToolBar::ToolBar(QWidget *parent) : QWidget(parent)
|
|||
g_tooleWid->setGraphicsEffect(effect);
|
||||
|
||||
this->platformType();
|
||||
m_enlarge->move(m_percentage->x() + m_percentage->width() + 7, 0);
|
||||
this->initGsetting();
|
||||
this->initControlQss();
|
||||
this->initConnect();
|
||||
|
@ -150,8 +151,9 @@ void ToolBar::initControlQss()
|
|||
{
|
||||
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
checkBtnSize = "width: 48px; height: 48px;";
|
||||
m_toolLayout->addWidget(m_zoomWid, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
// m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_adaptiveWidget, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_originalSize, 0, Qt::AlignCenter);
|
||||
|
@ -163,29 +165,30 @@ void ToolBar::initControlQss()
|
|||
m_toolLayout->addWidget(m_flipV, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_cutImage, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(5);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_line1, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(5);
|
||||
// m_toolLayout->addWidget(m_ocr, 0, Qt::AlignCenter);
|
||||
// m_toolLayout->setSpacing(5);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_ocr, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
// m_toolLayout->addWidget(m_filter,0,Qt::AlignCenter);
|
||||
// m_toolLayout->setSpacing(20);
|
||||
// m_toolLayout->addWidget(m_labelbar,0,Qt::AlignCenter);
|
||||
// m_toolLayout->setSpacing(16);
|
||||
// m_toolLayout->addWidget(m_line2, 0, Qt::AlignCenter);
|
||||
// m_toolLayout->setSpacing(20);
|
||||
m_toolLayout->addWidget(m_labelbar, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_line2, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_sidebar, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_information, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(10);
|
||||
m_toolLayout->addWidget(m_delImage, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_toolLayout->setContentsMargins(10, 0, 10, 0);
|
||||
g_tooleWid->setLayout(m_toolLayout);
|
||||
g_tooleWid->move(2, 2);
|
||||
g_tooleWid->resize(this->width() - 4, this->height() - 4);
|
||||
m_line2->hide();
|
||||
// m_line2->hide();
|
||||
} else {
|
||||
m_line2->show();
|
||||
checkBtnSize = "width: 24px; height: 24px;";
|
||||
// m_line2->show();
|
||||
m_toolLayout->addWidget(m_zoomWid, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(20);
|
||||
m_toolLayout->addWidget(m_adaptiveWidget, 0, Qt::AlignCenter);
|
||||
|
@ -206,8 +209,8 @@ void ToolBar::initControlQss()
|
|||
m_toolLayout->setSpacing(5);
|
||||
// m_toolLayout->addWidget(m_filter,0,Qt::AlignCenter);
|
||||
// m_toolLayout->setSpacing(20);
|
||||
// m_toolLayout->addWidget(m_labelbar,0,Qt::AlignCenter);
|
||||
// m_toolLayout->setSpacing(16);
|
||||
m_toolLayout->addWidget(m_labelbar, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(20);
|
||||
m_toolLayout->addWidget(m_line2, 0, Qt::AlignCenter);
|
||||
m_toolLayout->setSpacing(20);
|
||||
m_toolLayout->addWidget(m_sidebar, 0, Qt::AlignCenter);
|
||||
|
@ -234,7 +237,7 @@ void ToolBar::initConnect()
|
|||
connect(m_cutImage, &QPushButton::clicked, this, &ToolBar::cutImage);
|
||||
connect(m_ocr, &QPushButton::clicked, this, &ToolBar::getText);
|
||||
// connect(m_filter,&QPushButton::clicked,this,&ToolBar::filter);
|
||||
// connect(m_labelbar,&QPushButton::clicked,this,&ToolBar::labelbar);
|
||||
connect(m_labelbar, &QPushButton::clicked, this, &ToolBar::labelbar);
|
||||
connect(m_sidebar, &QCheckBox::clicked, this, &ToolBar::sidebar);
|
||||
connect(m_information, &QCheckBox::clicked, this, &ToolBar::information);
|
||||
connect(m_delImage, &QPushButton::clicked, this, &ToolBar::delImage);
|
||||
|
@ -250,6 +253,7 @@ void ToolBar::changePerRate(QString num, QString path)
|
|||
void ToolBar::reduceImageSlot()
|
||||
{
|
||||
operayteMode = OperayteMode::ZoomOut;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Q_EMIT startZoomImage();
|
||||
//缩放图片-埋点
|
||||
kdk::kabase::BuriedPoint buriedPointZoomInandOut;
|
||||
|
@ -262,6 +266,7 @@ void ToolBar::reduceImageSlot()
|
|||
void ToolBar::enlargeImageSlot()
|
||||
{
|
||||
operayteMode = OperayteMode::ZoomIn;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Q_EMIT startZoomImage();
|
||||
//缩放图片-埋点
|
||||
kdk::kabase::BuriedPoint buriedPointZoomInandOut;
|
||||
|
@ -275,41 +280,51 @@ void ToolBar::enlargeImageSlot()
|
|||
void ToolBar::originalSize()
|
||||
{
|
||||
operayteMode = OperayteMode::LifeSize;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Interaction::getInstance()->watchOriginalImage();
|
||||
}
|
||||
//适应窗口
|
||||
void ToolBar::adaptiveWidget()
|
||||
{
|
||||
operayteMode = OperayteMode::Window;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Interaction::getInstance()->watchAutoImage();
|
||||
}
|
||||
//旋转
|
||||
void ToolBar::rotate()
|
||||
{
|
||||
if (platForm.contains(Variable::platForm)) {
|
||||
operayteMode = OperayteMode::RotateN;
|
||||
Interaction::getInstance()->rotate(false);
|
||||
} else {
|
||||
// if (platForm.contains(Variable::platForm)) {
|
||||
// operayteMode = OperayteMode::RotateN;
|
||||
// InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
// Interaction::getInstance()->rotate(false);
|
||||
// } else {
|
||||
operayteMode = OperayteMode::RotateS;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Interaction::getInstance()->rotate();
|
||||
}
|
||||
// }
|
||||
Variable::g_hasRotation = true;
|
||||
}
|
||||
//水平镜像
|
||||
void ToolBar::flipH()
|
||||
{
|
||||
operayteMode = OperayteMode::FlipH;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Interaction::getInstance()->flipH();
|
||||
Variable::g_hasRotation = true;
|
||||
}
|
||||
//垂直镜像
|
||||
void ToolBar::flipV()
|
||||
{
|
||||
operayteMode = OperayteMode::FlipV;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Interaction::getInstance()->flipV();
|
||||
Variable::g_hasRotation = true;
|
||||
}
|
||||
//裁剪
|
||||
void ToolBar::cutImage()
|
||||
{
|
||||
operayteMode = OperayteMode::Cut;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
// Interaction::getInstance()->cutImage();
|
||||
Q_EMIT hideTwoBar();
|
||||
Q_EMIT startCutting();
|
||||
|
@ -326,6 +341,7 @@ void ToolBar::cutImage()
|
|||
void ToolBar::getText()
|
||||
{
|
||||
operayteMode = OperayteMode::Ocr;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Interaction::getInstance()->getText();
|
||||
// Q_EMIT startGetText();
|
||||
Q_EMIT viewOCRMode();
|
||||
|
@ -338,11 +354,34 @@ void ToolBar::filter()
|
|||
//标注
|
||||
void ToolBar::labelbar()
|
||||
{
|
||||
qDebug() << "标注";
|
||||
//去后端拿是否操作过的列表
|
||||
if (Variable::g_hasRotation) {
|
||||
QMessageBox msg;
|
||||
msg.setParent(this);
|
||||
//标注需基于原图编辑,是否进入标注?
|
||||
msg.setText(tr("Markup needs to be edited based on the original. Do you want to enter Markup?"));
|
||||
msg.setIcon(QMessageBox::Question);
|
||||
QPushButton *sureBtn = msg.addButton(tr("Yes"), QMessageBox::AcceptRole);
|
||||
msg.addButton(tr("No"), QMessageBox::RejectRole);
|
||||
msg.exec();
|
||||
if ((QPushButton *)msg.clickedButton() == sureBtn) {
|
||||
operayteMode = OperayteMode::ChangeImage;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Variable::g_needEnterSign = true;
|
||||
//发信号重新打开这张图片
|
||||
Q_EMIT markUpdateImage(m_imagePath);
|
||||
return;
|
||||
}
|
||||
Variable::g_needEnterSign = false;
|
||||
} else {
|
||||
Variable::g_needEnterSign = true;
|
||||
enterSign();
|
||||
}
|
||||
}
|
||||
//侧边栏
|
||||
void ToolBar::sidebar()
|
||||
{
|
||||
|
||||
Q_EMIT showSidebar();
|
||||
//图片预览-埋点
|
||||
kdk::kabase::BuriedPoint buriedPointPicturePreview;
|
||||
|
@ -436,7 +475,8 @@ void ToolBar::changeStyle()
|
|||
m_line1->setStyleSheet("QLabel{border: 1px solid #727272;background-color: #727272;}");
|
||||
m_line2->setStyleSheet("QLabel{border: 1px solid #727272;background-color: #727272;}");
|
||||
|
||||
m_sidebar->setStyleSheet("QCheckBox{border:0px;border-radius:4px;background:transparent;}"
|
||||
m_sidebar->setStyleSheet("QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image:url(:/res/res/"
|
||||
+ normalIconPath
|
||||
|
@ -450,7 +490,8 @@ void ToolBar::changeStyle()
|
|||
+ normalIconPath + "/1sidebar_hover.png);}");
|
||||
|
||||
m_information->setStyleSheet(
|
||||
"QCheckBox{border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;image:"
|
||||
" url(:/res/res/"
|
||||
+ normalIconPath
|
||||
|
@ -468,16 +509,15 @@ void ToolBar::changeStyle()
|
|||
} else {
|
||||
if (m_imageSuffix != "" && OCR_SUPPORT.contains(m_imageSuffix)) {
|
||||
m_ocr->setEnabled(true);
|
||||
m_ocr->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_ocr->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1ocr.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1ocr_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1ocr_hover.png);}");
|
||||
} else {
|
||||
|
@ -487,105 +527,118 @@ void ToolBar::changeStyle()
|
|||
m_ocr->setStyleSheet(btnStyle(headStyle + "ocr_damaged.png)"));
|
||||
m_ocr->setEnabled(false);
|
||||
}
|
||||
m_reduce->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
|
||||
if (m_imageSuffix != "" && !SIGN_NOT_SUPPORT.contains(m_imageSuffix)) {
|
||||
m_labelbar->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/1labelbar.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/1labelbar_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/1labelbar_hover.png);}");
|
||||
} else {
|
||||
QString head = "url(:/res/res/" + damagedIconPath + "/";
|
||||
QString num = "1";
|
||||
QString headStyle = head + num;
|
||||
m_labelbar->setStyleSheet(btnStyle(headStyle + "sign_damaged.png)"));
|
||||
m_labelbar->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
m_reduce->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1reduce.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1reduce_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1reduce_hover.png);}");
|
||||
|
||||
m_enlarge->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-image:"
|
||||
m_enlarge->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image:"
|
||||
" url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1enlarge.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1enlarge_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1enlarge_hover.png);}");
|
||||
|
||||
m_originalSize->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-"
|
||||
m_originalSize->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1originalSize.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1originalSize_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1originalSize_hover.png);}");
|
||||
|
||||
m_adaptiveWidget->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1adaptiveWidget.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1adaptiveWidget_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1adaptiveWidget_hover.png);}");
|
||||
}
|
||||
if ((m_isCanOperate && m_isOpenSuccess)) {
|
||||
m_rotate->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_rotate->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1rotate.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1rotate_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1rotate_hover.png);}");
|
||||
|
||||
m_flipH->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_flipH->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1flipH.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1flipH_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1flipH_hover.png);}");
|
||||
|
||||
m_flipV->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_flipV->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1flipV.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1flipV_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1flipV_hover.png);}");
|
||||
m_delImage->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-"
|
||||
m_delImage->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1delImage.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1delImage_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1delImage_hover.png);}");
|
||||
// m_line2->setStyleSheet("QLabel{border: 1px solid #393939;background-color: #393939;}");
|
||||
|
||||
|
@ -597,16 +650,15 @@ void ToolBar::changeStyle()
|
|||
return;
|
||||
}
|
||||
|
||||
m_cutImage->setStyleSheet(
|
||||
"QPushButton{background:transparent;border:0px;border-radius:4px;background-image: "
|
||||
m_cutImage->setStyleSheet("QPushButton{background:transparent;border:0px;border-radius:4px;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1cutImage.png);}"
|
||||
"QPushButton::hover{background:transparent;border:0px;border-radius:4px;background-"
|
||||
"QPushButton::hover{background:transparent;border:0px;border-radius:4px;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1cutImage_hover.png);}"
|
||||
"QPushButton::pressed{background:transparent;border:0px;border-radius:4px;background-"
|
||||
"QPushButton::pressed{background:transparent;border:0px;border-radius:4px;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1cutImage_hover.png);}");
|
||||
|
||||
|
@ -617,7 +669,8 @@ void ToolBar::changeStyle()
|
|||
// "QPushButton::pressed{border:0px;border-radius:4px;background-image:
|
||||
// url(:/res/res/"+normalIconPath+"/1filter_hover.png);}");
|
||||
|
||||
// labelbar->setStyleSheet("QPushButton{border:0px;border-radius:4px;background-image:
|
||||
|
||||
|
||||
// url(:/res/res/1labelbar.png);}"
|
||||
// "QPushButton::hover{border:0px;border-radius:4px;background-image:
|
||||
// url(:/res/res/1labelbar_hover.png);}"
|
||||
|
@ -635,7 +688,8 @@ void ToolBar::changeStyle()
|
|||
|
||||
m_percentage->setStyleSheet("QLabel{background-color:transparent;color:rgb(0,0,0);}");
|
||||
m_sidebar->setStyleSheet(
|
||||
"QCheckBox{border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
|
@ -649,7 +703,8 @@ void ToolBar::changeStyle()
|
|||
+ normalIconPath + "/sidebar_hover.png);}");
|
||||
|
||||
m_information->setStyleSheet(
|
||||
"QCheckBox{border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
|
@ -668,16 +723,15 @@ void ToolBar::changeStyle()
|
|||
} else {
|
||||
if (m_imageSuffix != "" && OCR_SUPPORT.contains(m_imageSuffix)) {
|
||||
m_ocr->setEnabled(true);
|
||||
m_ocr->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_ocr->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/ocr.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/ocr_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/ocr_hover.png);}");
|
||||
} else {
|
||||
|
@ -685,105 +739,113 @@ void ToolBar::changeStyle()
|
|||
m_ocr->setStyleSheet(btnStyle(head + "ocr_damaged.png)"));
|
||||
m_ocr->setEnabled(false);
|
||||
}
|
||||
m_reduce->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
if (m_imageSuffix != "" && !SIGN_NOT_SUPPORT.contains(m_imageSuffix)) {
|
||||
m_labelbar->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/labelbar.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/labelbar_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/labelbar_hover.png);}");
|
||||
} else {
|
||||
QString head = "url(:/res/res/" + damagedIconPath + "/";
|
||||
m_labelbar->setStyleSheet(btnStyle(head + "sign_damaged.png)"));
|
||||
m_labelbar->setEnabled(false);
|
||||
}
|
||||
m_reduce->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/reduce.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/reduce_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/reduce_hover.png);}");
|
||||
|
||||
m_enlarge->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-image:"
|
||||
m_enlarge->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image:"
|
||||
" url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/enlarge.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/enlarge_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/enlarge_hover.png);}");
|
||||
|
||||
m_originalSize->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-"
|
||||
m_originalSize->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/originalSize.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/originalSize_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/originalSize_hover.png);}");
|
||||
|
||||
m_adaptiveWidget->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/adaptiveWidget.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/adaptiveWidget_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/adaptiveWidget_hover.png);}");
|
||||
}
|
||||
if ((m_isOpenSuccess && m_isCanOperate)) {
|
||||
m_rotate->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_rotate->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/rotate.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/rotate_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/rotate_hover.png);}");
|
||||
|
||||
m_flipH->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_flipH->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/flipH.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/flipH_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/flipH_hover.png);}");
|
||||
|
||||
m_flipV->setStyleSheet(
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;background-image: "
|
||||
m_flipV->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/flipV.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/flipV_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/flipV_hover.png);}");
|
||||
m_delImage->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-"
|
||||
m_delImage->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/delImage.png);}"
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/delImage_hover.png);}"
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;"
|
||||
"background-image: url(:/res/res/"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/delImage_hover.png);}");
|
||||
// m_line2->setStyleSheet("QLabel{border: 1px solid #393939;background-color: #393939;}");
|
||||
} else {
|
||||
|
@ -795,15 +857,15 @@ void ToolBar::changeStyle()
|
|||
}
|
||||
m_cutImage->setStyleSheet(
|
||||
"QPushButton{background:transparent;border:0px;border-radius:4px;background:"
|
||||
"transparent;background-image: url(:/res/res/"
|
||||
"transparent;image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/cutImage.png);}"
|
||||
"QPushButton::hover{background:transparent;border:0px;border-radius:4px;background:"
|
||||
"transparent;background-image: url(:/res/res/"
|
||||
"transparent;image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/cutImage_hover.png);}"
|
||||
"QPushButton::pressed{background:transparent;border:0px;border-radius:4px;background:"
|
||||
"transparent;background-image: url(:/res/res/"
|
||||
"transparent;image: url(:/res/res/"
|
||||
+ normalIconPath + "/cutImage_hover.png);}");
|
||||
|
||||
// filter->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-image:
|
||||
|
@ -813,7 +875,8 @@ void ToolBar::changeStyle()
|
|||
// "QPushButton::pressed{border:0px;border-radius:4px;background:transparent;background-image:
|
||||
// url(:/res/res/filter_hover.png);}");
|
||||
|
||||
// labelbar->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;background-image:
|
||||
|
||||
|
||||
// url(:/res/res/labelbar.png);}"
|
||||
// "QPushButton::hover{border:0px;border-radius:4px;background:transparent;background-image:
|
||||
// url(:/res/res/labelbar_hover.png);}"
|
||||
|
@ -837,8 +900,12 @@ void ToolBar::setButtonState(bool isOpenSuccess, bool isCanOperate)
|
|||
m_cutImage->setEnabled(isOpenSuccess && isCanOperate); //裁剪
|
||||
m_ocr->setEnabled(isOpenSuccess && isCanOperate); // OCR
|
||||
// m_filter->setEnabled(isOpenSuccess);//滤镜
|
||||
// m_labelbar->setEnabled(isOpenSuccess);//标注栏
|
||||
m_delImage->setEnabled(isOpenSuccess && isCanOperate); //删除图片
|
||||
if (SIGN_NOT_SUPPORT.contains(m_imageSuffix)) {
|
||||
m_labelbar->setEnabled(false); //标注栏
|
||||
} else {
|
||||
m_labelbar->setEnabled(isOpenSuccess && isCanOperate); //标注栏
|
||||
}
|
||||
|
||||
//更新一波图标
|
||||
changeStyle();
|
||||
|
@ -858,6 +925,7 @@ void ToolBar::getImageType(bool canCut)
|
|||
m_cutImage->setEnabled(m_isOpenSuccess);
|
||||
// m_ocr->setEnabled(m_isOpenSuccess);
|
||||
}
|
||||
|
||||
if (!canCut) {
|
||||
if ("ukui-dark" == nowThemeStyle || "ukui-black" == nowThemeStyle) {
|
||||
headStyle = head + num;
|
||||
|
@ -875,6 +943,15 @@ void ToolBar::getSuffix(QString suffix)
|
|||
m_imageSuffix = suffix;
|
||||
}
|
||||
|
||||
void ToolBar::enterSign()
|
||||
{
|
||||
operayteMode = OperayteMode::Sign;
|
||||
InteractiveQml::getInstance()->setOperateWay(int(operayteMode));
|
||||
Variable::g_allowChangeImage = false;
|
||||
Q_EMIT showMarkingWid();
|
||||
Variable::g_hasRotation = false;
|
||||
}
|
||||
|
||||
void ToolBar::btnState()
|
||||
{
|
||||
QString head = "url(:/res/res/" + damagedIconPath + "/";
|
||||
|
@ -896,6 +973,7 @@ void ToolBar::btnState()
|
|||
m_enlarge->setStyleSheet(btnStyle(headStyle + "enlarge_damaged.png)"));
|
||||
m_originalSize->setStyleSheet(btnStyle(headStyle + "origSize_damaged.png)"));
|
||||
m_adaptiveWidget->setStyleSheet(btnStyle(headStyle + "adaptWid_damaged.png)"));
|
||||
m_ocr->setStyleSheet(btnStyle(headStyle + "ocr_damaged.png)"));
|
||||
}
|
||||
if (!(m_isCanOperate && m_isOpenSuccess)) {
|
||||
m_rotate->setStyleSheet(btnStyle(headStyle + "rotate_damaged.png)"));
|
||||
|
@ -903,19 +981,18 @@ void ToolBar::btnState()
|
|||
m_flipV->setStyleSheet(btnStyle(headStyle + "flipV_damaged.png)"));
|
||||
m_delImage->setStyleSheet(btnStyle(headStyle + "delImage_damaged.png)"));
|
||||
m_cutImage->setStyleSheet(btnStyle(headStyle + "cutImage_damaged.png)"));
|
||||
m_ocr->setStyleSheet(btnStyle(headStyle + "ocr_damaged.png)"));
|
||||
m_labelbar->setStyleSheet(btnStyle(headStyle + "sign_damaged.png)"));
|
||||
}
|
||||
}
|
||||
|
||||
QString ToolBar::btnStyle(QString iconName)
|
||||
{
|
||||
QString styleBtn;
|
||||
QString btnDefault =
|
||||
"QPushButton{border:0px;border-radius:4px;background:transparent;border-image: " + iconName + ";}";
|
||||
QString btnDefault = "QPushButton{border:0px;border-radius:4px;background:transparent;image: " + iconName + ";}";
|
||||
QString btnHover =
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;border-image: " + iconName + ";}";
|
||||
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;image: " + iconName + ";}";
|
||||
QString btnPress =
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;border-image: " + iconName + ";}";
|
||||
"QPushButton::pressed{border:0px;border-radius:4px;background:transparent;image: " + iconName + ";}";
|
||||
styleBtn = QString(btnDefault + btnHover + btnPress);
|
||||
return styleBtn;
|
||||
}
|
||||
|
@ -934,6 +1011,71 @@ void ToolBar::buttonSize(QSize acturalSize)
|
|||
m_information->setFixedSize(acturalSize);
|
||||
m_delImage->setFixedSize(acturalSize);
|
||||
m_ocr->setFixedSize(acturalSize);
|
||||
m_labelbar->setFixedSize(acturalSize);
|
||||
}
|
||||
|
||||
void ToolBar::updateCheckBtnQss()
|
||||
{
|
||||
if ("ukui-dark" == nowThemeStyle || "ukui-black" == nowThemeStyle) {
|
||||
m_sidebar->setStyleSheet("QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image:url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1sidebar.png);}"
|
||||
"QCheckBox::indicator:hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1sidebar_hover.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1sidebar_hover.png);}");
|
||||
|
||||
m_information->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;image:"
|
||||
" url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1information.png);}"
|
||||
"QCheckBox::indicator:hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/1information_hover.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/1information_hover.png);}");
|
||||
} else {
|
||||
m_sidebar->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:transparent;image: "
|
||||
"url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/sidebar.png);}"
|
||||
"QCheckBox::indicator:hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/sidebar_hover.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/sidebar_hover.png);}");
|
||||
|
||||
m_information->setStyleSheet(
|
||||
"QCheckBox::indicator{" + checkBtnSize
|
||||
+ "border:0px;border-radius:4px;background:transparent;}"
|
||||
"QCheckBox::indicator:unchecked{border:0px;border-radius:4px;background:"
|
||||
"transparent;image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/information.png);}"
|
||||
"QCheckBox::indicator:hover{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath
|
||||
+ "/information_hover.png);}"
|
||||
"QCheckBox::indicator:checked{border:0px;border-radius:4px;background:transparent;"
|
||||
"image: url(:/res/res/"
|
||||
+ normalIconPath + "/information_hover.png);}");
|
||||
}
|
||||
}
|
||||
|
||||
void ToolBar::platformType()
|
||||
|
@ -941,25 +1083,26 @@ void ToolBar::platformType()
|
|||
if (platForm.contains(Variable::platForm)) {
|
||||
this->resize(TOOLBAR_SIZE_INTEL);
|
||||
m_zoomWid->setFixedSize(TOOLZOOM_SIZE_INTEL);
|
||||
m_rotate->setToolTip(tr("Rorate left"));
|
||||
widRadius = "16px";
|
||||
normalIconPath = "intel";
|
||||
damagedIconPath = "inteldamaged";
|
||||
// m_rotate->setToolTip(tr("Rorate left"));
|
||||
widRadius = "12px";
|
||||
// normalIconPath = "intel";
|
||||
// damagedIconPath = "inteldamaged";
|
||||
normalIconPath = "sp1";
|
||||
damagedIconPath = "sp1damaged";
|
||||
this->buttonSize(TOOL_BUTTON_INTEL);
|
||||
m_percentage->setFixedSize(TOOL_PER);
|
||||
m_percentage->move(m_reduce->x() + m_reduce->width() + 5,
|
||||
(m_reduce->height() - m_percentage->height()) / 2 - 3);
|
||||
m_ocr->hide();
|
||||
} else {
|
||||
this->resize(TOOLBAR_SIZE);
|
||||
m_zoomWid->setFixedSize(TOOLZOOM_SIZE);
|
||||
m_rotate->setToolTip(tr("Rorate right"));
|
||||
widRadius = "6px";
|
||||
normalIconPath = "sp1";
|
||||
damagedIconPath = "sp1damaged";
|
||||
this->buttonSize(TOOL_BUTTON);
|
||||
m_percentage->setFixedSize(TOOL_PER);
|
||||
m_percentage->move(m_reduce->x() + m_reduce->width() + 5, 0);
|
||||
m_ocr->show();
|
||||
}
|
||||
m_enlarge->move(m_zoomWid->width() - m_enlarge->width(), 0);
|
||||
this->updateCheckBtnQss();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QGraphicsDropShadowEffect>
|
||||
#include "controller/interaction.h"
|
||||
#include <peony-qt/file-operation-utils.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
class ToolBar : public QWidget
|
||||
{
|
||||
|
@ -31,6 +32,10 @@ public:
|
|||
QFrame *g_tooleWid; //布局
|
||||
void getImageType(bool canCut);
|
||||
void getSuffix(QString suffix); //拿图片的格式
|
||||
void enterSign();
|
||||
void labelbar(); //标注
|
||||
void platformType();
|
||||
void initControlQss(); //初始化布局
|
||||
|
||||
private:
|
||||
QString widRadius = QString("6px");
|
||||
|
@ -72,20 +77,19 @@ private:
|
|||
void cutImage(); //裁剪
|
||||
void getText(); //获取图片中文字
|
||||
void filter(); //滤镜
|
||||
void labelbar(); //标注
|
||||
void sidebar(); //侧边栏--相册
|
||||
void information(); //信息栏
|
||||
//字体变化
|
||||
void lable2SetFontSizeSlot(int size);
|
||||
void initFontSize();
|
||||
|
||||
void initControlQss(); //初始化布局
|
||||
void initGsetting();
|
||||
void initConnect();
|
||||
void btnState(); //损坏图片的按钮状态
|
||||
QString btnStyle(QString iconName); //损坏图片按钮置灰的样式
|
||||
void buttonSize(QSize acturalSize);
|
||||
void platformType();
|
||||
|
||||
QString checkBtnSize = "width: 24px; height: 24px;";
|
||||
void updateCheckBtnQss();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
|
@ -101,6 +105,9 @@ Q_SIGNALS:
|
|||
void viewOCRMode(); // 通知view进入OCR模式
|
||||
void startGetText(); //通知showimagewidget做OCR模式对应的样式变换
|
||||
void startZoomImage(); //通知界面进行缩放图片
|
||||
//标注-0910
|
||||
void showMarkingWid();
|
||||
void markUpdateImage(QString path);
|
||||
};
|
||||
|
||||
#endif // TOOLBAR_H
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<context>
|
||||
<name>Core</name>
|
||||
<message>
|
||||
<location filename="../src/controller/core/core.cpp" line="653"/>
|
||||
<location filename="../src/controller/core/core.cpp" line="813"/>
|
||||
<source>Add</source>
|
||||
<translation>ཁ་སྣོན་བརྒྱབ་པ།</translation>
|
||||
</message>
|
||||
|
@ -16,42 +16,41 @@
|
|||
<translation type="vanished">信息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="20"/>
|
||||
<location filename="../src/view/information.cpp" line="21"/>
|
||||
<source>Info</source>
|
||||
<translation>ཆ་འཕྲིན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="25"/>
|
||||
<location filename="../src/view/information.cpp" line="26"/>
|
||||
<source>Name</source>
|
||||
<translation>མིང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="32"/>
|
||||
<location filename="../src/view/information.cpp" line="33"/>
|
||||
<source>Type</source>
|
||||
<translation>རིགས་དབྱིབས་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="38"/>
|
||||
<location filename="../src/view/information.cpp" line="39"/>
|
||||
<source>Capacity</source>
|
||||
<translation>ནུས་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="44"/>
|
||||
<location filename="../src/view/information.cpp" line="45"/>
|
||||
<source>Size</source>
|
||||
<translation>ཆེ་ཆུང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="50"/>
|
||||
<location filename="../src/view/information.cpp" line="51"/>
|
||||
<source>Color</source>
|
||||
<translation>ཁ་དོག</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="56"/>
|
||||
<source>Created</source>
|
||||
<translation>གསར་སྐྲུན་བྱས་པ།</translation>
|
||||
<translation type="vanished">གསར་སྐྲུན་བྱས་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/information.cpp" line="62"/>
|
||||
<location filename="../src/view/information.cpp" line="63"/>
|
||||
<source>Modified</source>
|
||||
<translation>བཟོ་བཅོས་བརྒྱབ་རྗེས།</translation>
|
||||
</message>
|
||||
|
@ -87,33 +86,34 @@
|
|||
<translation type="vanished">麒麟看图</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/kyview.cpp" line="30"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1341"/>
|
||||
<location filename="../src/view/kyview.cpp" line="29"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1497"/>
|
||||
<source>Pictures</source>
|
||||
<translation>པར་རིས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/kyview.cpp" line="690"/>
|
||||
<location filename="../src/view/kyview.cpp" line="838"/>
|
||||
<location filename="../src/view/kyview.cpp" line="995"/>
|
||||
<location filename="../src/view/kyview.cpp" line="996"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1083"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1227"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1522"/>
|
||||
<source>full srceen</source>
|
||||
<translation>ཕྱོགས་ཡོངས་ནས་ངོ་རྒོལ་བྱེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/kyview.cpp" line="1342"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1498"/>
|
||||
<source>Version:</source>
|
||||
<translation>པར་གཞི་འདི་ལྟ་སྟེ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/kyview.cpp" line="1343"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1499"/>
|
||||
<source>A system picture tool that can quickly open common formats. It provides zoom,flip and other processing simplely.</source>
|
||||
<translation>མགྱོགས་མྱུར་ངང་ཐུན་མོང་གི་རྣམ་གཞག་ཁ་ཕྱེ་ཐུབ་པའི་མ་ལག་གི་པར་རིས་ཡོ་བྱད་ཅིག་ཡིན། དེས་སྟབས་བདེའི་སྒོ་ནས་ཆེ་རུ་གཏོང་བ་དང་འདྲུད་པ་སོགས་ཀྱི་ལས་སྣོན་མཁོ་འདོན་བྱས་ཡོད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/kyview.cpp" line="633"/>
|
||||
<location filename="../src/view/kyview.cpp" line="694"/>
|
||||
<location filename="../src/view/kyview.cpp" line="835"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1001"/>
|
||||
<location filename="../src/view/kyview.cpp" line="779"/>
|
||||
<location filename="../src/view/kyview.cpp" line="993"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1233"/>
|
||||
<location filename="../src/view/kyview.cpp" line="1532"/>
|
||||
<source>recovery</source>
|
||||
<translation>སླར་གསོ་བྱུང་བ།</translation>
|
||||
</message>
|
||||
|
@ -134,17 +134,17 @@
|
|||
<context>
|
||||
<name>OpenImage</name>
|
||||
<message>
|
||||
<location filename="../src/view/openimage.cpp" line="20"/>
|
||||
<location filename="../src/view/openimage.cpp" line="21"/>
|
||||
<source>Load picture</source>
|
||||
<translation>པར་རིས་ཀྱི་པར་རིས</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/openimage.cpp" line="91"/>
|
||||
<location filename="../src/view/openimage.cpp" line="92"/>
|
||||
<source>Open Image</source>
|
||||
<translation>པར་རིས་ཁ་ཕྱེ་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/openimage.cpp" line="92"/>
|
||||
<location filename="../src/view/openimage.cpp" line="93"/>
|
||||
<source>Image Files(</source>
|
||||
<translation>པར་རིས་ཡིག་ཚགས་(</translation>
|
||||
</message>
|
||||
|
@ -160,7 +160,7 @@
|
|||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../src/main.cpp" line="68"/>
|
||||
<location filename="../src/main.cpp" line="67"/>
|
||||
<source>Pictures</source>
|
||||
<translation>པར་རིས།</translation>
|
||||
</message>
|
||||
|
@ -168,102 +168,117 @@
|
|||
<context>
|
||||
<name>ShowImageWidget</name>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="40"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1164"/>
|
||||
<source>Copy</source>
|
||||
<translation>འདྲ་བཤུས་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="41"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1165"/>
|
||||
<source>Rename</source>
|
||||
<translation>མིང་བསྒྱུར་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="42"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1166"/>
|
||||
<source>Set Desktop Wallpaper</source>
|
||||
<translation>ཅོག་ཙེའི་སྟེང་གི་གྱང་ཤོག་གཏན་འཁེལ་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="43"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1167"/>
|
||||
<source>Set Lock Wallpaper</source>
|
||||
<translation>ཟྭ་རྒྱག་པའི་གྱང་ཤོག་གཏན་འཁེལ་བྱ་དགོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="44"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1168"/>
|
||||
<source>Print</source>
|
||||
<translation>པར་སྐྲུན་ཡིག་རིགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="45"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1169"/>
|
||||
<source>Delete</source>
|
||||
<translation>བསུབ་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="46"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1170"/>
|
||||
<source>Show in File</source>
|
||||
<translation>ཡིག་ཆའི་ནང་དུ་མངོན་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="47"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1171"/>
|
||||
<source>Save as</source>
|
||||
<translation>གྲོན་ཆུང་བྱ་རྒྱུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="48"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1172"/>
|
||||
<source>Markup</source>
|
||||
<translation>མཱ་ཁི་ཕུའུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="63"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1211"/>
|
||||
<source>Next</source>
|
||||
<translation>གོམ་སྟབས་རྗེས་མར།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="67"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1215"/>
|
||||
<source>Previous</source>
|
||||
<translation>སྔོན་ཆད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="98"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1694"/>
|
||||
<source>覆盖保存</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1694"/>
|
||||
<source>备份保存</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1695"/>
|
||||
<source>不保存</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1200"/>
|
||||
<source>Save</source>
|
||||
<translation>གྲོན་ཆུང་བྱེད་དགོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="99"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="116"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1201"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1246"/>
|
||||
<source>Cancel</source>
|
||||
<translation>ཕྱིར་འཐེན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="118"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1249"/>
|
||||
<source>Export</source>
|
||||
<translation>ཕྱིར་གཏོང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="438"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="600"/>
|
||||
<source>OCR recognition...</source>
|
||||
<translation>OCRལ་གཟེངས་བསྟོད་བྱ་རྒྱུ་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="504"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="531"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="538"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="545"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="965"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="663"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="690"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="697"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="704"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1694"/>
|
||||
<source>Warning</source>
|
||||
<translation>ཐ་ཚིག་སྒྲོག་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="504"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="663"/>
|
||||
<source>save file failed!</source>
|
||||
<translation>ཡིག་ཆ་ཉར་ཚགས་བྱས་ནས་ཕམ་ཉེས་བྱུང་བ་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="531"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="690"/>
|
||||
<source>save fail.name cannot begin with "." </source>
|
||||
<translation>གྲོན་ཆུང fail.name བྱེད་པ་ནི་""ནས་འགོ་འཛུགས་མི་རུང་། </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="965"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="1694"/>
|
||||
<source>是否保存对此图片的更改?</source>
|
||||
<translation>是否保存对此图片的更改?</translation>
|
||||
</message>
|
||||
|
@ -272,8 +287,8 @@
|
|||
<translation type="vanished">保存失败。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="538"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="545"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="697"/>
|
||||
<location filename="../src/view/showimagewidget.cpp" line="704"/>
|
||||
<source>the file name is illegal</source>
|
||||
<translation>ཡིག་ཆའི་མིང་ནི་ཁྲིམས་དང་མི་མཐུན་པ</translation>
|
||||
</message>
|
||||
|
@ -285,7 +300,7 @@
|
|||
<translation type="vanished">麒麟看图</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="154"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="150"/>
|
||||
<source>Pictures</source>
|
||||
<translation>པར་རིས།</translation>
|
||||
</message>
|
||||
|
@ -305,47 +320,47 @@
|
|||
<translation>སྒོ་རྒྱག་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="150"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="146"/>
|
||||
<source>Return</source>
|
||||
<translation>ཕྱིར་སློག་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="298"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="304"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="330"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="333"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="294"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="300"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="326"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="329"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="332"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="336"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="340"/>
|
||||
<source>Warning</source>
|
||||
<translation>ཐ་ཚིག་སྒྲོག་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="299"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="295"/>
|
||||
<source>This file will be hidden(the file whose name begins with "." will be the hidden property file.)</source>
|
||||
<translation>ཡིག་ཆ་འདི་སྦས་སྐུང་བྱེད་སྲིད། (དེའི་མིང་ལ་""ཟེར་བ་ནས་འགོ་བརྩམས་པའི་ཡིག་ཆ་དེ་ནི་སྦས་སྐུང་བྱས་པའི་རྒྱུ་ནོར་ཡིག་ཆ་རེད། )</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="304"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="300"/>
|
||||
<source>the file name is illegal</source>
|
||||
<translation>ཡིག་ཆའི་མིང་ནི་ཁྲིམས་དང་མི་མཐུན་པ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="330"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="326"/>
|
||||
<source>File does not exist (or has been deleted)!</source>
|
||||
<translation>ཡིག་ཆ་མེད་པ་(ཡང་ན་བསུབ་ཟིན་པ་)།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="333"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="329"/>
|
||||
<source>This name has been occupied, please choose another!</source>
|
||||
<translation>མིང་འདི་བཟུང་ཟིན་པས་གཞན་ཞིག་འདེམས་རོགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="337"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="333"/>
|
||||
<source>This is a read-only file, please modify the permissions before operation!</source>
|
||||
<translation>འདི་ནི་ཀློག་འདོན་བྱས་པའི་ཡིག་ཆ་ཞིག་ཡིན་པས་བཀོལ་སྤྱོད་མ་བྱས་གོང་ལ་ཆོག་མཆན་གནང་རོགས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/titlebar.cpp" line="340"/>
|
||||
<location filename="../src/view/titlebar.cpp" line="336"/>
|
||||
<source>Other error, rename failed!</source>
|
||||
<translation>ནོར་འཁྲུལ་གཞན་དག་བྱུང་ན་མིང་བསྒྱུར་མ་ཐུབ་པ་རེད།</translation>
|
||||
</message>
|
||||
|
@ -361,57 +376,76 @@
|
|||
<context>
|
||||
<name>ToolBar</name>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="21"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="23"/>
|
||||
<source>Zoom out</source>
|
||||
<translation>ཆེ་རུ་གཏོང་དགོས།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="32"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="34"/>
|
||||
<source>View scale</source>
|
||||
<translation>ལྟ་ཀློག་གི་གཞི་ཁྱོན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="40"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="42"/>
|
||||
<source>Zoom in</source>
|
||||
<translation>ཆེ་རུ་གཏོང་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="49"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="51"/>
|
||||
<source>Life size</source>
|
||||
<translation>ཚེ་སྲོག་གི་ཆེ་ཆུང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="56"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="58"/>
|
||||
<source>Window widget</source>
|
||||
<translation>སྒེའུ་ཁུང་གི་ཆུང་ཆུང་།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="89"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="92"/>
|
||||
<source>OCR</source>
|
||||
<translation>ཨོ་སི་ཁྲུ་ལི་ཡ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="900"/>
|
||||
<source>Rorate left</source>
|
||||
<translation>རོ་ལ་ཐི་གཡོན་ཕྱོགས་སུ་</translation>
|
||||
<location filename="../src/view/toolbar.cpp" line="106"/>
|
||||
<source>Markup</source>
|
||||
<translation>མཱ་ཁི་ཕུའུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="912"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="362"/>
|
||||
<source>Markup needs to be edited based on the original. Do you want to enter Markup?</source>
|
||||
<translation>དེའི་བྱེད་ནུས་དགོས་མཁོ་ཐོག་མ་རིས་ལ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="364"/>
|
||||
<source>Yes</source>
|
||||
<translation>གཏན་ཁེལ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="365"/>
|
||||
<source>No</source>
|
||||
<translation>དགག་པ་འི།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rorate left</source>
|
||||
<translation type="vanished">རོ་ལ་ཐི་གཡོན་ཕྱོགས་སུ་</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="65"/>
|
||||
<source>Rorate right</source>
|
||||
<translation>རུལ་སུངས་སུ་གྱུར་པའི་གཡས</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="68"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="71"/>
|
||||
<source>Flip horizontally</source>
|
||||
<translation>འཕྲེད་ཕྱོགས་ནས་ཕར་འགྲོ་ཚུར་འོང་བྱེད</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="74"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="77"/>
|
||||
<source>Flip vertically</source>
|
||||
<translation>གཞུང་ཕྱོགས་ནས་ཕར་འགྲོ་ཚུར་འོང་བྱེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="81"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="84"/>
|
||||
<source>Crop</source>
|
||||
<translation>ལོ་ཏོག</translation>
|
||||
</message>
|
||||
|
@ -420,12 +454,12 @@
|
|||
<translation type="vanished">裁剪</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="113"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="115"/>
|
||||
<source>Sidebar</source>
|
||||
<translation>གཞོགས་ངོས་ཀྱི་ཀ་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="119"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="121"/>
|
||||
<source>Get info</source>
|
||||
<translation>ཆ་འཕྲིན་ཐོབ་པ།</translation>
|
||||
</message>
|
||||
|
@ -458,7 +492,7 @@
|
|||
<translation type="vanished">信息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/toolbar.cpp" line="126"/>
|
||||
<location filename="../src/view/toolbar.cpp" line="128"/>
|
||||
<source>Delete</source>
|
||||
<translation>བསུབ་པ།</translation>
|
||||
</message>
|
||||
|
@ -470,18 +504,18 @@
|
|||
<translation type="vanished">服务与支持团队: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="30"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="220"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="29"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="212"/>
|
||||
<source>Version: </source>
|
||||
<translation>པར་གཞི་འདི་ལྟ་སྟེ། </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="31"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="30"/>
|
||||
<source>A system picture tool that can quickly open common formats. It provides zoom,flip and other processing simplely.</source>
|
||||
<translation>མགྱོགས་མྱུར་ངང་ཐུན་མོང་གི་རྣམ་གཞག་ཁ་ཕྱེ་ཐུབ་པའི་མ་ལག་གི་པར་རིས་ཡོ་བྱད་ཅིག་ཡིན། དེས་སྟབས་བདེའི་སྒོ་ནས་ཆེ་རུ་གཏོང་བ་དང་འདྲུད་པ་སོགས་ཀྱི་ལས་སྣོན་མཁོ་འདོན་བྱས་ཡོད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="36"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="35"/>
|
||||
<source>menu</source>
|
||||
<translation>ཟས་ཐོ།</translation>
|
||||
</message>
|
||||
|
@ -490,7 +524,7 @@
|
|||
<translation type="vanished">打开..</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="57"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="56"/>
|
||||
<source>Theme</source>
|
||||
<translation>བརྗོད་བྱ་གཙོ་བོ།</translation>
|
||||
</message>
|
||||
|
@ -499,39 +533,39 @@
|
|||
<translation type="vanished">打开...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="26"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="267"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="276"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="25"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="259"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="268"/>
|
||||
<source>Service & Support: </source>
|
||||
<translation>ཞབས་ཞུ་ & Support: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="54"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="105"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="53"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="104"/>
|
||||
<source>Open</source>
|
||||
<translation>སྒོ་ཕྱེ་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="60"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="103"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="59"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="102"/>
|
||||
<source>Help</source>
|
||||
<translation>རོགས་རམ་བྱེད་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="63"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="101"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="62"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="100"/>
|
||||
<source>About</source>
|
||||
<translation>འབྲེལ་ཡོད་ཀྱི་སྐོར།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="66"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="99"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="65"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="98"/>
|
||||
<source>Quit</source>
|
||||
<translation>ཕྱིར་འཐེན་བྱ་རྒྱུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="171"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="189"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="163"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="181"/>
|
||||
<source>Pictures</source>
|
||||
<translation>པར་རིས།</translation>
|
||||
</message>
|
||||
|
@ -540,7 +574,7 @@
|
|||
<translation type="vanished">麒麟看图</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/view/menumodule.cpp" line="178"/>
|
||||
<location filename="../src/view/menumodule.cpp" line="170"/>
|
||||
<source>close</source>
|
||||
<translation>སྒོ་རྒྱག་པ།</translation>
|
||||
</message>
|
||||
|
|