Results 1 to 6 of 6

Thread: Existing Window Call

  1. #1
    Join Date
    Apr 2009
    Posts
    24
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Existing Window Call

    hi , I posted thread earlier regarding this problem but not solved.
    Here Following code are call UI file in Main Project
    Qt Code:
    1. void MainWindow::on_btn_screate_clicked()
    2. {
    3. // sessiondetail.ui is another UI file in same project
    4. Ui::sessiondetail ui;
    5. QMainWindow *sessiondetail = new QMainWindow;
    6. ui.setupUi(QMainWindow *sessiondetail);
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 

    And its output error is
    mainwindow.cpp:462: error: expected primary-expression before '*' token
    As a result which i want the sessiondetail.ui file must be displayed when click on button.
    Can anyOne Plz Slove this problem
    thanks to every one

    Regards, Raza

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

    Default Re: Existing Window Call

    The code is syntactically incorrect. The line "6" should read "ui.setupUi(sessiondetail);".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2009
    Posts
    24
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Existing Window Call

    thanks Wysota, for doing this it can't generate error
    but it also can't call UI file which i want, when click on button

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

    Default Re: Existing Window Call

    Sure it can. But it will go out of scope immediately. Look at your code again - you created an object local to the function and can't expect it to last beneath the function.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2009
    Posts
    24
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Existing Window Call

    thanks
    it done with this code
    Qt Code:
    1. void MainWindow::on_btn_screate_clicked()
    2. {
    3.  
    4. Ui::sessiondetail ui;
    5. QMainWindow *sessiondetail = new QMainWindow;
    6. ui.setupUi(sessiondetail);
    7. sessiondetail->show();
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 
    but it display sessiondetail.ui file 2 times,
    what reason behind it

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

    Default Re: Existing Window Call

    Come on man.... Learn a bit of C++ before taking on Qt...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 21:11
  2. Sub Window Call
    By hasnatzaidi in forum Newbie
    Replies: 1
    Last Post: 30th September 2009, 06:31
  3. Replies: 2
    Last Post: 9th August 2009, 23:08
  4. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 10:30
  5. Change shape of window / animate window
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2007, 09:16

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.