hi, anyone know why the text on label doesn't appear?? thanks
Qt Code:
//setText(s); } lab1 = new myLabel ("Mod1", this->Mo,""); lab2 = new myLabel ("Mod2", this->Mo,"");To copy to clipboard, switch view to plain text mode
hi, anyone know why the text on label doesn't appear?? thanks
Qt Code:
//setText(s); } lab1 = new myLabel ("Mod1", this->Mo,""); lab2 = new myLabel ("Mod2", this->Mo,"");To copy to clipboard, switch view to plain text mode
Regards
What is this->Mo ?
Is Mo shown ?
try calling show() at the end of the constructor.
Mithin
www.mithin.in
mo is a Widget; the label is shown; the background color appear....i tried show() but don't change...
Regards
oh sorry, I thought the label was not appearing. My mistake.
You are not setting any text and therefore no text appears.
uncomment setText(s)
Last edited by munna; 3rd June 2006 at 13:25.
Mithin
www.mithin.in
don't work.....I just tried
Regards
you should put ur labels in ctor or any other function called at startup.
Hi see that setText(s) in the constructor works! the problem was the presence the paintEvent(); I could put p.drawText inside paintEvent but this eat the setText of constructor; How can I avoid this? (I want set text on label to be s).thanks
Qt Code:
setText(s); } myMainForm::myMainform() { lab1 = new myLabel ("Mod1", this->Mo,""); lab2 = new myLabel ("Mod2", this->Mo,""); } QPainter p; p.begin( this ); p.rotate(20.0); p.drawRect(35,5,70,70); //p.drawText(50,50, "????" Qt::AlignCenter ); p.end(); }To copy to clipboard, switch view to plain text mode
Regards
You must invoke the base class's implementation of the paintEvent() somewhere:Originally Posted by mickey
Qt Code:
p.rotate(20.0); p.drawRect(35,5,70,70); p.end(); }To copy to clipboard, switch view to plain text mode
thank for this;
but I need also rotate it;
so how to do this?
Qt Code:
p.drawText(50,50, textLabel, Qt::AlignCenter ); mylabel.cpp(106): error C2664: 'void QPainter::drawText(int,int,const QString &,int,QPainter::TextDirection)' : cannot convert parameter 3 from 'QString *' to 'const QString &'To copy to clipboard, switch view to plain text mode
Regards
Could anyone help me (last message)? thanks
Regards
Which parameter of the QPainter::drawText() does this error message refer to?Originally Posted by mickey
What type does it expect?
What is the type of variable you have used?
Bookmarks