<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi All</p>
<p>I just started out with pyQt5 but I have experience with Qt and
C++.</p>
<p>I try to separate my code in different files for not getting
files that are too long. Therefor I am looking to a way that I can
create the different QMenus (so 'file', 'edit', 'Help', etc) in
separate files. I tried several things</p>
<ul>
<li>subclassing QMenu and then create in the main GUI part an
instance that I add to the QMenuBar<br>
<br>
</li>
<li>create a function in a different file that returns a QMenu
that I add to the QMenuBar<br>
<br>
</li>
</ul>
<p>but both methods didn't show the added menu in my menubar.</p>
<p>The first method had as problem that the derived class was not a
QMenu, so could not be added.<br>
</p>
<p>I tried second methods since in the documentation of QMenuBar I
found:</p>
<p><span style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">QAction<span> </span></span><b
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
letter-spacing: normal; orphans: 2; text-align: left;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-style:
initial; text-decoration-color: initial;"><a
href="http://pyqt.sourceforge.net/Docs/PyQt4/qmenubar.html#addMenu"
style="color: rgb(103, 41, 103); text-decoration: none;">addMenu</a></b><span
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;"><span> </span>(</span><i
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-align: left; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-style:
initial; text-decoration-color: initial;">self</i><span
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">, QMenu </span><i
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-align: left; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-style:
initial; text-decoration-color: initial;">menu</i><span
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">)</span></p>
<span style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
left; text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;">So it should be possible to add a QMenu
(second method).<br>
</span>
<p>Does someone has such an example?</p>
<p>Tx for your help</p>
<p>Alain<br>
</p>
<div class="moz-signature">-- <br>
<br>
<table style="background: none; border-width: 0px; border: 0px;
margin: 0; padding: 0; border-collapse: collapse; border-top:
1pt solid #F7751F; padding-top: 2px;" cellspacing="0"
cellpadding="0" border="0">
<tbody>
<tr>
<td style="padding-top: 0; padding-bottom: 0; padding-left:
0; padding-right: 7px; border-top: 0; border-bottom: 0:
border-left: 0; border-right: solid 3px #F7751F"
valign="top"><img id="preview-image-url"
src="cid:part2.3D9DECBB.8372DBA7@gmail.com"></td>
<td style="padding-top: 0; padding-bottom: 0; padding-left:
12px; padding-right: 0;">
<table style="background: none; border-width: 0px; border:
0px; margin: 0; padding: 0;" cellspacing="0"
cellpadding="0" border="0">
<tbody>
<tr>
<td colspan="2" style="padding-bottom: 5px; color:
#F7751F; font-size: 14px; font-family: Arial,
Helvetica, sans-serif;"><strong>Alain Muls</strong></td>
</tr>
<tr>
<td colspan="2" style="color: #333333; font-size:
11px; font-family: Arial, Helvetica, sans-serif;"><i>Professor</i></td>
</tr>
<tr>
<td colspan="2" style="color: #333333; font-size:
11px; font-family: Arial, Helvetica, sans-serif;">Department
CISS</td>
</tr>
<tr>
<td colspan="2" style="color: #333333; font-size:
11px; font-family: Arial, Helvetica, sans-serif;"><strong>Royal
Military Academy</strong></td>
</tr>
<tr>
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20">p:</td>
<td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top">+32 244 13936</td>
</tr>
<tr>
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20">a:</td>
<td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top">Renaissance Avenue 30</td>
</tr>
<tr>
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20"> </td>
<td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top">B1000 Brussels (Belgium)</td>
</tr>
<tr>
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20">w:</td>
<td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top"><a
href="http://www.rma.ac.be/ciss/en/" style="
color: #1da1db; text-decoration: none;
font-weight: normal; font-size: 11px;">www.rma.ac.be/ciss/en/</a> <span
style="color: #F7751F;">e: </span><a
href="mailto:alain.muls@rma.ac.be" style="color:
#1da1db; text-decoration: none; font-weight:
normal; font-size: 11px;">alain.muls@rma.ac.be</a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>