Commit graph

19 commits

Author SHA1 Message Date
gxalpha a4834efde9 UI: Remove Qt 5 ifdef guards and code 2023-07-12 13:22:13 -04:00
cg2121 fc8c428521 UI: Move saving of scene tree grid mode
Widget shouldn't save their own states, as then they can't be used
elsewhere.
2023-05-21 01:48:13 -07:00
cg2121 20896280b1 UI: Fix compiling error on Ubuntu
Makes sure ceil function uses std namespace
2023-05-21 01:48:13 -07:00
gxalpha 3e4bbe85c8 UI: Remove workaround for current scene being deselectable on Qt 6.4.3+
Qt 6.2 introduced an issue where SingleSelection item views would
deselect the current item if the user clicked on empty area in the
widget.
This was very confusing in the scene tree as it was now possible to
unselect the current scene. A workaround for this in OBS was added in
08e4ee6 and expanded on in dc30cf0, but being quite hacky it never was
the perfect solution.
I since dug into Qt and fixed the issue upstream in qt/qtbase@f11e5435c7
for Qt 6.4.3 and newer, so we can remove the workaround when using those
versions (with the long term goal of removing the code altogether).
2023-02-11 16:01:27 -08:00
gxalpha dc30cf0843 UI: Don't reselect SceneTree items if tree is clearing
In the scene tree, we currently prevent deselecting items by
automatically reselecting a new one to workaround a regression in Qt 6.2
that would let users unselect items even in SingleSelection QItemViews.
When clearing however, we explicitly want to unselect the currently
selected item, so we should avoid reselecting it in the SceneTree.
2022-09-30 05:41:35 -07:00
gxalpha 860b309db8 UI: Remove spacing from scene and source tree
Due to QTBUG-106395, sources or scenes that are drag-and-dropped into
the spacing between other sources and scenes would currently go to the
bottom of the list, leaving users confused. Until that is fixed, we have
to remove this spacing.
The call in scene-tree.cpp was redundant anyways, should this commit get
reverted in the future it doesn't need to be re-added.
2022-09-10 16:32:46 -07:00
jp9000 361eebc6f3 UI: Fix scene list crash
The original change in obsproject/obs-studio#7200 seems to have been
based upon the idea that if the "selected" parameter has no values, then
the "deselected" parameter must have values, which is clearly an unsafe
assumption to have make given that it causes an assert crash in Qt when
both parameters have 0 values contained within them.
2022-08-31 10:43:53 -07:00
Clayton Groeneveld 80f6faedfa
UI: Fix scene list spacing (#7202)
The reason why the scene list spacing would never work is because
spacing was always set to 0 in the resize event.
2022-08-29 18:14:30 -05:00
Ryan Foster 11bc39fe7c UI: Get correct coordinates for items in Scene Grid Mode
The x() and y() values of coordinates for events inside a scrollable
QWidget are relative to viewport's scrolled origin, the coordinates of
the upper left corner of the visible space, not the widget's true
origin. Since we do not allow horizontal scrolling, the value of x() is
okay. However, the value of y() needs to be adjusted by an offset of the
top()/y() value for the first widget in the SceneTree. When not
scrolled, this offset will be 0. When scrolled down, this offset will be
a negative value.
2022-08-29 18:22:45 -03:00
Ryan Foster 5b0ae8c70d UI: Fix scrollbar enablement in Scene Grid Mode
The UI layout math used to determine if scrollbars should be displayed
in the Scenes Dock was off by one pixel. This caused the scrollbar to
disappear when performing actions while scrolled to the bottom, such as
dragging items or resizing the dock.
2022-08-29 18:22:45 -03:00
Ryan Foster fd0c4b7d09 UI: Resize SceneTree after dropEvent
Calling resizeEvent for SceneTree after a dropEvent has occurred
prevents a dropped item from being displayed in the incorrect location
while in Grid Mode. There might be a better way to fix the incorrectly
displayed location of a dropped item, but we already do this in
SetGridMode and rowsInserted, so this is probably okay.
2022-08-29 18:22:45 -03:00
gxalpha 08e4ee6557 UI: Add workaround for scenes being unselected 2022-08-29 23:15:39 +10:00
gxalpha 05c6a408e3 UI: Fix Qt 6 position deprecations 2022-07-22 09:37:17 -04:00
VodBox d2e3d0da3c UI: Remove unnecessary code 2021-03-08 23:42:21 +13:00
VodBox 3046f3b578 UI: Fix grid mode scenes overlapping
fixes #2676
2021-03-08 23:33:54 +13:00
Clayton Groeneveld 41e38cc958 UI: Fix scene tree event handling
This fixes a bug where the same scene would show up in
the multiview more than once when reordering scenes.
2020-09-07 09:53:11 -05:00
Clayton Groeneveld f580de0bc7 UI: Fix multiview update regression
Fixes bug where multiview won't update when reordering scenes with drag
and drop. Was originally fixed with #2114, but bcddf4d caused a
regression where it didn't work anymore.
2020-08-22 08:37:26 -07:00
jpark37 291393643e UI: Fix QResizeEvent leaks
Not sure if this is a valid pattern in the Qt world though.
2020-01-04 09:51:29 -08:00
VodBox c0e2e7f12e UI: Add Grid Mode to Scenes Widget
Adds an option to the right click menu in the scenes widget to switch
modes. When in regular list mode, it'll let you select grid mode, and in
grid mode, it'll let you select list mode. Grid mode changes the scenes
widget to have a grid of buttons for scenes rather than a list, much
like XSplit.
2019-12-02 08:42:10 +13:00