Skip to content
Permalink
Browse files

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/qgis@6255 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m
g_j_m committed Dec 15, 2006
1 parent 41d9e36 commit c62aa18935f067647fb947b6c6bbb67912a5a016
Showing with 8 additions and 13 deletions.
  1. +8 −13 src/gui/qgsidentifyresults.cpp
@@ -53,7 +53,6 @@ QgsIdentifyResults::QgsIdentifyResults(const QgsAttributeAction& actions,

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

@@ -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 */

0 comments on commit c62aa18

Please sign in to comment.
You can’t perform that action at this time.