-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: Search combo property item with QVariant type #6788
Conversation
See QTBUG-104990. |
However QTBUG-104990 claims the bug was introduced in Qt6, the issue was found in Qt5. Maybe |
I'm saying that the behavior of |
Bring the modification in obsproject/obs-studio#6788
Bring the modification in obsproject/obs-studio#6788
Bring the modification in obsproject/obs-studio#6788
Bring the modification in obsproject/obs-studio#6788
Bring the modification in obsproject/obs-studio#6788
I know I just added two (optional) defects, but please merge this sooner than later. It's quite a nasty bug. The code looks good otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the commit message. This is no longer just about OBS_COMBO_FORMAT_FLOAT.
A combobox with `OBS_COMBO_FORMAT_FLOAT` type couldn't be initialized to select current item from the settings data. This commit will create QVariant value with the similar code as that of adding the items and search the current item using that value.
Looks good to me. Someone merge this ASAP as possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work fine, code changes make sense to me. In an ideal world, I'd love to hear back from QTBUG-104990 first, but even if it's a bug it would exist for some time so we'd need this anyways, so we should probably just merge it.
Description
When finding current item for a combobox on properties view, use
QVariant
type to hold current values instead of converting all types into string.Motivation and Context
A combobox created with
OBS_COMBO_FORMAT_FLOAT
cannot show the current item. When a modified callback for another item on the properties view returns true, the combobox is initialized again and the selection goes to the top item even though another item is selected.When adding items into the combobox,
userData
is generated in the code below.obs-studio/UI/properties-view.cpp
Lines 505 to 523 in e3f416f
userData
generation functionOBS_COMBO_FORMAT_INT
QVariant::fromValue<long long>(long long)
OBS_COMBO_FORMAT_FLOAT
QVariant::fromValue<double>(double)
OBS_COMBO_FORMAT_STRING
QByteArray(const char *)
I'm implementing a plugin on norihiro/obs-color-monitor#54 and found this bug.
How Has This Been Tested?
OS: Fedora 35
Qt version: 5.15.2-31.fc35 and 6.2.3-2.fc35 (I checked with both versions.)
Checked these steps for
xshm_input
(usingOBS_COMBO_FORMAT_INT
) andslideshow
(usingOBS_COMBO_FORMAT_STRING
).OBS_COMBO_FORMAT_FLOAT
.Also checked another source under development using
OBS_COMBO_FORMAT_FLOAT
.Need to check autoselect functionality but only available on two sources
av_capture_input
on macOS anddshow_input
on Windows.I've checked the signature and description of
QComboBox::findData
are same in between Qt5 and Qt6.Qt5: https://doc.qt.io/qt-5/qcombobox.html#findData
Qt6: https://doc.qt.io/qt-6/qcombobox.html#findData
Types of changes
Checklist:
QT_UTF8
is different on Windows.