代码拉取完成,页面将自动刷新
#include "tikzexportwindow.h"
#include "ui_tikzexportwindow.h"
#include <QFile>
#include <QFileDialog>
#include <QTextStream>
#include <QBuffer>
TikzExportWindow::TikzExportWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::TikzExportWindow)
{
ui->setupUi(this);
}
void TikzExportWindow::on_exportButton_clicked()
{
exportToTikZ();
close();
}
void TikzExportWindow::on_toGrid_clicked()
{
settings.snapToGrid = ui->toGrid->isChecked();
updateSettings();
}
void TikzExportWindow::on_toBW_clicked()
{
settings.setBW = ui->toBW->isChecked();
updateSettings();
}
void TikzExportWindow::on_toPlain_clicked()
{
settings.plainText = ui->toPlain->isChecked();
updateSettings();
}
void TikzExportWindow::on_saveButton_clicked()
{
QVariantMap globalSettings;
//QString filename = QFileDialog::getSaveFileName(this, tr("Save Playlist"), "", tr("Playlist Files (*.yuvplaylist)"));
QString filename = "settings.tikzexport";
globalSettings["toGrid"] = settings.snapToGrid;
globalSettings["toBW"] = settings.setBW;
globalSettings["toPlain"] = settings.plainText;
QString plistFileContents = PListSerializer::toPList(globalSettings);
QFile file( filename );
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream outStream(&file);
outStream << plistFileContents;
file.close();
}
void TikzExportWindow::on_importButton_clicked()
{
QFile file("settings.tikzexport");
if (!file.open(QIODevice::ReadOnly))
return;
QByteArray fileBytes = file.readAll();
QBuffer buffer(&fileBytes);
QVariantMap map = PListParser::parsePList(&buffer).toMap();
bool bw = map["toBW"].toBool();
bool grid = map["toGrid"].toBool();
bool plain = map["toPlain"].toBool();
settings.setBW = bw;
settings.plainText = plain;
settings.snapToGrid = grid;
ui->toBW->setChecked(bw);
ui->toPlain->setChecked(plain);
ui->toGrid->setChecked(grid);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。