[Interest] Keeping track of a QDialog position

Igor Mironchik igor.mironchik at gmail.com
Mon Oct 19 22:12:11 CEST 2015


Hi,

Try something like this:

#include <QApplication>
#include <QDialog>
#include <QMoveEvent>
#include <QDebug>


class Dialog
     :    public QDialog
{
public:
     Dialog()
     {}

protected:
     void moveEvent( QMoveEvent * e )
     {
         qDebug() << e->pos();

         e->accept();
     }
};


int main( int argc, char ** argv )
{
     QApplication app( argc, argv );

     Dialog dlg;
     dlg.show();

     return app.exec();
}

But you will receive move events only when user finished move (mouse was 
released)...

On 19.10.2015 22:36, Rollastre Prostrit wrote:
> Hello.
>
> I am trying to keep track of the position of a QDialog as the user
> clicks on the title and moves it around the desktop. At most, the only
> thing I manage is to get a move event when the user releases the mouse.
> But I need to keep track of the position to perform some operations
> (somewhat like docking).
>
> After some research performed, I learned about the
> NonClientAreaMouseButtonPress, NonClientAreaMouseButtonRelease, and
> NonClientAreaMouseButtonMove events which I can play with and would
> suffice for my use case. But I'm not getting such events in Linux (KDE)
> so this solution seems to not be portable.
>
> Can anybody suggest any way to solve this?
>
> Thanks
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Best Regards,
Igor Mironchik.




More information about the Interest mailing list