Browse Source

Save pen and brush settings

tags/v5.0.0
ArsenArsen 5 years ago
parent
commit
c3f1c6bfaf
  1. 1
      cropeditor/cropeditor.cpp
  2. 6
      cropeditor/cropscene.cpp
  3. 5
      cropeditor/settings/brushpenselection.cpp

1
cropeditor/cropeditor.cpp

@ -6,6 +6,7 @@
#include <QGraphicsPixmapItem>
#include <QGraphicsView>
#include <QTimer>
#include <settings.hpp>
CropEditor::CropEditor(QPixmap *image, QObject *parent) : QObject(parent)
{

6
cropeditor/cropscene.cpp

@ -11,9 +11,15 @@
#include <cropeditor/drawing/lineitem.hpp>
#include <cropeditor/drawing/pathitem.hpp>
#include <cropeditor/settings/brushpenselection.hpp>
#include <settings.hpp>
CropScene::CropScene(QObject *parent, QPixmap *pixmap) : QGraphicsScene(parent), prevButtons(Qt::NoButton)
{
pen().setColor(settings::settings().value("penColor", pen().color()).value<QColor>());
pen().setCosmetic(settings::settings().value("penCosmetic", pen().isCosmetic()).toBool());
pen().setWidthF(settings::settings().value("penWidth", pen().widthF()).toFloat());
brush().setColor(settings::settings().value("brushColor", brush().color()).value<QColor>());
_pixmap = pixmap;
QTimer::singleShot(0, [&] {
QPolygonF poly;

5
cropeditor/settings/brushpenselection.cpp

@ -7,6 +7,7 @@
#include <QInputDialog>
#include <QSlider>
#include <cropeditor/cropview.hpp>
#include <settings.hpp>
BrushPenSelection::BrushPenSelection(CropScene *scene) : QDialog(), ui(new Ui::BrushPenSelection)
{
@ -40,6 +41,10 @@ void BrushPenSelection::on_buttonBox_accepted()
scene->pen().setCosmetic(ui->cosmetic->isChecked());
scene->pen().setWidthF(ui->widthSpinner->value());
scene->brush().setColor(brush);
settings::settings().setValue("penColor", scene->pen().color());
settings::settings().setValue("penCosmetic", scene->pen().isCosmetic());
settings::settings().setValue("penWidth", scene->pen().widthF());
settings::settings().setValue("brushColor", scene->brush().color());
close();
}

Loading…
Cancel
Save