Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    [SOLVED] Listview custom delegate editTrigger problem

    General and Desktop
    1
    2
    585
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      smita30apr last edited by

      Hi,

      I have a Listview with my own cutom delegate.
      My custom delegate has a pushbutton which should do something.

      The problem is the you cannot click the pushbutton until the row of the ListView is doubleClicked which triggers edit mode.

      What can I do in the listview so that I can click my pushbutton without doubleclicking the item it is in?

      Regards

      1 Reply Last reply Reply Quote 0
      • S
        smita30apr last edited by

        I found out the way.

        You have to enable mouseTracking on the listView and use its entered(const QModelIndex & index) signal.

        Connect it with a slot open the editor like:

        @void MyDelegate::cell_entered(const QModelIndex &index) {
        if (m_is_any_item_in_edit_mode)
        m_list_view->closePersistentEditor(m_current_edited_index);
        m_list_view->openPersistentEditor(index);
        m_is_any_item_in_edit_mode = true;
        m_current_edited_index = index;
        }@

        1 Reply Last reply Reply Quote 0
        • First post
          Last post