Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
g_j_m committed Dec 15, 2006
1 parent 228a6c3 commit af43338
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/gui/qgsidentifyresults.cpp
Expand Up @@ -53,7 +53,6 @@ QgsIdentifyResults::QgsIdentifyResults(const QgsAttributeAction& actions,

QgsIdentifyResults::~QgsIdentifyResults()
{
saveWindowLocation();
delete mActionPopup;
}

Expand Down Expand Up @@ -151,26 +150,22 @@ 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;
}
// Save the current window location (store in ~/.qt/qgisrc)
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 */
Expand Down

0 comments on commit af43338

Please sign in to comment.