File indexing completed on 2024-05-12 04:20:44
0001 /* 0002 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KGantt library. 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include "kganttstyleoptionganttitem.h" 0010 0011 using namespace KGantt; 0012 0013 /*!\class KGantt::StyleOptionGanttItem kganttstyleoptionganttitem.h KGanttStyleOptionGanttItem 0014 * \ingroup KGantt 0015 * \brief QStyleOption subclass for gantt items. 0016 */ 0017 0018 typedef QStyleOptionViewItem BASE; 0019 0020 /*! Constructor. Sets grid to 0. */ 0021 StyleOptionGanttItem::StyleOptionGanttItem() 0022 : BASE(), 0023 displayPosition( Left ), 0024 grid( nullptr ) 0025 { 0026 type = QStyleOption::SO_CustomBase+89; 0027 version = 1; 0028 } 0029 0030 /*! Copy constructor. Creates a copy of \a other */ 0031 StyleOptionGanttItem::StyleOptionGanttItem( const StyleOptionGanttItem& other ) 0032 : BASE(other) 0033 { 0034 operator=( other ); 0035 } 0036 0037 /*! Assignment operator */ 0038 StyleOptionGanttItem& StyleOptionGanttItem::operator=( const StyleOptionGanttItem& other ) 0039 { 0040 BASE::operator=( other ); 0041 boundingRect = other.boundingRect; 0042 itemRect = other.itemRect; 0043 displayPosition = other.displayPosition; 0044 grid = other.grid; 0045 text = other.text; 0046 return *this; 0047 } 0048 0049 #ifndef QT_NO_DEBUG_STREAM 0050 QDebug operator<<( QDebug dbg, KGantt::StyleOptionGanttItem::Position p) 0051 { 0052 switch ( p ) { 0053 case KGantt::StyleOptionGanttItem::Left: dbg << "KGantt::StyleOptionGanttItem::Left"; break; 0054 case KGantt::StyleOptionGanttItem::Right: dbg << "KGantt::StyleOptionGanttItem::Right"; break; 0055 case KGantt::StyleOptionGanttItem::Center: dbg << "KGantt::StyleOptionGanttItem::Center"; break; 0056 case KGantt::StyleOptionGanttItem::Hidden: dbg << "KGantt::StyleOptionGanttItem::Hidden"; break; 0057 default: dbg << static_cast<int>( p ); 0058 } 0059 return dbg; 0060 } 0061 0062 QDebug operator<<( QDebug dbg, const KGantt::StyleOptionGanttItem& s ) 0063 { 0064 dbg << "KGantt::StyleOptionGanttItem[ boundingRect="<<s.boundingRect 0065 <<", itemRect="<<s.itemRect 0066 <<", displayPosition="<<s.displayPosition 0067 <<", grid="<<s.grid 0068 <<", text="<<s.text 0069 <<"]"; 0070 return dbg; 0071 } 0072 0073 #endif /* QT_NO_DEBUG_STREAM */ 0074 0075 0076 /*!\enum KGantt::StyleOptionGanttItem::Position 0077 * This enum is used to describe where the Qt::DisplayRole 0078 * (the label) should be located relative to the item itself. 0079 */ 0080 0081 /*!\var StyleOptionGanttItem::boundingRect 0082 * Contains the bounding rectangle for the item 0083 */ 0084 0085 /*!\var StyleOptionGanttItem::itemRect 0086 * Contains the "active" item rectangle that corresponds 0087 * to the values from the model. 0088 */ 0089 0090 /*!\var StyleOptionGanttItem::displayPosition 0091 * \see StyleOptionGanttItem::Position. 0092 */ 0093 0094 /*!\var StyleOptionGanttItem::grid 0095 * Contains a pointer to the AbstractGrid used by the view 0096 */ 0097 0098 /*!\var StyleOptionGanttItem::text 0099 * Contains a string printed to the item 0100 */