mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
UI: Enable drag&drop reordering for scenes
The empty implementation for the QDataStream operators is necessary to fix a Qt assertion: "QVariant::save: unable to save type 'std::vector<std::shared_ptr<OBSSignal> >' (type id: 1036)." It doesn't seem like a full implementation of the stream operators would be useful since the signal registration is very specific to the interaction between the scenes and sources list, i.e. in case the scenes list ever accepts scenes from sources (not 'obs_source's) other than itself (non InternalMove drag&drop?) it would have to register those scenes with the libobs core which should trigger the normal signal registration
This commit is contained in:
parent
b543ea6231
commit
95857b4443
|
@ -473,6 +473,18 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::IgnoreAction</enum>
|
||||
</property>
|
||||
<addaction name="actionRemoveScene"/>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -79,6 +79,18 @@ uint32_t TranslateQtKeyboardEventModifiers(Qt::KeyboardModifiers mods)
|
|||
return obsModifiers;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out,
|
||||
const std::vector<std::shared_ptr<OBSSignal>> &)
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in,
|
||||
std::vector<std::shared_ptr<OBSSignal>> &)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const OBSScene &scene)
|
||||
{
|
||||
return out << QString(obs_source_get_name(obs_scene_get_source(scene)));
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
#include <QWidget>
|
||||
#include <obs.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#define QT_UTF8(str) QString::fromUtf8(str)
|
||||
#define QT_TO_UTF8(str) str.toUtf8().constData()
|
||||
|
||||
|
@ -33,6 +36,10 @@ void QTToGSWindow(WId windowId, gs_window &gswindow);
|
|||
|
||||
uint32_t TranslateQtKeyboardEventModifiers(Qt::KeyboardModifiers mods);
|
||||
|
||||
QDataStream &operator<<(QDataStream &out,
|
||||
const std::vector<std::shared_ptr<OBSSignal>> &signal_vec);
|
||||
QDataStream &operator>>(QDataStream &in,
|
||||
std::vector<std::shared_ptr<OBSSignal>> &signal_vec);
|
||||
QDataStream &operator<<(QDataStream &out, const OBSScene &scene);
|
||||
QDataStream &operator>>(QDataStream &in, OBSScene &scene);
|
||||
QDataStream &operator<<(QDataStream &out, const OBSSceneItem &si);
|
||||
|
|
|
@ -133,6 +133,9 @@ OBSBasic::OBSBasic(QWidget *parent)
|
|||
qRegisterMetaType<OBSSource> ("OBSSource");
|
||||
qRegisterMetaType<obs_hotkey_id>("obs_hotkey_id");
|
||||
|
||||
qRegisterMetaTypeStreamOperators<
|
||||
std::vector<std::shared_ptr<OBSSignal>>>(
|
||||
"std::vector<std::shared_ptr<OBSSignal>>");
|
||||
qRegisterMetaTypeStreamOperators<OBSScene>("OBSScene");
|
||||
qRegisterMetaTypeStreamOperators<OBSSceneItem>("OBSSceneItem");
|
||||
|
||||
|
|
Loading…
Reference in a new issue