Qt QPixmap QPainter problem -


i have piece of code has lines of code:

int dsize = 100; qpainter *painter; qpixmap *img; qlabel *l_img;  painter = new qpainter; img = new qpixmap(dsize, dsize);  l_img = new qlabel; l_img->setpixmap(*img);  painter->begin(img); painter->fillrect(img->rect(), qt::white);  qpen pen(qt::black, 12); painter->setpen(pen); painter->drawline(40, 40, 40, 100);  painter->end(); l_img->show(); 

how ever when run code, don't see white image black rectangle on it. in fact see title of window written in big fonts. nothing seems work, image that. doing wrong?

thank you!

got it!!

it has line:

l_img->setpixmap(*img); 

it should after

painter->end(); 

thank you, xd.


Comments

Popular posts from this blog

java - netbeans "Please wait - classpath scanning in progress..." -

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

openxml - Programmatically format a date in an excel sheet using Office Open Xml SDK -