mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-14 20:30:32 +02:00
Tool structure- input bug
This commit is contained in:
@@ -12,12 +12,24 @@ IntelliTool::~IntelliTool(){
|
||||
|
||||
|
||||
void IntelliTool::onMouseRightPressed(int x, int y){
|
||||
this->drawing=true;
|
||||
//create drawing layer
|
||||
this->createToolLayer();
|
||||
if(drawing){
|
||||
drawing=false;
|
||||
this->deleteToolLayer();
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseRightReleased(int x, int y){
|
||||
//optional for tool
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseLeftPressed(int x, int y){
|
||||
this->drawing=true;
|
||||
//create drawing layer
|
||||
this->createToolLayer();
|
||||
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseLeftReleased(int x, int y){
|
||||
if(drawing){
|
||||
drawing=false;
|
||||
this->mergeToolLayer();
|
||||
@@ -25,17 +37,6 @@ void IntelliTool::onMouseRightReleased(int x, int y){
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseLeftPressed(int x, int y){
|
||||
if(drawing){
|
||||
drawing=false;
|
||||
this->deleteToolLayer();
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseLeftReleased(int x, int y){
|
||||
//optional for tool
|
||||
}
|
||||
|
||||
void IntelliTool::onMouseMoved(int x, int y){
|
||||
//optional for tool
|
||||
}
|
||||
|
||||
42
src/Painting/Tool/IntelliToolPen.cpp
Normal file
42
src/Painting/Tool/IntelliToolPen.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include"IntelliToolPen.h"
|
||||
#include"Layer/PaintingArea.h"
|
||||
#include"QDebug"
|
||||
|
||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area)
|
||||
:IntelliTool(Area){
|
||||
|
||||
}
|
||||
|
||||
IntelliToolPen::~IntelliToolPen(){
|
||||
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
//implement in here
|
||||
this->point=QPoint(x,y);
|
||||
this->Canvas->image->drawPixel(point, QColor(255,0,0,255));
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseRightReleased(int x, int y){
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
//implemnt in here
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseLeftPressed(int x, int y){
|
||||
//implement in here
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseLeftReleased(int x, int y){
|
||||
//implement in here
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseMoved(int x, int y){
|
||||
if(this->drawing){
|
||||
QPoint newPoint(x,y);
|
||||
this->Canvas->image->drawLine(this->point, newPoint, QColor(255,0,0,255), 2);
|
||||
this->point=newPoint;
|
||||
}
|
||||
}
|
||||
23
src/Painting/Tool/IntelliToolPen.h
Normal file
23
src/Painting/Tool/IntelliToolPen.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef INTELLITOOLPEN_H
|
||||
#define INTELLITOOLPEN_H
|
||||
|
||||
#include"IntelliTool.h"
|
||||
#include"QColor"
|
||||
#include"QPoint"
|
||||
|
||||
class IntelliToolPen : public IntelliTool{
|
||||
QColor clr;
|
||||
QPoint point;
|
||||
public:
|
||||
IntelliToolPen(PaintingArea* Area);
|
||||
virtual ~IntelliToolPen() override;
|
||||
|
||||
virtual void onMouseRightPressed(int x, int y) override;
|
||||
virtual void onMouseRightReleased(int x, int y) override;
|
||||
virtual void onMouseLeftPressed(int x, int y) override;
|
||||
virtual void onMouseLeftReleased(int x, int y) override;
|
||||
|
||||
virtual void onMouseMoved(int x, int y) override;
|
||||
};
|
||||
|
||||
#endif // INTELLITOOLPEN_H
|
||||
Reference in New Issue
Block a user