hi,
i m trying to capture the key press event. Now, this works for all other keys except the Tab key. What could be the problem?? Here is the code
Image_check
::Image_check(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
ui.pushButton->setFocus();
/* ui.pushButton->setFocusPolicy(Qt::StrongFocus );
ui.pushButton_2->setFocusPolicy(Qt::StrongFocus );*/
}
void Image_check
::keyPressEvent(QKeyEvent *e
) {
if(e->key() == Qt::Key_Tab)
{
if(sender() == ui.pushButton)
{
"first"
"The factory default will be used instead.");
}
else
{
"second"
"The factory default will be used instead.");
}
}
else
}
Image_check::Image_check(QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
ui.setupUi(this);
ui.pushButton->setFocus();
/* ui.pushButton->setFocusPolicy(Qt::StrongFocus );
ui.pushButton_2->setFocusPolicy(Qt::StrongFocus );*/
}
void Image_check::keyPressEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_Tab)
{
if(sender() == ui.pushButton)
{
QMessageBox::information(this, "Application name",
"first"
"The factory default will be used instead.");
}
else
{
QMessageBox::information(this, "Application name",
"second"
"The factory default will be used instead.");
}
QWidget::keyPressEvent(e);
}
else
QWidget::keyPressEvent(e);
}
To copy to clipboard, switch view to plain text mode
I need to capture the Tab key..and that only is not working
Please tell ur suggestions on this..Thanx
Amulya
Bookmarks