File: propertyeditdialog.cpp

package info (click to toggle)
vibes 0.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,684 kB
  • sloc: cpp: 6,120; python: 412; makefile: 214; sh: 13
file content (39 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "propertyeditdialog.h"
#include "ui_propertyeditdialog.h"

#include <QDebug>

PropertyEditDialog::PropertyEditDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PropertyEditDialog)
{
    ui->setupUi(this);
}

PropertyEditDialog::~PropertyEditDialog()
{
    delete ui;
}

QJsonObject PropertyEditDialog::showEditorForJson(QJsonObject init)
{
    PropertyEditDialog *dlg = new PropertyEditDialog();
    dlg->ui->comboBox_LineStyle->setCurrentText(init["LineStyle"].toString());
    dlg->ui->comboBox_FaceColor->setCurrentText(init["FaceColor"].toString());
    dlg->ui->comboBox_EdgeColor->setCurrentText(init["EdgeColor"].toString());
    dlg->ui->lineEdit_LineWidth->setText(init["LineWidth"].toString());

    QJsonObject json;

    if (dlg->exec() == Accepted)
    {
        json["LineStyle"] = QJsonValue(dlg->ui->comboBox_LineStyle->currentText());
        json["FaceColor"] = QJsonValue(dlg->ui->comboBox_FaceColor->currentText());
        json["EdgeColor"] = QJsonValue(dlg->ui->comboBox_EdgeColor->currentText());
        json["LineWidth"] = QJsonValue(dlg->ui->lineEdit_LineWidth->text());
    }

    // qDebug() << "dlg json result" << json;

    return json;
}