Resize input dialogs to fit contents

Current implementation will resize to whatever is smaller: screen width / 4 or text width in pixels.

Text width is calculated with `fontMetrics()`. This will not be accurate for custom DPI (see #758): height will be ok, width is still better than in `QInputDilog` but doesn't take DPI into consideration.
The new dialog is also resizable by hand.