• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • widgets
kshelplabel.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  kshelplabel.cpp - Help label used to document astronomical terms
3  -------------------
4  begin : Wed 1 Dec 2010
5  copyright : (C) 2010 by Valery Kharitonov
6  email : kharvd@gmail.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "kshelplabel.h"
19 #include <ktoolinvocation.h>
20 #include <QtGui/QMessageBox>
21 
22 KSHelpLabel::KSHelpLabel(const QString& text, const QString& anchor,
23  QWidget *parent) : QLabel(parent), m_anchor(anchor)
24 {
25  setText(text);
26  updateText();
27  connect(this, SIGNAL(linkActivated(QString)), SLOT(slotShowDefinition(QString)));
28 }
29 
30 KSHelpLabel::KSHelpLabel(QWidget *parent) : QLabel(parent)
31 {
32  connect(this, SIGNAL(linkActivated(QString)), SLOT(slotShowDefinition(QString)));
33 }
34 
35 void KSHelpLabel::setAnchor(const QString& anchor) {
36  m_anchor = anchor;
37  updateText();
38 }
39 
40 void KSHelpLabel::updateText() {
41  QLabel::setText("<a href=\"ai-" + m_anchor + "\">" + text() + "</a>");
42 }
43 
44 void KSHelpLabel::slotShowDefinition(const QString & term) {
45  KToolInvocation::invokeHelp(term);
46 }
47 
48 void KSHelpLabel::setText(const QString& txt) {
49  m_cleanText = txt;
50  QLabel::setText("<a href=\"ai-" + m_anchor + "\">" + m_cleanText + "</a>");
51 }
52 
QWidget
KSHelpLabel::anchor
QString anchor()
Definition: kshelplabel.h:50
KSHelpLabel::text
QString text()
Definition: kshelplabel.h:46
kshelplabel.h
KSHelpLabel::KSHelpLabel
KSHelpLabel(QWidget *parent=0)
Constructor.
Definition: kshelplabel.cpp:30
KSHelpLabel::setAnchor
void setAnchor(const QString &anchor)
Definition: kshelplabel.cpp:35
QLabel
KSHelpLabel::setText
void setText(const QString &text)
Definition: kshelplabel.cpp:48
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal