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 @@ ...@@ -22,6 +22,9 @@
#define KDEVPLATFORM_IOUTPUTVIEWMODEL_H #define KDEVPLATFORM_IOUTPUTVIEWMODEL_H
#include "outputviewexport.h" #include "outputviewexport.h"
#include <QObject>
class QModelIndex; class QModelIndex;
namespace KDevelop namespace KDevelop
...@@ -81,5 +84,7 @@ public: ...@@ -81,5 +84,7 @@ public:
} }
Q_DECLARE_INTERFACE(KDevelop::IOutputViewModel, "org.kdevelop.IOutputViewModel")
#endif #endif
...@@ -37,6 +37,8 @@ class OutputModelPrivate; ...@@ -37,6 +37,8 @@ class OutputModelPrivate;
class KDEVPLATFORMOUTPUTVIEW_EXPORT OutputModel : public QAbstractListModel, public KDevelop::IOutputViewModel class KDEVPLATFORMOUTPUTVIEW_EXPORT OutputModel : public QAbstractListModel, public KDevelop::IOutputViewModel
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(KDevelop::IOutputViewModel)
public: public:
enum CustomRoles { enum CustomRoles {
......
...@@ -361,13 +361,13 @@ KDevelop::IOutputViewModel *OutputWidget::outputViewModel() const ...@@ -361,13 +361,13 @@ KDevelop::IOutputViewModel *OutputWidget::outputViewModel() const
return nullptr; return nullptr;
QAbstractItemModel *absmodel = view->model(); QAbstractItemModel *absmodel = view->model();
auto *iface = dynamic_cast<KDevelop::IOutputViewModel*>(absmodel); auto* iface = qobject_cast<KDevelop::IOutputViewModel*>(absmodel);
if ( ! iface ) if ( ! iface )
{ {
// try if it's a proxy model? // try if it's a proxy model?
if ( auto* proxy = qobject_cast<QAbstractProxyModel*>(absmodel) ) if ( auto* proxy = qobject_cast<QAbstractProxyModel*>(absmodel) )
{ {
iface = dynamic_cast<KDevelop::IOutputViewModel*>(proxy->sourceModel()); iface = qobject_cast<KDevelop::IOutputViewModel*>(proxy->sourceModel());
} }
} }
return iface; 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