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

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • printing
kstarsdocument.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  kstarsdocument.cpp - K Desktop Planetarium
3  -------------------
4  begin : Wed Aug 10 2011
5  copyright : (C) 2011 by Rafał Kułaga
6  email : rl.kulaga@gmail.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "kstarsdocument.h"
19 #include "kstars.h"
20 #include "QPainter"
21 #include "QTextDocument"
22 #include "QTextDocumentWriter"
23 #include "QPrinter"
24 
25 KStarsDocument::KStarsDocument()
26 {
27  m_Document = new QTextDocument();
28 }
29 
30 KStarsDocument::~KStarsDocument()
31 {
32  if(m_Document)
33  {
34  delete m_Document;
35  }
36 }
37 
38 void KStarsDocument::clearContent()
39 {
40  m_Document->clear();
41 }
42 
43 void KStarsDocument::print(QPrinter *printer)
44 {
45  m_Document->print(printer);
46 }
47 
48 bool KStarsDocument::writeOdt(const QString &fname)
49 {
50  QTextDocumentWriter writer(fname);
51  return writer.write(m_Document);
52 }
53 
54 void KStarsDocument::writePsPdf(const QString &fname)
55 {
56  QPrinter printer(QPrinter::HighResolution);
57  printer.setOutputFileName(fname);
58  printer.setOutputFormat(fname.endsWith(".pdf") ? QPrinter::PdfFormat : QPrinter::PostScriptFormat);
59  m_Document->print(&printer);
60 }
KStarsDocument::~KStarsDocument
~KStarsDocument()
Destructor.
Definition: kstarsdocument.cpp:30
KStarsDocument::writePsPdf
void writePsPdf(const QString &fname)
Write contents of the document to the Postscript/PDF file.
Definition: kstarsdocument.cpp:54
KStarsDocument::m_Document
QTextDocument * m_Document
Definition: kstarsdocument.h:73
KStarsDocument::KStarsDocument
KStarsDocument()
Constructor.
Definition: kstarsdocument.cpp:25
KStarsDocument::writeOdt
bool writeOdt(const QString &fname)
Write contents of the document to Open Document Text file.
Definition: kstarsdocument.cpp:48
kstars.h
KStarsDocument::clearContent
void clearContent()
Clears contents of the document.
Definition: kstarsdocument.cpp:38
kstarsdocument.h
KStarsDocument::print
void print(QPrinter *printer)
Print contents of the document.
Definition: kstarsdocument.cpp:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

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