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