pixmapa
= QPixmap::grabWidget(this);
if ( e->button() == Qt::LeftButton )
//here I've left out that defines screen coords etc.
{
int idx, nr_pryzmy;
int temp_x1,temp_z1,z_szer=0,z_wys=0;
double xm,zm;
if(e->state() & Qt::LeftButton)
{
if(click_x1>click_x2)
{
temp_x1 = click_x2;
click_x2 = click_x1;
}
if(click_z1>click_z2)
{
temp_z1 = click_z2;
click_z2 = click_z1;
}
if(click_x1<xel) click_x1 = xel;
if(click_x2>xer) click_x2 = xer;
if(click_z1<yel) click_z1 = yel;
if(click_z2>yer) click_z2 = yer;
z_szer = click_x2 - click_x1;
z_wys = click_z2 - click_z1;
rr
= QRect(temp_x1,temp_z1,z_szer,z_wys
);
bitBlt(this,0,0,&pixmapa);
//rysuj_prostokaty(&p);
//repaint(rr);
p.setBrush(NoBrush);
p.setPen(DashLine);
if(z_ksztalt==1 || z_ksztalt==-1) p.drawRect(rr);
if(z_ksztalt==2)p.drawEllipse(rr); // THIS IS THE BIT THAT FAILS
}
}
//here I've left out a lot of subsiduary code etc.
if(z_ksztalt==2)
{
rr
= QRect(click_x1,click_z1,z_szer,z_wys
) ;
}
}
}
//Tanimbar: the update below causes the selected blocks to change density colour
update();
rysuj_prostokaty(&p);
}
void strPlot::mousePressEvent( QMouseEvent *e)
pixmapa = QPixmap::grabWidget(this);
if ( e->button() == Qt::LeftButton )
//here I've left out that defines screen coords etc.
void strPlot::mouseMoveEvent( QMouseEvent *e)
{
int idx, nr_pryzmy;
QRect rr;
QPoint punkt;
int temp_x1,temp_z1,z_szer=0,z_wys=0;
double xm,zm;
QPainter p( this );
if(e->state() & Qt::LeftButton)
{
if(click_x1>click_x2)
{
temp_x1 = click_x2;
click_x2 = click_x1;
}
if(click_z1>click_z2)
{
temp_z1 = click_z2;
click_z2 = click_z1;
}
if(click_x1<xel) click_x1 = xel;
if(click_x2>xer) click_x2 = xer;
if(click_z1<yel) click_z1 = yel;
if(click_z2>yer) click_z2 = yer;
z_szer = click_x2 - click_x1;
z_wys = click_z2 - click_z1;
rr = QRect(temp_x1,temp_z1,z_szer,z_wys);
bitBlt(this,0,0,&pixmapa);
//rysuj_prostokaty(&p);
//repaint(rr);
p.setBrush(NoBrush);
p.setPen(QPen(black,2));
p.setPen(DashLine);
if(z_ksztalt==1 || z_ksztalt==-1) p.drawRect(rr);
if(z_ksztalt==2)p.drawEllipse(rr); // THIS IS THE BIT THAT FAILS
}
}
void strPlot::mouseReleaseEvent( QMouseEvent *e)
//here I've left out a lot of subsiduary code etc.
if(z_ksztalt==2)
{
rr = QRect(click_x1,click_z1,z_szer,z_wys) ;
zmien_stan(QRegion(rr,QRegion::Ellipse));
}
}
}
//Tanimbar: the update below causes the selected blocks to change density colour
update();
QPainter p( this );
rysuj_prostokaty(&p);
}
To copy to clipboard, switch view to plain text mode
Bookmarks