×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    86

    Question rewrite QListView's click event

    About the QListView clicked event, I want to delete the clicked event high light.
    What could I do?
    The QListView : public QAbstractItemView

    Code:
    void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
    {
        Q_D(QAbstractItemView);
    
        QPoint pos = event->pos();
        QPersistentModelIndex index = indexAt(pos);
    
        if (state() == EditingState) {
            if (d->isIndexValid(index)
                && d->isIndexEnabled(index)
                && d->sendDelegateEvent(index, event))
                update(index);
            return;
        }
    
        bool click = (index == d->pressedIndex && index.isValid());
        bool selectedClicked = click && (event->button() & Qt::LeftButton) && d->pressedAlreadySelected;
        EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers);
        bool edited = edit(index, trigger, event);
    
        d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
    
        if (d->selectionModel && d->noSelectionOnMousePress) {
            d->noSelectionOnMousePress = false;
            d->selectionModel->select(index, selectionCommand(index, event));
        }
    
        setState(NoState);
    
        if (click) {
            emit clicked(index);
            if (edited)
                return;
            QStyleOptionViewItemV4 option = d->viewOptionsV4();
            if (d->pressedAlreadySelected)
                option.state |= QStyle::State_Selected;
            if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
                emit activated(index);
        }
    }
    thank you.
    where there is a will, there is a way.

  2. #2
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    86

    Re: rewrite QListView's click event

    the QListView mouseReleaseEvent code
    Code:
    void QListView::mouseReleaseEvent(QMouseEvent *e)
    {
        Q_D(QListView);
        QAbstractItemView::mouseReleaseEvent(e);
        // #### move this implementation into a dynamic class
        if (d->showElasticBand && d->elasticBand.isValid()) {
            d->viewport->update(d->mapToViewport(d->elasticBand));
            d->elasticBand = QRect();
        }
    }
    where there is a will, there is a way.

  3. #3
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    86

    Re: rewrite QListView's click event

    could I modify this code
    Code:
     QStyleOptionViewItemV4 option = d->viewOptionsV4();
     if (d->pressedAlreadySelected)
    option.state |= QStyle::State_Selected;
    QStyle::State_Selected?
    where there is a will, there is a way.

Similar Threads

  1. Mouse click Event
    By abhimanyu1 in forum Symbian C++
    Replies: 2
    Last Post: 2009-10-09, 08:10
  2. capture inbox click event
    By pamelag in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-10-03, 11:20
  3. Camera Click Event
    By shashideokar10 in forum Symbian C++
    Replies: 1
    Last Post: 2008-06-10, 09:38
  4. How to detect a double click event in S60 C++
    By kdinn in forum Symbian C++
    Replies: 0
    Last Post: 2002-12-11, 04:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •