Menu

#661 Resize Qt terminal on initial showing for correct view size

Version 5
closed-accepted
nobody
None
5
2016-02-09
2014-03-09
Dan Sebald
No

The initial plot of a Qt terminal is not correct. It appears that the view size (i.e., what is supposed to be the plot size described in qt terminal documentation) is too short because the menu of the Qt window is not accounted for. Do

set term qt 1 size 640,480
plot x
set term qt 1 size 640,480
plot x
set term qt 2 size 650,480
plot x

and compare the two sizes. It's evident the difference is just about the size of the menu.

Attached is a one line fix that will resize the window even on the first showing. It probably isn't the best approach, but it works because the algorithm currently redraws by subtracting out the plot area size from the window size (thereby providing the height of everything but the plot) then adding the new plot size to that. The plot appears to draw so fast that the adjustment can't be seen.

There are a bunch of line changes for comments because they were too long to read comfortably.

1 Attachments

Discussion

  • Ethan Merritt

    Ethan Merritt - 2014-03-09

    Um. I don't see any difference in size, other than the 10 pixels wider that you asked for in terminal 2. What am I supposed to see? I know that Mojca was seeing some initial size problem on OSX, but this is the first I've heard of a size problem on linux.

     
  • Dan Sebald

    Dan Sebald - 2014-03-09

    I'm attaching two screen captures of just the bottom portion of the plot. Before the patch the plot goes beyond the view port. After the patch the view port adjusts to the size of the plot. This only happens on the first drawing. If there is any mouse or key activity within the plot, it will be redrawn correctly.

    I can't figure out how to attach more than one thing. So, "before" first...

     

    Last edit: Dan Sebald 2014-03-09
  • Ethan Merritt

    Ethan Merritt - 2014-03-09

    That, I think, is the same thing that Mojca saw on OSX.
    It doesn't do that for me.
    One solution seems to be putting the mouse coordinate readout on the toolbar rather than at the bottom of the screen. Jérôme added that as an option in the tools widget.

     
    • Dan Sebald

      Dan Sebald - 2014-03-09

      Not quite. Attached is what I'm seeing after selecting mouse in Tool bar option, exiting gnuplot, then plotting after launching gnuplot again (before patch). If you are seeing the whole characters then there is something else different between the systems or the way things are set up, e.g., some other setting that forces a redraw on your system.

       
    • Dan Sebald

      Dan Sebald - 2014-03-09

      To test whether this is happening for you (perhaps your font sizes are slightly different and this isn't noticeable), plot something and move the mouse cursor above the plot and rotate the center button. On my system, the window size will enlarge slightly to show the full plot.

       
      • Ethan Merritt

        Ethan Merritt - 2014-03-09

        Nope. I don't have any such problem with sizing/resizing or with the fonts fitting on the screen.

        Any chance you could try a newer version of Qt? (You said you had 4.7)

         
        • Dan Sebald

          Dan Sebald - 2014-03-09

          Fine by me. In actuality I can't tell exactly what the window size in Gnome, so it isn't easy to verify the outer widget is 650x480. Nonetheless, the qt terminal documentation states:

          "
          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.
          "

          On second read, I guess it isn't really clear what it means. It says "plot area is given in pixels". We know what the plot area means...just the plot. "Actual size also includes"...hmm, "actual size" would suggest the end result is not going to be 640x480. But "space reserved" would suggest that is subtracted from the outer dimensions.

           
        • Dan Sebald

          Dan Sebald - 2014-03-09

          Well, I don't want to risk messing my system up for that little adjustment. So perhaps opening an inquiry to other linux users on gnuplot-beta would help answer that.

          It could be Qt. There are layout mechanism in Qt which could have a bug in one version and not another. On the other hand, something doesn't seem right about the layout. In QtGnuplotWidget.cpp is this

          QVBoxLayout* layout = new QVBoxLayout();
          layout->setContentsMargins(0, 0, 0, 0);
          layout->addWidget(m_view);
          setLayout(layout);
          

          A QLayout is the proper thing to use. However, I only see one thing added to the layout, "m_view". The proper thing to do is have a vertical layout something like this

          layout->addWidget(menuWidget);
          layout0>addWidget(m_view);
          if (status_bar)
          layout->addWidget(statusbarWidget);

          and Qt will do the proper adjustments depending upon how the container class is setup:

          http://qt-project.org/doc/qt-4.8/qboxlayout.html

          My guess is that, yes, Qt versions might make a difference here, but it looks like the layout isn't done quite right and if that were modified properly the difference I and OSX have might go away.

           
        • Christoph Bersch

          I can confirm that behavior here with Qt 5.2.1. However, strange enough, it happens on my laptop, but not on my desktop computer. Both should have, more or less, the same Debian unstable (64 bit) running. At least both have the same Qt 5.2.1 version.

          Dan's patch fixes the behavior for me.

           
  • Dan Sebald

    Dan Sebald - 2014-03-09

    By the way, this isn't a fix for size retention which was the initial concern. That will be addressed in a separate patch. I wanted to keep this separate to fix one thing at a time that could be easily confused between the two.

     
  • Dan Sebald

    Dan Sebald - 2014-03-09

    I've also noticed that the way that the Tool Bar/Status Bar option is implemented may not agree with the documentation. The qt term documentation states that size is the dimensions of the plot itself and that window elements around the plot are extra. Switching the tool bar mouse coords to status bar mouse coords will keep the outer window the same while shrinking the actual plot view. Do you agree that should be altered so that the graph view remains the same no matter how the option is configured?

     
  • Ethan Merritt

    Ethan Merritt - 2014-03-09

    I think not. If I say I want the terminal window a certain size, that's the size I want it regardless of whether it contains a toolbar, a Status bar, or whatever. If I specify the size, it's because I care about screen real estate not the precise plot aspect ratio.

     
  • Ethan Merritt

    Ethan Merritt - 2014-06-10

    I've applied this patch to CVS for 5.0 since it may possibly address bug report #1417 (forwarded from Debian bug tracker). They would be interested in a back-port to 4.6 if that is possible.

     
  • Ethan Merritt

    Ethan Merritt - 2014-06-10
    • status: open --> pending-accepted
    • Group: --> Version 5
     
  • Ethan Merritt

    Ethan Merritt - 2016-02-09
    • status: pending-accepted --> closed-accepted
     

Log in to post a comment.