Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. edit: editing failed
Forum Updated to NodeBB v4.3 + New Features

edit: editing failed

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 4.3k Views 2 Watching
  • 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.
  • C Offline
    C Offline
    cimer84
    wrote on last edited by cimer84
    #1

    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);
        }
    A 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C cimer84

        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);
            }
        A Offline
        A Offline
        alex_malyu
        wrote on last edited by alex_malyu
        #3

        @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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved