Commit d6139ff7 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

KDevelop::IOutputViewModel: use via Q_INTERFACES

parent 307442fc
......@@ -22,6 +22,9 @@
#define KDEVPLATFORM_IOUTPUTVIEWMODEL_H
#include "outputviewexport.h"
#include <QObject>
class QModelIndex;
namespace KDevelop
......@@ -81,5 +84,7 @@ public:
}
Q_DECLARE_INTERFACE(KDevelop::IOutputViewModel, "org.kdevelop.IOutputViewModel")
#endif
......@@ -37,6 +37,8 @@ class OutputModelPrivate;
class KDEVPLATFORMOUTPUTVIEW_EXPORT OutputModel : public QAbstractListModel, public KDevelop::IOutputViewModel
{
Q_OBJECT
Q_INTERFACES(KDevelop::IOutputViewModel)
public:
enum CustomRoles {
......
......@@ -361,13 +361,13 @@ KDevelop::IOutputViewModel *OutputWidget::outputViewModel() const
return nullptr;
QAbstractItemModel *absmodel = view->model();
auto *iface = dynamic_cast<KDevelop::IOutputViewModel*>(absmodel);
auto* iface = qobject_cast<KDevelop::IOutputViewModel*>(absmodel);
if ( ! iface )
{
// try if it's a proxy model?
if ( auto* proxy = qobject_cast<QAbstractProxyModel*>(absmodel) )
{
iface = dynamic_cast<KDevelop::IOutputViewModel*>(proxy->sourceModel());
iface = qobject_cast<KDevelop::IOutputViewModel*>(proxy->sourceModel());
}
}
return iface;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment