getting no response from QWheelEvent
-
I am trying to use the mouse wheel but it does not give any response.
i tried with the function below:
void wheelEvent(QWheelEvent *ev)
{
if(ev->angleDelta().y() > 0) // up Wheel
cout<< " increasing" << endl;
else if(ev->angleDelta().y() < 0) //down Wheel
cout<< " decreasing" << endl;
}
how to solve this problem? -
@Md-Saif-Khan said in QWheelEvent *ev problem:
how to solve this problem?
What exact problem? Where do you use this function?
-
I am using this function in qtopenglwidget. I have drawn linestrip. Now i want to add zoom in and out functionalities by using mouse wheel. I am new in qt . May be I am wrong. But i found in internet that to use mouse wheel, I have to use this function. Thats why first i was trying to print something by scrolling the mouse wheel. But it does not print anything.
-
@Md-Saif-Khan said in getting no response from QWheelEvent:
void wheelEvent(QWheelEvent *ev)
You don't use this function in your qtopenglwidget here ...
-
@Christian-Ehrlicher could you please tell me how i can use mouse wheel while i am working on qtopenglwidget?
-
Hi,
You start by creating a subclass of QOpenGLWidget.
-
Then I recommend with starting from the basics: C++ inheritance.
-
@Md-Saif-Khan said in getting no response from QWheelEvent:
me some website link where i can understand how they are using mouse wheel in qt for qtopenglwidget.
This will not help until you learn basic ++ stuff like inheritance as @SGaist already pointed out.
-
You know that your current free function just misses one thing to be properly used ?
-
I understood the problem. Thank you for your help. :)
-
Great !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three doted menu beside the answer you deem correct so that other forum users may know a solution was found :-)