octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55668] Variable Editor cannot delete certain


From: Rik
Subject: [Octave-bug-tracker] [bug #55668] Variable Editor cannot delete certain rows and columns in struct classes
Date: Fri, 8 Feb 2019 13:18:46 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #5, bug #55668 (project octave):

Maybe we need to post something on the Octave Maintainer's list about this. 
The problem is in the organization of the code and the way the classes
interact.  The problem is this function


  bool
  variable_editor_model::removeRows (int row, int count, const QModelIndex&)
  {
    if (row + count > data_rows ())
      {
        qDebug () << "Tried to remove too many rows "
                  << data_rows () << " "
                  << count << " (" << row << ")";
        return false;
      }

    octave_link::post_event
      (this, &variable_editor_model::eval_oct, name (),
       QString ("%1(%2:%3, :) = []")
       .arg (QString::fromStdString (name ()))
       .arg (row)
       .arg (row + count)
       .toStdString ());

    return true;
  }


It is a function from variable_editor_model and it assumes that all variables
can be deleted given a code sequence


varname(row:row+count, :) = [];


Unfortunately, that is not how fields can be removed from structs.  The code
would need to use rmfield().  This suggests that the code needs to be
organized so that a more specialized class, such as struct_model, could
override the default subroutine removeRows.  Unfortunately, struct_model is a
descendant from base_ve_model which does not define this method.  Only
variable_editor_model class has this method. 


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55668>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]