[LUA] ContextMenuEvent

User avatar
miaz3
Fusioneer
Posts: 219
Joined: Sat Jan 03, 2015 1:43 am
Location: Angoulême / France
Been thanked: 2 times
Contact:

[LUA] ContextMenuEvent

#1

Post by miaz3 » Sun Nov 10, 2019 9:48 am

I try to update a lua script for fusion studio and i would like to put a ContextMenuEvent on ui:Tree

With python i can handle this way :
  1.    
  2. def context_menu(self):
  3.     menu = QtGui.QMenu(self)
  4.     tipsRow = self.tableWidget.currentRow()
  5.     menu.addAction(self.tableWidget.item(tipsRow,5).text())
  6.     menu.addAction('remove', self.remove)
  7.     menu.addAction('open repository', self.openRepo)
  8.     menu.exec_(QtGui.QCursor.pos())
I learn at the same time, I must badly take. With lua in fusion 'contextMenuEvent' return nothing...
Like member 'contextMenuEvent' doesn't exist ?
  1. function win.On.FileFinder.contextMenuEvent(ev)
  2.     menu = QMenu()
  3.     menu:addAction('test')
  4. end
win > disp:AddWindow
FileFinder > ui:Tree

https://doc.qt.io/qt-5/qwidget.html#contextMenuEvent

have you an idea ?

User avatar
miaz3
Fusioneer
Posts: 219
Joined: Sat Jan 03, 2015 1:43 am
Location: Angoulême / France
Been thanked: 2 times
Contact:

Re: [LUA] ContextMenuEvent

#2

Post by miaz3 » Mon Nov 11, 2019 1:31 am

A bit clear, with a image
ui_tto.jpg
with python i can connect with 'CustomContextMenu'
  1. self.tableWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
  2. self.tableWidget.customContextMenuRequested.connect(self.context_menu)
Is it the same way in lua ?
You do not have the required permissions to view the files attached to this post.