gui changes for tool anwendung

This commit is contained in:
Sonaion
2019-12-19 14:33:28 +01:00
parent 71dd9aa7c2
commit 9bc45dedfd
4 changed files with 66 additions and 3 deletions

View File

@@ -195,7 +195,7 @@ void IntelliPhotoGui::slotSetActiveLayer(){
if (ok1) if (ok1)
{ {
paintingArea->setLayerToActive(layer); paintingArea->setLayerToActive(layer);
} }
} }
void IntelliPhotoGui::slotSetFirstColor(){ void IntelliPhotoGui::slotSetFirstColor(){
@@ -203,7 +203,7 @@ void IntelliPhotoGui::slotSetFirstColor(){
} }
void IntelliPhotoGui::slotSetSecondColor(){ void IntelliPhotoGui::slotSetSecondColor(){
paintingArea->colorPickerSetSecondColor(); paintingArea->colorPickerSetSecondColor();
} }
void IntelliPhotoGui::slotSwitchColor(){ void IntelliPhotoGui::slotSwitchColor(){
@@ -222,6 +222,22 @@ void IntelliPhotoGui::slotCreateLineTool(){
paintingArea->createLineTool(); paintingArea->createLineTool();
} }
void IntelliPhotoGui::slotCreateRectangleTool(){
paintingArea->createRectangleTool();
}
void IntelliPhotoGui::slotCreateCircleTool(){
paintingArea->createCircleTool();
}
void IntelliPhotoGui::slotCreatePolygonTool(){
paintingArea->createPolygonTool();
}
void IntelliPhotoGui::slotCreateFloodFillTool(){
paintingArea->createFloodFillTool();
}
// Open an about dialog // Open an about dialog
void IntelliPhotoGui::slotAboutDialog(){ void IntelliPhotoGui::slotAboutDialog(){
// Window title and text to display // Window title and text to display
@@ -326,6 +342,18 @@ void IntelliPhotoGui::createActions(){
actionCreateLineTool = new QAction(tr("&Line"), this); actionCreateLineTool = new QAction(tr("&Line"), this);
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool())); connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
actionCreateCircleTool = new QAction(tr("&Circle"), this);
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
// Create about action and tie to IntelliPhotoGui::about() // Create about action and tie to IntelliPhotoGui::about()
actionAboutDialog = new QAction(tr("&About"), this); actionAboutDialog = new QAction(tr("&About"), this);
connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog())); connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
@@ -377,6 +405,10 @@ void IntelliPhotoGui::createMenus(){
toolMenu->addAction(actionCreatePenTool); toolMenu->addAction(actionCreatePenTool);
toolMenu->addAction(actionCreatePlainTool); toolMenu->addAction(actionCreatePlainTool);
toolMenu->addAction(actionCreateLineTool); toolMenu->addAction(actionCreateLineTool);
toolMenu->addAction(actionCreateRectangleTool);
toolMenu->addAction(actionCreateCircleTool);
toolMenu->addAction(actionCreatePolygonTool);
toolMenu->addAction(actionCreateFloodFillTool);
toolMenu->addSeparator(); toolMenu->addSeparator();
toolMenu->addMenu(colorMenu); toolMenu->addMenu(colorMenu);

View File

@@ -55,6 +55,10 @@ private slots:
void slotCreatePenTool(); void slotCreatePenTool();
void slotCreatePlainTool(); void slotCreatePlainTool();
void slotCreateLineTool(); void slotCreateLineTool();
void slotCreateRectangleTool();
void slotCreateCircleTool();
void slotCreatePolygonTool();
void slotCreateFloodFillTool();
// slots for dialogs // slots for dialogs
void slotAboutDialog(); void slotAboutDialog();
@@ -99,6 +103,10 @@ private:
QAction *actionCreatePenTool; QAction *actionCreatePenTool;
QAction *actionCreatePlainTool; QAction *actionCreatePlainTool;
QAction *actionCreateLineTool; QAction *actionCreateLineTool;
QAction *actionCreateRectangleTool;
QAction *actionCreateCircleTool;
QAction *actionCreatePolygonTool;
QAction *actionCreateFloodFillTool;
// dialog actions // dialog actions
QAction *actionAboutDialog; QAction *actionAboutDialog;

View File

@@ -20,7 +20,7 @@
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent) PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
:QWidget(parent){ :QWidget(parent){
this->Tool = new IntelliToolPolygon(this, &colorPicker); this->Tool = nullptr;
this->setUp(maxWidth, maxHeight); this->setUp(maxWidth, maxHeight);
this->addLayer(200,200,0,0,ImageType::Shaped_Image); this->addLayer(200,200,0,0,ImageType::Shaped_Image);
layerBundle[0].image->drawPlain(QColor(0,0,255,255)); layerBundle[0].image->drawPlain(QColor(0,0,255,255));
@@ -192,6 +192,25 @@ void PaintingArea::createLineTool(){
Tool = new IntelliToolLine(this, &colorPicker); Tool = new IntelliToolLine(this, &colorPicker);
} }
void PaintingArea::createRectangleTool(){
delete this->Tool;
Tool = new IntelliToolRectangle(this, &colorPicker);
}
void PaintingArea::createCircleTool(){
delete this->Tool;
Tool = new IntelliToolCircle(this, &colorPicker);
}
void PaintingArea::createPolygonTool(){
delete this->Tool;
Tool = new IntelliToolPolygon(this, &colorPicker);
}
void PaintingArea::createFloodFillTool(){
delete this->Tool;
Tool = new IntelliToolFloodFill(this, &colorPicker);
}
int PaintingArea::getWidthOfActive(){ int PaintingArea::getWidthOfActive(){
return this->layerBundle[activeLayer].width; return this->layerBundle[activeLayer].width;
} }

View File

@@ -55,6 +55,10 @@ public:
void createPenTool(); void createPenTool();
void createPlainTool(); void createPlainTool();
void createLineTool(); void createLineTool();
void createRectangleTool();
void createCircleTool();
void createPolygonTool();
void createFloodFillTool();
int getWidthOfActive(); int getWidthOfActive();
int getHeightOfActive(); int getHeightOfActive();