void widget::mouseMoveEvent(QMouseEvent *e){QPoint p=e->pos();dialog->move(p.x() + this->width(), p.y());}
C++ (Qt)void widget::mouseMoveEvent(QMouseEvent *e){QPoint p=e->pos();dialog->move(p.x() + this->width(), p.y()); QWidget::mouseMoveEvent(e); }
C++ (Qt)#include <QtGui> class W : public QWidget{ public: W(QWidget *stick) : QWidget(), sticked(stick) {} protected: virtual void moveEvent(QMoveEvent *e) { e->accept(); sticked->move(pos() + QPoint(frameGeometry().width(), 0)); } private: QWidget *sticked;}; int main(int argc, char *argv[]){ QApplication app(argc, argv); QWidget *s = new QWidget; s->resize(320, 200); s->show(); W *w = new W(s); w->resize(220, 180); w->show(); return app.exec();}