-
Notifications
You must be signed in to change notification settings - Fork 0
/
LauncherScene.cpp
38 lines (27 loc) · 922 Bytes
/
LauncherScene.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "LauncherScene.h"
LauncherScene::LauncherScene(QObject *parent) :
QGraphicsScene(parent)
{
setSceneRect(0, 0, 1280, 800);
int margin = 50, columns = 6;
Grid grid(sceneRect().width(), columns, margin);
QList<LauncherItem *> items;
for (int i = 0; i < 10; i++)
{
items.append(new LauncherItem("open \"/Applications/Sublime Text.app\"", "/Users/nemanja/qt.png", grid.getItemSize()));
}
for (int i = 0; i < items.length(); i++)
{
LauncherItem *launcherItem = items.at(i);
launcherItem->setPos(grid.pos());
addItem(launcherItem);
grid.next();
}
QGamepad *gamepad = new QGamepad(0, this);
connect(gamepad, &QGamepad::buttonAChanged, this, &LauncherScene::onGamepadButtonStartChanged);
qDebug() << "ready";
}
void LauncherScene::onGamepadButtonStartChanged(bool value)
{
qDebug() << (value ? "on" : "off");
}