Results 1 to 10 of 10

Thread: Connecting from a dialog to mainWindow

Threaded View

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

    Default Re: Connecting from a dialog to mainWindow

    Quote Originally Posted by toufic.dbouk View Post
    Is there any advantage behind forwarding the signal to another signal
    Qt Code:
    1. connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString)));
    To copy to clipboard, switch view to plain text mode 
    over just emitting a new signal such as ?
    Qt Code:
    1. emit sendText(ui->lineEdit->text());
    To copy to clipboard, switch view to plain text mode 
    It depends on what the goal is.

    Given the thread starter's question it looks like the goal is a synchronisation between two line edits.
    For that goal the forwarding is "nicer" because you don't need a slot just to emit a signal again and the signal/signal connect makes the forwarding very obvious when reading the code.

    In the example you gave, i.e. reacting to a button, the slot plus explicit emit is the only possible choice.

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    toufic.dbouk (11th October 2013)

Similar Threads

  1. Using Variables From Dialog In MainWindow
    By steadi in forum Newbie
    Replies: 2
    Last Post: 7th October 2012, 23:18
  2. How to call a dialog from a mainwindow
    By luiz4um in forum Qt Programming
    Replies: 26
    Last Post: 29th June 2010, 10:41
  3. Open Dialog from MainWindow.
    By halvors in forum Qt Programming
    Replies: 8
    Last Post: 1st April 2010, 01:09
  4. Communication between MainWindow and a dialog
    By Backslash in forum Newbie
    Replies: 9
    Last Post: 3rd August 2007, 04:27
  5. Replies: 2
    Last Post: 23rd May 2007, 03:51

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.