×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    28

    Some of the QAction events are not calling the corresponding Slot functions

    Hi,

    I've added 4 QActions into the QMenu and the QMenu is mapped to the LSK(Options button)on Phone.

    code snippet:

    QMenu* optionsMenu = new QMenu(LSK);

    QAction *GTNP =optionsMenu->addAction("Go To Now playing");
    optionsMenu->setActiveAction(GTNP);
    connect(GTNP,SIGNAL(triggered()),this,SLOT(ActivateWindow()));


    QAction *iAdd = optionsMenu->addAction("Add to PlayList");
    connect(iAdd,SIGNAL(triggered()),this,SLOT(CreateSubMenu()));


    QAction *Del = optionsMenu->addAction("Delete");
    connect(Del,SIGNAL(triggered()),this,SLOT(DeleteArtist()));

    QAction *iExit = optionsMenu->addAction("Back");
    connect(iExit,SIGNAL(triggered()),this,SLOT(HandleBackEvent()));

    LSK->setMenu(optionsMenu);


    The Signal triggered from the 1st three QActions are not calling the corresponding slot function but its working fine for the last QAction.

    Any idea, why is this happening?
    Is there any limitation in using the QMenu?


    Thanks in Advance..
    Sachin

  2. #2
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Some of the QAction events are not calling the corresponding Slot functions

    Might be a bug in the current release...

    Are all the slots that you're attempting to connect to actually members of the current object (you use 'this' every time)?

    Mark

    P.S. You can always try the same code out on Qt for another platform to see if it's an S60 specific issue.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    28

    Re: Some of the QAction events are not calling the corresponding Slot functions

    Hi Mark,

    Yes, all the slots are declared under public slots.

    One more strange thing I observed is that,
    The HandleBackEvent() slot call is working fine, so
    when I call DeleteArtist() slot from inside the HandleBackEvent() slot function, even then also the DeleteArtist() is not called.

    I guess, something is not updating while building the project.

    Thanks and Regards,
    Sachin

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    16

    Re: Some of the QAction events are not calling the corresponding Slot functions

    Hi Sachin
    What is LSK in your code? is it a keyword for Left soft key? I am not able to find it.
    I created menu for Options, with little modification to your code:

    Code:
    QMenu* optionsMenu = new QMenu();
    	
    	QAction *GTNP =optionsMenu->addAction("Go To Now playing");
    	optionsMenu->setActiveAction(GTNP);
    	connect(GTNP,SIGNAL(triggered()),this,SLOT(slotNew()));
    	.....
    
    	OptionButton->setMenu(optionsMenu); //optionButton object of QPushButton

    With this, I am able to call all the slots on their respective triggered signal.
    Hope it'll help you.
    Sumit

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    28

    Re: Some of the QAction events are not calling the corresponding Slot functions

    Hi Sumit and Mark,

    Problem is sloved

    The moc file was not updated for that class.
    I explicitly updated the moc files by running the below command in the command prompt.

    prompt>moc -o moc_file.cpp file.h

    so it updates the moc file corresponding to the header file.

    So the siganl-slot mechanism is done using the moc files in the Qt.
    For more info. on moc files : http://doc.trolltech.com/4.4/moc.html


    Regards,
    Sachin

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Some of the QAction events are not calling the corresponding Slot functions

    Great news that it is fixed! This should happed automatically when you do a build though. Any ideas why it didn't?

    Mark

  7. #7
    Registered User
    Join Date
    Feb 2009
    Posts
    2

    Re: Some of the QAction events are not calling the corresponding Slot functions

    Hi,

    I'm also facing the same problem.
    Please reply.

    Thanks,
    Kalyani
    Last edited by Kalyani; 2009-02-20 at 12:54.

  8. #8
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Some of the QAction events are not calling the corresponding Slot functions

    Do a clean and then rebuild and see if that fixes the problem.

    Mark

  9. #9
    Registered User
    Join Date
    May 2008
    Posts
    28

    Re: Some of the QAction events are not calling the corresponding Slot functions

    You are correct! It should build moc files automatically.

    Eventhough all the moc files and corresponding header files are present in the makefile, the moc files were not getting updated. No idea in this regard.

    just check your make file before building.


    Sachin

Similar Threads

  1. Issue when trying to generate .sis file
    By rmulam in forum Symbian Tools & SDKs
    Replies: 9
    Last Post: 2009-08-13, 14:10
  2. Replies: 2
    Last Post: 2008-07-19, 00:11
  3. Calling functions from AppView::Draw()
    By trafcam in forum Symbian
    Replies: 10
    Last Post: 2007-11-22, 09:08
  4. Replies: 2
    Last Post: 2007-05-23, 09:19
  5. Calling NDS functions from command line
    By jarrodoakley in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2004-10-05, 07:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×