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. [SOLVED] QMdiSubWindow and Widget Checks
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QMdiSubWindow and Widget Checks

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k 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.
  • R Offline
    R Offline
    rizoritis
    wrote on last edited by
    #1

    Hello,

    I am using the following functions to add a subwindow to my mdiarea and to set a widget to the subwindow:

    @ mdisubwindow->setWidget(widget); /Add the widget to the subwindow/
    mdiarea->addSubWindow(mdisubwindow); /Add subwindow to the mdiarea/@

    I would like to put if statements prior to each call to

    1. first check if a widget has already been set to that particular subwindow
      2)check if the subwindow has already been added to the mdiarea

    So it should look like this:

    @ if(!widget is already set to mdisubwindow)
    {
    mdisubwindow->setWidget(widget);
    }
    if(!subwindow is already added to mdiarea)
    {
    mdiarea->addSubWindow(mdisubwindow);
    } @

    Any ideas would help because I cannot seem to find this anywhere...

    Thanks

    1 Reply Last reply
    0
    • jazzycamelJ Offline
      jazzycamelJ Offline
      jazzycamel
      wrote on last edited by
      #2
      1. mdisubwindow->widget() will give you a reference to the current widget if any.
      2. mdiarea->subWindowList() will give you a list of all the subwindows currently in the QMdiArea so you can check if mdisubwindow is among them.

      For the avoidance of doubt:

      1. All my code samples (C++ or Python) are tested before posting
      2. As of 23/03/20, my Python code is formatted to PEP-8 standards using black from the PSF (https://github.com/psf/black)
      1 Reply Last reply
      0
      • R Offline
        R Offline
        rizoritis
        wrote on last edited by
        #3

        [quote author="jazzycamel" date="1372435109"]1) mdisubwindow->widget() will give you a reference to the current widget if any.
        2) mdiarea->subWindowList() will give you a list of all the subwindows currently in the QMdiArea so you can check if mdisubwindow is among them.[/quote]

        Thanks!

        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