Code_TYMPAN
4.4.0
Industrial site acoustic simulation
Tympan
gui
app
TYCustomPopupMenu.cpp
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
21
#include "
Tympan/gui/app/TYApplication.h
"
22
#include "
Tympan/gui/app/TYMainWindow.h
"
23
#include "
TYCustomPopupMenu.h
"
24
25
#include <QMdiArea>
26
27
TYCustomPopupMenu::TYCustomPopupMenu
(QWidget* parent) : QMenu(parent)
28
{
29
QObject::connect(
this
, &QMenu::aboutToShow,
this
, &
TYCustomPopupMenu::onAboutToShow
);
30
}
31
32
TYCustomPopupMenu::TYCustomPopupMenu
(
const
QString& title, QWidget* parent) : QMenu(title, parent)
33
{
34
QObject::connect(
this
, &QMenu::aboutToShow,
this
, &
TYCustomPopupMenu::onAboutToShow
);
35
}
36
37
void
TYCustomPopupMenu::onAboutToShow
()
38
{
39
setVisible
(
true
);
40
}
41
42
void
TYCustomPopupMenu::setVisible
(
bool
visible)
43
{
44
QPoint point = pos();
45
QPoint point2;
46
47
if
(visible)
48
{
49
int
w =
getTYMainWnd
()->
getWorkspace
()->width();
50
int
h =
getTYMainWnd
()->
getWorkspace
()->height();
51
point2 =
getTYMainWnd
()->
getWorkspace
()->mapFromGlobal(point);
52
if
((point2.x() >= 0) && (point2.y() >= 0) && (point2.x() <= w) && (point2.y() <= h))
53
{
54
return
;
55
}
56
QMenu::setVisible(visible);
57
}
58
else
59
{
60
QMenu::setVisible(visible);
61
}
62
}
getTYMainWnd
TYMainWindow * getTYMainWnd()
Retourne le pointeur sur la fenetre principale.
Definition:
TYApplication.cpp:62
TYApplication.h
pour l'application Tympan (fichier header)
TYCustomPopupMenu.h
Definit un popup menu, necessaire pour maitriser l'ouverture automtique apres un createPopupMenu (fic...
TYMainWindow.h
Fenetre principale de l'application Tympan (fichier header)
TYCustomPopupMenu::TYCustomPopupMenu
TYCustomPopupMenu(QWidget *parent=0)
Constructeur.
Definition:
TYCustomPopupMenu.cpp:27
TYCustomPopupMenu::onAboutToShow
void onAboutToShow()
Definition:
TYCustomPopupMenu.cpp:37
TYCustomPopupMenu::setVisible
virtual void setVisible(bool visible)
Definition:
TYCustomPopupMenu.cpp:42
TYMainWindow::getWorkspace
QMdiArea * getWorkspace()
Definition:
TYMainWindow.h:66
Generated on Mon Nov 27 2023 07:56:31 for Code_TYMPAN by
1.9.1