title: in qt how to make a button move accordingly when resizing a widget
body: <p>I wanna do this: When I enlarge my mainwindow pressing and moving mouse, I want the widget(like a button) to move accordingly(not resize the button) to make sure the button is always at the edge of my mainwindow. I can do it in this way:</p>
  
  <pre><code>void MainWindow::resizeEvent(QResizeEvent *e)
  {
  int x,y,newx,newy,resizex,resizey;
  newx = this-&gt;width();
  newy = this-&gt;height();
  resizex = newx - mainwindowWidth;
  resizey = newy - mainwindowHeight;
  x = ui-&gt;button-&gt;pos().x();
  y = ui-&gt;button-&gt;pos().y();
  ui-&gt;button-&gt;move(x+resizex, y+resizey);
  mainwindowWidth = newx;
  mainwindowHeight = newy;
  }
  </code></pre>
  
  <p>But it's so complex. Does QPushButton have any attribute to do this job easily? Waiting for your answer. Any advice would be helpful. Thanks in advance.</p>