Results 1 to 3 of 3

Thread: Populate form after child window open

  1. #1
    Join Date
    Sep 2016
    Posts
    8
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Populate form after child window open

    Hello everyone,
    i'm trying to populate a secondary window lineEdit fields from DB after onclick event in the mainWindow.
    Is there any tutorial/guide that i can follow to understand how to achieve my goal?

    Thank you for your time and , i hope, answers.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Populate form after child window open

    The "Qt way" of communicating information between different parts of a GUI is to use signals and slots. In your case, your main window should probably implement a signal that is emitted in the onclick() method. As arguments to the signal, you can send the information you wish to appear on your secondary window. You will implement a slot in your secondary window that has the same arguments. In this slot, you fill your line edits with the arguments you have been passed.

    In the code that constructs the secondary window, connect the main window's signal to the secondary window's slot.

    See the Qt signals and slots tutorial.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. The following user says thank you to d_stranz for this useful post:

    Bruschetta (30th September 2016)

  4. #3
    Join Date
    Sep 2016
    Posts
    8
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Populate form after child window open

    Hello Stranz, thank you for the answer.
    Signal and Solts seems to be the best solution for my problems,anyway i menaged it to work using QTimer::singleShot(0, &obj, SLOT(function())).
    It was easier but i think not the cleansest way...

Similar Threads

  1. Qlabel Event no open window/form!
    By vProgramm in forum Newbie
    Replies: 2
    Last Post: 11th February 2015, 23:06
  2. Replies: 5
    Last Post: 17th September 2013, 06:45
  3. Replies: 11
    Last Post: 4th June 2008, 07:22
  4. Load form mdi child plugin
    By estanisgeyer in forum Qt Programming
    Replies: 4
    Last Post: 10th February 2008, 14:27
  5. MDI child form icon
    By tebessum in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 09:33

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.