Hey,

I have troubles on replacing items on resizeEvent of the QMainWindow - I am not using any layout, i just recalculate the new positions on resize.
If the window is resized slowly there are not any troubles but if i resize it very fast by moving the mouse in crazy ways i get weird results....
I added a "before resize" and a "after resize" screenshot to illustrate the problem.

The Code looks like follows:
Qt Code:
  1. void ClientMainWindow::resizeEvent(QResizeEvent * event){
  2. int heightPositionCorrection = (event->size().height()-event->oldSize().height())/2;
  3. int widthPositionCorrection = (event->size().width()-event->oldSize().width())/2;
  4.  
  5. ui.controlAirCondition->setGeometry(
  6. ui.controlAirCondition->geometry().x()+widthPositionCorrection,
  7. ui.controlAirCondition->geometry().y()+heightPositionCorrection,
  8. ui.controlAirCondition->geometry().width(),ui.controlAirCondition->geometry().height());
  9. ui.controlAlarmSystem->setGeometry(
  10. ui.controlAlarmSystem->geometry().x()+widthPositionCorrection,
  11. ui.controlAlarmSystem->geometry().y()+heightPositionCorrection,
  12. ui.controlAlarmSystem->geometry().width(),ui.controlAlarmSystem->geometry().height());
  13. ui.controlBlinds->setGeometry(
  14. ui.controlBlinds->geometry().x()+widthPositionCorrection,
  15. ui.controlBlinds->geometry().y()+heightPositionCorrection,
  16. ui.controlBlinds->geometry().width(),ui.controlBlinds->geometry().height());
  17. ui.controlHeating->setGeometry(
  18. ui.controlHeating->geometry().x()+widthPositionCorrection,
  19. ui.controlHeating->geometry().y()+heightPositionCorrection,
  20. ui.controlHeating->geometry().width(),ui.controlHeating->geometry().height());
  21. ui.controlLights->setGeometry(
  22. ui.controlLights->geometry().x()+widthPositionCorrection,
  23. ui.controlLights->geometry().y()+heightPositionCorrection,
  24. ui.controlLights->geometry().width(),ui.controlLights->geometry().height());
  25. ui.controlMusic->setGeometry(
  26. ui.controlMusic->geometry().x()+widthPositionCorrection,
  27. ui.controlMusic->geometry().y()+heightPositionCorrection,
  28. ui.controlMusic->geometry().width(),ui.controlMusic->geometry().height());
  29. ui.controlVideo->setGeometry(
  30. ui.controlVideo->geometry().x()+widthPositionCorrection,
  31. ui.controlVideo->geometry().y()+heightPositionCorrection,
  32. ui.controlVideo->geometry().width(),ui.controlVideo->geometry().height());
  33. ui.configScreen->setGeometry(
  34. ui.configScreen->geometry().x()+widthPositionCorrection,
  35. ui.configScreen->geometry().y()+heightPositionCorrection,
  36. ui.configScreen->geometry().width(),ui.configScreen->geometry().height());
  37. ui.controlPlaceholder->setGeometry(
  38. ui.controlPlaceholder->geometry().x()+widthPositionCorrection,
  39. ui.controlPlaceholder->geometry().y()+heightPositionCorrection,
  40. ui.controlPlaceholder->geometry().width(),ui.controlPlaceholder->geometry().height());
  41. }
To copy to clipboard, switch view to plain text mode 
before resizing.jpgafter resizing.jpg

What am i doing wrong here?