Revert "hlp:荆州版本"

This reverts commit 065b146998.
This commit is contained in:
kite_lucs
2026-10-19 17:48:03 +08:00
parent 065b146998
commit baa8882d09
438 changed files with 185387 additions and 163143 deletions
+117 -117
View File
@@ -1,117 +1,117 @@
#include "picscene.h"
#include <QDebug>
#include <QRectF>
#include <QPainter>
#include <QGraphicsView>
PicScene::PicScene(QObject *parent) :
QGraphicsScene(parent),IsdrawBackground(false)
{
}
void PicScene::setMode(Mode mode)
{
myMode = mode;
}
void PicScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
if (mouseEvent->button() != Qt::LeftButton)
return;
QGraphicsScene::mousePressEvent(mouseEvent);
}
//! [9]
//! [10]
void PicScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
update();//edit@12-12
QGraphicsScene::mouseMoveEvent(mouseEvent);
}
//! [10]
//! [11]
void PicScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
QGraphicsScene::mouseReleaseEvent(mouseEvent);
}
//! [13]
//! [14]
bool PicScene::isItemChange(int type)
{
foreach (QGraphicsItem *item, selectedItems()) {
if (item->type() == type)
return true;
}
return false;
}
//! [14]
void PicScene::keyPressEvent(QKeyEvent *event)
{
QGraphicsScene::keyPressEvent(event);
}
//edit@12-09
void PicScene::drawBackground(QPainter *painter, const QRectF &rect)
{
QGraphicsScene::drawBackground(painter,rect);
if(IsdrawBackground)
{
Q_UNUSED(rect);
QPen pen;
const qreal left=rect.left();
const qreal right=rect.right();
const qreal top=rect.top();
const qreal bottom=rect.bottom();
const int step=1;
//pen.setColor(QColor(60,60,60));
pen.setColor(Qt::lightGray);
//pen.setColor(Qt::darkCyan);
pen.setWidth(0);
//pen.setStyle(Qt::DashLine);
painter->setPen(pen);
//绘制横线
//绘制Y轴正半轴
for(int i=0;i>=top;i-=step)
{
painter->drawLine(left,i,right,i);
}
//绘制Y轴负半轴
for(int i=0;i<=bottom;i+=step)
{
painter->drawLine(left,i,right,i);
}
//绘制竖线
//绘制X轴正半轴
for(int i=0;i<=right;i+=step)
{
painter->drawLine(i,top,i,bottom);
}
//绘制X轴负半轴
for(int i=0;i>=left;i-=step)
{
painter->drawLine(i,top,i,bottom);
}
//edit@12-11
pen.setColor(Qt::green);
painter->setPen(pen);
QRectF BoundingRect=this->itemsBoundingRect();
BoundingRect.setHeight(32);
painter->drawRect(BoundingRect);
}
emit showTextWidthHeight();
}
//edit@12-09
void PicScene::setIsdrawBackground(bool newIsdrawBackground)
{
IsdrawBackground = newIsdrawBackground;
}
#include "picscene.h"
#include <QDebug>
#include <QRectF>
#include <QPainter>
#include <QGraphicsView>
PicScene::PicScene(QObject *parent) :
QGraphicsScene(parent),IsdrawBackground(false)
{
}
void PicScene::setMode(Mode mode)
{
myMode = mode;
}
void PicScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
if (mouseEvent->button() != Qt::LeftButton)
return;
QGraphicsScene::mousePressEvent(mouseEvent);
}
//! [9]
//! [10]
void PicScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
update();//edit@12-12
QGraphicsScene::mouseMoveEvent(mouseEvent);
}
//! [10]
//! [11]
void PicScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
QGraphicsScene::mouseReleaseEvent(mouseEvent);
}
//! [13]
//! [14]
bool PicScene::isItemChange(int type)
{
foreach (QGraphicsItem *item, selectedItems()) {
if (item->type() == type)
return true;
}
return false;
}
//! [14]
void PicScene::keyPressEvent(QKeyEvent *event)
{
QGraphicsScene::keyPressEvent(event);
}
//edit@12-09
void PicScene::drawBackground(QPainter *painter, const QRectF &rect)
{
QGraphicsScene::drawBackground(painter,rect);
if(IsdrawBackground)
{
Q_UNUSED(rect);
QPen pen;
const qreal left=rect.left();
const qreal right=rect.right();
const qreal top=rect.top();
const qreal bottom=rect.bottom();
const int step=1;
//pen.setColor(QColor(60,60,60));
pen.setColor(Qt::lightGray);
//pen.setColor(Qt::darkCyan);
pen.setWidth(0);
//pen.setStyle(Qt::DashLine);
painter->setPen(pen);
//绘制横线
//绘制Y轴正半轴
for(int i=0;i>=top;i-=step)
{
painter->drawLine(left,i,right,i);
}
//绘制Y轴负半轴
for(int i=0;i<=bottom;i+=step)
{
painter->drawLine(left,i,right,i);
}
//绘制竖线
//绘制X轴正半轴
for(int i=0;i<=right;i+=step)
{
painter->drawLine(i,top,i,bottom);
}
//绘制X轴负半轴
for(int i=0;i>=left;i-=step)
{
painter->drawLine(i,top,i,bottom);
}
//edit@12-11
pen.setColor(Qt::green);
painter->setPen(pen);
QRectF BoundingRect=this->itemsBoundingRect();
BoundingRect.setHeight(32);
painter->drawRect(BoundingRect);
}
emit showTextWidthHeight();
}
//edit@12-09
void PicScene::setIsdrawBackground(bool newIsdrawBackground)
{
IsdrawBackground = newIsdrawBackground;
}