Changeset View
Changeset View
Standalone View
Standalone View
src/kcmoduleqml.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 45 | : q(q), | |||
---|---|---|---|---|---|
47 | configModule(cm) | 47 | configModule(cm) | ||
48 | { | 48 | { | ||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | ~KCModuleQmlPrivate() | 51 | ~KCModuleQmlPrivate() | ||
52 | { | 52 | { | ||
53 | } | 53 | } | ||
54 | 54 | | |||
55 | void syncCurrentIndex() | ||||
56 | { | ||||
57 | if (!configModule || !pageRow) { | ||||
58 | return; | ||||
59 | } | ||||
60 | | ||||
61 | configModule->setCurrentIndex(pageRow->property("currentIndex").toInt()); | ||||
62 | } | ||||
63 | | ||||
55 | KCModuleQml *q; | 64 | KCModuleQml *q; | ||
56 | QQuickWindow *quickWindow; | 65 | QQuickWindow *quickWindow; | ||
57 | QQuickWidget *quickWidget; | 66 | QQuickWidget *quickWidget; | ||
58 | QQuickItem *rootPlaceHolder; | 67 | QQuickItem *rootPlaceHolder; | ||
59 | QQuickItem *pageRow; | 68 | QQuickItem *pageRow; | ||
60 | KQuickAddons::ConfigModule *configModule; | 69 | KQuickAddons::ConfigModule *configModule; | ||
61 | KDeclarative::QmlObjectSharedEngine *qmlObject; | 70 | KDeclarative::QmlObjectSharedEngine *qmlObject; | ||
62 | }; | 71 | }; | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 162 | if (d->pageRow) { | |||
156 | connect(d->configModule, &KQuickAddons::ConfigModule::pagePushed, this, [this](QQuickItem *page) { | 165 | connect(d->configModule, &KQuickAddons::ConfigModule::pagePushed, this, [this](QQuickItem *page) { | ||
157 | QMetaObject::invokeMethod(d->pageRow, "push", Qt::DirectConnection, Q_ARG(QVariant, QVariant::fromValue(page)), Q_ARG(QVariant, QVariant())); | 166 | QMetaObject::invokeMethod(d->pageRow, "push", Qt::DirectConnection, Q_ARG(QVariant, QVariant::fromValue(page)), Q_ARG(QVariant, QVariant())); | ||
158 | } | 167 | } | ||
159 | ); | 168 | ); | ||
160 | connect(d->configModule, &KQuickAddons::ConfigModule::pageRemoved, this, [this]() { | 169 | connect(d->configModule, &KQuickAddons::ConfigModule::pageRemoved, this, [this]() { | ||
161 | QMetaObject::invokeMethod(d->pageRow, "pop", Qt::DirectConnection, Q_ARG(QVariant, QVariant())); | 170 | QMetaObject::invokeMethod(d->pageRow, "pop", Qt::DirectConnection, Q_ARG(QVariant, QVariant())); | ||
162 | } | 171 | } | ||
163 | ); | 172 | ); | ||
173 | connect(d->configModule, &KQuickAddons::ConfigModule::currentIndexChanged, this, [this]() { | ||||
174 | d->pageRow->setProperty("currentIndex", d->configModule->currentIndex()); | ||||
175 | } | ||||
176 | ); | ||||
177 | //New syntax cannot be used to connect to QML types | ||||
178 | connect(d->pageRow, SIGNAL(currentIndexChanged()), this, SLOT(syncCurrentIndex())); | ||||
164 | 179 | | |||
165 | auto syncColumnWidth = [this](){ | 180 | auto syncColumnWidth = [this](){ | ||
166 | d->pageRow->setProperty("defaultColumnWidth", d->configModule->columnWidth() > 0 ? d->configModule->columnWidth() : d->rootPlaceHolder->width()); | 181 | d->pageRow->setProperty("defaultColumnWidth", d->configModule->columnWidth() > 0 ? d->configModule->columnWidth() : d->rootPlaceHolder->width()); | ||
167 | }; | 182 | }; | ||
168 | syncColumnWidth(); | 183 | syncColumnWidth(); | ||
169 | 184 | | |||
170 | connect(d->configModule, &KQuickAddons::ConfigModule::columnWidthChanged, | 185 | connect(d->configModule, &KQuickAddons::ConfigModule::columnWidthChanged, | ||
171 | this, syncColumnWidth); | 186 | this, syncColumnWidth); | ||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |