Results 1 to 2 of 2

Thread: Create a thread to the one UI to be connected with the QCloseEvent of the Main UI

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Create a thread to the one UI to be connected with the QCloseEvent of the Main UI

    Ok, it is a bit complicated. I want my application to be restarted from a QDialog executed from the main UI. The way I have created the other UIs executed from my main application is the following:
    1) Right Click in Forms->Qt->Qt Designer form Class
    2) Edit the UI and add its header file into the mainwindow.cpp in order to be able to execute the dialog through there.
    3) Execute the dialog using (e.g. if it is named 'preferences')
    Qt Code:
    1. preferences *gamatos= new preferences(this);
    2. gamatos->exec()
    To copy to clipboard, switch view to plain text mode 

    Well, what I want to do is to call the mainwindow's QCloseEvent from the preferences.cpp.
    Actually, in the preferences.cpp I do the following:
    Qt Code:
    1. system("/usr/bin/myapp&"); qApp->exit(0);
    To copy to clipboard, switch view to plain text mode 
    Which executes my app and the closes the current. It's a kind of a restart!
    I want, when this restart is given, the closing window to pass through the QCloseEvent of the mainwindow.cpp in order to save some user entries.
    I don't know how to create this thread which will go through the 2 forms(mainwindow and preferences)!

    Please be a bit specific with your answer because I'm quite newbie. Thx in advance
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    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: Create a thread to the one UI to be connected with the QCloseEvent of the Main UI

    Quote Originally Posted by hakermania View Post
    Ok, it is a bit complicated. I want my application to be restarted from a QDialog executed from the main UI.
    Why?

    Please be a bit specific with your answer because I'm quite newbie. Thx in advance
    Is "why?" specific enough? By the way, if you want specific answers then start by being specific with your question. Newbie or not newbie.
    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. QThreads and the main GUI Thread
    By coderbob in forum Qt Programming
    Replies: 4
    Last Post: 22nd January 2010, 12:00
  2. Replies: 9
    Last Post: 28th November 2009, 20:31
  3. Replies: 16
    Last Post: 7th October 2009, 08:17
  4. Replies: 6
    Last Post: 29th April 2009, 18:17
  5. Main thread - worker thread communication.
    By kikapu in forum Newbie
    Replies: 25
    Last Post: 23rd May 2007, 22:09

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.