Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PyQt QMainWindow

PyQt QMainWindow

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 302 Views
  • 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 Offline
    H Offline
    henry5059
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      1
      • H Offline
        H Offline
        henry5059
        wrote on last edited by
        #3

        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.

        JonBJ 1 Reply Last reply
        0
        • H henry5059

          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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @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
          1
          • JonBJ JonB

            @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 Offline
            H Offline
            henry5059
            wrote on last edited by
            #5

            @JonB Okay, thanks for the info

            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