Load main QML file while creating TabBox View

Layout loading still delayed till first show event.
This commit is contained in:
Martin Gräßlin 2011-11-04 20:08:23 +01:00
parent ba98af770a
commit c20e9c18c2

View file

@ -104,7 +104,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, QWidget *parent)
kdeclarative.initialize(); kdeclarative.initialize();
kdeclarative.setupBindings(); kdeclarative.setupBindings();
rootContext()->setContextProperty("clientModel", model); rootContext()->setContextProperty("clientModel", model);
updateQmlSource(); setSource(QUrl(KStandardDirs::locate("data", "kwin/tabbox/tabbox.qml")));
// FrameSvg // FrameSvg
m_frame->setImagePath("dialogs/background"); m_frame->setImagePath("dialogs/background");
@ -116,6 +116,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, QWidget *parent)
void DeclarativeView::showEvent(QShowEvent *event) void DeclarativeView::showEvent(QShowEvent *event)
{ {
updateQmlSource();
m_currentScreenGeometry = Kephal::ScreenUtils::screenGeometry(tabBox->activeScreen()); m_currentScreenGeometry = Kephal::ScreenUtils::screenGeometry(tabBox->activeScreen());
rootObject()->setProperty("screenWidth", m_currentScreenGeometry.width()); rootObject()->setProperty("screenWidth", m_currentScreenGeometry.width());
rootObject()->setProperty("screenHeight", m_currentScreenGeometry.height()); rootObject()->setProperty("screenHeight", m_currentScreenGeometry.height());
@ -188,7 +189,6 @@ void DeclarativeView::updateQmlSource()
return; return;
} }
m_currentLayout = tabBox->config().layoutName(); m_currentLayout = tabBox->config().layoutName();
setSource(QUrl(KStandardDirs::locate("data", "kwin/tabbox/tabbox.qml")));
QString file = KStandardDirs::locate("data", "kwin/tabbox/" + m_currentLayout.toLower().replace(' ', '_') + ".qml"); QString file = KStandardDirs::locate("data", "kwin/tabbox/" + m_currentLayout.toLower().replace(' ', '_') + ".qml");
if (file.isNull()) { if (file.isNull()) {
// fallback to default // fallback to default