Пример #1
0
void MainWindow::exportAsPictureSlot()
{
    QString supportedFormats("");
    QString supportedFormatsFilter("Images (");
    foreach(QByteArray name,QImageWriter::supportedImageFormats())
        supportedFormats +=  name + " ";
    supportedFormatsFilter+= "));;SVG files (*.svg);;All files (*)";
    QString sOpenedFileBasename = d->m_sOpenedFile.size() ? QFileInfo(d->m_sOpenedFile).baseName() : "untitled";


    QString sFilename = QFileDialog::getSaveFileName(this, "Save as picture as: " + supportedFormats, sOpenedFileBasename + ".png",
                                                     supportedFormatsFilter);
    if(sFilename.size()) {
        QByteArray ext = QFileInfo(sFilename).suffix().toLower().toLatin1();
        if (ext == "svg" || QImageWriter::supportedImageFormats().contains(ext)) {
            canvasWidget()->exportToPicture(sFilename);
        } else {
            QMessageBox::warning(this,"Picture was not exported", "Your system supports only following formats: " + supportedFormats);
        }
    }
}
Пример #2
0
QVideoFormatList QPxaVideoOutputFactory::preferredFormats()
{
    return supportedFormats();
}