Save pen and brush settings

This commit is contained in:
ArsenArsen 2017-05-02 15:47:08 +02:00
parent 2f247db776
commit c3f1c6bfaf
3 changed files with 12 additions and 0 deletions

View File

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

View File

@ -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;

View File

@ -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();
}