diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-13 00:46:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-13 00:46:47 +0000 |
commit | 67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7 (patch) | |
tree | 5f52a9eada2e9f3654fc327d7c14dfef570a6ecb /kdgantt/KDGanttViewItem.cpp | |
parent | 2ee4bf4fd5eff93b2fbef0ff8e8063edffc5da5c (diff) | |
download | tdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.tar.gz tdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.zip |
Initial conversion of kdepim to TQt
This will probably require some tweaking before it will build under Qt4,
however Qt3 builds are OK. Any alterations this commit makes to kdepim
behaviour under Qt3 are unintentional and should be fixed.
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1227832 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdgantt/KDGanttViewItem.cpp')
-rw-r--r-- | kdgantt/KDGanttViewItem.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/kdgantt/KDGanttViewItem.cpp b/kdgantt/KDGanttViewItem.cpp index c250d22f6..eff5c26e8 100644 --- a/kdgantt/KDGanttViewItem.cpp +++ b/kdgantt/KDGanttViewItem.cpp @@ -27,8 +27,8 @@ ** licensing are not clear to you. ** ** As a special exception, permission is given to link this program - ** with any edition of Qt, and distribute the resulting executable, - ** without including the source code for Qt in the source distribution. + ** with any edition of TQt, and distribute the resulting executable, + ** without including the source code for TQt in the source distribution. ** **********************************************************************/ @@ -122,18 +122,18 @@ shown or not. In the other mode (set with setDisplaySubitemsAsGroup( true ); ), called "calendar mode", the item is displayed as follows: - If the item has no children, it is displayed as usual. - If the item is opened (i.e., its children are displayed), the + If the item has no tqchildren, it is displayed as usual. + If the item is opened (i.e., its tqchildren are displayed), the start/end time of this item is computed automatically according to - the earliest start time/latest end time of its children. The item - and its children are displayed as usual. - If the item is closed (i.e., its children are hidden in the left - list view), the item itself is hidden, and its children are displayed + the earliest start time/latest end time of its tqchildren. The item + and its tqchildren are displayed as usual. + If the item is closed (i.e., its tqchildren are hidden in the left + list view), the item itself is hidden, and its tqchildren are displayed on the timeline of this item instead. To control the painting of - overlapping children, call \a setPriority() for the childs. + overlapping tqchildren, call \a setPriority() for the childs. Blocking of user interaction to open item: - If you want to block users to open items used as parents of calendar items, + If you want to block users to open items used as tqparents of calendar items, call \a KDGanttView::setCalendarMode( true ); Example 1, Color: @@ -147,12 +147,12 @@ \a KDGanttView::setCalendarMode( true ); \a KDGanttView::setDisplaySubitemsAsGroup( true ); Insert root items in the Gantt view. - Insert items as children of these root item in the Gantt view. - You may use any item type as parent and child; there are no limitations. + Insert items as tqchildren of these root item in the Gantt view. + You may use any item type as tqparent and child; there are no limitations. It is, however, recommended to use KDGanttViewTaskItems - Actually, you may add child items to the children themselves. - Such a child behaves then like a parent. - Now set the start/end time of the children to specify a time + Actually, you may add child items to the tqchildren themselves. + Such a child behaves then like a tqparent. + Now set the start/end time of the tqchildren to specify a time interval for these items. */ @@ -182,16 +182,16 @@ KDGanttViewItem::KDGanttViewItem( Type type, KDGanttView* view, Constructs an empty Gantt item. \param type the type of the item to insert - \param parentItem a parent item under which this one goes + \param tqparentItem a tqparent item under which this one goes \param lvtext the text to show in the list view \param name the name by which the item can be identified. If no name is specified, a unique name will be generated */ -KDGanttViewItem::KDGanttViewItem( Type type, KDGanttViewItem* parentItem, +KDGanttViewItem::KDGanttViewItem( Type type, KDGanttViewItem* tqparentItem, const TQString& lvtext, const TQString& name ) : - TQListViewItem(parentItem,lvtext) + TQListViewItem(tqparentItem,lvtext) { initColorAndShapes(type); generateAndInsertName( name ); @@ -224,18 +224,18 @@ KDGanttViewItem::KDGanttViewItem( Type type, KDGanttView* view, Constructs an empty Gantt item. \param type the type of the item to insert - \param parentItem a parent item under which this one goes + \param tqparentItem a tqparent item under which this one goes \param after another item at the same level behind which this one should go \param lvtext the text to show in the list view \param name the name by which the item can be identified. If no name is specified, a unique name will be generated */ -KDGanttViewItem::KDGanttViewItem( Type type, KDGanttViewItem* parentItem, +KDGanttViewItem::KDGanttViewItem( Type type, KDGanttViewItem* tqparentItem, KDGanttViewItem* after, const TQString& lvtext, const TQString& name ) : - TQListViewItem( parentItem, after, lvtext ) + TQListViewItem( tqparentItem, after, lvtext ) { initColorAndShapes(type); generateAndInsertName( name ); @@ -268,8 +268,8 @@ KDGanttViewItem::~KDGanttViewItem() if ( listView() ) { if ( isOpen() ) setOpen( false ); - if ( parent() ) - parent()->takeItem( this ); + if ( tqparent() ) + tqparent()->takeItem( this ); else myGanttView->myListView->takeItem( this ); myGanttView->myTimeTable->updateMyContent(); @@ -292,10 +292,10 @@ void KDGanttViewItem::generateAndInsertName( const TQString& name ) sItemDict.remove( _name ); TQString newName; - if ( name.isEmpty() || sItemDict.find( name ) ) { + if ( name.isEmpty() || sItemDict.tqfind( name ) ) { // create unique name newName.sprintf( "%p", (void* )this ); - while( sItemDict.find( newName ) ) { + while( sItemDict.tqfind( newName ) ) { newName += "_0"; } } else { @@ -325,11 +325,11 @@ TQString KDGanttViewItem::name() const with that name exists */ -KDGanttViewItem* KDGanttViewItem::find( const TQString& name ) +KDGanttViewItem* KDGanttViewItem::tqfind( const TQString& name ) { - if (name.isEmpty()) // avoid error msg from QDict + if (name.isEmpty()) // avoid error msg from TQDict return 0; - return sItemDict.find( name ); + return sItemDict.tqfind( name ); } @@ -451,7 +451,7 @@ bool KDGanttViewItem::editable() const Useful to get a so called "calendar view" with many items in one row. When \a displaySubitemsAsGroup() is set to true, this item has a normal view, when it is expanded. If it is not expanded (and has at least one child), - the item itself is hidden, and all children are displayed instead. + the item itself is hidden, and all tqchildren are displayed instead. To manage the painting priority of the childs (if overlapping), you may set \a priority() of these items. @@ -463,9 +463,9 @@ void KDGanttViewItem::setDisplaySubitemsAsGroup( bool show ) if ( !show && _displaySubitemsAsGroup) isVisibleInGanttView = true; _displaySubitemsAsGroup = show; - if ( parent() ) - if ( parent()->isOpen() ) - parent()->setOpen( true ); + if ( tqparent() ) + if ( tqparent()->isOpen() ) + tqparent()->setOpen( true ); if ( isOpen() ) setOpen( true ); updateCanvasItems(); @@ -735,7 +735,7 @@ TQString KDGanttViewItem::whatsThisText() const /*! Specifies whether this item should be shown highlighted. The user can also highlight items with the mouse. - If the item displays its subitems (children) as a group + If the item displays its subitems (tqchildren) as a group (displaySubitemsAsGroup() == true), all changes apply to all subitems as well. @@ -916,10 +916,10 @@ void KDGanttViewItem::createShape( KDCanvasPolygonItem* &itemShape, // items which don't have any tqshapes return; } - item->setBrush(Qt::SolidPattern); + item->setBrush(TQt::SolidPattern); item->setZ(5); itemShape = (KDCanvasPolygonItem*) item; - itemBack->setBrush(Qt::SolidPattern); + itemBack->setBrush(TQt::SolidPattern); itemBack->setZ(3); itemShapeBack = (KDCanvasPolygonItem*) itemBack; @@ -999,7 +999,7 @@ void KDGanttViewItem::colors( TQColor& start, TQColor& middle, TQColor& end ) co KDGanttView::setHighlightColors() in order to get a uniform Gantt view. - If the item displays its subitems (children) as a group, + If the item displays its subitems (tqchildren) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well. @@ -1048,7 +1048,7 @@ void KDGanttViewItem::highlightColors( TQColor& start, TQColor& middle, TQColor& It is advisable not to use this method, but rather set the text color for all items with KDGanttView::setTextColor() in order to get a uniform Gantt view. - If the item displays its subitems (children) as a group, + If the item displays its subitems (tqchildren) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well. \param color the text color @@ -1140,7 +1140,7 @@ const TQPixmap* KDGanttViewItem::pixmap( int column ) const for all items of a type with KDGanttView::setDefaultColor() in order to get a uniform Gantt view. - If the item displays its subitems (children) as a group, + If the item displays its subitems (tqchildren) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well. @@ -1187,7 +1187,7 @@ TQColor KDGanttViewItem::defaultColor() const for all items of a type with KDGanttView::setDefaultHighlightColor() in order to get a uniform Gantt view. - If the item displays its subitems (children) as a group, + If the item displays its subitems (tqchildren) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well. @@ -1226,7 +1226,7 @@ TQColor KDGanttViewItem::defaultHighlightColor() const /*! Returns the first child of this item. - \return the first child of this item, 0 if this item has no children + \return the first child of this item, 0 if this item has no tqchildren */ KDGanttViewItem* KDGanttViewItem::firstChild() const { @@ -1248,14 +1248,14 @@ KDGanttViewItem* KDGanttViewItem::nextSibling() const /*! - Returns the parent item of this item + Returns the tqparent item of this item - \return the parent item of this item, 0 if this item is a top-level + \return the tqparent item of this item, 0 if this item is a top-level item */ -KDGanttViewItem* KDGanttViewItem::parent() const +KDGanttViewItem* KDGanttViewItem::tqparent() const { - return (KDGanttViewItem*)TQListViewItem::parent(); + return (KDGanttViewItem*)TQListViewItem::tqparent(); } @@ -1306,11 +1306,11 @@ void KDGanttViewItem::updateCanvasItems() if (blockUpdating) return; TQPen p,pBack; TQBrush b; - b.setStyle(Qt::SolidPattern); + b.setStyle(TQt::SolidPattern); if ( enabled() ) { textCanvas->setColor(myTextColor); if (isHighlighted) { - b.setStyle(Qt::SolidPattern); + b.setStyle(TQt::SolidPattern); b.setColor(myStartColorHL); startShape->setBrush(b); b.setColor(myMiddleColorHL); @@ -1323,7 +1323,7 @@ void KDGanttViewItem::updateCanvasItems() p.setColor(myEndColorHL); endLine->setPen(p); } else { - b.setStyle(Qt::SolidPattern); + b.setStyle(TQt::SolidPattern); b.setColor(myStartColor); // qDebug("update color %s %s", listViewText().latin1(),myStartColor.name().latin1() ); startShape->setBrush(b); @@ -1338,10 +1338,10 @@ void KDGanttViewItem::updateCanvasItems() endLine->setPen(p); } } else { - //TQColor discol = Qt::lightGray; + //TQColor discol = TQt::lightGray; TQColor discol = TQColor(232,232,232); textCanvas->setColor( TQColor(150,150,150) ); - b.setStyle(Qt::SolidPattern); + b.setStyle(TQt::SolidPattern); b.setColor(discol); startShape->setBrush(b); midShape->setBrush(b); @@ -1458,7 +1458,7 @@ void KDGanttViewItem::initColorAndShapes(Type t) startLineBack->setZ(1);endLineBack->setZ(1); actualEnd = new KDCanvasLine(myGanttView->myTimeTable,this,Type_is_KDGanttViewItem); actualEnd->setZ(5); - actualEnd->setPen( TQPen ( Qt::red, 3 ) ); + actualEnd->setPen( TQPen ( TQt::red, 3 ) ); textCanvas = new KDCanvasText(myGanttView->myTimeTable,this,Type_is_KDGanttViewItem); textCanvas->setText(""); @@ -1547,13 +1547,13 @@ KDGanttViewItem::Shape KDGanttViewItem::stringToShape( const TQString& string ) Creates a DOM node that describes this item. \param doc the DOM document to which the node belongs - \param parentElement the element into which to insert this node + \param tqparentElement the element into which to insert this node */ void KDGanttViewItem::createNode( TQDomDocument& doc, - TQDomElement& parentElement ) + TQDomElement& tqparentElement ) { TQDomElement itemElement = doc.createElement( "Item" ); - parentElement.appendChild( itemElement ); + tqparentElement.appendChild( itemElement ); itemElement.setAttribute( "Type", typeToString( type() ) ); KDGanttXML::createDateTimeNode( doc, itemElement, "StartTime", startTime() ); @@ -1674,22 +1674,22 @@ KDGanttViewItem* KDGanttViewItem::createFromDomElement( KDGanttView* view, Creates a KDGanttViewItem according to the specification in a DOM element. - \param parent the parent item under which the item will be inserted + \param tqparent the tqparent item under which the item will be inserted \param element the DOM element from which to read the specification \return the newly created element */ -KDGanttViewItem* KDGanttViewItem::createFromDomElement( KDGanttViewItem* parent, +KDGanttViewItem* KDGanttViewItem::createFromDomElement( KDGanttViewItem* tqparent, TQDomElement& element ) { TQString typeString = element.attribute( "Type" ); Q_ASSERT( !typeString.isEmpty() ); KDGanttViewItem* item; if( typeString == "Task" ) - item = new KDGanttViewTaskItem( parent ); + item = new KDGanttViewTaskItem( tqparent ); else if( typeString == "Summary" ) - item = new KDGanttViewSummaryItem( parent ); + item = new KDGanttViewSummaryItem( tqparent ); else if( typeString == "Event" ) - item = new KDGanttViewEventItem( parent ); + item = new KDGanttViewEventItem( tqparent ); else { qDebug( "Unknown item type in KDGanttViewItem::createFromDomElement()" ); return 0; @@ -1704,12 +1704,12 @@ KDGanttViewItem* KDGanttViewItem::createFromDomElement( KDGanttViewItem* parent, Creates a KDGanttViewItem according to the specification in a DOM element. - \param parent the parent item under which the item will be inserted + \param tqparent the tqparent item under which the item will be inserted \param previous to item behind this one should appear \param element the DOM element from which to read the specification \return the newly created element */ -KDGanttViewItem* KDGanttViewItem::createFromDomElement( KDGanttViewItem* parent, +KDGanttViewItem* KDGanttViewItem::createFromDomElement( KDGanttViewItem* tqparent, KDGanttViewItem* previous, TQDomElement& element ) { @@ -1717,11 +1717,11 @@ KDGanttViewItem* KDGanttViewItem::createFromDomElement( KDGanttViewItem* parent, Q_ASSERT( !typeString.isEmpty() ); KDGanttViewItem* item; if( typeString == "Task" ) - item = new KDGanttViewTaskItem( parent, previous ); + item = new KDGanttViewTaskItem( tqparent, previous ); else if( typeString == "Summary" ) - item = new KDGanttViewSummaryItem( parent, previous ); + item = new KDGanttViewSummaryItem( tqparent, previous ); else if( typeString == "Event" ) - item = new KDGanttViewEventItem( parent, previous ); + item = new KDGanttViewEventItem( tqparent, previous ); else { qDebug( "Unknown item type in KDGanttViewItem::createFromDomElement()" ); return 0; @@ -1944,9 +1944,9 @@ void KDGanttViewItem::showSubitemTree( int CoordY ) /*! - Returns the start time of the children of this item. + Returns the start time of the tqchildren of this item. - \return the start time of the children of this item + \return the start time of the tqchildren of this item */ TQDateTime KDGanttViewItem::myChildStartTime() { @@ -1978,9 +1978,9 @@ TQDateTime KDGanttViewItem::myChildStartTime() /*! - Returns the end time of the children of this item. + Returns the end time of the tqchildren of this item. - \return the end time of the children of this item + \return the end time of the tqchildren of this item */ TQDateTime KDGanttViewItem::myChildEndTime() { @@ -2030,7 +2030,7 @@ bool KDGanttViewItem::showNoInformation() The height of the line is the height of the item. The brush of the line is specified by KDGanttView::setNoInformationBrush(). (i.e. the same brush for all items of the Gantt view). - The default brush is TQBrush( TQColor ( 100,100,100 ), Qt::FDiagPattern ); + The default brush is TQBrush( TQColor ( 100,100,100 ), TQt::FDiagPattern ); \param show if true, the 'showNoInformation' line is shown for this item \sa showNoInformation(), KDGanttView::setNoInformationBrush(), KDGanttView::noInformationBrush() */ @@ -2044,7 +2044,7 @@ void KDGanttViewItem::setShowNoInformation( bool show ) /*! If the name of this item is \a name (i.e., listViewText() == name), the pointer to this item is returned. Otherwise, it looks for an - item with name \a name in the set of children and subchildren of + item with name \a name in the set of tqchildren and subtqchildren of this item. \param name the name of the item \return the pointer to the item with name \a name @@ -2228,7 +2228,7 @@ void KDGanttViewItem::paintBranches ( TQPainter* p, const TQColorGroup& cg, int x_c = w/2; int y_c = y+y_coord+ temp->height ()/2; int y_ce ; - if ( temp->itemBelow() && temp->itemBelow()->parent() == this ) + if ( temp->itemBelow() && temp->itemBelow()->tqparent() == this ) y_ce =y+y_coord+ temp->height (); else y_ce = y_c; @@ -2255,11 +2255,11 @@ void KDGanttViewItem::resetSubitemVisibility() if ( myGanttView->calendarMode() ) { // in calendarmode only items can be opened which have subitems which have subitems if ( ! temp ) { - if ( !parent() ) - // has no parent, has no child : show! + if ( !tqparent() ) + // has no tqparent, has no child : show! setVisible( true ); else - // has parent, has no child : hide! + // has tqparent, has no child : hide! setVisible( false ); return; } @@ -2524,8 +2524,8 @@ bool KDGanttViewItem::isMyTextCanvas(TQCanvasItem *tc) void KDGanttViewItem::setProgress(int percent) { - myProgress = QMAX(0, percent); - myProgress = QMIN(100, myProgress); + myProgress = TQMAX(0, percent); + myProgress = TQMIN(100, myProgress); } /*! |