[Qt-interest] How to scroll text drawn with Qpainter in QGraphicsview
_h_
hiralsmaillist at gmail.com
Fri Aug 21 15:40:20 CEST 2009
Hi,
I have implemented QGraphicsView as follow...
3 class GraphicsView: public QGraphicsView
4 {
5 public:
6 GraphicsView(QGraphicsScene *s): QGraphicsView(s) {};
7
8 GraphicsView(QWidget *parent): QGraphicsView(parent) {
9 //setViewport(new QGLWidget);
10 //setViewportUpdateMode(FullViewPortUpdate);
11 //setOptimizationFlags(DontClipPainter);
12 //setCacheMode(CacheNone);
13 };
14 ~GraphicsView(){};
15 protected:
16 /*void drawBackground(QPainter *painter, const QRectF &rect) {
17 //painter->save();
18 //paintGL();
19 //painter->restore();
20 //painter->fillRect(rect, Qt::blue);
21 }*/
22 void drawForeground(QPainter *painter, const QRectF &rect) {
23 QColor c(0, 255, 127);
24 painter->fillRect(rect, c);
25 QFont f;
26 f.setPointSize(25);
27 painter->setFont(f);
28 painter->drawText(0,0, "help would required to scoll this
text");
29 }
30 };
The problem here is that the text drawn with painter (at line 28) is getting
cut and QGraphicsView doesn't shows the scrollbars.
In my application user can set any font size, and based on the font size
view should display scrollbars.
Thank you in advance.
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090821/169613c6/attachment.html
More information about the Qt-interest-old
mailing list