Kstars

kshelplabel.h
1/*
2 SPDX-FileCopyrightText: 2010 Valery Kharitonov <kharvd@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#ifndef KSHELPLABEL_H
8#define KSHELPLABEL_H
9
10#include <QLabel>
11
12/** Label for displaying links to AstroInfo project
13 * @author Valery Kharitonov
14 */
15class KSHelpLabel : public QLabel
16{
18 Q_PROPERTY(QString anchor READ anchor WRITE setAnchor)
19 Q_PROPERTY(QString text READ text WRITE setText)
20
21 public:
22 /**
23 * Constructor. Creates clear label
24 */
25 explicit KSHelpLabel(QWidget *parent = nullptr);
26
27 /**
28 * Constructor. Creates label with a text and help anchor.
29 * @param text Text of the label
30 * @param anchor Name of the section in the AstroInfo project (without 'ai-')
31 * @param parent Parent widget
32 */
33 KSHelpLabel(const QString &text, const QString &anchor, QWidget *parent = nullptr);
34
35 QString text() const { return m_cleanText; }
36 void setText(const QString &text);
37
38 void setAnchor(const QString &anchor);
39 QString anchor() const { return m_anchor; }
40
41 private slots:
42 /** Open AstroInfo definition of the terms
43 * @param term jargon term */
44 void slotShowDefinition(const QString &term);
45
46 private:
47 /**
48 * Updates text with the new anchor
49 */
50 void updateText();
51
52 /**
53 * Anchor in AstroInfo project
54 */
55 QString m_anchor;
56
57 /**
58 * String without markup
59 */
60 QString m_cleanText;
61};
62
63#endif // KSHELPLABEL_H
Label for displaying links to AstroInfo project.
Definition kshelplabel.h:16
KSHelpLabel(QWidget *parent=nullptr)
Constructor.
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.