Results 1 to 3 of 3

Thread: First Click of a QwtPlotPicker does not respond

  1. #1
    Join Date
    Apr 2013
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default First Click of a QwtPlotPicker does not respond

    Hi fellow coders:


    I am working on a bit of code where I need to find the coordinates of a mouse click on a QwtPlot object. Everything works fine except the very first mouse click is ignored. Here is the initialization code:

    Qt Code:
    1. // code snippet ---------------------------------------------------------------------------------
    2. picker = new QwtPlotPicker(btrElement->btrStructure.btr->canvas());
    3. picker->setEnabled(true);
    4. picker->setTrackerPen(QColor(Qt::white));
    5. picker->setTrackerMode(QwtPlotPicker::AlwaysOn);
    6. picker->setStateMachine(new QwtPickerClickPointMachine());
    7. picker->setRubberBand(QwtPicker::RectRubberBand);
    8. connect(picker,
    9. SIGNAL(selected(QPointF)),
    10. this,
    11. SLOT(rcvBTRPointSelected(QPointF)));
    To copy to clipboard, switch view to plain text mode 

    I would expect that once I click on the QwtPlot object, it would immediately respond to the click via the SLOT/SIGNAL mechanisms that Qt uses. This does happen after the initial click.
    As another note: I am using 5 of these plots and each exhibits the very same behavior.
    Any help would be greatly appreciated. Thanks.

    -jbob

  2. #2
    Join Date
    Apr 2013
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: First Click of a QwtPlotPicker does not respond

    An update: I have found that the use of a QwtPlotPanner is the root cause, however, I cannot figure out why this is causing the first mouse click to not be recognized.


    Added after 26 minutes:


    I believe I have resolved this problem, however, I am not sure I understand why this resolution works:

    I am using a QwtPlotPanner and a QwtPlotPicker. If the QwtPlotPicker is initialized BEFORE the QwtPlotPanner, the very first mouse click on the QwtPlot is ignored. I have modified my code to initialize the QwtPlotPanner before the Picker. With this change, things do seem to be working as expected. If there is anyone that explain to me why this is so, I would appreciate it.

    V/R
    --jbob
    Last edited by jbob99; 18th April 2013 at 15:42.

  3. #3
    Join Date
    Mar 2013
    Posts
    19
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: First Click of a QwtPlotPicker does not respond

    Have a look on setMousePattern methods (default behavior) for both Panner and Picker objects to see if you don't have conflicts.

Similar Threads

  1. QGraphicsScene doesn't respond to mousePressEvent
    By Affenbrotbaum in forum Qt Programming
    Replies: 1
    Last Post: 21st January 2010, 19:56
  2. How to respond the reallty button?
    By anson97209 in forum Qt Programming
    Replies: 2
    Last Post: 18th October 2009, 20:04
  3. How to respond the reallty button?
    By anson97209 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 15th October 2009, 12:08
  4. respond to up dn keys tableview
    By rogerholmes in forum Newbie
    Replies: 1
    Last Post: 28th March 2009, 07:05
  5. QFileInfo for directory does not respond to 'touch'
    By kghose in forum Qt Programming
    Replies: 2
    Last Post: 28th July 2008, 15:09

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.