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. |
jpark37
left a comment
There was a problem hiding this comment.
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. |
sebastian-s-beckmann
left a comment
There was a problem hiding this comment.
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
QVarianttype to hold current values instead of converting all types into string.Motivation and Context
A combobox created with
OBS_COMBO_FORMAT_FLOATcannot 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,
userDatais generated in the code below.obs-studio/UI/properties-view.cpp
Lines 505 to 523 in e3f416f
userDatageneration functionOBS_COMBO_FORMAT_INTQVariant::fromValue<long long>(long long)OBS_COMBO_FORMAT_FLOATQVariant::fromValue<double>(double)OBS_COMBO_FORMAT_STRINGQByteArray(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_inputon macOS anddshow_inputon Windows.I've checked the signature and description of
QComboBox::findDataare 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_UTF8is different on Windows.