File indexing completed on 2024-05-12 15:54:28
0001 /* 0002 * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KGantt library. 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License, or (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 0018 */ 0019 0020 #include "kganttstyleoptionganttitem.h" 0021 0022 using namespace KGantt; 0023 0024 /*!\class KGantt::StyleOptionGanttItem kganttstyleoptionganttitem.h KGanttStyleOptionGanttItem 0025 * \ingroup KGantt 0026 * \brief QStyleOption subclass for gantt items. 0027 */ 0028 0029 typedef QStyleOptionViewItem BASE; 0030 0031 /*! Constructor. Sets grid to 0. */ 0032 StyleOptionGanttItem::StyleOptionGanttItem() 0033 : BASE(), 0034 displayPosition( Left ), 0035 grid( nullptr ) 0036 { 0037 type = QStyleOption::SO_CustomBase+89; 0038 version = 1; 0039 } 0040 0041 /*! Copy constructor. Creates a copy of \a other */ 0042 StyleOptionGanttItem::StyleOptionGanttItem( const StyleOptionGanttItem& other ) 0043 : BASE(other) 0044 { 0045 operator=( other ); 0046 } 0047 0048 /*! Assignment operator */ 0049 StyleOptionGanttItem& StyleOptionGanttItem::operator=( const StyleOptionGanttItem& other ) 0050 { 0051 BASE::operator=( other ); 0052 boundingRect = other.boundingRect; 0053 itemRect = other.itemRect; 0054 displayPosition = other.displayPosition; 0055 grid = other.grid; 0056 text = other.text; 0057 return *this; 0058 } 0059 0060 #ifndef QT_NO_DEBUG_STREAM 0061 QDebug operator<<( QDebug dbg, KGantt::StyleOptionGanttItem::Position p) 0062 { 0063 switch ( p ) { 0064 case KGantt::StyleOptionGanttItem::Left: dbg << "KGantt::StyleOptionGanttItem::Left"; break; 0065 case KGantt::StyleOptionGanttItem::Right: dbg << "KGantt::StyleOptionGanttItem::Right"; break; 0066 case KGantt::StyleOptionGanttItem::Center: dbg << "KGantt::StyleOptionGanttItem::Center"; break; 0067 case KGantt::StyleOptionGanttItem::Hidden: dbg << "KGantt::StyleOptionGanttItem::Hidden"; break; 0068 default: dbg << static_cast<int>( p ); 0069 } 0070 return dbg; 0071 } 0072 0073 QDebug operator<<( QDebug dbg, const KGantt::StyleOptionGanttItem& s ) 0074 { 0075 dbg << "KGantt::StyleOptionGanttItem[ boundingRect="<<s.boundingRect 0076 <<", itemRect="<<s.itemRect 0077 <<", displayPosition="<<s.displayPosition 0078 <<", grid="<<s.grid 0079 <<", text="<<s.text 0080 <<"]"; 0081 return dbg; 0082 } 0083 0084 #endif /* QT_NO_DEBUG_STREAM */ 0085 0086 0087 /*!\enum KGantt::StyleOptionGanttItem::Position 0088 * This enum is used to describe where the Qt::DisplayRole 0089 * (the label) should be located relative to the item itself. 0090 */ 0091 0092 /*!\var StyleOptionGanttItem::boundingRect 0093 * Contains the bounding rectangle for the item 0094 */ 0095 0096 /*!\var StyleOptionGanttItem::itemRect 0097 * Contains the "active" item rectangle that corresponds 0098 * to the values from the model. 0099 */ 0100 0101 /*!\var StyleOptionGanttItem::displayPosition 0102 * \see StyleOptionGanttItem::Position. 0103 */ 0104 0105 /*!\var StyleOptionGanttItem::grid 0106 * Contains a pointer to the AbstractGrid used by the view 0107 */ 0108 0109 /*!\var StyleOptionGanttItem::text 0110 * Contains a string printed to the item 0111 */