Results 1 to 3 of 3

Thread: QMdiSubWindow problem with resized window

  1. #1
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation QMdiSubWindow problem with resized window

    Hi friends,

    I'm developing an application in MDI. I have a window in the designer developed with properties in height and width fixed, but to put in a QMdiSubWindow, these properties are lost and the window can be resized. Indeed there should not appear maximize the button and much less allow resizing. How to fix this?

    Here this partial code:

    Qt Code:
    1. template<class T> T *MainWindow::createT(T *win)
    2. {
    3. win = new T();
    4. QMdiSubWindow *mdiSubWin = new QMdiSubWindow;
    5. mdiSubWin->setWidget(win);
    6. mdiSubWin->setAttribute(Qt::WA_DeleteOnClose);
    7. mdiArea->addSubWindow(mdiSubWin);
    8. mdiSubWin->show();
    9. // mdiSubWin->setSizePolicy(qobject_cast<T *>(win)->sizePolicy());
    10. }
    To copy to clipboard, switch view to plain text mode 

    Thanks help,

    Marcelo Estanislau
    Standard Net Tecnologia
    Brazil - RS
    Last edited by jpn; 7th January 2008 at 13:52. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMdiSubWindow problem with resized window

    You have to set the fixed size for the mdiSubWin(which is the container). Even if the child has a fixed size, nobody stops the parent from resizing.

    Regards

  3. #3
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: QMdiSubWindow problem with resized window

    Hi again,

    Ok, I wrote the code in this function based on the size of my window, see in the picture what happened in attach. This is the code changed:

    Qt Code:
    1. template<class T> T *MainWindow::createT(T *win)
    2. {
    3. win = new T();
    4. QMdiSubWindow *mdiSubWin = new QMdiSubWindow;
    5. mdiSubWin->setWidget(win);
    6. mdiSubWin->setAttribute(Qt::WA_DeleteOnClose);
    7. mdiArea->addSubWindow(mdiSubWin);
    8. mdiSubWin->show();
    9. mdiSubWin->setGeometry(0,0,450,300);
    10. mdiSubWin->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    11. mdiSubWin->setMinimumSize(450,300);
    12. mdiSubWin->setMaximumSize(450,300);
    13. //mdiSubWin->setSizePolicy(qobject_cast<T *>(win)->sizePolicy());
    14. }
    To copy to clipboard, switch view to plain text mode 

    We still can maximize the window, giving a double-click the title bar or clicking on the maximize button. Well there might be a resource for the QMdiSubWindow inherit the properties.
    Attached Images Attached Images
    Last edited by jacek; 7th January 2008 at 15:43. Reason: changed [qtclass] to [code]

Similar Threads

  1. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 09:30
  2. Problem hiding main window on minimize
    By bpetty in forum Newbie
    Replies: 5
    Last Post: 18th September 2007, 17:41
  3. New to QT, problem displaying main window...
    By McCall in forum Qt Programming
    Replies: 4
    Last Post: 15th June 2007, 14:27
  4. Problem in porting Main window on linux
    By jyoti kumar in forum Qt Tools
    Replies: 2
    Last Post: 2nd June 2006, 08:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.