Results 1 to 2 of 2

Thread: Moving a QMdiSubWindow

  1. #1
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Moving a QMdiSubWindow

    Hi,
    I'm having troubles moving the position of a sub window in a QMdiArea. When I am in the class that manages the QMdiSubWindow I attempt to move it via:
    Qt Code:
    1. this->move(200,100);
    To copy to clipboard, switch view to plain text mode 
    However it doesnt work.

    For an example, look at the Mdi example in the Qt Folder\examples\mainwindows\mdi. In the file mdichild.cpp, add the above code to line 55.
    Best Regards,
    Phil Winder
    www.philwinder.com

  2. #2
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: Moving a QMdiSubWindow

    Hello!

    You should call move(...) for QMdiSubWindow, not for the widget (QTextEdit) inside it.
    Please modify createMdiChild method in Qt Folder\examples\mainwindows\mdi\mainwindow.cpp, ln199:

    Qt Code:
    1. MdiChild *MainWindow::createMdiChild()
    2. {
    3. MdiChild *child = new MdiChild;
    4. QMdiSubWindow *sub = mdiArea->addSubWindow(child); // modified
    5. sub->move(200,100); // added
    6.  
    7. connect(child, SIGNAL(copyAvailable(bool)),
    8. cutAct, SLOT(setEnabled(bool)));
    9. connect(child, SIGNAL(copyAvailable(bool)),
    10. copyAct, SLOT(setEnabled(bool)));
    11.  
    12. return child;
    13. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to pastor for this useful post:

    philwinder (2nd November 2008)

Similar Threads

  1. Catching escape event with QMdiSubWindow
    By y.shan in forum Qt Programming
    Replies: 0
    Last Post: 3rd September 2008, 13:02
  2. Close a QMdiSubwindow
    By John_P in forum Qt Programming
    Replies: 4
    Last Post: 14th March 2008, 17:23
  3. QMdiSubWindow resizing in 4.3
    By kalpa in forum Qt Programming
    Replies: 0
    Last Post: 4th June 2007, 13:39
  4. why pushbutton moving??
    By Shuchi Agrawal in forum Qt Tools
    Replies: 7
    Last Post: 19th January 2007, 17:17
  5. Moving a QFile
    By stevey in forum Qt Programming
    Replies: 1
    Last Post: 24th August 2006, 11:56

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.