PDA

View Full Version : Draw the QGraphicsItem's thumbnail when moved to the view



SamSong
16th August 2009, 17:46
hi, all
my application is graphics/view module.
when I click my element toolbar which activate the element insert action, I want to create
the element thumbnail which moves follow the mouse ,when released , create the element at the release position. I try the Drag/Drop method, which not worked well ,and then I try to reimplement the mousemovement ,
when the element action toggled



// when the element add action toggled ,I set the m_pasteHereAction ture.
void DiagramView::mouseMoveEvent(QMouseEvent *e)
if(this->m_pasteHereAction)
{
QPainter painter(this);
painter.drawRect(e->pos().x(),e->pos().y(), 200,100);
}

it is not work,any helps ,thanks very much !