2
* This file is part of unity-2d
4
* Copyright 2011 Canonical Ltd.
7
* - Aurélien Gâteau <aurelien.gateau@canonical.com>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published
11
* by the Free Software Foundation; version 3.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#include <mousearea.h>
24
#include <unity2dapplication.h>
28
#include <QVBoxLayout>
30
int main(int argc, char** argv)
32
Unity2dApplication app(argc, argv);
34
QLabel* enteredLabel = new QLabel("Entered");
35
QVBoxLayout* layout = new QVBoxLayout(&window);
36
layout->addWidget(enteredLabel);
38
MouseArea* area = new MouseArea(&window);
39
area->setGeometry(QRect(10, 10, 200, 100));
40
QObject::connect(area, SIGNAL(entered()), enteredLabel, SLOT(show()));
41
QObject::connect(area, SIGNAL(exited()), enteredLabel, SLOT(hide()));
43
enteredLabel->setVisible(area->containsMouse());