Results 1 to 2 of 2

Thread: Pass value to dialog

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Pass value to dialog

    Opening a dialog from the main window menu and I need to pass a QSqlRecord to it.
    I have the record value, and I suspect the answer is signals & slots.
    I can make the slot in the dialog, but what would the signal from the main window be?
    I'm still having trouble grasping the full power of signals & slots.

    Here is what I have so far.

    Qt Code:
    1. void MainWindow::on_actionEdit_Log_Entry_triggered()
    2. {
    3. if (::open_log != "") {
    4. QModelIndex index = view->currentIndex();
    5. QSqlRecord record;
    6. int i = index.row();
    7. record = model->record(i);
    8. qDebug() << "record is " << record; // record looks good, need to pass it.
    9. EditLog *edit = new EditLog(this);
    10. edit->show();
    11. }else{
    12. QMessageBox::information(this, "Edit Log", tr("A log must be open to edit it."));
    13. }
    14. }
    To copy to clipboard, switch view to plain text mode 

    Any help please?

  2. #2
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Pass value to dialog

    In this case you do not need to use signals. Just add function like setRecord(QSqlRecord

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

    waynew (17th April 2010)

Similar Threads

  1. Pass by reference in QtScript
    By songyu_us in forum Qt Programming
    Replies: 0
    Last Post: 14th July 2009, 17:59
  2. How to blur parent dialog when child dialog is displayed
    By abhilashajha in forum Qt Programming
    Replies: 4
    Last Post: 10th June 2009, 13:01
  3. Is it possible to pass arguments to thread?
    By zolookas in forum Newbie
    Replies: 1
    Last Post: 16th July 2008, 18:29
  4. Same port when you pass socketDescriptor?
    By Dumbledore in forum Qt Programming
    Replies: 3
    Last Post: 11th December 2007, 22:03
  5. Pass by reference
    By vermarajeev in forum General Programming
    Replies: 6
    Last Post: 20th July 2007, 14:53

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.