PDA

View Full Version : Move the window



santhoshv84
16th September 2008, 09:08
Hi,

I removed the Caption bar..
So now i want to know how to move the entire window when dragging the mouse..

Thanks and regards,
Santhosh

aamer4yu
16th September 2008, 09:33
Do it yourself !
ie. reimplement the mousepress, mouse move and mouse release events.
on mouse press you can hold a variable showing mousePressd= true. then in mouse move event, use QWidget::move :)

santhoshv84
16th September 2008, 10:06
Hi,

I tried like that..
I used a boolean m_MouseDown;

This is the code i used in mouseMoveEvent()
if(event->button() == Qt::LeftButton)
{
QPoint pt = event->pos();
int x = pt.x();
int y = pt.y();
if(((x>0) && (x<25)) &&((y>0) && (y<25)))
{
move(x,y);
}
}

is it correct or wrong?

Thanks in advance..

aamer4yu
16th September 2008, 10:54
is it correct or wrong?
You shud know it if u have run the program ;)

hint - on mousemove -
move(globalPos - hotSpot) ... get the idea ??