Okular

textdocumentsettings.h
1/*
2 SPDX-FileCopyrightText: 2013 Azat Khuzhin <a3at.mail@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#ifndef _OKULAR_TEXTDOCUMENTSETTINGS_H_
8#define _OKULAR_TEXTDOCUMENTSETTINGS_H_
9
10#include "okularcore_export.h"
11
12#include <KConfigSkeleton>
13#include <QFont>
14#include <QObject>
15#include <QWidget>
16
17namespace Okular
18{
19class TextDocumentSettingsWidgetPrivate;
20class TextDocumentSettingsPrivate;
21
22/**
23 * Here is example of how you can add custom settings per-backend:
24 *
25 * In .h header:
26 * \code
27 * class KIntSpinBox;
28 * ...
29 *
30 * class YourGenerator
31 * {
32 * ...
33 * public:
34 * bool reparseConfig();
35 * void addPages( KConfigDialog* dlg );
36 * ...
37 * private:
38 * QString customArgument;
39 * KIntSpinBox *customArgumentWidget;
40 * ...
41 * }
42 * \endcode
43 *
44 * In .cpp module:
45 * \code
46 * #include <KIntSpinBox>
47 * ...
48 * bool YourGenerator::reparseConfig()
49 * {
50 * ... Do something with customArgumentWidget and customArgument ...
51 * }
52 * void YourGenerator::addPages( KConfigDialog* dlg )
53 * {
54 * Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
55 *
56 * KIntSpinBox *customArgumentWidget = new KIntSpinBox( dlg );
57 * customArgumentWidget->setObjectName( QString::fromUtf8( "kcfg_CustomArgument" ) );
58 * widget->addRow( "Custom argument", customArgumentWidget );
59 *
60 * Okular::TextDocumentSettings *settings = generalSettings();
61 * settings->addItemString( "CustomArgument", customArgument );
62 *
63 * dlg->addPage( widget, settings, ... );
64 * }
65 * \endcode
66 */
67
68/**
69 * TextDocumentSettingsWidget
70 *
71 * Contain default settings for text based documents.
72 * (all generators that inherited from TextDocumentGenerator)
73 * Generator can add settings to this object individually.
74 *
75 * @since 0.17 (KDE 4.11)
76 */
77class OKULARCORE_EXPORT TextDocumentSettingsWidget : public QWidget
78{
79 Q_OBJECT
80
81public:
82 explicit TextDocumentSettingsWidget(QWidget *parent = nullptr);
84
85 void addRow(const QString &labelText, QWidget *widget);
86
87private:
88 friend class TextDocumentGenerator;
89
90 TextDocumentSettingsWidgetPrivate *d_ptr;
91 Q_DECLARE_PRIVATE(TextDocumentSettingsWidget)
92 Q_DISABLE_COPY(TextDocumentSettingsWidget)
93};
94
95/**
96 * TextDocumentSettings
97 *
98 * Contain default settings/config skeleton
99 * To save/restore settings.
100 *
101 * @since 0.17 (KDE 4.11)
102 */
103class OKULARCORE_EXPORT TextDocumentSettings : public KConfigSkeleton
104{
105 Q_OBJECT
106
107public:
108 QFont font() const;
109
110private:
111 friend class TextDocumentGenerator;
112
113 TextDocumentSettings(const QString &config, QObject *parent);
114
115 TextDocumentSettingsPrivate *d_ptr;
116 Q_DECLARE_PRIVATE(TextDocumentSettings)
117 Q_DISABLE_COPY(TextDocumentSettings)
118};
119
120}
121
122#endif
QTextDocument-based Generator.
Here is example of how you can add custom settings per-backend:
global.h
Definition action.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.