It is the same code you already have, just using a QImage instead of QBitmap.
QPainter works on any QPaintDevice, QBitmap and QImage are two implementations of that interface.
Cheers,
_
It is the same code you already have, just using a QImage instead of QBitmap.
QPainter works on any QPaintDevice, QBitmap and QImage are two implementations of that interface.
Cheers,
_
Hi anda_skoa,
I tried this one with the following code.
QString filename = "sample.bmp";
QString format = "bmp";
QImage img(384,60,QImage::format_MonoLSB);
img.fill(Qt::white);
QPainter painter(&img);
QFont serifFont("Times", 18, QFont::Bold);
painter.setFont(serifFont);
painter.setPen(Qt::black);
QStaticText strText(txtStr);
strText.setTextFormat(Qt::RichText);
painter.drawStaticText(10,0,strText);
painter.save();
img.save(filename,format.toAscii());
painter.restore();
I used QImage in place of QBitmap .But still it is not working in device.
I think QPainter is gui class so that it is not working.
so can you provide another alternative solution.
What does it mean "not working"?
Have you changed your application object to QCoreApplication?
Cheers,
_
Hi anda_skoa,
I changed my application object to QCoreApplication.I didn't get any error in compile time,
but i am getting error in run time like this
QScreenLinuxFb::connect: No such file or directory
Error opening framebuffer device /dev/fb0
QScreenLinuxFb::connect: No such file or directory
Error opening framebuffer device /dev/fb0
QScreenLinuxFb::connect: No such file or directory
Error opening framebuffer device /dev/fb0
QScreenLinuxFb::connect: No such file or directory
Error opening framebuffer device /dev/fb0
our device don't have any LCD .Can you provide any solution
Very strange, the QCoreApplication does not have code to load any QPA plugin, only QGuiApplication does.
Still, you could try providing the qminimal QPA plugin and using the -platform commandline switch to load it explicitly.
Cheers,
_
Hi anda_skoa,
we are not using Qt-5,we are using Qt-4.7.4
I see.
You'll have to check where the request for the framebuffer connection comes from, QImage quite certainly doesn't need it.
Alternatively you could look into providing a virtual framebuffer that the application would then work with, or a virtual X server, e.g. Xvfb
Cheers,
_
Hi anda_skoa,
we are getting problem with QPainter.
Can you provide any link or documentation for Xvfb installation or configuration
Bookmarks