Results 1 to 4 of 4

Thread: signal

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default signal

    Hi,
    my connect in mainForm fail because says that there is no signal! Why?
    Qt Code:
    1. connect( fileSaveAction, SIGNAL(statusMessage(const QString&)),
    2. statusBar(), SLOT(message(const QString&)) );
    To copy to clipboard, switch view to plain text mode 

    I have declared signal from qtDesigner....
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: signal

    Is fileSaveAction a QAction? Then it doesn't have such signal. You can't declare a signal for an already existing class. You probably declared that signal in your form and not in the QAction object.

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: signal

    how to declare a signal from QT designer...I don't understand...fileSave is a QAction. I have insert statusMessage(const QString&) as signal in "members" from qt designer..
    is not ok?
    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: signal

    Quote Originally Posted by mickey
    how to declare a signal from QT designer...I don't understand...fileSave is a QAction. I have insert statusMessage(const QString&) as signal in "members" from qt designer..
    is not ok?
    You have declared a signal for your form and not for the QAction object. You can't add signals to already existing classes. You have to subclass them to do that.

    It'll be better if you connect the activated() signal from your QAction to a custom slot in the form and implement the functionality there:

    Qt Code:
    1. connect(fileSaveAction, SIGNAL(activated()), this, SLOT(onActivated()));
    2. //...
    3.  
    4. void myclass::onActivated(){
    5. statusBar()->message(varHoldingCustomMessage);
    6. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  2. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  3. Possible signal mapper problem
    By MarkoSan in forum Qt Programming
    Replies: 13
    Last Post: 25th January 2008, 13:11
  4. Replies: 2
    Last Post: 17th May 2006, 21:01

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.