Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 981711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:35:06+00:00 2026-05-16T04:35:06+00:00

Is there any way to determine if a QTableView has an open editor in

  • 0

Is there any way to determine if a QTableView has an open editor in the current cell? I need to handle the following situation:

  • A user double-clicks a cell and edits the data, but leaves the cell in the “edit” state.
  • On another part of the UI, an action is taken that changes the selected row of the underlying model.
  • Back on my view, I want to determine if the newly selected row is the same as the open row. If not, I need to take an action. (Prompt the user? Commit automatically? Revert?)

I see how to get the current item, and can get the delegate on that item, but I don’t see any isEditMode() property I was hoping to find.

Can someone point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:35:07+00:00Added an answer on May 16, 2026 at 4:35 am

    Subclass your delegate so that it includes an accessor that tells you when it’s editing:

    void MyDelegate::setEditorData ( QWidget * editor, const QModelIndex & index ) const {
        // _isEditing  will have to be mutable because this method is const
        _isEditing = true; 
        QStyledItemDelegate::setEditorData(editor, index);
    }
    
    void MyDelegate::setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const {
        QStyledItemDelegate::setModelData(editor, model, index);
        _isEditing = false;
    }
    
    bool MyDelegate::isEditing() const { return _isEditing; }
    

    Then you can just check the delegate to see what’s going on. Alternatively and/or if you don’t like the mutable, you can emit signals so you know what state the delegate is in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to determine if a file is open by anything include
Is there any way to determine if the user clicked on a link, the
Is there any way to determine if a text file is currently open in
Is there any way to determine if an oauth token has been revoked besides
Is there any way to determine in JDBC that a column or table has
Is there any way to determine a removable drive speed in Windows without actually
Is there any way to determine if an object is a generic list? I'm
Is there any way to determine the local culture of a PC (such as
Is there any way to determine if the mouse scrolls up or down using
Is there any way to determine a page numer (in paged list), that contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.