mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-19 12:21:52 +02:00
Expose DisplayRole as name in sourcesModel
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "utils/logger.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "globalactionmanager.h"
|
||||
#include "sourcesmodel.h"
|
||||
|
||||
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QtDeclarative>
|
||||
@@ -70,18 +72,14 @@ TomahawkTouchWindow::loadQml()
|
||||
tLog()<< Q_FUNC_INFO << "clear component cache";
|
||||
m_view->engine()->clearComponentCache();
|
||||
|
||||
tLog()<< Q_FUNC_INFO << "set source";
|
||||
m_view->setSource( QUrl::fromLocalFile( QMLGUI "/main.qml" ) );
|
||||
|
||||
tLog()<< Q_FUNC_INFO << "set context property";
|
||||
QDeclarativeContext* context = m_view->rootContext();
|
||||
//context->setContextProperty( "myModel", m_superCollectionProxyModel );
|
||||
|
||||
tLog()<< Q_FUNC_INFO << "make objects accessible from qml";
|
||||
context->setContextProperty( "audioEngine", AudioEngine::instance() );
|
||||
|
||||
context->setContextProperty( "globalActionManager", GlobalActionManager::instance() );
|
||||
|
||||
context->setContextProperty( "sourcesModel", s_sourcesModel );
|
||||
|
||||
tLog()<< Q_FUNC_INFO << "finished";
|
||||
tLog()<< Q_FUNC_INFO << "set source";
|
||||
m_view->setSource( QUrl::fromLocalFile( QMLGUI "/main.qml" ) );
|
||||
}
|
||||
|
@@ -55,6 +55,10 @@ SourcesModel::SourcesModel( QObject* parent )
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
|
||||
connect( SourceList::instance(), SIGNAL( sourceRemoved( Tomahawk::source_ptr ) ), SLOT( onSourceRemoved( Tomahawk::source_ptr ) ) );
|
||||
connect( ViewManager::instance(), SIGNAL( viewPageActivated( Tomahawk::ViewPage* ) ), this, SLOT( viewPageActivated( Tomahawk::ViewPage* ) ) );
|
||||
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "name";
|
||||
setRoleNames(roles);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user