Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Leopard 10.5.8 中使用 Qt 4.6.0。我有几个滑块。每次我滑动/单击滑块时,它都会在 Windows 中获得焦点。但是,它并没有关注 Mac。我必须手动单击 Tab 来更改焦点。如何纠正这种情况?提前致谢!
我只需要重新实现事件 QWidget::mousePressEvent ( QMouseEvent * event ) :
void MyChildWidget::mousePressEvent ( QMouseEvent * event ) { //event->accept(); this->setFocus(Qt::TabFocusReason); event->ignore(); // give control to the parent QSlider::mousePressEvent(event); }