33 lines
1.0 KiB
C++
33 lines
1.0 KiB
C++
|
#include "adduniversedialog.h"
|
||
|
#include "qsacnuniverse.h"
|
||
|
#include "sacn/extended.h"
|
||
|
#include "universeview.h"
|
||
|
#include "universeviewdelegate.h"
|
||
|
|
||
|
|
||
|
QWidget * UniverseViewDelegate::createEditor(QWidget *parent,
|
||
|
const QStyleOptionViewItem &option,
|
||
|
const QModelIndex &index) const
|
||
|
{
|
||
|
QVariant data = index.data(Qt::EditRole);
|
||
|
|
||
|
if (data.metaType().id() == qMetaTypeId<QSacnUniverse*>())
|
||
|
{
|
||
|
auto univ = data.value<QSacnUniverse*>();
|
||
|
auto universeView = new UniverseView(parent, univ);
|
||
|
universeView->show();
|
||
|
|
||
|
return new QWidget(parent);
|
||
|
}
|
||
|
|
||
|
if (index.data().canConvert<sACN::EXTENDED::DISCOVERY::discoveredUniverse*>())
|
||
|
{
|
||
|
auto disc = data.value<sACN::EXTENDED::DISCOVERY::discoveredUniverse*>();
|
||
|
auto subscribe = new AddUniverseDialog(parent, disc->universe,
|
||
|
tr("Subscribe to Universe"));
|
||
|
return subscribe;
|
||
|
}
|
||
|
|
||
|
return QStyledItemDelegate::createEditor(parent, option, index);
|
||
|
}
|