Little aplication that translate a string in Arabic and after save this Label in BMP
-
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.. :)
-
@painter.drawText(rect, Qt::AlignCenter, (textedit));@
I not undstand: what is rect and after how take text from textedit on mainwindows.ui.?
-
The documentation of the function that you choose to use, states (among a lot of other stuff):
[quote]Draws the given text within the provided rectangle.[/quote]
So, the rectangle you provide in rect is the area in which the text will be rendered. In your case, you will want to be the whole image, so you provide the rectangle your image provides for these purposes:
@
QString text;
//text = .... (see below)
painter.drawText(myImage.rect(), Qt::AlignCenter, text);
@OK?
So, now for what to put on line 2 of the sample above. So far, you have put all your rendering code in your main() function. You may want to re-think that. That has nothing to do with Qt, but everything with object oriented C++ programming in general.
I guess the code for rendering should go in a function inside your MainWindow class. If you do so, you'll automatically have access to the textedit that you put on your main window.
-
thanks Andre..
I have a GUI project with:
mainwindow.ui--> where i drawed a QLineEdit called textedit.
mainwindow.h
main.cpp
mainwindow.cppHow to select textedit in mainwindow.ui instead of Qstring text?
-
What did you try already. I already told you: we're not here to guide you Every. Single. Step. Of. The. Way.
Did you start in that free book you were recommended already?