File indexing completed on 2024-05-19 04:36:35
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #include "ResizeHandle.h" 0021 0022 #include <QPainter> 0023 #include <QStyleOptionGraphicsItem> 0024 0025 #include <QDebug> 0026 0027 namespace tikz { 0028 namespace ui { 0029 0030 ResizeHandle::ResizeHandle(Position position) 0031 : Handle(Handle::ResizeHandle, position) 0032 { 0033 } 0034 0035 ResizeHandle::~ResizeHandle() 0036 { 0037 } 0038 0039 int ResizeHandle::type() const 0040 { 0041 return UserType + 5; 0042 } 0043 0044 void ResizeHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) 0045 { 0046 Q_UNUSED(widget); 0047 Q_UNUSED(option); 0048 0049 painter->save(); 0050 painter->setRenderHints(QPainter::Antialiasing); 0051 0052 painter->setPen(Qt::black); 0053 painter->setBrush(isHovered() ? Qt::yellow : Qt::green); 0054 0055 painter->drawRect(rect()); 0056 0057 painter->restore(); 0058 } 0059 0060 } 0061 } 0062 0063 // kate: indent-width 4; replace-tabs on;