Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ChartView RubberBand zoom out (right click) event
Forum Updated to NodeBB v4.3 + New Features

ChartView RubberBand zoom out (right click) event

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 544 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • cpperC Offline
    cpperC Offline
    cpper
    wrote on last edited by cpper
    #1

    Hello,
    I want to control the zoom out event caused by right clicking when rubber band is enabled in a chart view. I want to achieve this, but using eventFilter instead of subclassing QChartView. However, the mouse release event seems not to be triggered. Here is the code:

        //MainWindow constructor:
        chartView.setMouseTracking(true);
        chartView.setInteractive(true);
        
        chartView.installEventFilter(this);
     
      //..................
    
      bool MainWindow::eventFilter(QObject *watched, QEvent *event){ 
          if(watched == &chartView && event->type() == QEvent::MouseButtonRelease){
               if(static_cast<QMouseEvent*>(event)->button() == Qt::RightButton)  {
                   qDebug() << "here i am" ;              
               }
           }
           return QMainWindow::eventFilter(watched, event);
      }
    

    If I replace QEvent::MouseButtonRelease with QEvent::MouseButtonPress the event gets called. However the zooming out happens when releasing the mouse, so that is what I need to control.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved