As an update I implemented the following solution, though I still find it odd that there was no built in mechanism (that I could find anyways)
//I was already inheriting QTreeWidget
//because this is a special built tree that I use in multiple places
{
...
};
void ProductTreeWidget
::keyPressEvent(QKeyEvent* event
) {
switch (event->key())
{
case Qt::Key_Space:
case Qt::Key_Select:
if(currentItem())
{
}
}
}
//I was already inheriting QTreeWidget
//because this is a special built tree that I use in multiple places
class ProductTreeWidget: public QTreeWidget
{
...
};
void ProductTreeWidget::keyPressEvent(QKeyEvent* event)
{
QTreeWidget::keyPressEvent(event);
switch (event->key())
{
case Qt::Key_Space:
case Qt::Key_Select:
if(currentItem())
{
emit QTreeWidget::itemClicked(currentItem(), 0);
}
}
}
To copy to clipboard, switch view to plain text mode
If anybody can see any obvious flaws to this approach pls post
Bookmarks