Kstars

loggingform.cpp
1/*
2 SPDX-FileCopyrightText: 2011 Rafał Kułaga <rl.kulaga@gmail.com>
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}
void createFinderChartLogger()
Create simple logging form for finder charts.
QTextDocument * getDocument()
Get logging form internal QTextDocument.
QString i18n(const char *text, const TYPE &arg...)
AlignHCenter
void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior)
QTextTable * insertTable(int rows, int columns)
void insertText(const QString &text)
bool movePosition(MoveOperation operation, MoveMode mode, int n)
void setBorder(qreal width)
QTextTableCell cellAt(const QTextCursor &cursor) const const
void mergeCells(const QTextCursor &cursor)
QTextCursor firstCursorPosition() const const
void setAlignment(Qt::Alignment alignment)
void setCellPadding(qreal padding)
void setCellSpacing(qreal spacing)
void setColumnWidthConstraints(const QList< QTextLength > &constraints)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.