File indexing completed on 2024-04-28 07:54:19

0001 /* This file is part of KsirK.
0002    Copyright (C) 2008 Gael de Chalendar <kleag@free.fr>
0003 
0004    KsirK is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, either version 2
0007    of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; if not, write to the Free Software
0016    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017    02110-1301, USA
0018 */
0019 
0020 // application specific includes
0021 #include "ksirkskineditortextitem.h"
0022 
0023 #include<QGraphicsSceneMouseEvent>
0024 
0025 #include "ksirkskineditor_debug.h"
0026  
0027 namespace KsirkSkinEditor
0028 {
0029 
0030 TextItem::TextItem(QGraphicsItem* parent) :
0031       QGraphicsTextItem(parent)
0032 {
0033   qCDebug(KSIRKSKINEDITOR_LOG);
0034 }
0035 
0036 TextItem::~TextItem()
0037 {
0038   qCDebug(KSIRKSKINEDITOR_LOG);
0039 }
0040 
0041 void TextItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
0042 {
0043   qCDebug(KSIRKSKINEDITOR_LOG);
0044 //   setPosition(event->scenePos().x()-width()/2,event->scenePos().y()-height()/2)
0045   emit pressed(this, event->scenePos());
0046   QGraphicsItem::mousePressEvent(event);
0047 }
0048 
0049 void TextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
0050 {
0051   qCDebug(KSIRKSKINEDITOR_LOG) << event->scenePos();
0052   emit placed(this, event->scenePos());
0053   QGraphicsItem::mouseReleaseEvent(event);
0054 }
0055 
0056 } // closing namespace
0057 
0058 #include "moc_ksirkskineditortextitem.cpp"