MoveWidget

Rene M�rten delta_x at gmx.net
Sat Jan 1 12:32:45 GMT 2000


On Thu, 30 Dec 1999, you wrote:
> Hi Rene,
> 
> I think you have to implement something like this:
> 
> 
> void YourWidget::mousePressEvent(QMouseEvent *e) {
> 
>   if (e->button() == LeftButton) {
> 
>     widgetRectWhenPressed = geometry();
> 
>     xMousePosWhenPressed = e->x();
>     yMousePosWhenPressed = e->y();
>   }
> }
> 
> void YourWidget::mousePressEvent(QMouseEvent *e) {
> 
>   if (e->state() & LeftButton) {
> 
>      move(widgetRectWhenPressed.x() + e->x() -  xMousePosWhenPressed,
>                 widgetRectWhenPressed.y() + e->y() -  yMousePosWhenPressed);
>   }
> }
> 
> 
> See KWriteView::mouseMoveEvent and KWriteView::mousePressEvent as examples.
> 
> Hope this helps,
> Christian.

Hi Christian,
i thought there ore some classes / options, that i do not must program this, e.g. a auto-moveable widget or so.
thanx trotzdem :)

-- 
Kind Regards

Rene Maerten
E-Mail: Delta_X at LinuxCoding.de
Home:   http://www.LinuxCoding.de
Telephone: +49-3328-305200
Don't buy Windows Beta 2000, just try Linux !





More information about the KDevelop mailing list