Changeset View
Changeset View
Standalone View
Standalone View
effects/desktopgrid/desktopgrid.cpp
Show All 30 Lines | |||||
31 | #include <QApplication> | 31 | #include <QApplication> | ||
32 | #include <KGlobalAccel> | 32 | #include <KGlobalAccel> | ||
33 | #include <KLocalizedString> | 33 | #include <KLocalizedString> | ||
34 | #include <netwm_def.h> | 34 | #include <netwm_def.h> | ||
35 | #include <QEvent> | 35 | #include <QEvent> | ||
36 | #include <QMouseEvent> | 36 | #include <QMouseEvent> | ||
37 | #include <QTimer> | 37 | #include <QTimer> | ||
38 | #include <QVector2D> | 38 | #include <QVector2D> | ||
39 | #include <QQmlContext> | 39 | #include <QMatrix4x4> | ||
40 | #include <QQmlEngine> | | |||
41 | #include <QQuickItem> | | |||
42 | 40 | | |||
41 | #include <QQuickItem> | ||||
42 | #include <QQmlContext> | ||||
43 | #include <KWayland/Server/surface_interface.h> | 43 | #include <KWayland/Server/surface_interface.h> | ||
44 | 44 | | |||
45 | #include <cmath> | 45 | #include <cmath> | ||
46 | 46 | | |||
47 | namespace KWin | 47 | namespace KWin | ||
48 | { | 48 | { | ||
49 | 49 | | |||
50 | // WARNING, TODO: This effect relies on the desktop layout being EWMH-compliant. | 50 | // WARNING, TODO: This effect relies on the desktop layout being EWMH-compliant. | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 91 | connect(effects, &EffectsHandler::screenAboutToLock, this, [this]() { | |||
96 | } | 96 | } | ||
97 | }); | 97 | }); | ||
98 | 98 | | |||
99 | // Load all other configuration details | 99 | // Load all other configuration details | ||
100 | reconfigure(ReconfigureAll); | 100 | reconfigure(ReconfigureAll); | ||
101 | } | 101 | } | ||
102 | 102 | | |||
103 | DesktopGridEffect::~DesktopGridEffect() | 103 | DesktopGridEffect::~DesktopGridEffect() | ||
104 | { | 104 | { | ||
105 | foreach (DesktopButtonsView *view, m_desktopButtonsViews) | | |||
106 | view->deleteLater(); | | |||
107 | m_desktopButtonsViews.clear(); | | |||
108 | } | 105 | } | ||
meven: Could you convert those foreach you touch | |||||
Please don't use auto here, it obfuscates code rather than erases redundancy. Also, there has to be whitespace before :. zzag: Please don't use `auto` here, it obfuscates code rather than erases redundancy. Also, there has… | |||||
I've said before that if we are to have a policy on auto, can we try to start a thread on https://techbase.kde.org/Policies/Frameworks_Coding_Style about auto. Same for the colon. davidedmundson: I've said before that if we are to have a policy on auto, can we try to start a thread on https… | |||||
Well, it's true, usage of auto is not covered by any coding convention in KDE afaik, but we could use common sense to decide whether it's okay to use auto here Given for (EffectQuickScene *view : m_desktopButtonsViews) { and for (auto *view : m_desktopButtonsViews) { Which one is more readable? view is not an iterator and there is no repetition. zzag: Well, it's true, usage of `auto` is not covered by any coding convention in KDE afaik, but we… | |||||
109 | 106 | | |||
110 | void DesktopGridEffect::reconfigure(ReconfigureFlags) | 107 | void DesktopGridEffect::reconfigure(ReconfigureFlags) | ||
111 | { | 108 | { | ||
112 | DesktopGridConfig::self()->read(); | 109 | DesktopGridConfig::self()->read(); | ||
113 | 110 | | |||
114 | foreach (ElectricBorder border, borderActivate) { | 111 | foreach (ElectricBorder border, borderActivate) { | ||
115 | effects->unreserveElectricBorder(border, this); | 112 | effects->unreserveElectricBorder(border, this); | ||
116 | } | 113 | } | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 182 | { | |||
189 | } | 186 | } | ||
190 | for (int desktop = 1; desktop <= effects->numberOfDesktops(); desktop++) { | 187 | for (int desktop = 1; desktop <= effects->numberOfDesktops(); desktop++) { | ||
191 | ScreenPaintData d = data; | 188 | ScreenPaintData d = data; | ||
192 | paintingDesktop = desktop; | 189 | paintingDesktop = desktop; | ||
193 | effects->paintScreen(mask, region, d); | 190 | effects->paintScreen(mask, region, d); | ||
194 | } | 191 | } | ||
195 | 192 | | |||
196 | // paint the add desktop button | 193 | // paint the add desktop button | ||
197 | foreach (DesktopButtonsView *view, m_desktopButtonsViews) { | 194 | for (EffectQuickScene* view : m_desktopButtons) { | ||
zzag: Align `*` to right. | |||||
198 | if (!view->effectWindow) { | 195 | view->rootItem()->setOpacity(timeline.currentValue()); | ||
199 | EffectWindow *viewWindow = effects->findWindow(view->winId()); | 196 | effects->renderEffectQuickView(view); | ||
meven: Same | |||||
200 | if (viewWindow) { | | |||
201 | viewWindow->setData(WindowForceBlurRole, QVariant(true)); | | |||
202 | view->effectWindow = viewWindow; | | |||
203 | } | | |||
204 | } | | |||
205 | if (view->effectWindow) { | | |||
206 | WindowPaintData d(view->effectWindow); | | |||
207 | d.multiplyOpacity(timeline.currentValue()); | | |||
208 | effects->drawWindow(view->effectWindow, PAINT_WINDOW_TRANSLUCENT, infiniteRegion(), d); | | |||
209 | } | | |||
210 | } | 197 | } | ||
211 | 198 | | |||
212 | if (isUsingPresentWindows() && windowMove && wasWindowMove) { | 199 | if (isUsingPresentWindows() && windowMove && wasWindowMove) { | ||
213 | // the moving window has to be painted on top of all desktops | 200 | // the moving window has to be painted on top of all desktops | ||
214 | QPoint diff = cursorPos() - m_windowMoveStartPoint; | 201 | QPoint diff = cursorPos() - m_windowMoveStartPoint; | ||
215 | QRect geo = m_windowMoveGeometry.translated(diff); | 202 | QRect geo = m_windowMoveGeometry.translated(diff); | ||
216 | WindowPaintData d(windowMove, data.projectionMatrix()); | 203 | WindowPaintData d(windowMove, data.projectionMatrix()); | ||
217 | d *= QVector2D((qreal)geo.width() / (qreal)windowMove->width(), (qreal)geo.height() / (qreal)windowMove->height()); | 204 | d *= QVector2D((qreal)geo.width() / (qreal)windowMove->width(), (qreal)geo.height() / (qreal)windowMove->height()); | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | |||||
308 | void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) | 295 | void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) | ||
309 | { | 296 | { | ||
310 | if (timeline.currentValue() != 0 || (isUsingPresentWindows() && isMotionManagerMovingWindows())) { | 297 | if (timeline.currentValue() != 0 || (isUsingPresentWindows() && isMotionManagerMovingWindows())) { | ||
311 | if (isUsingPresentWindows() && w == windowMove && wasWindowMove && | 298 | if (isUsingPresentWindows() && w == windowMove && wasWindowMove && | ||
312 | ((!wasWindowCopy && sourceDesktop == paintingDesktop) || | 299 | ((!wasWindowCopy && sourceDesktop == paintingDesktop) || | ||
313 | (sourceDesktop != highlightedDesktop && highlightedDesktop == paintingDesktop))) { | 300 | (sourceDesktop != highlightedDesktop && highlightedDesktop == paintingDesktop))) { | ||
314 | return; // will be painted on top of all other windows | 301 | return; // will be painted on top of all other windows | ||
315 | } | 302 | } | ||
316 | foreach (DesktopButtonsView *view, m_desktopButtonsViews) { | | |||
317 | if (view->effectWindow == w) { | | |||
318 | if (!activated && timeline.currentValue() < 0.05) { | | |||
319 | view->hide(); | | |||
320 | } | | |||
321 | return; // will be painted on top of all other windows | | |||
322 | } | | |||
323 | } | | |||
324 | 303 | | |||
325 | qreal xScale = data.xScale(); | 304 | qreal xScale = data.xScale(); | ||
326 | qreal yScale = data.yScale(); | 305 | qreal yScale = data.yScale(); | ||
327 | 306 | | |||
328 | data.multiplyBrightness(1.0 - (0.3 * (1.0 - hoverTimeline[paintingDesktop - 1]->currentValue()))); | 307 | data.multiplyBrightness(1.0 - (0.3 * (1.0 - hoverTimeline[paintingDesktop - 1]->currentValue()))); | ||
329 | 308 | | |||
330 | for (int screen = 0; screen < effects->numScreens(); screen++) { | 309 | for (int screen = 0; screen < effects->numScreens(); screen++) { | ||
331 | QRect screenGeom = effects->clientArea(ScreenArea, screen, 0); | 310 | QRect screenGeom = effects->clientArea(ScreenArea, screen, 0); | ||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 405 | { | |||
439 | } | 418 | } | ||
440 | effects->addRepaintFull(); | 419 | effects->addRepaintFull(); | ||
441 | } | 420 | } | ||
442 | 421 | | |||
443 | void DesktopGridEffect::slotWindowDeleted(EffectWindow* w) | 422 | void DesktopGridEffect::slotWindowDeleted(EffectWindow* w) | ||
444 | { | 423 | { | ||
445 | if (w == windowMove) | 424 | if (w == windowMove) | ||
446 | windowMove = nullptr; | 425 | windowMove = nullptr; | ||
447 | foreach (DesktopButtonsView *view, m_desktopButtonsViews) { | | |||
448 | if (view->effectWindow && view->effectWindow == w) { | | |||
449 | view->effectWindow = nullptr; | | |||
450 | break; | | |||
451 | } | | |||
452 | } | | |||
453 | if (isUsingPresentWindows()) { | 426 | if (isUsingPresentWindows()) { | ||
454 | for (QList<WindowMotionManager>::iterator it = m_managers.begin(), | 427 | for (QList<WindowMotionManager>::iterator it = m_managers.begin(), | ||
455 | end = m_managers.end(); it != end; ++it) { | 428 | end = m_managers.end(); it != end; ++it) { | ||
456 | it->unmanage(w); | 429 | it->unmanage(w); | ||
457 | } | 430 | } | ||
458 | } | 431 | } | ||
459 | } | 432 | } | ||
460 | 433 | | |||
Show All 16 Lines | |||||
477 | { | 450 | { | ||
478 | if ((e->type() != QEvent::MouseMove | 451 | if ((e->type() != QEvent::MouseMove | ||
479 | && e->type() != QEvent::MouseButtonPress | 452 | && e->type() != QEvent::MouseButtonPress | ||
480 | && e->type() != QEvent::MouseButtonRelease) | 453 | && e->type() != QEvent::MouseButtonRelease) | ||
481 | || timeline.currentValue() != 1) // Block user input during animations | 454 | || timeline.currentValue() != 1) // Block user input during animations | ||
482 | return; | 455 | return; | ||
483 | QMouseEvent* me = static_cast< QMouseEvent* >(e); | 456 | QMouseEvent* me = static_cast< QMouseEvent* >(e); | ||
484 | if (!(wasWindowMove || wasDesktopMove)) { | 457 | if (!(wasWindowMove || wasDesktopMove)) { | ||
485 | foreach (DesktopButtonsView *view, m_desktopButtonsViews) { | 458 | for (EffectQuickScene *view : m_desktopButtons) { | ||
486 | if (view->geometry().contains(me->pos())) { | 459 | view->forwardMouseEvent(me); | ||
487 | const QPoint widgetPos = view->mapFromGlobal(me->pos()); | 460 | if (e->isAccepted()) { | ||
meven: Could you convert those foreach you touch | |||||
488 | QMouseEvent event(me->type(), widgetPos, me->pos(), me->button(), me->buttons(), me->modifiers()); | | |||
489 | view->windowInputMouseEvent(&event); | | |||
490 | return; | 461 | return; | ||
491 | } | 462 | } | ||
492 | } | 463 | } | ||
493 | } | 464 | } | ||
494 | 465 | | |||
495 | if (e->type() == QEvent::MouseMove) { | 466 | if (e->type() == QEvent::MouseMove) { | ||
496 | int d = posToDesktop(me->pos()); | 467 | int d = posToDesktop(me->pos()); | ||
497 | if (windowMove != nullptr && | 468 | if (windowMove != nullptr && | ||
▲ Show 20 Lines • Show All 557 Lines • ▼ Show 20 Line(s) | 1025 | foreach (EffectWindow * w, (*it).managedWindows()) { | |||
1055 | (*it).moveWindow(w, w->geometry()); | 1026 | (*it).moveWindow(w, w->geometry()); | ||
1056 | } | 1027 | } | ||
1057 | } | 1028 | } | ||
1058 | } | 1029 | } | ||
1059 | QTimer::singleShot(zoomDuration + 1, this, | 1030 | QTimer::singleShot(zoomDuration + 1, this, | ||
1060 | [this] { | 1031 | [this] { | ||
1061 | if (activated) | 1032 | if (activated) | ||
1062 | return; | 1033 | return; | ||
1063 | foreach (DesktopButtonsView *view, m_desktopButtonsViews) { | 1034 | for (EffectQuickScene *view : m_desktopButtons) { | ||
meven: Same | |||||
1064 | view->hide(); | 1035 | view->hide(); | ||
1065 | } | 1036 | } | ||
1066 | } | 1037 | } | ||
1067 | ); | 1038 | ); | ||
1068 | setHighlightedDesktop(effects->currentDesktop()); // Ensure selected desktop is highlighted | 1039 | setHighlightedDesktop(effects->currentDesktop()); // Ensure selected desktop is highlighted | ||
1069 | } | 1040 | } | ||
1070 | effects->addRepaintFull(); | 1041 | effects->addRepaintFull(); | ||
1071 | } | 1042 | } | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 1090 | if (w->isOnDesktop(i) && w->screen() == j &&isRelevantWithPresentWindows(w)) { | |||
1120 | manager.manage(w); | 1091 | manager.manage(w); | ||
1121 | } | 1092 | } | ||
1122 | } | 1093 | } | ||
1123 | m_proxy->calculateWindowTransformations(manager.managedWindows(), j, manager); | 1094 | m_proxy->calculateWindowTransformations(manager.managedWindows(), j, manager); | ||
1124 | m_managers.append(manager); | 1095 | m_managers.append(manager); | ||
1125 | } | 1096 | } | ||
1126 | } | 1097 | } | ||
1127 | } | 1098 | } | ||
1128 | bool enableAdd = effects->numberOfDesktops() < 20; | | |||
1129 | bool enableRemove = effects->numberOfDesktops() > 1; | | |||
1130 | 1099 | | |||
1131 | QVector<DesktopButtonsView*>::iterator it = m_desktopButtonsViews.begin(); | 1100 | auto it = m_desktopButtons.begin(); | ||
1132 | const int n = DesktopGridConfig::showAddRemove() ? effects->numScreens() : 0; | 1101 | const int n = DesktopGridConfig::showAddRemove() ? effects->numScreens() : 0; | ||
1133 | for (int i = 0; i < n; ++i) { | 1102 | for (int i = 0; i < n; ++i) { | ||
1134 | DesktopButtonsView *view; | 1103 | EffectQuickScene *view; | ||
1135 | if (it == m_desktopButtonsViews.end()) { | 1104 | QSize size; | ||
1136 | view = new DesktopButtonsView(); | 1105 | if (it == m_desktopButtons.end()) { | ||
1137 | m_desktopButtonsViews.append(view); | 1106 | view = new EffectQuickScene(this); | ||
1138 | it = m_desktopButtonsViews.end(); // changed through insert! | 1107 | | ||
1139 | connect(view, &DesktopButtonsView::addDesktop, this, &DesktopGridEffect::slotAddDesktop); | 1108 | connect(view, &EffectQuickView::repaintNeeded, this, []() { | ||
1140 | connect(view, &DesktopButtonsView::removeDesktop, this, &DesktopGridEffect::slotRemoveDesktop); | 1109 | effects->addRepaintFull(); | ||
1110 | }); | ||||
1111 | | ||||
1112 | view->rootContext()->setContextProperty("effects", effects); | ||||
1113 | view->setSource(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/desktopgrid/main.qml")))); | ||||
1114 | | ||||
1115 | QQuickItem *rootItem = view->rootItem(); | ||||
1116 | if (!rootItem) { | ||||
1117 | delete view; | ||||
1118 | continue; | ||||
1119 | } | ||||
1120 | | ||||
1121 | m_desktopButtons.append(view); | ||||
1122 | it = m_desktopButtons.end(); // changed through insert! | ||||
1123 | | ||||
1124 | size = QSize(rootItem->implicitWidth(), rootItem->implicitHeight()); | ||||
1141 | } else { | 1125 | } else { | ||
1142 | view = *it; | 1126 | view = *it; | ||
1143 | ++it; | 1127 | ++it; | ||
1128 | size = view->size(); | ||||
1144 | } | 1129 | } | ||
1145 | view->setAddDesktopEnabled(enableAdd); | | |||
1146 | view->setRemoveDesktopEnabled(enableRemove); | | |||
1147 | const QRect screenRect = effects->clientArea(FullScreenArea, i, 1); | 1130 | const QRect screenRect = effects->clientArea(FullScreenArea, i, 1); | ||
1148 | view->show(); // pseudo show must happen before geometry changes | 1131 | view->show(); // pseudo show must happen before geometry changes | ||
1149 | view->setPosition(screenRect.right() - border/3 - view->width(), | 1132 | const QPoint position(screenRect.right() - border/3 - size.width(), | ||
1150 | screenRect.bottom() - border/3 - view->height()); | 1133 | screenRect.bottom() - border/3 - size.height()); | ||
1134 | view->setGeometry(QRect(position, size)); | ||||
1151 | } | 1135 | } | ||
1152 | while (it != m_desktopButtonsViews.end()) { | 1136 | while (it != m_desktopButtons.end()) { | ||
1153 | (*it)->deleteLater(); | 1137 | (*it)->deleteLater(); | ||
1154 | it = m_desktopButtonsViews.erase(it); | 1138 | it = m_desktopButtons.erase(it); | ||
1155 | } | 1139 | } | ||
1156 | } | 1140 | } | ||
1157 | 1141 | | |||
1158 | void DesktopGridEffect::setupGrid() | 1142 | void DesktopGridEffect::setupGrid() | ||
1159 | { | 1143 | { | ||
1160 | // We need these variables for every paint so lets cache them | 1144 | // We need these variables for every paint so lets cache them | ||
1161 | int x, y; | 1145 | int x, y; | ||
1162 | int numDesktops = effects->numberOfDesktops(); | 1146 | int numDesktops = effects->numberOfDesktops(); | ||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | 1275 | { | |||
1292 | effects->setNumberOfDesktops(effects->numberOfDesktops() - 1); | 1276 | effects->setNumberOfDesktops(effects->numberOfDesktops() - 1); | ||
1293 | } | 1277 | } | ||
1294 | 1278 | | |||
1295 | void DesktopGridEffect::slotNumberDesktopsChanged(uint old) | 1279 | void DesktopGridEffect::slotNumberDesktopsChanged(uint old) | ||
1296 | { | 1280 | { | ||
1297 | if (!activated) | 1281 | if (!activated) | ||
1298 | return; | 1282 | return; | ||
1299 | const uint desktop = effects->numberOfDesktops(); | 1283 | const uint desktop = effects->numberOfDesktops(); | ||
1300 | bool enableAdd = desktop < 20; | | |||
1301 | bool enableRemove = desktop > 1; | | |||
1302 | foreach (DesktopButtonsView *view, m_desktopButtonsViews) { | | |||
1303 | view->setAddDesktopEnabled(enableAdd); | | |||
1304 | view->setRemoveDesktopEnabled(enableRemove); | | |||
1305 | } | | |||
1306 | if (old < desktop) | 1284 | if (old < desktop) | ||
1307 | desktopsAdded(old); | 1285 | desktopsAdded(old); | ||
1308 | else | 1286 | else | ||
1309 | desktopsRemoved(old); | 1287 | desktopsRemoved(old); | ||
1310 | } | 1288 | } | ||
1311 | 1289 | | |||
1312 | void DesktopGridEffect::desktopsAdded(int old) | 1290 | void DesktopGridEffect::desktopsAdded(int old) | ||
1313 | { | 1291 | { | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 1400 | { | |||
1438 | 1416 | | |||
1439 | if (!w->isOnCurrentActivity()) { | 1417 | if (!w->isOnCurrentActivity()) { | ||
1440 | return false; | 1418 | return false; | ||
1441 | } | 1419 | } | ||
1442 | 1420 | | |||
1443 | return true; | 1421 | return true; | ||
1444 | } | 1422 | } | ||
1445 | 1423 | | |||
1446 | /************************************************ | | |||
1447 | * DesktopButtonView | | |||
1448 | ************************************************/ | | |||
1449 | DesktopButtonsView::DesktopButtonsView(QWindow *parent) | | |||
1450 | : QQuickView(parent) | | |||
1451 | , effectWindow(nullptr) | | |||
1452 | , m_visible(false) | | |||
1453 | , m_posIsValid(false) | | |||
1454 | { | | |||
1455 | setFlags(Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint); | | |||
1456 | setColor(Qt::transparent); | | |||
1457 | | ||||
1458 | rootContext()->setContextProperty(QStringLiteral("add"), QVariant(true)); | | |||
1459 | rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(true)); | | |||
1460 | setSource(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/desktopgrid/main.qml")))); | | |||
1461 | if (QObject *item = rootObject()->findChild<QObject*>(QStringLiteral("addButton"))) { | | |||
1462 | connect(item, SIGNAL(clicked()), SIGNAL(addDesktop())); | | |||
1463 | } | | |||
1464 | if (QObject *item = rootObject()->findChild<QObject*>(QStringLiteral("removeButton"))) { | | |||
1465 | connect(item, SIGNAL(clicked()), SIGNAL(removeDesktop())); | | |||
1466 | } | | |||
1467 | } | | |||
1468 | | ||||
1469 | void DesktopButtonsView::windowInputMouseEvent(QMouseEvent *e) | | |||
1470 | { | | |||
1471 | if (e->type() == QEvent::MouseMove) { | | |||
1472 | mouseMoveEvent(e); | | |||
1473 | } else if (e->type() == QEvent::MouseButtonPress) { | | |||
1474 | mousePressEvent(e); | | |||
1475 | } else if (e->type() == QEvent::MouseButtonDblClick) { | | |||
1476 | mouseDoubleClickEvent(e); | | |||
1477 | } else if (e->type() == QEvent::MouseButtonRelease) { | | |||
1478 | mouseReleaseEvent(e); | | |||
1479 | } | | |||
1480 | } | | |||
1481 | | ||||
1482 | void DesktopButtonsView::setAddDesktopEnabled(bool enable) | | |||
1483 | { | | |||
1484 | rootContext()->setContextProperty(QStringLiteral("add"), QVariant(enable)); | | |||
1485 | } | | |||
1486 | | ||||
1487 | void DesktopButtonsView::setRemoveDesktopEnabled(bool enable) | | |||
1488 | { | | |||
1489 | rootContext()->setContextProperty(QStringLiteral("remove"), QVariant(enable)); | | |||
1490 | } | | |||
1491 | | ||||
1492 | bool DesktopButtonsView::isVisible() const | | |||
1493 | { | | |||
1494 | return m_visible; | | |||
1495 | } | | |||
1496 | | ||||
1497 | void DesktopButtonsView::show() | | |||
1498 | { | | |||
1499 | if (!m_visible && m_posIsValid) { | | |||
1500 | setPosition(m_pos); | | |||
1501 | m_posIsValid = false; | | |||
1502 | } | | |||
1503 | m_visible = true; | | |||
1504 | QQuickView::show(); | | |||
1505 | } | | |||
1506 | | ||||
1507 | void DesktopButtonsView::hide() | | |||
1508 | { | | |||
1509 | if (!m_posIsValid) { | | |||
1510 | m_pos = position(); | | |||
1511 | m_posIsValid = true; | | |||
1512 | setPosition(-width(), -height()); | | |||
1513 | } | | |||
1514 | m_visible = false; | | |||
1515 | } | | |||
1516 | | ||||
1517 | } // namespace | 1424 | } // namespace | ||
1518 | 1425 | |
Could you convert those foreach you touch