You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I need some advice on using this library. I'm trying to implement a grid view with unicode box drawing characters. My first draft was just a plain widget that rendered itself directly with paint_event, but I have scrollable text boxes in the grid boxes and would like to replace my draft implementation with Text_view widgets or something.
I attempted the refactor by making a Grid layout wrapping a Vertical<Horizontal>, but wasn't able to join adjacent borders, which resulted in wasted screen space. Then I thought to interleave VLabel and HLabel widgets to create the borders, but the logic seems ugly (I would much rather think about all 4 borders of a single cell at a time).
Ideally, what I would like to do is to draw the widget contents and then the borders (or vice versa, point is to let Grid handle the border drawing). But, based on the fact that Layout blackholes update(), it looks like drawing in layers like this isn't really supported; i.e. widgets are meant to have exclusive control of their section of the canvas. The manual also seems to recommend against overriding event handlers in a layout, but the meaning of the statement isn't clear:
Layouts are Widgets, but they should not have to override any event handlers, if new event handlers are needed, then a new Layout type should be created.
Is there another way to phrase this?
And, to be clear about the widget tree structure: is it the case that a widget is a layout widget if and only if it is not a terminal node?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi. I need some advice on using this library. I'm trying to implement a grid view with unicode box drawing characters. My first draft was just a plain widget that rendered itself directly with
paint_event
, but I have scrollable text boxes in the grid boxes and would like to replace my draft implementation with Text_view widgets or something.I attempted the refactor by making a
Grid
layout wrapping aVertical<Horizontal>
, but wasn't able to join adjacent borders, which resulted in wasted screen space. Then I thought to interleaveVLabel
andHLabel
widgets to create the borders, but the logic seems ugly (I would much rather think about all 4 borders of a single cell at a time).Ideally, what I would like to do is to draw the widget contents and then the borders (or vice versa, point is to let
Grid
handle the border drawing). But, based on the fact thatLayout
blackholesupdate()
, it looks like drawing in layers like this isn't really supported; i.e. widgets are meant to have exclusive control of their section of the canvas. The manual also seems to recommend against overriding event handlers in a layout, but the meaning of the statement isn't clear:Layouts are Widgets, but they should not have to override any event handlers, if new event handlers are needed, then a new Layout type should be created.
Is there another way to phrase this?
And, to be clear about the widget tree structure: is it the case that a widget is a layout widget if and only if it is not a terminal node?
Beta Was this translation helpful? Give feedback.
All reactions