Results 1 to 2 of 2

Thread: how to call signal from GUI to dll with the same object

  1. #1
    Join Date
    Nov 2020
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default how to call signal from GUI to dll with the same object

    In mainwindow constructor i am creating the member variable
    kkkk= new Exp_IRIG_EMIT;

    i am connecting the signal for updating progressbar range and value

    calling initialize function to create thread in dll. and it will be loop
    kkkk->Initialize();


    click on ABORT push button on_pushButton_clicked() function get called

    In side function i am calling signal to abort the thread

    if i use kkkk object to abort its not calling abort signal

    signal is get called when i create a new object with Exp_IRIG_EMIT.

    i want to use the same object how to abort. any one can help to sortout the issue.
    Attached Files Attached Files

  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: how to call signal from GUI to dll with the same object

    There are (at least) four errors in your code:

    1 - The while(1) loop in ReadFunction() never allows the thread's event loop to run and process any events (such as calls to the abort slot). Therefore, the call to the slot will never have a chance to be processed and fAbort will never change status.

    2 - In your MainWindow on_pushButton_clicked method, you are creating a second instance of Exp_IRIG_EMIT. This is not the same instance as the one you created (kkkk) in the constructor. You should know this - it is basic C++. So connecting a signal and slot together from this new instance does nothing.

    3 - In your MainWindow constructor, you create an instance of Exp_IRIG_EMIT (kkkk), but you never connect the pushbutton's clicked() signal to its abort slot.

    4 - You do not need an SAbortSignal in MainWIndow if all you want to do is call the Abort_Thread slot in Exp_IRIG_EMIT. Simply connect QPushButton::clicked() directly to kkkk's slot in the MainWindow constructor.
    <=== 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.

Similar Threads

  1. Replies: 1
    Last Post: 14th August 2014, 18:08
  2. Replies: 2
    Last Post: 8th August 2012, 12:11
  3. How to call a function in the mother object from a child object?
    By Momergil in forum General Programming
    Replies: 4
    Last Post: 18th December 2011, 16:49
  4. Cannot call function without object
    By Salazaar in forum Newbie
    Replies: 5
    Last Post: 11th June 2007, 15:55
  5. Call on Parent Object
    By hufgardm in forum Newbie
    Replies: 1
    Last Post: 7th September 2006, 16:11

Tags for this Thread

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.