Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [RESOLVED] Can't emit signal on dialog close
Forum Updated to NodeBB v4.3 + New Features

[RESOLVED] Can't emit signal on dialog close

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrcgnerd
    wrote on 14 Mar 2014, 14:04 last edited by
    #1

    Hello.

    Here is my problem I have two dialogs, and when I close firs dialog, I want that second closed too.

    I'm using signals and slots, and emiting signal from first dialog witch triggers slot in other dialog, this slot looks like this:

    @void Dialog2::CloseSecondDialog(void)
    {
    close();
    }@

    The problem is that I can't emit signal onDialogClose , it just don't woking, and I don't know why ? My code:

    @Dialog1::~Dialog1()
    {
    emit CloseSecondDialog();
    delete ui;

    }@

    I made some tests and tried to emit signal from other place for example, after buton click:

    @void Dialog1::on_pushButton_clicked()
    {
    emit CloseSecondDialog();
    }@

    And it worked perfectly. So why it's not working when Dialog is closed ?

    Sory for my english.

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on 14 Mar 2014, 21:43 last edited by
      #2

      You should emit signal in "closeEvent":http://qt-project.org/doc/qt-5/qdialog.html#closeEvent not in destructor.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrcgnerd
        wrote on 16 Mar 2014, 21:50 last edited by
        #3

        Thanks for help.

        Since one of the dialogs are model and other modeless, I got it working like this:

        @Dialog2->show();
        Dialog1->exec();
        Dialog2->close();@

        And it's working perfect for my :D.
        But I think I will do it the right way and use closeEvent.

        Thanks again for both answers.

        1 Reply Last reply
        0

        2/3

        14 Mar 2014, 21:43

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved