What is the best method to generate a Qt text object with line numbers through klayout's ruby scripting?
One example I have found outside of klayout involves creating sub-classes from QPlainTextEdit and QWidget. In this c++ example, the line number area [QWidget] is painted and controlled by events in the text object [QPlainTextEdit]. However, I am not sure how to go about doing something similar through klayout.
Is there another method to use?
Comments
Hi,
well, you can basically convert the sample into Ruby, but I doubt that you would like to do this. It's a big effort and frankly I have some doubts whether that will be successful in terms of functionality required and performance.
I had a similar topic for the macro editor. The solution there is to use a separate panel next to the text widget which shows the line numbers and synchronize both by means of signals. You'll find the sources for the side panel widget in
layMacroEditorPage.cc
. The class of the side panel widget isMacroEditorSidePanel
.Another option is not to show line numbers in the text edit widget but to show the current line in a label below or beside the edit widget. That's fairly simple to implement with signals/events and serves the purpose of showing the current location.
Matthias
jnopaja,
I'm interested in doing a similar thing. Could you please paste your code?
Thanks,
David