当前位置: 首页>>代码示例>>C++>>正文


C++ QSvgGenerator::setDescription方法代码示例

本文整理汇总了C++中QSvgGenerator::setDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ QSvgGenerator::setDescription方法的具体用法?C++ QSvgGenerator::setDescription怎么用?C++ QSvgGenerator::setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSvgGenerator的用法示例。


在下文中一共展示了QSvgGenerator::setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convertSvm

bool ExportHtml::convertSvm(QByteArray &input, QByteArray &output, QSize size)
{

    QBuffer *outBuf = new QBuffer(&output);
    QSvgGenerator generator;
    generator.setOutputDevice(outBuf);
    generator.setSize(QSize(200, 200));
    generator.setTitle("Svg image");
    generator.setDescription("This is an svg image that is converted from svm by Calligra");

    Libsvm::SvmParser  svmParser;

    QPainter painter;

    if (!painter.begin(&generator)) {
        kDebug(30503) << "Can not open the painter";
        return false;
    }

    painter.scale(50,50);
    Libsvm::SvmPainterBackend svmPainterBackend(&painter, size);
    svmParser.setBackend(&svmPainterBackend);
    if (!svmParser.parse(input)) {
        kDebug(30503) << "Can not Parse the Svm file";
        return false;
    }
    painter.end();

    return true;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:30,代码来源:exporthtml.cpp

示例2: convertWmf

bool ExportHtml::convertWmf(QByteArray &input, QByteArray &output, QSizeF size)
{
    QBuffer *outBuf = new QBuffer(&output);
    QSvgGenerator generator;
    generator.setOutputDevice(outBuf);
    generator.setSize(QSize(200, 200));
    generator.setTitle("Svg image");
    generator.setDescription("This is an svg image that is converted from WMF by Calligra");

    QPainter painter;

    if (!painter.begin(&generator)) {
        kDebug(30503) << "Can not open the painter";
        return false;
    }

    painter.scale(50,50);
    Libwmf::WmfPainterBackend  wmfPainter(&painter, size);
    if (!wmfPainter.load(input)) {
        kDebug(30503) << "Can not Parse the WMF file";
        return false;
    }

    // Actually paint the WMF.
    painter.save();
    wmfPainter.play();
    painter.restore();
    painter.end();

    return true;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:31,代码来源:exporthtml.cpp

示例3: saveSvg

void ExportWizard::saveSvg()
{
    if (m_ui->svgFilePath->text().isEmpty()) {
        QMessageBox::warning(this, tr("No file selected !"), tr("You need to choose a file path for saving."));
        return;
    }
    QString svgFilePath = m_ui->svgFilePath->text();

    // get the rendering size
    QRect svgRect(m_canvas->sceneRect().toRect());

    // create the SVG writer
    QSvgGenerator generator;
    generator.setFileName(svgFilePath);
    generator.setSize(svgRect.size());
    generator.setResolution(physicalDpiX());
    generator.setViewBox(svgRect);
    generator.setTitle(m_canvas->titleText());
    generator.setDescription(tr("Created with %1").arg(QCoreApplication::applicationName() + " " + QCoreApplication::applicationVersion()));

    // paint over the writer
    QPainter painter(&generator);
    painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform, true);
    m_canvas->renderVisible(&painter, svgRect, svgRect, Qt::IgnoreAspectRatio, !m_ui->svgAsIsBox->isChecked());
    painter.end();
}
开发者ID:arielmr,项目名称:fotowall,代码行数:26,代码来源:ExportWizard.cpp

示例4: exportSvg

void ExportImageDialog::exportSvg(const QString &fileName)
{
    SkyMap *map = m_KStars->map();

    // export as SVG
    QSvgGenerator svgGenerator;
    svgGenerator.setFileName(fileName);
    svgGenerator.setTitle(i18n("KStars Exported Sky Image"));
    svgGenerator.setDescription(i18n("KStars Exported Sky Image"));
    svgGenerator.setSize(QSize(map->width(), map->height()));
    svgGenerator.setResolution(qMax(map->logicalDpiX(), map->logicalDpiY()));
    svgGenerator.setViewBox(QRect(0, 0, map->width(), map->height()));

    SkyQPainter painter(m_KStars, &svgGenerator);
    painter.begin();

    map->exportSkyImage(&painter);

    if(m_DialogUI->addLegendCheckBox->isChecked())
    {
        addLegend(&painter);
    }

    painter.end();
}
开发者ID:monisha4,项目名称:kstars-hackfest,代码行数:25,代码来源:exportimagedialog.cpp

示例5: saveSvg

//! [save SVG]
void Window::saveSvg()
{
    QString newPath = QFileDialog::getSaveFileName(this, tr("Save SVG"),
        path, tr("SVG files (*.svg)"));

    if (newPath.isEmpty())
        return;

    path = newPath;

//![configure SVG generator]
    QSvgGenerator generator;
    generator.setFileName(path);
    generator.setSize(QSize(200, 200));
    generator.setViewBox(QRect(0, 0, 200, 200));
    generator.setTitle(tr("SVG Generator Example Drawing"));
    generator.setDescription(tr("An SVG drawing created by the SVG Generator "
                                "Example provided with Qt."));
//![configure SVG generator]
//![begin painting]
    QPainter painter;
    painter.begin(&generator);
//![begin painting]
    displayWidget->paint(painter);
//![end painting]
    painter.end();
//![end painting]
}
开发者ID:Afreeca,项目名称:qt,代码行数:29,代码来源:window.cpp

示例6: tr

void struct3d::saveImage() {
//	view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
//	QPixmap pixmap(view->size());
//	QPainter painter(&pixmap);
//	painter.setRenderHint(QPainter::Antialiasing);
//	view->render(&painter);
//	pixmap.save(QApplication::applicationDirPath() + "/image.png", "PNG",100);
	QString fileName = QFileDialog::getSaveFileName((QWidget *) this,
										 tr("Save as:"),
										 "structure.svg",
										 tr("SVG files (*.svg);;All Files (*)"));

	QRectF rect = scene->sceneRect();
	QSvgGenerator generator;
	generator.setFileName(fileName);
	generator.setSize(QSize(scene->sceneRect().width(), scene->sceneRect().height()));
	generator.setViewBox(scene->sceneRect());
	generator.setTitle(tr("Title"));
	generator.setDescription(tr("Description"));
	QPainter painter;
	painter.begin(&generator);
	scene->render(&painter, QRectF(), rect);
	painter.end();

}
开发者ID:serj129,项目名称:macro_structures,代码行数:25,代码来源:struct3d.cpp

示例7: convertEmf

bool ExportHtml::convertEmf(QByteArray &input, QByteArray &output, QSize size)
{
    QBuffer *outBuf = new QBuffer(&output);
    QSvgGenerator generator;
    generator.setOutputDevice(outBuf);
    generator.setSize(QSize(200, 200));
    generator.setTitle("Svg image");
    generator.setDescription("This is an svg image that is converted from EMF by Calligra");

    Libemf::Parser  emfParser;

    QPainter painter;

    if (!painter.begin(&generator)) {
        kDebug(30503) << "Can not open the painter";
        return false;
    }

    painter.scale(50,50);
    Libemf::OutputPainterStrategy  emfPaintOutput(painter, size, true );
    emfParser.setOutput( &emfPaintOutput );
    if (!emfParser.load(input)) {
        kDebug(30503) << "Can not Parse the EMF file";
        return false;
    }
    painter.end();

    return true;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:29,代码来源:exporthtml.cpp

示例8: setupGenerator

	void setupGenerator(QSvgGenerator& generator, QString& templateName)
	{
		generator.setFileName(templateName + ".svg");
		generator.setSize(QSize(256, 256));
		generator.setViewBox(QRectF(0, 0, 256, 256));
		generator.setTitle("VPL " + templateName);
		generator.setDescription("This image was generated by an helper tool part of Aseba, get it at http://thymio.org");

	}
开发者ID:aseba-community,项目名称:aseba,代码行数:9,代码来源:rendervplblocks.cpp

示例9: saveSvg

void QGVPage::saveSvg(QString filename)
{
    // TODO: We only have m_vpPage because constructor gets passed a view provider...
    //NOTE: this makes wrong size pages in low-Rez
    TechDraw::DrawPage *page( m_vpPage->getDrawPage() );

    const QString docName( QString::fromUtf8(page->getDocument()->getName()) );
    const QString pageName( QString::fromUtf8(page->getNameInDocument()) );
    QString svgDescription = tr("Drawing page: ") +
                             pageName +
                             tr(" exported from FreeCAD document: ") +
                             docName;


    QSvgGenerator svgGen;
    svgGen.setFileName(filename);
    svgGen.setSize(QSize((int) Rez::guiX(page->getPageWidth()), (int) Rez::guiX(page->getPageHeight())));   //expects pixels, gets mm
    //"By default this property is set to QSize(-1, -1), which indicates that the generator should not output 
    // the width and height attributes of the <svg> element."  >> but Inkscape won't read it without size info??
    svgGen.setViewBox(QRect(0, 0, Rez::guiX(page->getPageWidth()), Rez::guiX(page->getPageHeight())));
    
    svgGen.setResolution(Rez::guiX(25.4));    // docs say this is DPI. 1dot/mm so 25.4dpi

    svgGen.setTitle(QObject::tr("FreeCAD SVG Export"));
    svgGen.setDescription(svgDescription);

    Gui::Selection().clearSelection();

    toggleMarkers(false);             //fiddle cache, vertices, frames, etc
    toggleHatch(false);
    scene()->update();
    viewport()->repaint();

    double width  =  Rez::guiX(page->getPageWidth());
    double height =  Rez::guiX(page->getPageHeight());
    QRectF sourceRect(0.0,-height,width,height);
    QRectF targetRect;

    Gui::Selection().clearSelection();
    QPainter p;

    p.begin(&svgGen);
    scene()->render(&p, targetRect,sourceRect);
    p.end();

    toggleMarkers(true);
    toggleHatch(true);
    scene()->update();
    viewport()->repaint();
}
开发者ID:peterl94,项目名称:FreeCAD_sf_master,代码行数:50,代码来源:QGVPage.cpp

示例10: svgSave

// Save the file in the editor to a file at fileName
void svgSave(const QString &fileName, NoteEditor *editor)
{
    QSvgGenerator generator;
    generator.setFileName(fileName);
    generator.setSize(editor->size());
    generator.setViewBox(QRect(0, 0, editor->width(), editor->height()));
    generator.setTitle("Ink");
    generator.setDescription("ThreeRing ink");

    QPainter painter;
    painter.begin(&generator);
    editor->paint(painter);
    painter.end();
}
开发者ID:aarmea,项目名称:ThreeRing,代码行数:15,代码来源:svgfileio.cpp

示例11: Write

void DrawSVG::Write(QString filename)
{
	if(!canvas) return;
	QSvgGenerator generator;
	generator.setFileName(filename);
	generator.setSize(QSize(canvas->width(), canvas->height()));
	generator.setTitle("MLDemos screenshot");
	generator.setDescription("Generated with MLDemos");
	QPainter painter;
	painter.begin(&generator);
	// we need to paint the different layers:
	// confidence map
	// samples + trajectories + reward
	canvas->PaintStandard(painter, true);
    if(canvas->bDisplayLearned)
	{
		// learned model
        painter.setBackgroundMode(Qt::TransparentMode);
        if(classifier) DrawClassificationSamples(canvas, painter, classifier, classifierMulti);
		if(regressor) drawRegr->DrawModel(canvas, painter, regressor);
		if(dynamical) drawDyn->DrawModel(canvas, painter, dynamical);
        if(clusterer) drawClust->DrawModel(canvas, painter, clusterer);
        if(projector) drawProj->DrawModel(canvas, painter, projector);
        if(dynamical)
		{
			int cnt = 10000; // not too many or it will make unreadable files
			int steps = 8;
			VectorsFast(cnt, steps, painter);
		}
		if(maximizer)
		{
			Maximization(painter);
		}
	}

	if(canvas->bDisplayInfo)
	{
		// model info
        painter.setBackgroundMode(Qt::TransparentMode);
        if(classifier) drawClass->DrawInfo(canvas, painter, classifier);
		if(regressor) drawRegr->DrawInfo(canvas, painter, regressor);
		if(dynamical) drawDyn->DrawInfo(canvas, painter, dynamical);
		if(clusterer) drawClust->DrawInfo(canvas, painter, clusterer);
        if(projector) drawProj->DrawInfo(canvas, painter, projector);
    }
	painter.end();
}
开发者ID:aadaa88,项目名称:mldemos,代码行数:47,代码来源:drawSVG.cpp

示例12: image

void Figure2D::exportGraphics(QString fileName)
{
    // Open file save dialog if no filename given
    if (fileName.isEmpty())
        fileName = QFileDialog::getSaveFileName(this, tr("Export VIBes graphics"),
                QString(), tr("Portable Network Graphics (*.png);;"
                              "Joint Photographic Experts Group (*.jpg *.jpeg);;"
                              "Windows Bitmap (*.bmp);;"
                              "Scalable Vector Graphics (*.svg)"));

    // Abort if no file selected
    if (fileName.isEmpty())
        return;

    // Append .png if no extension was specified
    if (fileName.indexOf('.',1) < 0) // Search '.' from the second character (*nix hidden files start with a dot)
        fileName.append(".png");

    // Save as raster
    if (fileName.endsWith(".jpg", Qt::CaseInsensitive)
            || fileName.endsWith(".jpeg", Qt::CaseInsensitive)
            || fileName.endsWith(".png", Qt::CaseInsensitive)
            || fileName.endsWith(".bmp", Qt::CaseInsensitive))
    {
        QImage image(this->size()*2, QImage::Format_ARGB32);
        image.fill(QColor(255,255,255,0));
        QPainter painter;
        painter.begin(&image);
        this->render(&painter);
        painter.end();
        image.save(fileName);
    }
    // Save as vector (SVG)
    else if (fileName.endsWith(".svg", Qt::CaseInsensitive))
    {
        QSvgGenerator generator;
        generator.setFileName(fileName);
        generator.setSize(this->size());
        generator.setViewBox(QRect(QPoint(0,0),this->size()));
        generator.setTitle(tr("VIBes figure"));
        generator.setDescription(tr("Graphics generated with VIBes on %1.").arg(QDateTime::currentDateTime().toString()));
        QPainter painter;
        painter.begin(&generator);
        this->render(&painter);
        painter.end();
    }
}
开发者ID:schvarcz,项目名称:VIBES,代码行数:47,代码来源:figure2d.cpp

示例13: QPaintEvent

  void Spectrum1DWidget::saveAsImage()
  {
    QString file_name = QFileDialog::getSaveFileName(this, "Save File", "", "Raster images *.bmp *.png *.jpg *.gif (*.bmp *.png *.jpg *.gif);;Vector images *.svg (*.svg)");
    bool x_visible = x_scrollbar_->isVisible();
    bool y_visible = y_scrollbar_->isVisible();
    x_scrollbar_->hide();
    y_scrollbar_->hide();

    if (file_name.contains(".svg", Qt::CaseInsensitive)) // svg vector format
    {
      QSvgGenerator generator;
      generator.setFileName(file_name);
      generator.setSize(QSize(this->width(), this->height()));
      generator.setViewBox(QRect(0, 0, this->width() - 1, this->height() - 1));
      generator.setTitle(file_name);
      generator.setDescription("TOPPView generated SVG");
      QPainter painter;
      painter.begin(&generator);

      painter.save();
      painter.translate(QPoint(y_axis_->pos()));
      y_axis_->paint(&painter, new QPaintEvent(y_axis_->contentsRect()));
      painter.restore();

      painter.save();
      painter.translate(QPoint(canvas_->pos()));
      dynamic_cast<Spectrum1DCanvas*>(canvas_)->paint(&painter, new QPaintEvent(canvas_->contentsRect()));
      painter.restore();

      painter.save();
      painter.translate(QPoint(x_axis_->pos()));
      x_axis_->paint(&painter, new QPaintEvent(x_axis_->contentsRect()));
      painter.restore();

      painter.end();
      x_scrollbar_->setVisible(x_visible);
      y_scrollbar_->setVisible(y_visible);
    }
    else // raster graphics formats
    {
      QPixmap pixmap = QPixmap::grabWidget(this);
      x_scrollbar_->setVisible(x_visible);
      y_scrollbar_->setVisible(y_visible);
      pixmap.save(file_name);
    }
  }
开发者ID:BioinformaticsArchive,项目名称:OpenMS,代码行数:46,代码来源:Spectrum1DWidget.cpp

示例14: saveWidgetAsSVG

bool saveWidgetAsSVG(QWidget* widget, const QRect& r, const QString& fileName)
{
    QFontMetrics fm(widget->font());
    
    int heightText= fm.height()+10;
    

    //int versionHeight = 20;
    //int heightAxe = 0;
    //if (Axe.mShowSubs) heightAxe = 20;
    
    
    QSvgGenerator svgGenFile;
    svgGenFile.setFileName(fileName);
    svgGenFile.setViewBox(r);
    svgGenFile.setDescription(QObject::tr("SVG widget drawing "));
    
    QPainter p;
    p.begin(&svgGenFile);
    p.setFont(widget->font());
    widget->render(&p);
  
    p.setPen(Qt::black);
   
    //p.drawText(0, r.height()+heightAxe+versionHeight, r.width(), versionHeight,
    //           Qt::AlignCenter,
    //           qApp->applicationName() + " " + qApp->applicationVersion());
    p.drawText(0, r.height() + 10, r.width(), heightText,
               Qt::AlignCenter,
               qApp->applicationName() + " " + qApp->applicationVersion());
    p.end();
    
   
    
    return true;
}
开发者ID:chrono35,项目名称:chronomodel,代码行数:36,代码来源:QtUtilities.cpp

示例15: sipReleaseType

static PyObject *meth_QSvgGenerator_setDescription(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QString* a0;
        int a0State = 0;
        QSvgGenerator *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QSvgGenerator, &sipCpp, sipType_QString,&a0, &a0State))
        {
            sipCpp->setDescription(*a0);
            sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QSvgGenerator, sipName_setDescription, doc_QSvgGenerator_setDescription);

    return NULL;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:24,代码来源:sipQtSvgQSvgGenerator.cpp


注:本文中的QSvgGenerator::setDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。