20 #include "QTextDocument"
21 #include "QTextDocumentFragment"
23 #include "QTextDocumentWriter"
24 #include "QSvgGenerator"
38 cursor.movePosition(QTextCursor::Start);
40 QTextBlockFormat titleBlockFmt;
41 titleBlockFmt.setAlignment(Qt::AlignCenter);
45 QTextCharFormat titleCharFmt;
46 QFont titleFont(
"Times", 20, QFont::Bold);
47 titleCharFmt.setFont(titleFont);
49 cursor.insertBlock(titleBlockFmt, titleCharFmt);
50 cursor.insertText(title);
53 if(!subtitle.isEmpty())
55 QTextCharFormat subtitleCharFmt;
56 QFont subtitleFont(
"Times", 14);
57 subtitleCharFmt.setFont(subtitleFont);
59 cursor.insertBlock(titleBlockFmt, subtitleCharFmt);
60 cursor.insertText(subtitle);
62 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
68 QTextCursor cursor =
m_Document->rootFrame()->lastCursorPosition();
70 QTextBlockFormat descrBlockFmt;
71 descrBlockFmt.setAlignment(Qt::AlignJustify);
72 QTextCharFormat descrCharFmt;
73 QFont descrFont(
"Times", 10);
74 descrCharFmt.setFont(descrFont);
76 cursor.insertBlock(descrBlockFmt, descrCharFmt);
77 cursor.insertText(description);
79 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
84 QTextCursor cursor =
m_Document->rootFrame()->lastCursorPosition();
86 QTextBlockFormat geoBlockFmt;
87 geoBlockFmt.setAlignment(Qt::AlignLeft);
88 QTextCharFormat geoCharFmt;
89 QFont geoFont(
"Times", 10, QFont::Bold);
90 geoCharFmt.setFont(geoFont);
92 cursor.insertBlock(geoBlockFmt);
93 cursor.insertText(i18n(
"Date, time and location: "), geoCharFmt);
97 if(!geoStr.isEmpty()) {
103 if(!geoStr.isEmpty()) {
109 geoFont.setBold(
false);
110 geoCharFmt.setFont(geoFont);
111 cursor.insertText(KGlobal::locale()->formatDateTime(ut) +
", " + geoStr, geoCharFmt);
113 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
118 QTextCursor cursor =
m_Document->rootFrame()->lastCursorPosition();
119 cursor.insertFragment(QTextDocumentFragment(log->
getDocument()));
121 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
122 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
127 QTextCursor cursor =
m_Document->rootFrame()->lastCursorPosition();
128 QTextCharFormat textFmt;
129 QTextBlockFormat blockFmt;
130 blockFmt.setAlignment(Qt::AlignHCenter);
134 cursor.insertBlock(blockFmt, textFmt);
135 cursor.insertImage(img);
136 cursor.insertBlock(blockFmt, textFmt);
137 cursor.insertText(description);
142 cursor.insertBlock(blockFmt, textFmt);
143 cursor.insertText(description);
144 cursor.insertBlock(blockFmt, textFmt);
145 cursor.insertImage(img);
148 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
149 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
154 QTextCursor cursor =
m_Document->rootFrame()->lastCursorPosition();
155 cursor.insertFragment(QTextDocumentFragment(table->
getDocument()));
157 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
158 cursor.insertBlock(QTextBlockFormat(), QTextCharFormat());
163 QTextCursor cursor =
m_Document->rootFrame()->lastCursorPosition();
165 QTextBlockFormat titleBlockFmt;
166 titleBlockFmt.setAlignment(Qt::AlignLeft);
167 QTextCharFormat titleCharFmt;
168 QFont titleFont(
"Times", 16, QFont::Bold);
169 titleFont.setCapitalization(QFont::AllUppercase);
170 titleCharFmt.setFont(titleFont);
172 cursor.insertBlock(titleBlockFmt, titleCharFmt);
173 cursor.insertText(title);
QTextDocument * getDocument()
Get table document.
QString translatedName() const
void insertImage(const QImage &img, const QString &description, bool descriptionBelow=true)
Insert image to the finder chart.
FinderChart()
Constructor.
QString translatedProvince() const
void insertDescription(const QString &description)
Insert description to the finder chart.
void insertDetailsTable(DetailsTable *table)
Insert details table to the finder chart.
Contains all relevant information for specifying a location on Earth: City Name, State/Province name...
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
void insertLoggingForm(LoggingForm *log)
Insert logging form to the finder chart.
QTextDocument * m_Document
void insertSectionTitle(const QString &title)
Insert section title to the finder chart.
void insertGeoTimeInfo(const KStarsDateTime &ut, GeoLocation *geo)
Insert details about date&time and geographic location.
static const char description[]
QString translatedCountry() const
Represents details tables that can be inserted to finder charts and logging forms.
Base class for KStars documents.
void insertTitleSubtitle(const QString &title, const QString &subtitle)
Insert title and subtitle to the finder chart.