A
A
Alexander Rublev2016-04-02 20:09:34
Python
Alexander Rublev, 2016-04-02 20:09:34

How to resize subwindows window in mdiArea?

When I add a window to mdiArea, it becomes small. How to make the window when opened becomes the size that is set in the designer?
Screenshot of the designer Screenshot
1QJXA.jpg
of the program
i.stack.imgur.com/s2gi7.jpg
code

main_class, main_base_class = loadUiType(getcwd() + '/ui/main.ui')
class MainWindow(QMainWindow, main_class):
    def __init__(self, *args):
       self.user = my_class.User
       super(MainWindow, self).__init__(*args)
       self.setupUi(self)
       self.show()
       self.setDisabled(True)
       self.login = login_window.LoginWindow(self, self.user)
       self.login.show()

    def set_privilege(self):
       if self.user.privilege == "швея":
           self.ma_material.setDisabled(True)
           self.ma_material_provider.setDisabled(True)

    def view_material(self):
       self.material = material.Material()
       self.mdi.addSubWindow(self.material)
       self.material.show()


material_class, material_base_class = loadUiType(getcwd() + '/ui/material.ui')
class Material(QMainWindow, material_class):
   def __init__(self, *args):
       super(Material, self).__init__()
       self.setupUi(self)

app = QApplication(sys.argv)
main = form.main_window.MainWindow()
sys.exit(app.exec_())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Rublev, 2016-04-13
@Meller008

Here is the solution, I'll write it as best as I can

self.material = material.Material() #создаем экземпляр класса окна которое будет внутри MDI
self.sub_material = QMdiSubWindow() #Создаем пустое под окно MDI
self.sub_material.setWidget(self.material) #Заполняем пустое окно нашим классом
self.mdi.addSubWindow(self.sub_material) #Добавляем окно к самой MDI области
self.sub_material.resize(self.material.size()) #Редактируем размер MDI под окна, взяв размеры из созданного в дизайнере класса
self.sub_material.show() #Отображаем под окно

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question