Kstars

loggingform.cpp
1 /*
2  SPDX-FileCopyrightText: 2011 Rafał Kułaga <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "loggingform.h"
8 
9 #include <KLocalizedString>
10 
11 #include <QTextDocument>
12 #include <QTextTable>
13 
15 {
16  QTextCursor cursor(m_Document.get());
18 
19  QTextTableFormat tableFormat;
20  tableFormat.setAlignment(Qt::AlignHCenter);
21  tableFormat.setBorder(2);
22  tableFormat.setCellPadding(2);
23  tableFormat.setCellSpacing(4);
24 
25  QTextCharFormat fieldCharFmt;
26  QFont font("Times", 10);
27  fieldCharFmt.setFont(font);
28 
29  QVector<QTextLength> constraints;
32  tableFormat.setColumnWidthConstraints(constraints);
33 
34  QTextTable *table = cursor.insertTable(5, 4, tableFormat);
35  table->mergeCells(0, 0, 1, 4);
36  table->cellAt(0, 0).firstCursorPosition().insertText(i18n("Observer:"), fieldCharFmt);
37 
38  table->mergeCells(1, 0, 1, 2);
39  table->cellAt(1, 0).firstCursorPosition().insertText(i18n("Date:"), fieldCharFmt);
40  table->mergeCells(1, 2, 1, 2);
41  table->cellAt(1, 2).firstCursorPosition().insertText(i18n("Time:"), fieldCharFmt);
42 
43  table->mergeCells(2, 0, 1, 2);
44  table->cellAt(2, 0).firstCursorPosition().insertText(i18n("Site:"), fieldCharFmt);
45  table->cellAt(2, 2).firstCursorPosition().insertText(i18n("Seeing:"), fieldCharFmt);
46  table->cellAt(2, 3).firstCursorPosition().insertText(i18n("Trans:"), fieldCharFmt);
47 
48  table->mergeCells(3, 0, 1, 4);
49  table->cellAt(3, 0).firstCursorPosition().insertText(i18n("Telescope:"), fieldCharFmt);
50 
51  table->mergeCells(4, 0, 1, 3);
52  table->cellAt(4, 0).firstCursorPosition().insertText(i18n("Eyepiece:"), fieldCharFmt);
53  table->cellAt(4, 3).firstCursorPosition().insertText(i18n("Power:"), fieldCharFmt);
54 }
55 
57 {
58  return m_Document.get();
59 }
AlignHCenter
void setColumnWidthConstraints(const QVector< QTextLength > &constraints)
QTextCursor firstCursorPosition() const const
QTextDocument * getDocument()
Get logging form internal QTextDocument.
Definition: loggingform.cpp:56
void setCellSpacing(qreal spacing)
QTextTableCell cellAt(int row, int column) const const
QString i18n(const char *text, const TYPE &arg...)
void setFont(const QFont &font, QTextCharFormat::FontPropertiesInheritanceBehavior behavior)
void createFinderChartLogger()
Create simple logging form for finder charts.
Definition: loggingform.cpp:14
void setBorder(qreal width)
QTextTable * insertTable(int rows, int columns, const QTextTableFormat &format)
void setCellPadding(qreal padding)
void insertText(const QString &text)
void setAlignment(Qt::Alignment alignment)
bool movePosition(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode, int n)
void mergeCells(int row, int column, int numRows, int numCols)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 15 2022 04:04:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.