Important: Please read the Qt Code of Conduct -

check for non valid object

  • say i have such code:

    ... = QMainWindow()
    def create_dock_widgets(self):
        # should i check if window is valid object?

    should i actually do it?

  • @user4592357
    And do what if it isn't? You're only going to raise, and will raise anyway if it isn't. Plus = QMainWindow() would have raised in the first place if it couldn't create a main window.

    Of course you can check everywhere if you wish. But that can be a lot of code. I wouldn't bother here.

    Unless you're doing it for a school project. In which case, goodness knows...

Log in to reply