how to manipulate the keyboard event?
hi i have develop a lilttle account sistem and i need to manipulate the keyboard event, i have tryed overrriding the MyApplication::KeyPressed(Qevent * event) and configurating the TabWidget FocusPolicy to receive focus from the keyboard and the mouse, but nothiong happend!!!, can anybody help, thx
Re: how to manipulate the keyboard event?
you can try to use
with
Code:
bool QWidget::focusNextPrevChild ( bool next
)
Re: how to manipulate the keyboard event?
I think you need to handle event from QTabBar, so next example is how to do this
Code:
TabWidget
::TabWidget(QWidget *parent
){
tabBar()->installEventFilter(this);
}
TabWidget::~TabWidget()
{
}
{
if (event
->type
() == QEvent::KeyPress && o
== tabBar
()) { QKeyEvent *keyEvent
= static_cast<QKeyEvent
*>
(event
);
if (keyEvent->key() == Qt::Key_Right) {
if (currentIndex() != 2) {
setCurrentIndex(2);
QWidget *widget
= this
->widget
(currentIndex
());
if (widget)
widget->setFocus();
return true;
}
}
}
}
I hope it helps you.