Skip to content

Commit 2a5a1c9

Browse files
committed
Improved menu for server's device in ProjectView window
1 parent 47dc8bf commit 2a5a1c9

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/server/gui/server_ui.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,12 +1022,24 @@ void mbServerUi::contextMenuDevice(mbServerDeviceUi * deviceUi)
10221022
mn.exec(QCursor::pos());
10231023
}
10241024

1025-
void mbServerUi::contextMenuDeviceRef(mbServerDeviceRef *device)
1026-
{
1027-
mbServerPort *port = nullptr;
1028-
if (device)
1029-
port = device->port();
1030-
contextMenuPort(port);
1025+
void mbServerUi::contextMenuDeviceRef(mbServerDeviceRef */*device*/)
1026+
{
1027+
//mbServerPort *port = nullptr;
1028+
//if (device)
1029+
// port = device->port();
1030+
//contextMenuPort(port);
1031+
QMenu mn(m_projectUi); // Note: be careful to delete deviceUi while his child 'QMenu' in stack
1032+
// User can choose 'actionDeleteDevice' and program can crash
1033+
// Solution: don't use direct 'delete deviceUi', use 'deviceUi->deleteLater'
1034+
Q_FOREACH(QAction *a, ui->menuDevice->actions())
1035+
mn.addAction(a);
1036+
mn.addSeparator();
1037+
mn.addAction(ui->actionPortDeviceNew);
1038+
mn.addAction(ui->actionPortDeviceAdd);
1039+
mn.addAction(ui->actionPortDeviceEdit);
1040+
mn.addAction(ui->actionPortDeviceDelete);
1041+
mn.exec(QCursor::pos());
1042+
10311043
}
10321044

10331045
void mbServerUi::contextMenuAction(mbServerSimAction * /*action*/)

src/server/gui/server_ui.ui

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,22 +602,22 @@
602602
</action>
603603
<action name="actionPortDeviceNew">
604604
<property name="text">
605-
<string>New Device...</string>
605+
<string>New Device Ref...</string>
606606
</property>
607607
</action>
608608
<action name="actionPortDeviceEdit">
609609
<property name="text">
610-
<string>Edit Device...</string>
610+
<string>Edit Device Ref...</string>
611611
</property>
612612
</action>
613613
<action name="actionPortDeviceDelete">
614614
<property name="text">
615-
<string>Delete Device</string>
615+
<string>Delete Device Ref</string>
616616
</property>
617617
</action>
618618
<action name="actionPortDeviceAdd">
619619
<property name="text">
620-
<string>Add Existing...</string>
620+
<string>Add Existing Ref...</string>
621621
</property>
622622
</action>
623623
<action name="actionDataViewInsert">

0 commit comments

Comments
 (0)