Ask Your Question
1

rqt_robot_dashboard Icon Size

asked 2015-08-24 16:55:59 -0500

David Lu gravatar image

If I wanted to take an existing rqt_robot_dashboard widget, say, the PR2 motors widget, and make the button twice as large, how would I do that?

(Don't suggest changing the size on line 63 because that just makes the area surrounding the icon larger, not the actual icon)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-01-27 17:34:32 -0500

erelson gravatar image

I had some fun recently with this. My solution/understanding turned out to be three parts:

  • Icons (svg format in my case) need to have their internal size at least as large as you are trying to do with the icon. (bizarre to me).
  • In rqt_robot_dashboard, where self.max_icon_size is set in setup(); I think this dictates a "canvas" size per button on the dashboard.
  • In e.g. nav_view_dash_widget.py, self.setFixedSize can scale the icons. I ended up doing (and then getting distracted by other things):

    # Old version:
    #self.setFixedSize(self._icons[0].actualSize(QSize(50, 30)))
    # New version, larger, more absolute:
    self.setFixedSize(QSize(100,60))
    

Caveat: I'm working with a derived version of rqt_dash for Fetch robots, so I've been playing with ever so slightly different code. Nor have I fully wrested control of the rqt_dashboard setup to my liking.

edit flag offensive delete link more

Comments

Thanks. I'll try this out soon.

David Lu gravatar image David Lu  ( 2016-02-01 10:33:45 -0500 )edit

"Soon"

A combination of three things fixed it for me.

  • Resizing the svg (your point 1)

  • Setting max_icon_size in my setup (your point 2)

  • Not calling setFixedSize in the widget.

Thanks for your help!

David Lu gravatar image David Lu  ( 2016-02-24 13:49:54 -0500 )edit
1

answered 2015-08-26 21:53:23 -0500

Aaron Blasdel gravatar image

updated 2015-08-27 11:19:24 -0500

This line in the dashboard code proper might be causing problems: https://github.com/ros-visualization/...

If you change it there too maybe that will help. Sorry for the sloppy coding on my part.

Below is the email exchange we already had for posterity in the hopes it might help some wayward soul:

Aaron: You already modded the actual size of the svg right? I think they can only get smaller?

David Lu!!: Nope. I'm not an svg expert.

Aaron: Me neither but I think the icon can only shrink in Qicon. No promises but if you figure out how to make it bigger and then bump the number you mentioned before it will probably be bigger.

David Lu!!: No dice. My 300x300 png still shows up tiny.

edit flag offensive delete link more

Comments

Sadly, this doesn't work. I tried setting max_icon_size before the constructor, but it did not affect anything.

David Lu gravatar image David Lu  ( 2015-09-01 15:04:53 -0500 )edit

QIcons resize fine when used in widgets like push buttons or inside list/table/tree cells. QToolButtons might be different. The docs mention two ways to set icon size. Have you tried setting it from the QToolButton itself?.

Adolfo Rodriguez T gravatar image Adolfo Rodriguez T  ( 2015-09-02 03:57:02 -0500 )edit

Shoot. I recall wrestling with sizing when I originally created it... I won't have any time to check this out again till late next week. Sorry DLu!!

Aaron Blasdel gravatar image Aaron Blasdel  ( 2015-09-03 15:02:26 -0500 )edit

@Adolfo: Setting the size hints did not work for me.

David Lu gravatar image David Lu  ( 2015-09-07 16:07:45 -0500 )edit

I'm going to create a dashboard for the fetch when I get a chance. When I do I'll look into this again.

Aaron Blasdel gravatar image Aaron Blasdel  ( 2015-09-15 19:46:40 -0500 )edit

One of our talented engineers over here at fetch figured this out (note: not me).

Seems it was a combo of what we were trying and a max size set in the svg. He knows more and will post soonish.

Aaron Blasdel gravatar image Aaron Blasdel  ( 2016-01-27 16:16:21 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-24 16:55:59 -0500

Seen: 164 times

Last updated: Aug 27 '15