1

I'm using Qt 4.6.0 in Leopard 10.5.8. I have a few sliders. Every time I slide/click on a slider, it gets focus in Windows. However, it does not get focus on Mac. I have to manually click Tab to change focus. How to rectify this? Thanks in advance!

Viet
  • 17,944
  • 33
  • 103
  • 135

1 Answers1

1

I just had to re-implement the event 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);
}
Viet
  • 17,944
  • 33
  • 103
  • 135