gazebosim / gz-gui

Builds on top of Qt to provide widgets which are useful when developing robotics applications, such as a 3D view, plots, dashboard, etc, and can be used together in a convenient unified interface.
https://gazebosim.org
Apache License 2.0
72 stars 41 forks source link

Anchored floating plugins share same size #129

Open chapulina opened 3 years ago

chapulina commented 3 years ago

Loading this config:

Config

``` 800 800 scene docked false ogre scene 0 0 1 0.8 0.8 0.8 -6 0 6 0 0.5 0 pub 500 100 #ff0000 floating sub 200 300 #00ff00 floating ```

Where one plugin's size is 100x500 and the other is 300x200, results in both plugins having the size 300x200.

igngui

This is where the height and width are being applied for anchored plugins:

https://github.com/ignitionrobotics/ign-gui/blob/22434e23832760130c88d38d7c569a049dcec65c/src/Plugin.cc#L474-L481

I checked that setProperty("width"... is being set with the correct values to the correct CardItems. If I prevent the 2nd plugin's width from being set, both plugins end up with the 1st plugin's width: 500.

This pure QML file sets the widths correctly for items anchored the same way as in the example:

QML

Open with `qmlscene` ``` import QtQuick 2.0 Rectangle { id: scene width: 800 height: 800 color: "#cccccc" Rectangle { id: pub anchors.top: scene.top anchors.left: scene.left width: 100 height: 500 color: "#ff0000" } Rectangle { id: sub anchors.top: pub.top anchors.left: pub.right width: 300 height: 200 color: "#00ff00" } } ```

qml


I'm not sure if there's a problem within Qt when setting sizes through C++ after items are anchored, or if we're doing something wrong in ign-gui.

Sarath18 commented 3 years ago

I would like to add a few more observations to this issue:

  1. Expanding/collapsing the second plugin will change the size of the first plugin as well. But expanding/collapsing the first plugin will work independently.
  2. I tried adding multiple plugins (2+) anchored plugins as described in the above config file. So if I have n plugins, the nth plugin can change the size of itself and all the plugins before it.
  3. If I add 3 plugins and then resize each of them manually (so that all of them have different sizes), they all become independent, i.e. changing the size of any plugin doesn't affect the size of the others as described in 2.

From what I understand, there might be an issue with anchors being set due to line <line own="left" target="right"/> where the target is the previous plugin in order, and not the size of the plugin. I am saying this because if we set the anchor <line own="left" target="left"/>" to all the plugins with target plugin as scene their sizes work as intended.