hi all
i am using QT4.1 on Mac
i had created a table with data in diffrent columns using QPainter
now i am selecting data from table on mousePressEvent()...and selcted upto mouseMoveEvent()...and upto that particular data i am using fillRect()...
it is working when debugged but it is not shown on run time
by debugging results i had seen mouseMove Event() is called again and again...so i want to know why its happening...and why its not showing painted rectangle
if anyone know do tell me by simple example code
i had done like this
void MainForm::mousePressEvent ( QMouseEvent * e )
{
//m_DataPainter->fillRect(m_SelectedRect,Qt::white);
m_StartingPointX= 0;
m_StartingPointX = e->pos().x();
m_StartingPointY= 0;
m_StartingPointY = e->pos().y();
}
void MainForm::mouseMoveEvent ( QMouseEvent * e )
{
if (e->type() == QEvent::MouseMove)
{
m_EndingPointX=e->pos().x();
m_EndingPointY=e->pos().y();
int x2=m_EndingPointX - m_StartingPointX;
int y2=m_EndingPointY - m_StartingPointY;
m_DataPainter->fillRect(m_StartingPointX,m_StartingPointY,x2,y2, Qt::lightGray);
}
}
thanks in advance




Reply With Quote
Bookmarks