Results 1 to 3 of 3

Thread: Executing a method after passing an object from a QDialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11
    Thanks
    2

    Default Executing a method after passing an object from a QDialog

    Hi Every-1!

    In my DVDCollection-Application I'm trying to pass a DVD-object made in a QDialog onto the main-application.

    void WdgDvdsCollection::on_btnInputNewDvd_clicked()
    {
    DlgNewDvd dialog(this);
    if (dialog.exec() == QDialog::Accepted)
    {
    Dvd d = dialog.tempDvd;
    InsertNewDvd(d);
    UpdateUi();
    }
    }

    void WdgDvdsCollection::InsertNewDvd(Dvd d)
    {
    QSqlQuery query;
    query.prepare("insert into tblDvds (title, publisher, nrOfDvds, genre) values (:title, :publisher, :nrOfDvds, :genre");
    // rest of code in method
    }


    When I debug the application with F10, it enters the if-structure (so it executes dialog.exec() and 'accepts' the QDialog.
    The Dvd-object d in the if-structure gets the values from the DVD in QDialog; so the DVD-object is also made.
    But when I try to execute the next line (i.e. InsertNewDvd(d); ) with F10, the debugger steps over the line and the method doesn't get executed...

    Any idea?

    Grtz,
    JazzKatua

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Executing a method after passing an object from a QDialog

    Have you tried stepping into the function?
    Or do a simple qDebug() inside the function instead of executing the code step by step?

    Cheers,
    _

  3. #3
    Join Date
    Apr 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: Executing a method after passing an object from a QDialog

    Hi Anda_Skoa!

    I think it was indeed F11 to enter the function. Now I realize that the QSqlQuery-function didn't get executed because it was created BEFORE the database-connection was opened(via db.open() ).
    The reason I use F10 is because F11 enters ALL functions (e.g. QString-functions from Qt-libs) and is of no use for me.
    I found the solution in Qt Creator: in Tools / Options in Debugger: GDB-tab => clicking 'Skip known frames when stepping'.
    Thnx Anda_Skoa!
    Last edited by JazzKatua; 4th January 2014 at 12:47. Reason: updated contents

Similar Threads

  1. TypeError: Object [object Object] has no method 'sendData'
    By TheIndependentAquarius in forum Qt Quick
    Replies: 2
    Last Post: 30th November 2013, 05:54
  2. Passing a object between QDialog and QMainWindow
    By m_bishop in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2013, 14:53
  3. Replies: 4
    Last Post: 15th July 2011, 18:31
  4. Weird results when passing a QByteArray* to a method
    By agerlach in forum Qt Programming
    Replies: 1
    Last Post: 1st December 2010, 22:05
  5. Open a QMainWindow Object in QDialog Object
    By chuengchuenghq in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2008, 06: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
  •  
Qt is a trademark of The Qt Company.