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-2024> <EDF-DTG> <FRANCE>
3
* This file is part of Code_TYMPAN (R).
4
* Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
* Code_TYMPAN (R) is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
* See the GNU General Public License for more details.
12
* You should have received a copy of the GNU General Public License along
13
* with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
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:63
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:63
Generated on Mon Feb 2 2026 12:03:42 for Code_TYMPAN by
1.9.1