2
Wallch - Wallpaper Changer
3
A tool for changing Desktop Wallpapers automatically
5
Copyright © 2010-2014 by Alex Solanos and Leon Vitanos
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; either version 3
10
of the License, or (at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
#define QT_NO_KEYWORDS
29
#include <QGraphicsScene>
35
this->setFlag(QGraphicsItem::ItemIsMovable, true);
36
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
37
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
38
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
39
this->setFocus(Qt::MouseFocusReason);
40
this->setAcceptHoverEvents(true);
43
void MarkItem::hoverEnterEvent(QGraphicsSceneHoverEvent *){
44
setCursor(QCursor(Qt::SizeAllCursor));
45
this->update(this->boundingRect());
48
void MarkItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *){
49
this->update(this->boundingRect());
52
void MarkItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
54
QAction *deleteAction = menu.addAction("Delete");
55
QAction *selectedAction = menu.exec(event->screenPos());
56
if(deleteAction == selectedAction){
57
this->scene()->removeItem(this);
61
void MarkItem::setPointType(PointItemType::Value type, const QString &path /* = QString()*/){
66
case PointItemType::Point1:
67
imagePath_ = ":/images/point1.png";
69
case PointItemType::Point2:
70
imagePath_ = ":/images/point2.png";
72
case PointItemType::CustomPoint:
77
this->setPixmap(QPixmap(imagePath_));
80
PointItemType::Value MarkItem::getType(){
84
QString MarkItem::imagePath(){
88
bool MarkItem::willFinallyBeVisible(){
89
return this->scene()->sceneRect().intersects(this->sceneBoundingRect());