Little aplication that translate a string in Arabic and after save this Label in BMP
-
Thanks for your answer.
I don't know how implement the traslation part.. A dictionary is ok.. But the problem is that in Arabic the shape of the letters change depending on the next letter, for example:"student" is طالب but it is formed by this letter:
ط ا ل ب
Note like change form for example this: ل --> لب -
But that is not your problem. Let Qt's text renderer worry about the text shapes... AFAIK, it is quite good at doing that.
-
Where is text renderer documentation?
Do you have an example for this?
I must export Arabic Label on a BMP file like ARAB1.bmp..thanks
-
[quote author="Andre" date="1333378587"]The rendering to an image is the simple part... Just create a QImage, create a QPainter on that, and render your Arabic string using QPainter::paintText()[/quote]
-
Sorry.. but i'm a newbie in QT can you create for me a little application with this operations?
After i study your example for training... I want to learn QT and i want start from this first application..Please :)
-
Sorry, no. I'm not going to do your homework for you. However, if why don't you just give it a (serious) try, and post your code when you get stuck? I'm sure somebody, perhaps myself, will be willing to help you out then. But you have to show that you're willing to put in effort of your own first.
-
ok you can guide me step by step? Not is my housework :) i'm only a pensioner who wants to learn QT :D
-
[quote author="enaud84" date="1333380451"]ok you can guide me step by step?[/quote]
Why don't you give it a try and get started? We're not here to hold your hand every baby step of the way, but in general, we're a friendly bunch that are ready to help you. I already gave you a pointer on where to get started for the rendering stuff: [[doc:QImage]]. Note that that class also supports saving to file, including .bmp files (through a plugin, but that's of secundairy importance right now).
-
ok.. then start with :
@
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QPainter>int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
QImage myImage;return a.exec();
}
@
to be continued..edit: please use @ tags around code sections; Andre
-
now how create a Painter on that?
-
[[doc:QPainter]] only has one constructor that looks relevant... See if you can spot it as well. For better understanding, try if you can find out what QImage actually is, what class it inherits from.
-
I think:
@
QPainter painter( &myImage );
@ -
OK, great. So now you have a QPainter on your QImage. Time to use that painter for something useful, right. Can you spot a useful method for painting text in the QPainter documentation?
Perhaps you should give your image a size too... It is hard to paint if your canvas is too small, after all.
-
Hi,
how set size of Image?
I not find method for painting text in the QPainter documentation :(Thanks
-
enaud84 - I don't think what you people are doing in this threat is going to work any time soon. If your English is decent go and read a book on Qt, it will take you a while but you will actually learn something and be able to develop on your own without needing to be pushed every step of the way.
Here is a link to a GOOD and FREE book on programming with Qt, it also contains the basics of C++ so it is a very good learning resource:
http://ptgmedia.pearsoncmg.com/images/9780131879058/downloads/0131879057_Ezust_book.pdfAs you get familiar with C++ and Qt you will find it much easier to work with the Qt documentation as well. I can tell you cannot get your way around the Qt DOC since you claim you cannot find a QPainter method for drawing text, and there is a whole bunch of overloads of the drawText() method.
Good luck, be patient and consistent and you will be rewarded.
-
[quote author="enaud84" date="1333400351"]Hi,
how set size of Image?
I not find method for painting text in the QPainter documentation :(Thanks[/quote]
No, I understand that. But you would not expect to control the size of a real painting canvas via your brush or pencil either, right? Perhaps you should look at the [[doc:QImage]] documentation for a way to set the size of the image... -
this book is perfect! it start from zero :)
very thanks :)
[quote author="ddriver" date="1333401818"]enaud84 - I don't think what you people are doing in this threat is going to work any time soon. If your English is decent go and read a book on Qt, it will take you a while but you will actually learn something and be able to develop on your own without needing to be pushed every step of the way.Here is a link to a GOOD and FREE book on programming with Qt, it also contains the basics of C++ so it is a very good learning resource:
http://ptgmedia.pearsoncmg.com/images/9780131879058/downloads/0131879057_Ezust_book.pdfAs you get familiar with C++ and Qt you will find it much easier to work with the Qt documentation as well. I can tell you cannot get your way around the Qt DOC since you claim you cannot find a QPainter method for drawing text, and there is a whole bunch of overloads of the drawText() method.
Good luck, be patient and consistent and you will be rewarded.[/quote]
-
I'm continued with my experiment:
@
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QPainter>int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
QImage myImage(120,120,QImage::Format_Mono);
QPainter painter( &myImage );return a.exec();
}
@
now i must draw a bitmap with a text that i write in a text box..How I must proceed?
thanks
-
Let me quote myself:
[quote author="Andre" date="1333381873"]OK, great. So now you have a QPainter on your QImage. Time to use that painter for something useful, right. Can you spot a useful method for painting text in the QPainter documentation? [/quote]You're on the right way, but you might try to make slightly bigger strides before getting back here for more help...
-
i'm a novice and so i call help to you for to do this little application just for study.. :)