0

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.

1 Answer 1

3

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)

1
  • 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. Commented Aug 22, 2013 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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