edit: editing failed



  • We have a problem. Not always can edit some values because It's neccesary a condition. How can I avoid the message edit: editing failed?
    I have a model that i reimplement to put the conditions to be Qt::Editable.
    This is the code:

        {
            if (event->button() == Qt::LeftButton)
            {
                QModelIndex index = indexAt(event->pos());
                if (index.column() != 0)
                { // column you want to use for one click
                    setCurrentIndex(index);
                    edit(index);
                }
            }
            QTableView::mousePressEvent(event);
        }

  • Lifetime Qt Champion

    Hi,

    What are you exactly trying to achieve ? Disable edition on the column 0 ?



  • @cimer84 said:

    We have a problem

    We do not have any problem I hope :)

    It looks like your code does in your event handler.

    Why do you call QTableView::mousePressEvent(event);
    after you started editing?
    Editing can't be done, cause code in QTableView::mousePressEvent(event);
    probably has different ideas what should be done as a reaction on the left mouse button click.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.