Make 'not editable' fields 'copyable'

29 views
Skip to first unread message

Fernando Governatore

unread,
Feb 25, 2016, 2:16:51 PM2/25/16
to project-camelot
Hi,

I'm trying to change the default behavior of Camelot so that I can
copy the text on 'not editable' text lines. By default, Qt does not
allow disabled fields to have its text selected/copied, but it allows
ReadOnly fields.

With this change, I can copy the text:

--- a/camelot/view/controls/editors/textlineeditor.py    Thu Nov 19 15:55:43 2015 -0200
+++ b/camelot/view/controls/editors/textlineeditor.py    Thu Feb 25 16:12:21 2016 -0300
@@ -101,7 +101,7 @@
         if text_input is not None:
             editable = kwargs.get('editable', False)
             value = text_input.text()
-            text_input.setEnabled(editable)
+            text_input.setReadOnly(not editable)
             text_input.setText(value)
             text_input.setToolTip(six.text_type(kwargs.get('tooltip') or ''))
             set_background_color_palette(text_input,

But this doesn't change any TableView nor does it change fields on a form
that are related to another table.

Is there a simple way of doing it?

Thanks,
Fernando

Erik Janssens

unread,
Feb 25, 2016, 4:55:57 PM2/25/16
to project...@googlegroups.com
I suppose this is because when a field is not editable,
the table view does not open an editor, as such, the user
cannot interact with the field

I've changed this in the 'no_shared_data' branch, so an
editor is always opened when the user clicks in a field

You could patch your Camelot to do so as well by
reimplementing the flags method on the CollectionProxy
--
--
You received this message because you are subscribed to the "Project Camelot" group.
Visit www.python-camelot.com for more information
 
To post to this group, send email to project...@googlegroups.com
To unsubscribe from this group, send email to
project-camel...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/project-camelot?hl=en

---
You received this message because you are subscribed to the Google Groups "Project Camelot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-camel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages