I have a QDockWidget, properties are set like this;

Qt Code:
  1. helpWindow = new QDockWidget(this);
  2. helpWindow->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
To copy to clipboard, switch view to plain text mode 

When I close the window, I save the size and pos like this:

Qt Code:
  1. QPoint winPos = helpWindow->pos();
  2. int xHelp = winPos.x();
  3. int yHelp = winPos.y();
  4.  
  5. qDebug() << "Saving helpWindow pos: " << xHelp << yHelp;
  6.  
  7. QSize winSize = helpWindow->size();
  8. int wHelp = winSize.width();
  9. int hHelp = winSize.height();
  10.  
  11. QSqlDatabase db = QSqlDatabase::database(ctrlConn);
  12. QSqlQuery query(db);
  13. query.prepare("UPDATE settings set xHelp=?, yHelp=?, wHelp=?, hHelp=? where id=1");
  14. query.addBindValue(xHelp);
  15. query.addBindValue(yHelp);
  16. query.addBindValue(wHelp);
  17. query.addBindValue(hHelp);
  18. query.exec();
  19. close();
To copy to clipboard, switch view to plain text mode 

Here's the problem: the size saves correctly. The pos always saves as 0,63 regardless of the dock window position.

On restore, when the dock window is opened:

Qt Code:
  1. query.exec("SELECT xHelp, yHelp, wHelp, hHelp from settings where id = 1");
  2. query.last();
  3. int xHelp = query.value(0).toInt();
  4. int yHelp = query.value(1).toInt();
  5. int wHelp = query.value(2).toInt();
  6. int hHelp = query.value(3).toInt();
  7.  
  8. qDebug() << "Restoring helpWindow pos: " << xHelp << yHelp;
  9.  
  10. if (xHelp + yHelp > 0) {
  11. helpWindow->move(xHelp, yHelp);
  12. helpWindow->resize(wHelp, hHelp);
  13. }
To copy to clipboard, switch view to plain text mode 

Neither the size or the pos is restored properly. Even though the size is the saved size.