Results 1 to 7 of 7

Thread: Open a window inside another window

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Oct 2009
    Posts
    70
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Smile Re: Open a window inside another window

    If u means this:

    Qt Code:
    1. class MainWindow : public QWidget
    2. {
    3. public:
    4. MainWindow(QWidget *parent = 0);
    5.  
    6. private slots:
    7. void newWindow();
    8.  
    9. private:
    10. QWidget *newWindow;
    11. };
    12.  
    13. MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
    14. {
    15. QPushButton *n = new QPushButton("new Window");
    16. n->show();
    17. connect(n,SIGNAL(clicked()),this,SLOT(newWindow()));
    18. }
    19.  
    20. int main(int argv, char *argc[])
    21. {
    22. QApplication app(argv,argc);
    23.  
    24. MainWindow mW;
    25.  
    26. mW.show();
    27. app.exec();
    28. }
    29.  
    30. void MainWindow::newWindow()
    31. {
    32. newWindow = new QWidget;
    33.  
    34. newWindow->setGeometry(QRect(100,100,300,300));
    35. newWindow->setWindowTitle("new Window");
    36. newWindow->show();
    37. }
    To copy to clipboard, switch view to plain text mode 
    ...

  2. The following user says thank you to Peppy for this useful post:

    passerb (17th October 2009)

Similar Threads

  1. open a video file in a new window...
    By jiapei100 in forum Qt Programming
    Replies: 0
    Last Post: 19th September 2009, 14:53
  2. Replies: 2
    Last Post: 9th August 2009, 22:08
  3. Best way to open a Qt window from web page?
    By montylee in forum Qt Programming
    Replies: 9
    Last Post: 19th January 2009, 08:04
  4. Storing window geometry inside XML file.
    By GuS in forum Qt Programming
    Replies: 4
    Last Post: 17th July 2008, 13:42
  5. right way to open a new window
    By wind in forum Newbie
    Replies: 1
    Last Post: 1st November 2006, 11:17

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.