Qt Virtual Chart Table (QVCT)
COverlayUrl.cpp
Go to the documentation of this file.
1
// INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2
3
/*
4
* Qt Virtual Chart Table (QVCT)
5
* Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6
* Author: Cedric Dufour <http://cedric.dufour.name>
7
*
8
* The Qt Virtual Chart Table (QVCT) is free software:
9
* you can redistribute it and/or modify it under the terms of the GNU General
10
* Public License as published by the Free Software Foundation, Version 3.
11
*
12
* The Qt Virtual Chart Table (QVCT) is distributed in the hope
13
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
*
16
* See the GNU General Public License for more details.
17
*/
18
19
// QT
20
#include <QString>
21
#include <QUrl>
22
#include <QWidget>
23
24
// QVCT
25
#include "
overlays/COverlayUrl.hpp
"
26
27
28
//------------------------------------------------------------------------------
29
// CONSTRUCTORS / DESTRUCTOR
30
//------------------------------------------------------------------------------
31
32
COverlayUrl::COverlayUrl
( QWidget* _pqParent )
33
:
COverlayText
( _pqParent )
34
{}
35
36
COverlayUrl::COverlayUrl
(
const
QString& _rqsText, QWidget* _pqParent )
37
:
COverlayText
( _rqsText, _pqParent )
38
{}
39
40
COverlayUrl::COverlayUrl
(
const
QString& _rqsText,
const
QString& _rqsLink, QWidget* _pqParent )
41
:
COverlayText
( _pqParent )
42
{
43
setText
( _rqsText, _rqsLink, !_rqsText.length() );
44
}
45
46
47
//------------------------------------------------------------------------------
48
// METHODS: QLabel (override)
49
//------------------------------------------------------------------------------
50
51
void
COverlayUrl::setText
(
const
QString& _rqsText )
52
{
53
setText
( _rqsText, _rqsText, !_rqsText.length() );
54
}
55
56
57
//------------------------------------------------------------------------------
58
// METHODS: COverlayText (override)
59
//------------------------------------------------------------------------------
60
61
//
62
// SETTERS
63
//
64
65
void
COverlayUrl::setText
(
const
QString& _rqsText,
bool
_bInvalid )
66
{
67
setText
( _rqsText, _rqsText, _bInvalid );
68
}
69
70
void
COverlayUrl::setText
(
const
QString& _rqsText,
const
QString& _rqsLink,
bool
_bInvalid )
71
{
72
QFont __qFont = QLabel::font();
73
__qFont.setItalic( _bInvalid );
74
QLabel::setFont( __qFont );
75
QUrl __qUrl( _rqsLink );
76
if
( _rqsText.length() && __qUrl.isValid() )
77
{
78
QLabel::setOpenExternalLinks(
true
);
79
QLabel::setText(
"<A HREF=\""
+__qUrl.toString()+
"\">"
+_rqsText+
"</A>"
);
80
}
81
else
82
{
83
QLabel::setOpenExternalLinks(
false
);
84
QLabel::setText( _rqsText.length() ? _rqsText :
emptyString
() );
85
}
86
}
COverlayUrl.hpp
COverlayText
[UI] Overlay-specific text label
Definition:
COverlayText.hpp:34
COverlayText::emptyString
const QString & emptyString()
Returns the string corresponding to undefined (empty) content ("n/a" in English)
Definition:
COverlayText.cpp:79
COverlayUrl::setText
void setText(const QString &_rqsText)
Definition:
COverlayUrl.cpp:51
COverlayUrl::COverlayUrl
COverlayUrl(QWidget *_pqParent=0)
Definition:
COverlayUrl.cpp:32
overlays
COverlayUrl.cpp
Generated on Wed May 25 2022 19:46:17 for Qt Virtual Chart Table (QVCT) by
1.9.1