• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kapptemplate

  • sources
  • kde-4.14
  • kdesdk
  • kapptemplate
  • templates
  • C++
  • flake
%{APPNAME}Shape.cpp
Go to the documentation of this file.
1 #include "%{APPNAME}Shape.h"
2 
3 #include <KoShapeBackground.h>
4 #include <KoTextDocumentLayout.h>
5 #include <KoInlineTextObjectManager.h>
6 #include <KoDom.h>
7 #include <KoXmlWriter.h>
8 #include <KoShapeLoadingContext.h>
9 #include <KoShapeSavingContext.h>
10 
11 #include <QPainter>
12 
13 #include <KDebug>
14 
15 %{APPNAME}Shape::%{APPNAME}Shape()
16 {
17  setShapeId("%{APPNAME}Shape_ID");
18  setCollisionDetection(true);
19 }
20 
21 %{APPNAME}Shape::~%{APPNAME}Shape()
22 {
23 }
24 
25 void %{APPNAME}Shape::paint(QPainter& painter, const KoViewConverter& converter)
26 {
27  applyConversion(painter, converter);
28  if(background())
29  {
30  QPainterPath p;
31  p.addRect(QRectF(QPointF(), size()));
32  background()->paint(painter, p);
33  }
34 
35  // painting goes here
36 }
37 
38 bool %{APPNAME}Shape::loadOdf( const KoXmlElement& element, KoShapeLoadingContext& context )
39 {
40  kDebug() << "Loading %{APPNAME}Shape";
41 
42  loadOdfAttributes(element, context, OdfAllAttributes);
43 
44  KoXmlElement score = KoXml::namedItemNS(element, "http://www.koffice.org/%{APPNAMELC}", "score-partwise");
45 
46  // loading data goes here
47 
48  return true;
49 }
50 
51 void %{APPNAME}Shape::saveOdf( KoShapeSavingContext& context ) const
52 {
53  kDebug() << "Saving %{APPNAME}Shape";
54 
55  KoXmlWriter& writer = context.xmlWriter();
56  writer.startElement("draw:frame");
57  saveOdfAttributes(context, OdfAllAttributes);
58 
59  writer.startElement("%{APPNAMELC}:shape");
60  writer.addAttribute("xmlns:%{APPNAMELC}", "http://www.koffice.org/%{APPNAMELC}");
61 
62  // saving data goes here
63 
64  writer.endElement(); // %{APPNAMELC}:shape
65 
66  saveOdfCommonChildElements(context);
67  writer.endElement(); // draw:frame
68 }
%{APPNAME}Shape.h
paint
void paint(QPainter &painter, const KoViewConverter &viewconverter)
QPointF
QPainter
QPainterPath::addRect
void addRect(const QRectF &rectangle)
QPainterPath
APPNAME
main APPNAME
QRectF
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:39:44 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapptemplate

Skip menu "kapptemplate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal