You must use fillRect() in paintEvent(...) only. Do something like that:
//somewhere in class
bool DrawSelection;
{
if(DrawSelection)
painter.fillRect(m_SelectedRect,Qt::white);
...
}
//somewhere in class
bool DrawSelection;
void MainForm::paintEvent(QPaintEvent* e)
{
QPainter painter(this);
if(DrawSelection)
painter.fillRect(m_SelectedRect,Qt::white);
...
}
To copy to clipboard, switch view to plain text mode
and in mouse press event:
{
...
m_StartingPointX= 0;
...
//check sizes and set
DrawSelection = true;
}
void MainForm::mousePressEvent (QMouseEvent * e)
{
...
m_StartingPointX= 0;
...
//check sizes and set
DrawSelection = true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks