Results 1 to 7 of 7

Thread: My first qt question: how can I convert a MDIsubwindow to popup windows back and forc

  1. #1
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default My first qt question: how can I convert a MDIsubwindow to popup windows back and forc

    Hi all , I am new here.
    What I want to do is:
    I have a MDI app in page mode. I want user can select a page and change that window into popup window(parent as desktop) so he can drag it out side of MDI app window.
    Also I want that popup window can be converted back to one page of MDI window.

    Does anyone know how can I do this?
    Thanks.



    I am using QT 4.4.3
    Last edited by alxwang; 1st February 2009 at 01:44.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: My first qt question: how can I convert a MDIsubwindow to popup windows back and


  3. #3
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: My first qt question: how can I convert a MDIsubwindow to popup windows back and

    Tks.
    It is kind of works.
    I remove the QMdiSubWindow to another mdiarea in another qmainwindow.
    Then before the new window close I addSubWindow it back to mdiarea again.
    It works fine in Window but in MAC, it never come back. New tab added but when I click that tab nothing(just gray area) displayed. If I switch to another page this page's header just be gray out.

    Any hint?
    THanks again.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: My first qt question: how can I convert a MDIsubwindow to popup windows back and

    Can we see the code?

  5. #5
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: My first qt question: how can I convert a MDIsubwindow to popup windows back and

    Sure.
    When I need to move the MDIsubWindow to desktop:
    Qt Code:
    1. QMdiArea *area = new QMdiArea();
    2. QMdiSubWindow *subWin = this->mdiArea->activeSubWindow();
    3. // I did try to remove this subwin from mdiArea first but not difference
    4. area->addSubWindow(subWin);
    5. XSubWindow *win = new XSubWindow();
    6. win->setMdiArea(area);
    7. win->show();
    8. connect(win, SIGNAL(returnSubWindow(QMdiSubWindow*)), this, SLOT(getReturnedSubWindow(QMdiSubWindow*)));
    To copy to clipboard, switch view to plain text mode 

    XSubWindow is just a QMainWindow with
    closeEvent like
    Qt Code:
    1. void XSubWindow::closeEvent(QCloseEvent *event)
    2. {
    3. emit returnSubWindow(this->mdiArea->activeSubWindow());
    4. event->accept();
    5.  
    6. }
    To copy to clipboard, switch view to plain text mode 
    to handle the returnSubWindow in main MDI window:
    Qt Code:
    1. void MainWindow::getReturnedSubWindow(QMdiSubWindow *rwin)
    2. {
    3. this->mdiArea->addSubWindow(rwin);
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

    The content of MDIsubWindow is ether a WEBkit window:
    Qt Code:
    1. XWebWidget *child = new XWebWidget;
    2. child->setWindowTitle("Demo");
    3. mdiArea->addSubWindow(child);
    To copy to clipboard, switch view to plain text mode 
    or
    QGraphicsScene only contains a picture.
    Qt Code:
    1. scene.setSceneRect(-300, -300, 600, 600);
    2. scene.setItemIndexMethod(QGraphicsScene::NoIndex);
    3.  
    4. view->setWindowTitle("Demo Bid Page");
    5. view->setRenderHint(QPainter::Antialiasing);
    6. view->setBackgroundBrush(QPixmap(":/images/demo.jpg"));
    7.  
    8. mdiArea->addSubWindow(view);
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Feb 2009
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: My first qt question: how can I convert a MDIsubwindow to popup windows back and

    No one knows?

  7. #7
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: My first qt question: how can I convert a MDIsubwindow to popup windows back and

    without looking at your code in too much detail:
    probably your window does get closed after adding it to the other QMDiArea.
    Try ignoring (or if that does not work: filtering) the close event.

    HTH

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.