Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Parent-child closing windows in pyside6

Parent-child closing windows in pyside6

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 44 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    C.J. Mejias
    wrote last edited by
    #1

    Hi Group,

    We have the following problem, we are develoments a desktop application, that open windows in modal form in series.

    LoginApp -> MainMenu -> MainTreeMenu -> KSecOption -> RoleMainWindow -> RoleDefinitionAdd

    The application works fine, when windows are open, but the problem is when you close the windows; when RoleDefinitionAdd is closed it return to its parent RoleMainWindow, and when RoleMainWindow is closed, it return to Taskbar (of windows11) instead of return to KSecOpion.

    However, if RoleDefinitionAdd is not opened, then the application works fine, I mean, when you open till RoleMainWindow, and the close it, it return to KSecOption, then return to MainTreeMenu this to MainTreeMenu this to MainMenu this return to LoginApp, and finally exit from the application.

    Her part of the source
    class LoginApp(QMainWindow, LoginUser_v):
    def init(self, ctx, parent = None):
    super().init(parent)
    ....
    def start_app(self):
    self.window = MainMenu(self.ctx,'ksec')
    self.window.showMaximized()
    self.window.show()

    class MainTreeMenu(QMainWindow, Menu_v):
    def init(self, ctx, appname,parent = None):
    super().init(parent)

    class KSecOption(QMainWindow, Menu_v):
    def init(self, ctx, pgm_option,parent = None):
    super().init(parent)
    self.ctx = ctx
    print('opcion menu',pgm_option,parent)
    window = eval(pgm_option) #Open RoleMainWindow
    window.setWindowModality(Qt.WindowModal)
    window.show()

    class RoleMainWindow(kSecurityMain_v):
    def init(self, ctx, parent = None,mdi_area=None):
    super().init(parent)
    ...
    def add_role(self):
    window = RoleDefinitionAdd(self.ctx, self, self.find_roles_table)
    window.show()

    Can someone help me? Any reading material or examples? please, this driving me crazy

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      From the top of my head: opening widgets upon opening widgets within a constructor is usually bad design.
      Even more when the window variable is local to the function.
      I would recommend properly building your widgets and only after that start your business logic and have proper functions that will create and further show these widgets.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved