|
From: Jérôme L. <lod...@us...> - 2014-03-09 21:07:15
|
The bottom line is that setting a custom size for a widget with Qt is no less than a nightmare. Apparently, there is no way to tell Qt that the widget should have a given size to start with, and then be resizable. So I have spend countless hours trying to find tweaks to emulate this behaviour, as until now all my attempts have resulted in an incorrect behaviour for at least one Qt version on one platform. I would be very happy if you come up with code that works correctly, but this task is not easy because this code has to be tested on the 3 platforms (Unix, OSX, windows) which have different sizing policy for widgets, and with Qt 4 and Qt 5. > I'm beginning to suspect that is the case, and what is different between > the Qt versions is probably the obscure size hint. Newer versions are > probably more accurate. However, I'm wondering if we can get away from > the size hint and get direct results with just a little clean up of The size hint tweak is a very recent addition that is used to set the size of the window before it is displayed. Before this addition, the window was resized after it is display, and sometimes was stuck in a wrong size. > Now, from what Ethan describes, the size specifications option for qt > terminal refers to the outer dimensions of the QMainWindow, not the > plotting area. I think the documentation could be clearer on this: I was not aware of this interpretation of the specification, but it looks weird to me. Setting the size of the window would mean that the size of the plotting area would depend, for instance, on whether the toolbar is hidden or not, on the window decoration for the title bar... Also, don't forget that the QtGnuplotWidget can also be used without a QtGnuplotwindow around it. it can be embedded in any Qt application, in which case I don't know what size the widget should actually report to the gnuplot core if the size the widget usually reports is the total window size. > "The size of the plot area is given in pixels, it defaults to 640x480. > In addition to that, the actual size of the window also includes the space > reserved for the toolbar and the status bar." > > The 640x480 is not the plot area, more accurately the "size of the > window". Is there consensus on this? > The code of the qt terminal as it is written now, assumes the opposite: the size set by the "size" option of the "set term qt" command is the size of the plotting area (more precisely of the viewport widget of the QGraphicsView showing the plot), and the application that embeds the plot area, which can be (but not necessarily is) a QtGnuplotWindow, takes care of reserving more screen space to fit other widgets, such as a toolbar, a title bar... > If there is, then here is another question. What do > > term->xmax > term->ymax > > represent to the core code? Outer window dimensions? Or the plot area? They are set to qt_oversampling multiplied by the plot area dimensions. Jérôme |