How to fixed the size of the QGraphicsScene.?
Hi,
I am having QGraphicsScene in the QGraphicsView,
now what happens is when I set any QPixmap to QGraphicsScene then it will change QGraphicsScene to QPixmap size,
that is not my requirement,
I want to fixed the size of the QGraphicsScene and then image should be adjusted according to QGraphicsScene's size no matter how big an image was.
Please kindly provide me the solution,
Re: How to fixed the size of the QGraphicsScene.?
Re: How to fixed the size of the QGraphicsScene.?
I have tried it but that will bound the QGraphicsScene's size to minimum means QGraphicsScene will not shrink less then provided,
but QGraphicsScene can take any size maximum than that,
that is not needed in my case,
hope u understand ....
Re: How to fixed the size of the QGraphicsScene.?
Quote:
hope u understand ....
am... actually I don't... sorry...
Re: How to fixed the size of the QGraphicsScene.?
You could reimplement
and use the QPainter to draw the QPixmap. Because it looks me to you want the pixmap as background or?
You could even do something like
Code:
painter->drawPixmap(0,0, m_backgroundImage.scaled(rect.width(), rect.height(),Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
Re: How to fixed the size of the QGraphicsScene.?
when I am using
painter->drawPixmap(0,0, m_backgroundImage.scaled(rect.width(), rect.height(),Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
I am getting the error that painter is not active.
please guide me
Re: How to fixed the size of the QGraphicsScene.?
Try calling QPainter::begin() and QPainter::end(). http://doc.qt.nokia.com/latest/qpainter.html#begin
Re: How to fixed the size of the QGraphicsScene.?
I am using QPainter::begin() and QPainter::end().
dude .... !!!!
Re: How to fixed the size of the QGraphicsScene.?
Re: How to fixed the size of the QGraphicsScene.?
Actually I am using QPainter outside of paintevent().