This commit is contained in:
AshBastian
2020-01-10 12:28:55 +01:00
parent 048fae53fb
commit 74d2d30fe0
4 changed files with 43 additions and 25 deletions

View File

@@ -46,7 +46,7 @@ void IntelliPhotoGui::slotOpen(){
// If we have a file name load the image and place // If we have a file name load the image and place
// it in the paintingArea // it in the paintingArea
if (!fileName.isEmpty()){ if (!fileName.isEmpty())
paintingArea->open(fileName); paintingArea->open(fileName);
UpdateGui(); UpdateGui();
} }
@@ -636,10 +636,10 @@ void IntelliPhotoGui::createGui(){
WidthLine = new QLabel(); WidthLine = new QLabel();
WidthLine->setText("Width"); WidthLine->setText("Width");
WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); WidthLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
EditLineWidth = new QLineEdit(); EditLineWidth = new QLineEdit();
EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); EditLineWidth->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
EditLineWidth->setText("5"); EditLineWidth->setText("5");
ValidatorLineWidth = new QIntValidator(); ValidatorLineWidth = new QIntValidator();
ValidatorLineWidth->setTop(99); ValidatorLineWidth->setTop(99);
@@ -648,10 +648,10 @@ void IntelliPhotoGui::createGui(){
innerAlphaLine = new QLabel(); innerAlphaLine = new QLabel();
innerAlphaLine->setText("Inner Alpha"); innerAlphaLine->setText("Inner Alpha");
innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); innerAlphaLine->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
EditLineInnerAlpha = new QLineEdit(); EditLineInnerAlpha = new QLineEdit();
EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3); EditLineInnerAlpha->setFixedSize(Buttonsize.width()*2,(Buttonsize.height()*2)/3);
EditLineInnerAlpha->setText("255"); EditLineInnerAlpha->setText("255");
ValidatorInnerAlpha = new QIntValidator(); ValidatorInnerAlpha = new QIntValidator();
ValidatorInnerAlpha->setTop(999); ValidatorInnerAlpha->setTop(999);
@@ -659,21 +659,21 @@ void IntelliPhotoGui::createGui(){
EditLineInnerAlpha->setValidator(ValidatorInnerAlpha); EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
FirstColorButton = new QPushButton(); FirstColorButton = new QPushButton();
FirstColorButton->setFixedSize(Buttonsize/2); FirstColorButton->setFixedSize(Buttonsize);
SecondColorButton = new QPushButton(); SecondColorButton = new QPushButton();
SecondColorButton->setFixedSize(Buttonsize/2); SecondColorButton->setFixedSize(Buttonsize);
preview = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png"); preview = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png");
SwitchColorButton = new QPushButton(); SwitchColorButton = new QPushButton();
SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2); SwitchColorButton->setFixedSize(Buttonsize.width()*2,Buttonsize.height());
SwitchColorButton->setIcon(preview); SwitchColorButton->setIcon(preview);
SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2)); SwitchColorButton->setIconSize(QSize(Buttonsize.width()*2,Buttonsize.height()));
ActiveLayerLine = new QLabel(); ActiveLayerLine = new QLabel();
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1); QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
ActiveLayerLine->setText(string); ActiveLayerLine->setText(string);
ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3); ActiveLayerLine->setFixedSize(Buttonsize.width()*2+10,(Buttonsize.height()*2)/3);
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer(); IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
if(activePicture){ if(activePicture){
@@ -707,6 +707,7 @@ void IntelliPhotoGui::createGui(){
mainLayout->addWidget(SwitchColorButton,13,2,1,2); mainLayout->addWidget(SwitchColorButton,13,2,1,2);
mainLayout->addWidget(ActiveLayerLine,14,2,1,2); mainLayout->addWidget(ActiveLayerLine,14,2,1,2);
mainLayout->addWidget(ActiveLayerImageLine,15,2,1,2); mainLayout->addWidget(ActiveLayerImageLine,15,2,1,2);
mainLayout->setHorizontalSpacing(0);
} }
void IntelliPhotoGui::setIntelliStyle(){ void IntelliPhotoGui::setIntelliStyle(){
@@ -799,6 +800,19 @@ void IntelliPhotoGui::setDefaultToolValue(){
slotEnterPressed(); slotEnterPressed();
} }
void IntelliPhotoGui::setToolWidth(int value){
if(value < 1){
value = 1;
}else if(value > 50){
value = 50;
}
EditLineWidth->setText(QString("%1").arg(value));
}
int IntelliPhotoGui::getToolWidth(){
return EditLineWidth->text().toInt();
}
void IntelliPhotoGui::UpdateGui(){ void IntelliPhotoGui::UpdateGui(){
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1); QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
ActiveLayerLine->setText(string); ActiveLayerLine->setText(string);

View File

@@ -34,6 +34,9 @@ IntelliPhotoGui();
void UpdateGui(); void UpdateGui();
void setToolWidth(int value);
int getToolWidth();
protected: protected:
// Function used to close an event // Function used to close an event
void closeEvent(QCloseEvent*event) override; void closeEvent(QCloseEvent*event) override;
@@ -103,7 +106,7 @@ void setDefaultToolValue();
// What we'll draw on // What we'll draw on
PaintingArea* paintingArea; PaintingArea* paintingArea;
const QSize Buttonsize = QSize(70,70); const QSize Buttonsize = QSize(35,35);
QPixmap preview; QPixmap preview;
QPushButton* CircleButton; QPushButton* CircleButton;
QPushButton* FloodFillButton; QPushButton* FloodFillButton;

View File

@@ -46,6 +46,7 @@ void IntelliTool::onMouseMoved(int x, int y){
void IntelliTool::onWheelScrolled(int value){ void IntelliTool::onWheelScrolled(int value){
//if needed for future general tasks implement in here //if needed for future general tasks implement in here
Area->DummyGui->setToolWidth(value+Area->DummyGui->getToolWidth());
} }
bool IntelliTool::createToolLayer(){ bool IntelliTool::createToolLayer(){