Skip to content

Commit af43338

Browse files
author
g_j_m
committed
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
1 parent 228a6c3 commit af43338

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/gui/qgsidentifyresults.cpp

+8-13
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ QgsIdentifyResults::QgsIdentifyResults(const QgsAttributeAction& actions,
5353

5454
QgsIdentifyResults::~QgsIdentifyResults()
5555
{
56-
saveWindowLocation();
5756
delete mActionPopup;
5857
}
5958

@@ -151,26 +150,22 @@ void QgsIdentifyResults::restorePosition()
151150
{
152151

153152
QSettings settings;
154-
int ww = settings.readNumEntry("/Windows/Identify/w", 281);
155-
int wh = settings.readNumEntry("/Windows/Identify/h", 316);
156-
int wx = settings.readNumEntry("/Windows/Identify/x", 100);
157-
int wy = settings.readNumEntry("/Windows/Identify/y", 100);
153+
QPoint pos = settings.value("/Windows/Identify/pos",
154+
QPoint(100,100)).toPoint();
155+
QSize size = settings.value("/Windows/Identify/size",
156+
QSize(281,316)).toSize();
158157
//std::cerr << "Setting geometry: " << wx << ", " << wy << ", " << ww << ", " << wh << std::endl;
159-
resize(ww,wh);
160-
move(wx,wy);
158+
resize(size);
159+
move(pos);
161160
show();
162161
//std::cerr << "Current geometry: " << x() << ", " << y() << ", " << width() << ", " << height() << std::endl;
163162
}
164163
// Save the current window location (store in ~/.qt/qgisrc)
165164
void QgsIdentifyResults::saveWindowLocation()
166165
{
167166
QSettings settings;
168-
QPoint p = this->pos();
169-
QSize s = this->size();
170-
settings.writeEntry("/Windows/Identify/x", p.x());
171-
settings.writeEntry("/Windows/Identify/y", p.y());
172-
settings.writeEntry("/Windows/Identify/w", s.width());
173-
settings.writeEntry("/Windows/Identify/h", s.height());
167+
settings.setValue("/Windows/Identify/pos", this->pos());
168+
settings.setValue("/Windows/Identify/size", this->size());
174169
}
175170

176171
/** add an attribute and its value to the list */

0 commit comments

Comments
 (0)