Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to write a plugin that simply resizes the qgis main window to make it small. How can I access the qgis main window through the qgis api?

Use Case: We are having problems with qgis taking over the screen, so that the minimization toolbar is inaccessible, and we can't use anything else on the desktop until we have exited qgis. This seems to be a result of incapatability between Qt and our very old windowing system. I know how to fix this problem using the QGIS.conf file or the registry, but we have many users of varying ability, and many are switching between windows and linux (tunneled through Solaris) servers, which can cause the problem to recur. Fixing the problem with repeated edits of the config file (or the windows registry) is really too much to ask of them. So, I want to make a button that they can just press, and fix it.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

We can do this though the iface.mainWindow() object, which returns a QMainWindow.

iface.mainWindow().showMaximized() will set the main window to max screen size.

You can also set it in resize

iface.mainWindow().resize(QSize(400, 400)

share|improve this answer
    
Thanks! That worked great! I think at FOSSGIS next month, you and underdark and Tim Sutton and the others should put out coin jars, so that all the users who owe you a beer can toss in. I would definitely be buying. –  MonsterMushroom Aug 22 '13 at 14:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.