Results 1 to 7 of 7

Thread: Frames connection

  1. #1
    Join Date
    Mar 2009
    Posts
    3

    Default Frames connection

    I have created a form MainWindow - QMainWindow class and a Frame - QFrame class , after that in the mainwindow.ui.
    I have added a button and created a new singnal clicked > openframe , after, in the mainwindow.h i have added public slots : void openframe() , after that in the mainwindow.cpp i have added:
    #include "frame.h"

    and

    void MainWindow :: openframe()
    {
    Frame frame();
    frame.exec();
    }

    but it is not working

    please help me to connect these two frame with button click

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Frames connection

    Quote Originally Posted by cuios View Post
    void MainWindow :: openframe()
    {
    Frame frame();
    frame.exec();
    }
    frame goes immediately out of scope after exec() returns, so if exec() does not block you'll probably see only a short flicker.

    Try to create it on the heap with "new".

    Ginsengelf
    Last edited by Ginsengelf; 23rd March 2009 at 16:00. Reason: messed up tags

  3. #3
    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    13
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Frames connection

    Try creating your frame in heap like this
    MainWindow:MainWindow()
    {
    frame = new QFrame(this);
    --------
    }

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Frames connection

    btw, QFrame hasn't method exec()
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Mar 2009
    Posts
    3

    Default Re: Frames connection

    I have tried this

    MainWindow *other = new MainWindow;
    other->show();

    but I do not want to duplicate the frame , all I want is to use one that was designed in Qt Creator GUI designer

    thanks a lot

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Frames connection

    Hi,

    don't understand what you exactly want, but if you want to open an other "window" beside your main application you should use QDialog instead of QFrame. Even a look at Using a Designer .ui File in Your Application could be helpful.

    Lykurg

  7. #7
    Join Date
    Mar 2009
    Posts
    3

    Default Re: Frames connection

    Solved.
    Thanks a lot to all , everything was very helpfull !!!!!!

Similar Threads

  1. cannot share the database connection!!!!
    By cbarmpar in forum Qt Programming
    Replies: 13
    Last Post: 23rd September 2008, 14:42
  2. SQL connection closure problem.
    By cbarmpar in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2008, 08:42
  3. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 10:22
  4. Replies: 3
    Last Post: 2nd August 2007, 21:28
  5. How do I keep the client connection open ?
    By probine in forum Newbie
    Replies: 2
    Last Post: 25th March 2006, 19:06

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.