Connect the customContextMenuRequested signal to a slot where you look at the x,y co-ordinates to find out which cell the menu was requested from using QTableWidget::itemAt(QPoint).
Connect the customContextMenuRequested signal to a slot where you look at the x,y co-ordinates to find out which cell the menu was requested from using QTableWidget::itemAt(QPoint).
Last edited by Corran; 13th January 2006 at 17:58.
If you cannot release code, then some questions instead:
How are you handeling the tabs->convertion (show tabs as 8 spaces, etc)
Are displaying the current line in another color?
What other goodies do you have implemented?
Thanks but I have already done it by myself. I asked the question before thinking about the answer!!!Originally Posted by Corran
![]()
Dear elcuco, your beast appeared to me!!!
Looks nice but still needs a little work.
Let's describe the "Graal" I made starting from QSA's editorOriginally Posted by elcuco
![]()
DevEdit : inherits QTextEdit
- custom contextMenu
- some additional signals and slots for convinience
DevStatus : inherits QStatusBar
- additional slot to write right aligned message (in my case its colum and row)
DevLineNumber : inherits QWidget
- draws line number (note : taken verbatim from QSA)
- additional signals and slots are planned for integrated debugging purpose
DevEditor : inherits QWidget
- All the widgets described above are put into a QGridLayout and signals are properly connected to have those widgets working together
following signals are wrapped for convinience:
- QTextEdit's signals
- QStatusBar signal
- QTextEdit's scrollbar's signals
The description I give may not be very clear but you'll understand with the code.
I'm gonna post it during the week. Wait...
edit :
posted a screenshot.
After thinking a bit I decided to reimplement my DevEdit as clone of QTextEdit but without any HTML stuff making it slow and with a custom highlighting mechanism.
You'll have to wait more before the final version but if anyone is interested in the current one he can e-mail me to get it.
edit 2:
WTF !!! I looked into Qt's source and QTextedit would be quite hard to reimplement using inheritance... I'll try to craft a widget with a QAbstractScrollArea inside and custom paint, keypress, context menu (...)events.
I do not like the idea of starting from scratch but...
Last edited by fullmetalcoder; 10th February 2006 at 15:41.
Current Qt projects : QCodeEdit, RotiDeCode
Ok, nice. So it can be done...
I see you have exactly the same problem I have.
I am using a QTabWidget, I seem to have an orrible space on the right side, which means the right scrollbar is not on the "infinite-right". I have looked into Qt-Assistant code for some ideas about how they did it, and I "borrowed" that code, but still the internal editor is way from from the sides of the window.
Again, a few questions if you do not mind:
1) "display tab as X spaces", did you implement it? If so how? if not, how are you planning?
2) The syntax highlighter. It's based on the examples from the trolls? See notes bellow.
3) Current line and match brackets. Planned...? Implemented...?
I am toying with this issue myself, and I already implemented a hack of a system for displaying and loading SL. I am currently loading parts of GtkSourceView SH definitions, and I can display in a rather good quality C/C++/C# syntaxes. I will fix the implementation I have to display DIFF and other goodies (I am still messing the implementation...). I used as a base the SH example supplied by the trolls with some spin ups.
If found that using RegEx for for the painting is extreamly painfull, as in big files (~1000 lines) text will take about 5 seconds to load. I will try to see if the code for settign the QSyntaxHighliter can be put in a QTimer::singleShot() to make this call asynchroneous and improove usability, as hack for a good SH system.
Did you write the SH yourself (as the example on Qt4.0 showed), or are you deriving QSyntaxHihlighter. In any case, how is the drawing made? (hard coded contexts or something like Kate?)
Bookmarks