I've got a confusing issue where a dialog's position keeps moving on subsequent 
showings of it. Here's what I think is relevant:
In mainwindow.h:
  troubleshootingDialog* troubleshooter; 
Where troubleshootingDialog is
  class troubleshootingDialog : public QDialog

In mainwindow.cpp, MainWindow::MainWindow()
  troubleshooter = new troubleshootingDialog(this);
  troubleshooter->hide();

And then I have a slot that is connected to the Troubleshoot button's clicked 
signal:
void MainWindow::troubleShoot()
{
    // generate troubleshooting content
    ...
    troubleshooter->setTroubleshootingContent(content);
    troubleshooter->exec();
}

The troubleshooting dialog merely has a QWebView and a Cancel button, and that 
call to setTroubleShootingContent() just passes an html string that then gets 
passed on to the QWebView. There's no calls to move(), setGeometry(), etc. 
inside of setTroubleshootingContent().  So each time that troubleShoot() slot 
fires, the dialog is shown, but it keeps walking across the screen. Not sure if 
there's something magical about these numbers, but it moves down by 8 pixels, 
right by 30. Every time. Commenting out the call to setTroubleShootingContent() 
has no effect on positioning, it keeps moving by 8 x 30.  

If I change the content of slot to be:
    troubleshooter = new troubleshootingDialog(this);
    troubleshooter->hide();
    troubleshooter->setTroubleshootingContent(content);
    troubleshooter->exec();
    troubleshooter->deleteLater();
Then the dialog maintains its position, although technically its no longer the 
same dialog each time. So that fixes it from a UI point of view, but it seems 
silly to me that I need to keep creating a new dialog and then destroying it 
instead of just reusing the same one each time.

Sean
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to