View Full Version : On Press Space Key item in QTreeWidget gets checked.
merry
5th January 2012, 06:39
Working in Qt4.6 on mac os 10.6 , Whenever i press Space key item in QTreeWidget gets checked, i am trying to handle it using keyPressEvent but nothing happens.
void MyTreeWidget::keyPressEvent ( QKeyEvent * event )
{
this->QTreeWidget::keyPressEvent(event);
if(event->key()==Qt::Key_Space)
{
event->ignore();
}
}
What should i do so that nothing happens on press of space key.
Regards,
ChrisW67
5th January 2012, 07:06
Try not calling the superclass keyPressEvent() if you don't want it to handle the key press.
merry
5th January 2012, 07:39
I used keyPressEvent() for handling the space key, if i not use this then also it wont works, On press space key the item in treeWidget gets checked.
Spitfire
9th January 2012, 09:19
You're ignoring the even after passing it to the base clase, no wonder that doesn't change widget's bahaviour.
Put line 3 at the end of the function then event will get ignored before it's processed.
Also, could you elaborate what you mean by 'checked'?
Is there a checkbox that gets checked or widget gets higlighted like when it's selected or maybe something else?
I'm bit confused here.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.