Forum
Sign Up
× DataGrid for Qt.C++

multi editing cells

1 month 1 week ago #1 by robert
multi editing cells was created by robert
Hello,

we would like to implement multi editing of cells in QtitanGrid for python. "multi editing" meaning: select a few cells, start editing and apply the result to all selected. Previously we used to override the "commitData" method of the modelviews. How can we achieve this?

Many regards

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago #2 by Developer Machines
I'd suggest to use these signals to get notified about editing value:
void editorModifying(GridEditor* editor); - changing some value in the editor
void editorStoping(EditorEventArgs* args) - before the end edititng, the value is not in the model
void editorStoped(EditorEventArgs* args) - editor stoped, the value in the model.
void editorValidating(EditorValidationEventArgs* args) - the value validatation. It depends on GridEditorRepository::immediatePost() and GridEditorRepository::validateOnEnter() flags.

Looks like you need editorStoped() and commit the value to the other model's cells on it.

See my python debug code:
from DevMachines.QtitanGrid import (GridEditor, EditorEventArgs, EditorValidationEventArgs)
.....

        self.connect(view, SIGNAL("editorModifying(GridEditor*)"), self, SLOT("viewEditorModifying(GridEditor*)"))
        self.connect(view, SIGNAL("editorStoping(EditorEventArgs*)"), self, SLOT("viewEditorStoping(EditorEventArgs*)"))
        self.connect(view, SIGNAL("editorStoped(EditorEventArgs*)"), self, SLOT("viewEditorStoped(EditorEventArgs*)"))
        self.connect(view, SIGNAL("editorValidating(EditorValidationEventArgs*)"), self, SLOT("viewEditorValidating(EditorValidationEventArgs*)"))

....................

    @QtCore.Slot(GridEditor)
    def viewEditorModifying(self, editor):
        view = self.grid.view()
        print("editorModifying: " + str(editor))
        print("editorModifying, value: " + str(editor.getContextValue()))

    @QtCore.Slot(EditorEventArgs)
    def viewEditorStoping(self, args):
        view = self.grid.view()
        print("editorStoping: " + str(args) + "args.modelRowIndex: " + str(args.row().modelRowIndex()))
        print("editorStoping, value: " + str(view.activeEditor().getContextValue()))

    @QtCore.Slot(EditorEventArgs)
    def viewEditorStoped(self, args):
        view = self.grid.view()
        print("editorStoped: " + str(args))
        print("editorStoped, value: " + str(view.activeEditor().getContextValue()))

    @QtCore.Slot(EditorValidationEventArgs)
    def viewEditorValidating(self, args):
        print("editorValidating: " + str(args))
        print("editorValidating, edit value: " + str(args.editValue()))
        print("editorValidating, editing value: " + str(args.editingValue()))
        print("editorValidating, index: " + str(args.modelIndex()))

Please Log in or Create an account to join the conversation.

More
1 month 4 days ago #3 by robert
Replied by robert on topic multi editing cells
Thank you, yes that solved my question!

Please Log in or Create an account to join the conversation.

More
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer MachinesEduard
Time to create page: 0.127 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.( any questions related to our products or services )
  • This email address is being protected from spambots. You need JavaScript enabled to view it.( questions related to licensing )