Commit 8eeb0ef6 authored by Alexander A. Maly's avatar Alexander A. Maly

Added QMutex declaration to drawview

parent b04217d8
Pipeline #2825 passed with stages
in 3 minutes and 49 seconds
#include "drawview.h" #include "drawview.h"
#include "drawmodule.h" #include "drawmodule.h"
#include <QMutex>
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QMouseEvent> #include <QMouseEvent>
#include <QScrollBar> #include <QScrollBar>
#include <QLabel>
#include <QDebug> #include <QDebug>
...@@ -157,37 +159,27 @@ void DrawView::setNet() ...@@ -157,37 +159,27 @@ void DrawView::setNet()
DRAW->setNetStepX(stepX); DRAW->setNetStepX(stepX);
DRAW->setNetStepY(stepY); DRAW->setNetStepY(stepY);
DRAW->drawNet(); DRAW->drawNet();
} }
DRAW->setNetStepX(stepX); DRAW->setNetStepX(stepX);
DRAW->setNetStepY(stepY); DRAW->setNetStepY(stepY);
lastStep = stepX;
qDebug() << "c_scale" << c_scale << "NetStep" << DRAW->NetStepX() << "PPC" << pixel_per_cell; qDebug() << "c_scale" << c_scale << "NetStep" << DRAW->NetStepX() << "PPC" << pixel_per_cell;
update(); update();
} else { } else {
double pixel_per_cell = DRAW->NetStepX() / (1 / c_scale); double pixel_per_cell = DRAW->NetStepX() / (1 / c_scale);
//if(!net)pixel_per_cell=lastStep/(1/c_scale);
if (pixel_per_cell < 15) { //Net step too short if (pixel_per_cell < 15) { //Net step too short
net = false; net = false;
smallNetLabel->show(); smallNetLabel->show();
// lastStep=DRAW->NetStepX();
} else { } else {
if (pixel_per_cell > 15 && !net && pixel_per_cell < this->width() * 2) { if (pixel_per_cell > 15 && !net && pixel_per_cell < this->width() * 2) {
net = true; net = true;
smallNetLabel->hide(); smallNetLabel->hide();
// DRAW->setNetStepX(lastStep);
// DRAW->setNetStepY(lastStep);
} }
if (pixel_per_cell > this->width() * 2) { if (pixel_per_cell > this->width() * 2) {
net = false; net = false;
} }
} }
} }
}; }
void DrawView::wheelEvent(QWheelEvent *event) void DrawView::wheelEvent(QWheelEvent *event)
{ {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#define DRAWVIEW_H #define DRAWVIEW_H
#include <QGraphicsView> #include <QGraphicsView>
#include <QLabel>
class QLabel; class QLabel;
class QMutex;
namespace ActorDraw namespace ActorDraw
{ {
...@@ -42,13 +42,12 @@ protected: ...@@ -42,13 +42,12 @@ protected:
private: private:
DrawModule *DRAW; DrawModule *DRAW;
QMutex *dr_mutex;
double c_scale; double c_scale;
bool pressed; bool pressed;
bool net; bool net;
QPoint press_pos; QPoint press_pos;
bool firstResize; bool firstResize;
double lastStep;
QMutex *dr_mutex;
QLabel *smallNetLabel; QLabel *smallNetLabel;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment