painter problem in new Qt-4.2.3 installation
Hi all
I just installed Kubuntu to 7.04 on two of my computers. On both I downloaded Qt from A Trolltech mirror.
All went fine, no errors or messages on installation
I have 2 programs that use "QPaintEvent". Both work fine on another computer running the same Qt version. Now one program runs fine on the new installations, the othe locks up the computer and forces a re-boot on both of the new installations.
This works fine on all computers
Code:
{
int xs, xe, ys, ye;
int W, H, w, h;
int width, height;
int counter;
if(addressList.count() == 0) return;
f.setFamily("MuktiNarrow");
f.setPointSize(10);
p.setFont(f);
pen.setBrush(Qt::black);
p.setPen(pen);
W = ui.frmLabelBoxes->width();
H = ui.frmLabelBoxes->height();
width = ((W-20)-30)/3;
height = (H - 115)/10;
counter = 0;
for(h = 0; h < 10; ++h)
{
for(w = 0; w < 3; ++w)
{
k = addressList[counter++];
if(counter > addressList.count()-1) return;
xs = 35 + w * (10 + width);
ys = 30 + h * (10 + height);
xe = width;
ye = height;
p.drawRect(xs, ys, xe, ye );
p.fillRect(xs+1, ys+1, xe-1, ye-1, Qt::white);
k = addressList[counter++];
temp = k.split("\n");
count = temp.count();
for(n = 0; n < count; ++n)
p.drawText(xs + 10, ys + 15 * (n + 1) , temp[n]);
}
}
And this llocks up on the "drawLine" and the "drawText" commands (they are optioned out here)
Code:
{
double angle;
int n, xs, xe, ys, ye, xc, yc;
bool ok;
if(paintSupportLines.count () > 0)
{
f.setFamily("Courier");
f.setPointSize(dwgScaleFactor);
p.setFont(f);
pen.setBrush(Qt::blue);
p.setPen(pen);
p.setViewport(viewportRect);
p.setWindow(windowRect);
if(clearWindow == "erase")
{
p.eraseRect(windowRect);
clearWindow = "cancel erase";
}
else
{
for( n = 0; n < paintSupportLines.count(); ++n )
{
p.setClipRect(clippingRect);
k = paintSupportLines[n];
temp = k.split( "," );
xs = temp[0].toInt(&ok);
ys = temp[1].toInt(&ok);
xe = temp[2].toInt(&ok);
ye = temp[3].toInt(&ok);
//p.drawLine( xs, ys, xe, ye );
// start of labeling.
if(temp[4] == "true")
{
p.setClipRect(windowRect);
xc = (xs + xe) / 2;
yc = (ys + ye) / 2;
if( xs == xe ) angle = pi/2;
else if( ys == ye) angle = 0;
else angle = atan((double)(ye-ys)/(xe-xs));
angle = (angle * 180)/pi;
p.save();
p.translate( xc, yc );
p.rotate( angle );
p.scale(1, -1);
k = "S" + h.setNum(n + 1);
//p.drawText(0, 0, k);
p.restore();
}
}
}
I have varified that the data is correct.
I am at a loss and really need some help.
Thanks
Re: painter problem in new Qt-4.2.3 installation
How large is the paintSupportLines list?
Re: painter problem in new Qt-4.2.3 installation
Quote:
Originally Posted by
marcel
How large is the paintSupportLines list?
anywhere from 1 to maybe a hundredw
I just changed the "drawLine" to "drawRect" and it worked I got a whole lot of boxes instead of lines. Strange What?