Code_TYMPAN
4.4.0
Industrial site acoustic simulation
Tympan
gui
app
TYMenuItem.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) <2012> <EDF-R&D> <FRANCE>
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation; either version 2 of the License, or
6
* (at your option) any later version.
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
* See the GNU General Public License for more details.
11
* You should have received a copy of the GNU General Public License along
12
* with this program; if not, write to the Free Software Foundation, Inc.,
13
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14
*/
15
16
/*
17
*
18
*
19
*/
20
27
#ifndef __TY_MENU_ITEM__
28
#define __TY_MENU_ITEM__
29
30
#include "
TYAppDefines.h
"
31
#include <qpainter.h>
32
37
class
TYMenuItem
:
public
QAction
38
{
39
public
:
40
TYMenuItem
(
const
QString&
s
,
const
QFont& f) : QAction(NULL),
_string
(
s
),
_font
(f)
41
{
42
setObjectName(
s
);
43
};
44
~TYMenuItem
() {}
45
46
void
paint
(QPainter* p,
int
x,
int
y,
int
w,
int
h)
47
{
48
p->setFont(
_font
);
49
p->drawText(x, y, w, h, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextDontClip,
_string
);
50
}
51
52
QSize
sizeHint
()
53
{
54
return
QFontMetrics(
_font
).size(Qt::AlignLeft | Qt::AlignVCenter | Qt::TextDontClip,
_string
);
55
}
56
57
private
:
58
QString
_string
;
59
QFont
_font
;
60
};
61
62
#endif
// __TY_MENU_ITEM__
s
NxReal s
Definition:
NxVec3.cpp:317
TYAppDefines.h
TYMenuItem
gestion des items de menu avec une police et des styles particuliers (gras, italique....
Definition:
TYMenuItem.h:38
TYMenuItem::~TYMenuItem
~TYMenuItem()
Definition:
TYMenuItem.h:44
TYMenuItem::_string
QString _string
Definition:
TYMenuItem.h:58
TYMenuItem::paint
void paint(QPainter *p, int x, int y, int w, int h)
Definition:
TYMenuItem.h:46
TYMenuItem::TYMenuItem
TYMenuItem(const QString &s, const QFont &f)
Definition:
TYMenuItem.h:40
TYMenuItem::sizeHint
QSize sizeHint()
Definition:
TYMenuItem.h:52
TYMenuItem::_font
QFont _font
Definition:
TYMenuItem.h:59
Generated on Mon Nov 27 2023 07:56:31 for Code_TYMPAN by
1.9.1