dwj
dwj

Reputation: 3483

QSlider focus with a hotkey?

The QSlider documentation says, "A slider accepts focus on Tab and provides both a mouse wheel and a keyboard interface." Is there an easy way to assign a hotkey to it to give it focus similar to how one can assign an Alt key for QCheckboxes?

Upvotes: 1

Views: 681

Answers (1)

Dave Mateer
Dave Mateer

Reputation: 17956

If you have an associated label, you should be able to use QLabel::setBuddy(QWidget*). Otherwise, you could override the keyPressEvent for the parent form that would have focus and then call QSlider::setFocus(Qt::FocusReason).

Upvotes: 2

Related Questions