CodePudding user response:
Is there, how to make the mouse in tabWidget open track and obtain relative to the coordinates of the controlCodePudding user response:
SetMouseTracking useless? How do you want to track?CodePudding user response:
Just as I do not press the mouse left key of mouse can obtain real-time coordinates relative to the control, but not, although I have already set up mouse trackingMainWindow: : MainWindow (QWidget * parent) :
QMainWindow (parent),
UI (new UI: : MainWindow)
{
The UI - & gt; SetupUi (this);
SetMouseTracking (true);
CentralWidget () - & gt; SetMouseTracking (true);
The UI - & gt; TabWidget - & gt; SetMouseTracking (true);
}
MainWindow: : ~ MainWindow ()
{
Delete the UI;
}
Void MainWindow: : mouseMoveEvent (QMouseEvent * e)
{
QPoint p=e - & gt; Pos ();
The UI - & gt; The label - & gt; SetText (QString (" % 1 and % 2 ")). Arg (p.x ()). Arg (p.y ()));
}
CodePudding user response:
Try to rewrite the base class QWidget enterEvent (QEvent *) eventsCodePudding user response:
Mean rewriting tabWidget, then improve it??