Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved PyQt QMainWindow

    General and Desktop
    3
    5
    139
    Loading More Posts
    • 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.
    • H
      henry5059 last edited by

      Good, please, how do I open a single instance of a QMainWindow ?, that is, only when there is no instance of that type of QMainWindow.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        As silly as it may sound: create it only once.

        For a more complete answer, please provide more details about your use case.

        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 Reply Quote 1
        • H
          henry5059 last edited by

          Example: I have three classes that inherit from QMainWindow called: UnityIndex, ArticleIndex and InvoicingIndex, I want a single instance of each class to be executed, that is, the instance is executed only when it is not active and if it is already active, do not execute a new instance, and that allows me to execute the three classes but with a single instance.

          JonB 1 Reply Last reply Reply Quote 0
          • JonB
            JonB @henry5059 last edited by

            @henry5059
            You can't. Also, you don't "execute classes, or even instances of classes". So "allows me to execute the three classes but with a single instance" doesn't mean a lot to me.

            Purely at a guess, perhaps you are talking about needing a QStackedWidget so as to show only one widget at time from among multiple widgets.

            Separately, why you would want to have more than one instance of a QMainWindow anywhere in your program I do not know. Usually you are best with one main window, nothing else needs to have QMainWindow style.

            H 1 Reply Last reply Reply Quote 1
            • H
              henry5059 @JonB last edited by

              @JonB Okay, thanks for the info

              1 Reply Last reply Reply Quote 0
              • First post
                Last post