Possible fix for ticket #453. Code now follows the example in the Qt

4.2.2 QWidget window geometry documentation. The docs do state that
restoring the window position is not guaranteed to work on all systems.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6255 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
g_j_m 2006-12-15 09:21:43 +00:00
parent 228a6c3469
commit af43338334

View File

@ -53,7 +53,6 @@ QgsIdentifyResults::QgsIdentifyResults(const QgsAttributeAction& actions,
QgsIdentifyResults::~QgsIdentifyResults()
{
saveWindowLocation();
delete mActionPopup;
}
@ -151,13 +150,13 @@ void QgsIdentifyResults::restorePosition()
{
QSettings settings;
int ww = settings.readNumEntry("/Windows/Identify/w", 281);
int wh = settings.readNumEntry("/Windows/Identify/h", 316);
int wx = settings.readNumEntry("/Windows/Identify/x", 100);
int wy = settings.readNumEntry("/Windows/Identify/y", 100);
QPoint pos = settings.value("/Windows/Identify/pos",
QPoint(100,100)).toPoint();
QSize size = settings.value("/Windows/Identify/size",
QSize(281,316)).toSize();
//std::cerr << "Setting geometry: " << wx << ", " << wy << ", " << ww << ", " << wh << std::endl;
resize(ww,wh);
move(wx,wy);
resize(size);
move(pos);
show();
//std::cerr << "Current geometry: " << x() << ", " << y() << ", " << width() << ", " << height() << std::endl;
}
@ -165,12 +164,8 @@ void QgsIdentifyResults::restorePosition()
void QgsIdentifyResults::saveWindowLocation()
{
QSettings settings;
QPoint p = this->pos();
QSize s = this->size();
settings.writeEntry("/Windows/Identify/x", p.x());
settings.writeEntry("/Windows/Identify/y", p.y());
settings.writeEntry("/Windows/Identify/w", s.width());
settings.writeEntry("/Windows/Identify/h", s.height());
settings.setValue("/Windows/Identify/pos", this->pos());
settings.setValue("/Windows/Identify/size", this->size());
}
/** add an attribute and its value to the list */