Results 1 to 2 of 2

Thread: singal send twice?

  1. #1
    Join Date
    Apr 2006
    Location
    the netherlands
    Posts
    17
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default singal send twice?

    Hi all,

    It's been a while since I tried to programme with Qt and I already encoutered my first problem :-)

    Why does the following QMessage appear twice after the signal is emitted?

    This is my code (parts of it)

    Qt Code:
    1. connect(ui.tvDir, SIGNAL(activated(QModelIndex)), this, SLOT(on_tvDir_activated(QModelIndex)));
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. void MainForm::on_tvDir_activated(QModelIndex index)
    2. {
    3. ...
    4.  
    5. if( ext.toUpper() == "GEF" )
    6. QMessageBox::information(this, "test", "found gef file");
    7. //ThisMessage is shown twice?!
    8. }
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: singal send twice?

    Looks like the slot uses the naming convention *) of automatic connections. This is why the signal slot connection is established twice; 1) by hand 2) automatically.

    *) void on_<widget name>_<signal name>(<signal parameters>)
    J-P Nurmi

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

    masoroso (12th April 2007)

Similar Threads

  1. QtNetwork send ICMP Packet
    By SlowTree in forum Qt Programming
    Replies: 3
    Last Post: 29th October 2007, 21:13
  2. how to send file with qt c++?
    By wei243 in forum Qt Programming
    Replies: 5
    Last Post: 3rd March 2007, 10:32
  3. My client can't send data
    By hiuao in forum Qt Programming
    Replies: 10
    Last Post: 23rd February 2007, 10:32
  4. Manually send signal to slot
    By donmorr in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2006, 16:03
  5. send signal from QCombobox
    By raphaelf in forum Qt Programming
    Replies: 22
    Last Post: 28th February 2006, 15:18

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.