From e36e315d55c42b4d17f3065661a3e8e1a97e1c7f Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 5 Dec 2012 17:02:09 +0000 Subject: fixed radio button delegate git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3023 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/radioitemdelegate.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/qmmpui/radioitemdelegate.cpp') diff --git a/src/qmmpui/radioitemdelegate.cpp b/src/qmmpui/radioitemdelegate.cpp index 81d1fafad..a65930f7b 100644 --- a/src/qmmpui/radioitemdelegate.cpp +++ b/src/qmmpui/radioitemdelegate.cpp @@ -82,16 +82,19 @@ QSize RadioItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QMod bool RadioItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) { - if (event->type() == QEvent::MouseButtonRelease) + if (event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::KeyPress) { if (hasRadioButton(index)) { - QRect checkRect = qApp->style()->subElementRect(QStyle::SE_RadioButtonIndicator, &option); + if(event->type() == QEvent::MouseButtonRelease) + { + QRect checkRect = qApp->style()->subElementRect(QStyle::SE_RadioButtonIndicator, &option); - QMouseEvent *mouseEvent = dynamic_cast(event); + QMouseEvent *mouseEvent = dynamic_cast(event); - if(!checkRect.contains(mouseEvent->pos())) - return QStyledItemDelegate::editorEvent(event,model,option,index); + if(!checkRect.contains(mouseEvent->pos())) + return QStyledItemDelegate::editorEvent(event,model,option,index); + } if (!index.data(Qt::CheckStateRole).toBool()) { -- cgit v1.2.3-13-gbd6f