Results 1 to 3 of 3

Thread: QPushbutton Right Click with customcontext menu sender inaccessible.

  1. #1
    Join Date
    Jan 2018
    Posts
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Windows

    Question QPushbutton Right Click with customcontext menu sender inaccessible.

    I want to use right click of push button. I am connecting Custommenurequested signal with the slot. Signal is generated and slot is triggered. My problem is I am not able to access the sender to know which pushbutton is clicked. My connection is done in one class and event is generated in another class. My slot is present in same class where connection is done. While debugging in slot it says sender not accessible.
    I tried to put the slot in the class where the signal is generated. In that case linker error says receiver not found in current object and slot is not triggered.
    How this can be solved? Either access the sender from another class or connecting to slot from another class.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QPushbutton Right Click with customcontext menu sender inaccessible.

    Its really hard to tell without seeing the code.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,249
    Thanks
    304
    Thanked 868 Times in 855 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QPushbutton Right Click with customcontext menu sender inaccessible.

    My problem is I am not able to access the sender to know which pushbutton is clicked.
    Unfortunately, even if you do find a way for the debugger to show you the sender, I think the sender might turn out to be the context menu, not the push button that responded to the click to post the menu.

    In any case, as high_flyer says, it is impossible to diagnose code problems with no code.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 4
    Last Post: 11th January 2014, 04:06
  2. Replies: 0
    Last Post: 24th March 2013, 11:41
  3. Replies: 1
    Last Post: 18th May 2012, 12:36
  4. Using double click in QPushButton
    By nikbits in forum Newbie
    Replies: 1
    Last Post: 16th September 2011, 12:28
  5. QPushButton click
    By qutron in forum Newbie
    Replies: 2
    Last Post: 29th November 2010, 15:47

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.