Changeset View
Changeset View
Standalone View
Standalone View
src/plasmaquick/appletquickitem.cpp
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 107 | { | |||
---|---|---|---|---|---|
110 | //Extract the representation's Layout, if any | 110 | //Extract the representation's Layout, if any | ||
111 | //No Item? | 111 | //No Item? | ||
112 | if (!item) { | 112 | if (!item) { | ||
113 | return; | 113 | return; | ||
114 | } | 114 | } | ||
115 | 115 | | |||
116 | //Search a child that has the needed Layout properties | 116 | //Search a child that has the needed Layout properties | ||
117 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | 117 | //HACK: here we are not type safe, but is the only way to access to a pointer of Layout | ||
118 | foreach (QObject *child, item->children()) { | 118 | const auto lstChildren = item->children(); | ||
119 | for (QObject *child : lstChildren) { | ||||
119 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | 120 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | ||
120 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | 121 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | ||
121 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | 122 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | ||
122 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | 123 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | ||
123 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | 124 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | ||
124 | ) { | 125 | ) { | ||
125 | layout = child; | 126 | layout = child; | ||
126 | break; | 127 | break; | ||
Show All 24 Lines | |||||
151 | propagateSizeHint("maximumWidth"); | 152 | propagateSizeHint("maximumWidth"); | ||
152 | propagateSizeHint("maximumHeight"); | 153 | propagateSizeHint("maximumHeight"); | ||
153 | propagateSizeHint("fillWidth"); | 154 | propagateSizeHint("fillWidth"); | ||
154 | propagateSizeHint("fillHeight"); | 155 | propagateSizeHint("fillHeight"); | ||
155 | 156 | | |||
156 | 157 | | |||
157 | QObject *ownLayout = nullptr; | 158 | QObject *ownLayout = nullptr; | ||
158 | 159 | | |||
159 | foreach (QObject *child, q->children()) { | 160 | const auto children = q->children(); | ||
161 | for (QObject *child : children) { | ||||
160 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | 162 | //find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight | ||
161 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | 163 | if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && | ||
162 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | 164 | child->property("preferredWidth").isValid() && child->property("preferredHeight").isValid() && | ||
163 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | 165 | child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid() && | ||
164 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | 166 | child->property("fillWidth").isValid() && child->property("fillHeight").isValid() | ||
165 | ) { | 167 | ) { | ||
166 | ownLayout = child; | 168 | ownLayout = child; | ||
167 | break; | 169 | break; | ||
▲ Show 20 Lines • Show All 427 Lines • ▼ Show 20 Line(s) | 558 | { | |||
595 | 597 | | |||
596 | d->qmlObject->setSource(d->applet->kPackage().fileUrl("mainscript")); | 598 | d->qmlObject->setSource(d->applet->kPackage().fileUrl("mainscript")); | ||
597 | 599 | | |||
598 | if (!engine || !engine->rootContext() || !engine->rootContext()->isValid() || !d->qmlObject->mainComponent() || d->qmlObject->mainComponent()->isError() || d->applet->failedToLaunch()) { | 600 | if (!engine || !engine->rootContext() || !engine->rootContext()->isValid() || !d->qmlObject->mainComponent() || d->qmlObject->mainComponent()->isError() || d->applet->failedToLaunch()) { | ||
599 | QString reason; | 601 | QString reason; | ||
600 | if (d->applet->failedToLaunch()) { | 602 | if (d->applet->failedToLaunch()) { | ||
601 | reason = d->applet->launchErrorMessage(); | 603 | reason = d->applet->launchErrorMessage(); | ||
602 | } else if (d->applet->kPackage().isValid()) { | 604 | } else if (d->applet->kPackage().isValid()) { | ||
603 | foreach (QQmlError error, d->qmlObject->mainComponent()->errors()) { | 605 | const auto errors = d->qmlObject->mainComponent()->errors(); | ||
606 | for (QQmlError error : errors) { | ||||
604 | reason += error.toString() + QLatin1Char('\n'); | 607 | reason += error.toString() + QLatin1Char('\n'); | ||
605 | } | 608 | } | ||
606 | reason = i18n("Error loading QML file: %1", reason); | 609 | reason = i18n("Error loading QML file: %1", reason); | ||
607 | } else { | 610 | } else { | ||
608 | reason = i18n("Error loading Applet: package inexistent. %1", applet()->launchErrorMessage()); | 611 | reason = i18n("Error loading Applet: package inexistent. %1", applet()->launchErrorMessage()); | ||
609 | } | 612 | } | ||
610 | 613 | | |||
611 | d->qmlObject->setSource(d->coronaPackage.fileUrl("appleterror")); | 614 | d->qmlObject->setSource(d->coronaPackage.fileUrl("appleterror")); | ||
▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines |