I'm new in pyqt. I want to do an application with a Qmainwindow with its menubar and menu items. when I click in some menu item A QMdiSubWindow should appear into the qmdiarea, How can I do that? this is my qmainwindow code:
class Ui_mainForm(QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.resize(928, 695)
self.qareaMdi = QtGui.QWidget(self)
#all the design code...
self.actionFriends.triggered.connect(self.actionFriends_click)
#more code...
def actionFriends_click(self):
#how can I call a qmdisubwindow here?
and this is my QMdiSubWindow code:
class Ui_friendForm(QMdiSubWindow):
def __init__(self):
QtGui.QMdiSubWindow.__init__(self)
self.resize(878, 551)
QtCore.QMetaObject.connectSlotsByName(self)
thanks in advance
Update: I modified the actionFriends_click function like this:
def actionFriends_click(self):
subwindow_friend = Ui_friendForm()
self.mdiArea.addSubWindow(subwindow_friend)
subwindow_friend.show()
Update 2: I forgot It. We have to add a reference into Ui_mainForm
from VIEW.friendsForm import Ui_friendForm
In this case the QMdiSubWindows Ui_friendForm class is in the VIEW package.
We have to add a reference into Ui_mainForm (In this case the QMdiSubWindows Ui_friendForm class is in the VIEW package.) and I modified the actionFriends_click function like this:
from VIEW.friendsForm import Ui_friendForm
def actionFriends_click(self):
subwindow_friend = Ui_friendForm()
self.mdiArea.addSubWindow(subwindow_friend)
subwindow_friend.show()