Absturz behoben

Bei Mausraddrehen kam es zu Absturz, wenn Tool nullptr, weil Zugriff auf Tool
This commit is contained in:
AshBastian
2020-01-07 16:03:54 +01:00
parent 2aa49f1b79
commit c06a4aa87e
2 changed files with 9 additions and 7 deletions

View File

@@ -277,11 +277,13 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
} }
void PaintingArea::wheelEvent(QWheelEvent*event){ void PaintingArea::wheelEvent(QWheelEvent*event){
if(this->Tool != nullptr){
QPoint numDegrees = event->angleDelta() / 8; QPoint numDegrees = event->angleDelta() / 8;
if(!numDegrees.isNull()) { if(!numDegrees.isNull()) {
QPoint numSteps = numDegrees / 15; QPoint numSteps = numDegrees / 15;
Tool->onWheelScrolled(numSteps.y()* -1); Tool->onWheelScrolled(numSteps.y()* -1);
} }
}
} }
// QPainter provides functions to draw on the widget // QPainter provides functions to draw on the widget

View File

@@ -107,7 +107,7 @@ bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
bool isNear = false; bool isNear = false;
int StartX = Startpoint.x(); int StartX = Startpoint.x();
int StartY = Startpoint.y(); int StartY = Startpoint.y();
int valueToNear = 10; int valueToNear = 5;
for(int i = StartX - valueToNear; i < StartX + valueToNear; i++) { for(int i = StartX - valueToNear; i < StartX + valueToNear; i++) {
for(int j = StartY - valueToNear; j < StartY + valueToNear; j++) { for(int j = StartY - valueToNear; j < StartY + valueToNear; j++) {