I have various elements scattered all across the interface. I want to make some buttons draggable and when I drag one, I want it to stay on top of every other element of the interface, not matter where it its, its position, its hierarcy.
How to have a "global zIndex" in SwiftUI that allows to have one element floating over everything else in the interface?
Related
SwiftUI's default List behaviour for changing sizes of existing List items is different to inserting new ones (no scrolling vs scrolling visible items).
I want them to both not scroll. In my app, there are legitimately a large number of updates that happen almost immediately in the List View, and I don't want the user to lose their place, which happens if updates trigger the currently viewable list of items to move down.
This simple example shows the two behaviours.
How to use example:
Add some items
Scroll down.
Resize some items. It resizes items from the top item first.
Notice that the view you see is unaffected until the items on the screen are changed ("not scrolling"). It appears to be offsetting the position of the List such that the currently visible portion is unchanged.
Now add some items. Notice that inserting the items pushes the current items down ("scrolling"). In this case it does not seem to attempt to offset the position of the List, and so the items, with new content, are moved down.
I'd like to customise the List behaviour (iOS16+ is ok) so that the insertion behaviour is the same as the update behaviour.
Does anyone know the best way to do this?
Do I have to rebuild using UICollectionView (which is I believe how List is implemented under iOS16…?)
I want to create some kind of toolbar, consisting of buttons. I used ButtonBox, and put inside some toggle buttons, color button and one regular button.
I want to accomplish two things:
Make buttons stick together despite window width, without margin between them.
Have rightmost button on the right of the window, and other buttons on the left.
If I didn't wanted second thing, I could just use set_valign so that toolbar would shrink to the right.
I tried adding empty Gtk::Box after color button and allowing it to expand, and this keeps rightmost button on the right, but it still leaves margins between buttons, no matter what parameters for pack_start and pack_end I try - there is two optional boolean parameters, but neither of them seem to do anything.
Here is how it looks normally:
Here is how it looks with empty box:
So what should I do to remove margin between buttons, and is there a better way to keep some buttons on the right, and some on the left?
ButtonBox will always have space between buttons. If you want the buttons without space between, use a regular Box.
Otherwise you did the right thing. Use a Box to move the right button to the edge. Sometimes you can achieve the same affect by using pack_start and pack_end to different buttons, all within the same Box.
So, if I figure out this correctly, QGraphicsItem are (abstract) graphics items which belong to one QGraphicsScene (which is scene manager basically).
QGraphicsView is specific "view" into that scene and multiple views can view same scene.
If I were to have 3 views viewing on same scene, where one view views 1-5/10 items, other 5-10/10 and third view views all of them, I would need to have one scene and three views with some kind of filters which items to draw. Is this possible ?
How can I filter which QGraphicsItems are displayed in specific QGraphicsView?
It's not possible to do directly, but is rather easy with viewscenes (akin to viewmodels).
Item visibility is an integral part of the scene, not a view. This makes sense: once you start letting scenes change item properties, there's never a sane place where one might stop. Next you want to move items a bit, etc. So this simply isn't supported in the current design.
You can have a prototype scene that has all items, and then viewscenes (viewmodels) that have copies of the items you wish visible. The items are small and cheap to copy, so even with a thousand items in a scene, the cost to implement it that way is minuscule. Just make a factory to make copies of all item types you're interested in, and run them on the prototype scene, ignoring the items you wish not shown.
I have RadioGroup with many buttons. Now when I add an item, they become smaller and smaller. How is it possible to make them scrollable?
TRadioGroup does not natively support scrolling. However, what you can do instead is the following:
place a TGroupBox on your UI.
place a TScrollBox onto the TGroupBox, set its Align property to alClient, and its BorderStyle property to bsNone.
place a TRadioGroup onto the TScrollBox, clear its Caption property, and set its Left property to -2 and its Top property to -15 (or whatever the TRadioGroup.Font is set to plus a few extra pixels). This positioning is needed because you cannot turn off the TRadioGroup's borders or the space reserved for its Caption.
Tweak the TScrollBox.HorzScrollBar.Range and TScrollBox.VertScrollBar.Range properties so they do not scroll far enough to see the TRadioGroup's right and bottom borders.
This way, the buttons appear as if they are part of the TGroupBox, but with the added scrollbar(s).
RadioGroup->Items->Count
TRadioGroup component doesn't have an embedded scrollbar, but you can put the radio group on a TScrollBox for a similar effect.
You can use the Buttons collection to refer each button, e.g.
RadioGroup->Buttons[0]->Height = 5;
RadioGroup->Buttons[1]->Top = RadioGroup->Buttons[0]->Top + 10;
Anyway a TComboBox could also be a good choice.
I have two QGraphicsView that are of equal width, one ontop the other in a Vertical Layout.
When I re-size my application window, the QGraphicsView on the bottom does what I expect, it remains at the exact position it started at, however the top view begins to move the scene to the right exposing coordinates that are below x=0(essentially blank padding on the left edge of the View), which I do not want, I need both to behave the same because they correspond to each other.
I must have missed something, because should these views behave exactly the same? I need them to align, as the top view has hidden scroll bars and scrolls horizontally by however much the bottom view is scrolled.
Make sure your resizeAnchor is set to NoAnchor and alignment is Qt::AlignLeft | Qt::AlignTop. You may need to try some other combination to work with your situation.