PDA

View Full Version : alternative to qtextedit



Rooster
3rd August 2008, 22:38
I have a series of custom widgets that I use to draw graphs on. I also resize them with a series of zoom in and zoom outs. However, when I insert the qtextedit widget in there everything seems to go crazy. When I try to resize all the graph widgets disappear. I use the qtextedit widget for debugging but ultimately it will be used to display information about the graphs. Is there something else that I could use to out text on to using QStrings?

fullmetalcoder
4th August 2008, 09:17
mmmm... Not very clear. :eek:
Do you mean you've created some sort of graph (presumably in a QGraphicsView (http://doc.trolltech.com/latest/qgraphicsview.html)) and at some point you add a QTextEdit (http://doc.trolltech.com/latest/qtextedit.html) to the scene (a bit crazy)? Or do you add it in a layout close to the view (recommended)? Or is it something else?

edit : seeing the "Qt3" tag I suppose you're using QCanvas instead but I'm pretty sure the above still stand.

Rooster
5th August 2008, 00:18
I am using qt4 and what I have is a custom widget that has a paint event that draws the graphs. The QTextEdit is in a layout below the graphs. When I remove it from the qui everything works fine, but when I include it everything goes to crap.

Hope this helps explain things.

fullmetalcoder
5th August 2008, 09:46
So you insert a QTextEdit, which causes a resize of all previously inserted widget according to the layout policy and then your widget looks bad that's it?

Have you tried resizing your graph widget on the fly (without having the text edit inserted)? Most likely it will lead to the same drawing problems which indicates that there is something wrong in your drawing code (not taking reacting to resize events, not taking widget size into account when drawing, ...)

Rooster
7th August 2008, 02:36
I went back and took a look at how I was doing the resizing and played around with that and now everything works.

Thanks