From 7eff63b41e4f5bc008877581abd87774c2907e08 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 5 Oct 2012 15:58:48 +0200 Subject: Doc: Modularized Qt Svg documentation Change-Id: I2b503ec04a0a4bf800f62c8d3dc2bf1675293add Reviewed-by: Sergio Ahumada Reviewed-by: Jerome Pasion --- doc/src/examples/svggenerator.qdoc | 122 --------------------- doc/src/examples/svgviewer.qdoc | 46 -------- doc/src/images/svggenerator-example.png | Bin 11625 -> 0 bytes doc/src/images/svgviewer-example.png | Bin 48184 -> 0 bytes doc/src/snippets/code/src_svg_qgraphicssvgitem.cpp | 51 --------- 5 files changed, 219 deletions(-) delete mode 100644 doc/src/examples/svggenerator.qdoc delete mode 100644 doc/src/examples/svgviewer.qdoc delete mode 100644 doc/src/images/svggenerator-example.png delete mode 100644 doc/src/images/svgviewer-example.png delete mode 100644 doc/src/snippets/code/src_svg_qgraphicssvgitem.cpp (limited to 'doc') diff --git a/doc/src/examples/svggenerator.qdoc b/doc/src/examples/svggenerator.qdoc deleted file mode 100644 index a2f49f6..0000000 --- a/doc/src/examples/svggenerator.qdoc +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example painting/svggenerator - \title SVG Generator Example - - The SVG Generator example shows how to add SVG file export to applications. - - \image svggenerator-example.png - - Scalable Vector Graphics (SVG) is an XML-based language for describing - two-dimensional vector graphics. Qt provides classes for rendering and - generating SVG drawings. This example allows the user to create a simple - picture and save it to an SVG file. - - The example consists of two classes: \c Window and \c DisplayWidget. - - The \c Window class contains the application logic and constructs the user - interface from a Qt Designer UI file as described in the - \l{Using a Designer UI File in Your Application#The Multiple Inheritance Approach}{Qt Designer manual}. - It also contains the code to write an SVG file. - - The \c DisplayWidget class performs all the work of painting a picture on - screen. Since we want the SVG to resemble this picture as closely as - possible, we make this code available to the \c Window class so that it can - be used to generate SVG files. - - \section1 The DisplayWidget Class - - The \c DisplayWidget class displays a drawing consisting of a selection of - elements chosen by the user. These are defined using \c Shape and - \c Background enums that are included within the class definition: - - \snippet examples/painting/svggenerator/displaywidget.h DisplayWidget class definition - - Much of this class is used to configure the appearance of the drawing. The - \c paintEvent() and \c paint() functions are most relevant to the purpose - of this example, so we will describe these here and leave the reader to - look at the source code for the example to see how shapes and colors are - handled. - - We reimplement the QWidget::paintEvent() function to display the drawing - on screen: - - \snippet examples/painting/svggenerator/displaywidget.cpp paint event - - Here, we only construct a QPainter object, begin painting on the device - and set a render hint for improved output quality before calling the - \c paint() function to perform the painting itself. When this returns, - we close the painter and return. - - The \c paint() function is designed to be used for different painting - tasks. In this example, we use it to draw on a \c DisplayWidget instance - and on a QSvgGenerator object. We show how the painting is performed to - demonstrate that there is nothing device-specific about the process: - - \snippet examples/painting/svggenerator/displaywidget.cpp paint function - - \section1 The Window Class - - The \c Window class represents the example's window, containing the user - interface, which has been created using Qt Designer: - - \snippet examples/painting/svggenerator/window.h Window class definition - - As with the \c DisplayWidget class, we concentrate on the parts of the code - which are concerned with painting and SVG generation. In the \c Window - class, the \c saveSvg() function is called whenever the \gui{Save As...} - button is clicked; this connection was defined in the \c{window.ui} file - using Qt Designer. - - The start of the \c saveSvg() function performs the task of showing a file - dialog so that the user can specify a SVG file to save the drawing to. - - \snippet examples/painting/svggenerator/window.cpp save SVG - - In the rest of the function, we set up the generator and configure it to - generate output with the appropriate dimensions and write to the - user-specified file. We paint on the QSvgGenerator object in the same way - that we paint on a widget, calling the \c DisplayWidget::paint() function - so that we use exactly the same code that we used to display the drawing. - - The generation process itself begins with the call to the painter's - \l{QPainter::}{begin()} function and ends with call to its - \l{QPainter::}{end()} function. The QSvgGenerator paint device relies on - the explicit use of these functions to ensure that output is written to - the file. - - \section1 Further Reading - - The \l{SVG Viewer Example} shows how to display SVG drawings in an - application, and can be used to show the contents of SVG files created - by this example. - - See the QtSvg module documentation for more information about SVG and Qt's - SVG classes. -*/ diff --git a/doc/src/examples/svgviewer.qdoc b/doc/src/examples/svgviewer.qdoc deleted file mode 100644 index ff83308..0000000 --- a/doc/src/examples/svgviewer.qdoc +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example painting/svgviewer - \title SVG Viewer Example - - The SVG Viewer example shows how to add SVG viewing support to applications. - - \image svgviewer-example.png - - Scalable Vector Graphics (SVG) is an XML-based language for describing two-dimensional - vector graphics. Qt provides classes for rendering and displaying SVG drawings in - widgets and on other paint devices. This example allows the user to load SVG files - and view them in a QGraphicsView using a QGraphicsSvgItem. Based on the selected - renderer the QGraphicsView uses either a QWidget or QGLWidget as its viewport. A - third render mode is also provided, where the QGraphicsView draws indirectly though - a QImage. This allows testing of drawing accuracy and performance for both the - native, raster, and OpenGL paint engines. - - See the QtSvg module documentation for more information about SVG and Qt's SVG classes. -*/ diff --git a/doc/src/images/svggenerator-example.png b/doc/src/images/svggenerator-example.png deleted file mode 100644 index e7a8e53..0000000 Binary files a/doc/src/images/svggenerator-example.png and /dev/null differ diff --git a/doc/src/images/svgviewer-example.png b/doc/src/images/svgviewer-example.png deleted file mode 100644 index 14f1377..0000000 Binary files a/doc/src/images/svgviewer-example.png and /dev/null differ diff --git a/doc/src/snippets/code/src_svg_qgraphicssvgitem.cpp b/doc/src/snippets/code/src_svg_qgraphicssvgitem.cpp deleted file mode 100644 index af175cb..0000000 --- a/doc/src/snippets/code/src_svg_qgraphicssvgitem.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] -QSvgRenderer *renderer = new QSvgRenderer(QLatin1String("SvgCardDeck.svg")); -QGraphicsSvgItem *black = new QGraphicsSvgItem(); -QGraphicsSvgItem *red = new QGraphicsSvgItem(); - -black->setSharedRenderer(renderer); -black->setElementId(QLatin1String("black_joker")); - -red->setSharedRenderer(renderer); -red->setElementId(QLatin1String("red_joker")); -//! [0] -- cgit v1.2.1