Ignore:
Timestamp:
01/19/10 18:34:18 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
395d6d3
Parents:
02c1e09
Message:

single-click is used to open event dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/treeview.cpp

    r02c1e09 rc53a3f4  
    2222    QPoint point = aEvent->pos();
    2323
    24     testForControlClicked(index,point);
    25 
    26     // pass the event to the Base class, so item clicks/events are handled correctly
    27     QTreeView::mouseReleaseEvent(aEvent);
     24    // test whether we have handled the mouse event
     25    if(!testForControlClicked(index,point))
     26    {
     27        // pass the event to the Base class, so item clicks/events are handled correctly
     28        QTreeView::mouseReleaseEvent(aEvent);
     29    }
    2830}
    2931
    30 void TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint)
     32// returns bool if some Control was clicked
     33bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aPoint)
    3134{
     35    bool handled = false;
     36
    3237    if(!aIndex.isValid())
    33         return;
     38        return handled;
    3439
    3540    QRect rect = visualRect(aIndex); // visual QRect of selected/clicked item in the list
     
    5661                // since the Favourite icon has changed, update TreeView accordingly
    5762                static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex);
     63                handled = true;
    5864            }
    5965            break;
     
    8995                // since the Alarm icon has changed, update TreeView accordingly
    9096                static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex);
    91 
     97                handled = true;
    9298            }
    9399            break;
     
    97103                qDebug() << "MAP CLICKED: " << qVariantValue<QString>(aIndex.data());
    98104                emit(requestForMap(aIndex));
     105                handled = true;
    99106            }
    100107        break;
     
    103110            {
    104111                // item was clicked, but not a control
     112                handled = false;
    105113            }
    106114    };
     115
     116    return handled;
    107117}
    108118
Note: See TracChangeset for help on using the changeset viewer.