示例#1
0
void PageScreen::dialogAccepted()
{
    if (!ui->location->text().isEmpty()) {
        if (QFile::exists(ui->location->text())) {
            const QString &text = tr("File '%1' already exists. Do you want to overwrite it?").arg(ui->location->text());
            QMessageBox::StandardButton button = QMessageBox::warning(this, tr("File already exists"), text,
                                                 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);

            if (button != QMessageBox::Yes) {
                return;
            }
        }

        QApplication::setOverrideCursor(Qt::WaitCursor);

        const QString &format = m_formats[ui->formats->currentIndex()];
        if (format == QLatin1String("PDF")) {
            saveAsDocument(format);
        }
        else {
            saveAsImage(format);
        }

        QApplication::restoreOverrideCursor();

        close();
    }
}
示例#2
0
Plotter::Plotter(QWidget *parent)
    : QWidget(parent)
{
    backgroundColor = Qt::black;
    textColor = Qt::blue;
    gridColor = Qt::gray;
    noOfCurves = 0;
    noOfPoints = 99;
    minY = 0;
    maxY = 100;
    this->numXTicks = 10;
    this->numYTicks = 10;
    showGrid = false;

    maximizeButton = new QToolButton(this);
    maximizeButton->setCheckable(true);
    maximizeButton->setIcon(QIcon(":images/maximize.png"));
    maximizeButton->setToolTip("Maximize");
    maximizeButton->setIconSize(QSize(35,35));
    maximizeButton->adjustSize();

    curvePenButton = new QToolButton(this);
    curvePenButton->setIcon(QIcon(":images/style.png"));
    curvePenButton->setToolTip("Change color Settings");
    curvePenButton->setIconSize(QSize(35,35));
    curvePenButton->adjustSize();

    savePictureButton = new QToolButton(this);
    savePictureButton->setIcon(QIcon(":images/image-x-generic.png"));
    savePictureButton->setToolTip("Save as Image");
    savePictureButton->setIconSize(QSize(35,35));
    savePictureButton->adjustSize();

    gridButton = new QToolButton(this);
    gridButton->setIcon(QIcon(":images/grid.png"));
    gridButton->setToolTip("Show/Hide Grid");
    gridButton->setIconSize(QSize(35,35));
    gridButton->setCheckable(true);
    gridButton->adjustSize();

    antiAliasing = true;
    connect(maximizeButton,SIGNAL(clicked()),this,SIGNAL(maximizeButtonSignal()));
    connect(maximizeButton,SIGNAL(clicked()),this,SLOT(maximizeButtonSlot()));
    connect(curvePenButton,SIGNAL(clicked()),this,SLOT(changePlotSettingSlot()));
    connect(savePictureButton,SIGNAL(clicked()),this,SLOT(saveAsImage()));
    connect(gridButton,SIGNAL(clicked()),this,SLOT(gridButtonSlot()));

    this->loadSettings();
}
示例#3
0
void ObserverTable::save(std::string file, std::string extension)
{
      saveAsImage(file, extension);
}
void ObserverTextScreen::save(std::string file, std::string extension)
{
      saveAsImage(file, extension);
}
示例#5
0
void Ui::Ui_MainWindow::saveImageAction(){
	saveAsImage(QFileDialog::getSaveFileName(this,"Save to...","","Images (*.jpg *.jpeg *.png *.tiff *.bmp *.xpm *.ppm *.xbm)"));
}