2
$Id: KDGanttView.cpp 937849 2009-03-10 15:15:48Z winterz $
3
KDGantt - a multi-platform charting engine
6
/****************************************************************************
7
** Copyright (C) 2002-2004 Klarälvdalens Datakonsult AB. All rights reserved.
9
** This file is part of the KDGantt library.
11
** This file may be used under the terms of the GNU General Public
12
** License versions 2.0 or 3.0 as published by the Free Software
13
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
14
** included in the packaging of this file. Alternatively you may (at
15
** your option) use any later version of the GNU General Public
16
** License if such license has been publicly approved by
17
** Klarälvdalens Datakonsult AB (or its successors, if any).
19
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
20
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
21
** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
22
** not expressly granted herein.
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
** As a special exception, permission is given to link this program
28
** with any edition of Qt, and distribute the resulting executable,
29
** without including the source code for Qt in the source distribution.
31
**********************************************************************/
33
// we need the protected QHeader method
34
// QHeader::paintSection ( QPainter * p, int index, const QRect & fr )
35
// in order to print the header of the list view
36
// because we cannot reimplement QHeader to access this method we
37
// have to get access to the protected QHeader methods
39
#include "KDGanttView.h"
40
#include "KDGanttViewSubwidgets.h"
41
#include "KDGanttMinimizeSplitter.h"
42
#include "KDGanttViewItem.h"
43
#include "KDGanttViewTaskItem.h"
44
#include "KDGanttViewEventItem.h"
45
#include "KDGanttViewSummaryItem.h"
46
#include "KDGanttXMLTools.h"
47
#if QT_VERSION < 0x040000
48
#include "itemAttributeDialog.h"
54
#include <QApplication>
56
#include <QPrintDialog>
57
#include <QDragEnterEvent>
59
#include <QMessageBox>
61
#include <QTextStream>
66
#include "../evaldialog/evaldialog.h"
70
\class KDGanttView KDGanttView.h
71
This class represents a Gantt view with the Gantt chart, the header,
72
an optional listview and an optional legend.
74
In order to set up a Gantt view, create an object of this class, and
75
populate it with a number of \a KDGanttViewItem objects.
77
If you experience problems with the repainting of the content of the
78
Gantt View after scrolling, call \a setRepaintMode().
82
Constructs an empty KDGanttView.
84
\param parent the widget parent
85
\param name the internal debugging name
89
KDGanttView::KDGanttView( QWidget* parent, const char* name )
90
: KDGanttMinimizeSplitter( Qt::Vertical, parent ),
92
myTimeHeaderScroll(0),
93
mFixedHorizon( false )
95
setObjectName( name );
98
EvalDialog::checkEvalLicense( "KD Gantt" );
101
mUserHorizonChangeEnabled = true;
102
#if QT_VERSION < 0x040000
103
setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
105
mySplitter = new KDGanttMinimizeSplitter( this );
106
#if QT_VERSION < 0x040000
107
mySplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left );
109
leftWidget = new QVBox( mySplitter );
110
rightWidget = new QVBox( mySplitter );
111
//leftWidget->setMinimumSize( 20, 20 );
112
//rightWidget->setMinimumSize( 20, 20 );
113
myLegend = new KDLegendWidget( leftWidget, this );
114
spacerLeft = new QWidget( leftWidget );
115
spacerLeftLayout = new QHBoxLayout( spacerLeft );
116
spacerLeftLayout->setMargin( 0 );
117
spacerLeftLayout->setSpacing( 0 );
119
myListView = new KDListView(leftWidget, this);
120
myListView->setVScrollBarMode (QScrollView::AlwaysOff );
121
#if QT_VERSION < 0x040000
122
connect( myListView, SIGNAL( selectionChanged( QListViewItem* ) ),
123
this, SLOT( slotSelectionChanged( QListViewItem* ) ) );
124
connect( myListView, SIGNAL( mouseButtonClicked ( int, QListViewItem * , const QPoint &, int ) ),
125
this, SLOT( slotmouseButtonClicked ( int , QListViewItem * , const QPoint &, int ) ) );
126
connect( myListView, SIGNAL( contextMenuRequested ( QListViewItem * , const QPoint &, int ) ),
127
this, SLOT( slotcontextMenuRequested ( QListViewItem * , const QPoint & , int ) ) );
128
connect( myListView, SIGNAL(expanded ( QListViewItem * ) ),
129
this, SLOT(slotItemExpanded ( QListViewItem * ) ) );
130
connect( myListView, SIGNAL(collapsed ( QListViewItem * ) ),
131
this, SLOT(slotItemCollapsed( QListViewItem * ) ) );
132
connect( myListView, SIGNAL(currentChanged( QListViewItem * ) ),
133
this, SLOT(slotCurrentChanged ( QListViewItem * ) ) );
134
connect( myListView, SIGNAL(itemRenamed ( QListViewItem * , int , const QString & ) ),
135
this, SLOT(slotItemRenamed ( QListViewItem *, int , const QString & ) ) );
136
connect( myListView, SIGNAL(mouseButtonPressed( int, QListViewItem * , const QPoint &, int ) ),
137
this, SLOT(slotMouseButtonPressed ( int , QListViewItem * , const QPoint & , int ) ) );
139
connect( myListView, SIGNAL( selectionChanged( Q3ListViewItem* ) ),
140
this, SLOT( slotSelectionChanged( Q3ListViewItem* ) ) );
141
connect( myListView, SIGNAL( mouseButtonClicked ( int, Q3ListViewItem * , const QPoint &, int ) ),
142
this, SLOT( slotmouseButtonClicked ( int , Q3ListViewItem * , const QPoint &, int ) ) );
143
connect( myListView, SIGNAL( contextMenuRequested ( Q3ListViewItem * , const QPoint &, int ) ),
144
this, SLOT( slotcontextMenuRequested ( Q3ListViewItem * , const QPoint & , int ) ) );
145
connect( myListView, SIGNAL(expanded ( Q3ListViewItem * ) ),
146
this, SLOT(slotItemExpanded ( Q3ListViewItem * ) ) );
147
connect( myListView, SIGNAL(collapsed ( Q3ListViewItem * ) ),
148
this, SLOT(slotItemCollapsed( Q3ListViewItem * ) ) );
149
connect( myListView, SIGNAL(currentChanged( Q3ListViewItem * ) ),
150
this, SLOT(slotCurrentChanged ( Q3ListViewItem * ) ) );
151
connect( myListView, SIGNAL(itemRenamed ( Q3ListViewItem * , int , const QString & ) ),
152
this, SLOT(slotItemRenamed ( Q3ListViewItem *, int , const QString & ) ) );
153
connect( myListView, SIGNAL(mouseButtonPressed( int, Q3ListViewItem * , const QPoint &, int ) ),
154
this, SLOT(slotMouseButtonPressed ( int , Q3ListViewItem * , const QPoint & , int ) ) );
156
//connect( myListView, SIGNAL( ), this, SLOT( ) );
157
myTimeTable = new KDTimeTableWidget (0,this);
159
spacerRight = new QWidget( rightWidget );
161
myTimeHeaderContainer = new QHBox( rightWidget );
162
myTimeHeaderContainer->setFrameStyle( QFrame::NoFrame );
163
myTimeHeaderContainer->setMargin( 0 );
164
myTimeHeaderScroll = new QScrollView ( myTimeHeaderContainer );
165
myTimeHeaderScroll->setHScrollBarMode( QScrollView::AlwaysOff );
166
myTimeHeaderScroll->setVScrollBarMode( QScrollView::AlwaysOff );
167
timeHeaderSpacerWidget = new QWidget( myTimeHeaderContainer );
171
myTimeHeaderScroll = new QScrollView ( rightWidget );
172
myTimeHeaderScroll->setHScrollBarMode( QScrollView::AlwaysOff );
173
myTimeHeaderScroll->setVScrollBarMode( QScrollView::AlwaysOn );
175
//myTimeHeader = new KDTimeHeaderWidget (rightWidget,this);
176
myTimeHeader = new KDTimeHeaderWidget (myTimeHeaderScroll->viewport(),this);
177
myTimeHeaderScroll->addChild( myTimeHeader );
178
QPalette pal = myTimeHeader->palette();
179
myTimeHeaderScroll->viewport()->setPalette( pal );
180
timeHeaderSpacerWidget->setPalette( pal );
181
myCanvasView = new KDGanttCanvasView( this, myTimeTable, rightWidget);
182
myTimeHeaderScroll->setFrameStyle( QFrame::NoFrame );
184
myCanvasView->setFrameStyle( QFrame::NoFrame );
185
myCanvasView->setMargin( 0 );
187
myTimeHeaderScroll->setMargin( 0 );//myCanvasView->frameWidth() );
188
setFrameStyle(myListView->frameStyle());
190
myListView->setFrameStyle( QFrame::NoFrame );
191
myListView->setMargin( 0 );
192
#if QT_VERSION < 0x040000
193
QObject::connect(myListView, SIGNAL ( expanded ( QListViewItem * ) ) ,
194
myTimeTable , SLOT( expandItem(QListViewItem * ))) ;
195
QObject::connect(myListView, SIGNAL (collapsed ( QListViewItem * ) ) ,
196
myTimeTable , SLOT(collapseItem(QListViewItem * ))) ;
198
QObject::connect(myListView, SIGNAL ( expanded ( Q3ListViewItem * ) ) ,
199
myTimeTable , SLOT( expandItem(Q3ListViewItem * ))) ;
200
QObject::connect(myListView, SIGNAL (collapsed ( Q3ListViewItem * ) ) ,
201
myTimeTable , SLOT(collapseItem(Q3ListViewItem * ))) ;
203
timeHeaderSpacerWidget->setFixedWidth(myCanvasView->verticalScrollBar()->width() );
204
listViewIsVisible = true;
205
chartIsEditable = true;
206
editorIsEnabled = true;
207
_displaySubitemsAsGroup = false;
211
myTextColor = Qt::black;
212
//QObject::connect( this, SIGNAL (itemDoubleClicked( KDGanttViewItem* ) ) , this, SLOT( editItem( KDGanttViewItem* ))) ;
213
#if QT_VERSION < 0x040000
214
myItemAttributeDialog = 0;
216
setRepaintMode( KDGanttView::Medium );
217
setShowLegendButton( true );
218
setHeaderVisible( false );
220
// now connecting the widgets
221
connect(myCanvasView->horizontalScrollBar(), SIGNAL ( valueChanged ( int )) ,myTimeHeaderScroll->horizontalScrollBar(), SLOT( setValue ( int))) ;
222
connect(myCanvasView, SIGNAL ( heightResized( int )) ,myTimeTable, SLOT( checkHeight ( int))) ;
223
connect(myCanvasView, SIGNAL ( widthResized( int )) ,myTimeHeader, SLOT( checkWidth ( int))) ;
225
QObject::connect(myCanvasView->verticalScrollBar(), SIGNAL ( valueChanged ( int ) ) ,myListView->verticalScrollBar(), SLOT( setValue ( int ))) ;
226
connect(myTimeHeader, SIGNAL ( sizeChanged( int ) ) ,this, SLOT(slotHeaderSizeChanged() )) ;
227
connect(myTimeHeader, SIGNAL ( sizeChanged( int ) ) ,myTimeTable, SLOT(resetWidth( int ) )) ;
228
connect(myListView, SIGNAL ( contentsMoving ( int, int ) ) ,myCanvasView, SLOT( moveMyContent( int, int ))) ;
229
connect(myTimeTable, SIGNAL ( heightComputed ( int ) ) ,myCanvasView, SLOT( setMyContentsHeight( int ))) ;
230
// the next three are for adding new ticks at left/right
231
#if QT_VERSION < 0x040000
232
//connect( myCanvasView->horizontalScrollBar(), SIGNAL( prevLine () ) ,this, SLOT( addTickLeft()));
233
//connect( myCanvasView->horizontalScrollBar(), SIGNAL( nextLine () ) ,this, SLOT( addTickRight()));
235
connect( myCanvasView->horizontalScrollBar(), SIGNAL( actionTriggered ( int ) ) ,this, SLOT( hScrollBarAction( int )));
236
connect( myCanvasView->verticalScrollBar(), SIGNAL( actionTriggered ( int ) ) ,this, SLOT( vScrollBarAction( int )));
239
fCenterTimeLineAfterShow = false;
240
fDragEnabled = false;
241
fDropEnabled = false;
242
closingBlocked = false;
243
myTimeHeader->computeTicks();
244
centerTimelineAfterShow( QDateTime::currentDateTime () );
245
setDisplayEmptyTasksAsLine( false );
246
//QValueList<int> list;
249
//mySplitter->setSizes( list );
250
myTimeTable->setBlockUpdating();// block updating until this->show() is called
251
mAddTickcountForTimeline = 1;
252
myListView->setDefaultRenameAction( QListView::Reject );
255
KDGanttView::~KDGanttView()
257
// Don't call clearAll, it recreates widgets inside KDLegendWidget
258
QPtrList<KDGanttViewTaskLink> tll = taskLinks();
259
tll.setAutoDelete( true );
261
QPtrList<KDGanttViewTaskLinkGroup> tlg = myTaskLinkGroupList;
262
tlg.setAutoDelete( true );
266
// delete cut item, if there is any
267
myCanvasView->resetCutPaste( 0 );
271
This virtual method returns 0.
272
Reimplement this virtual method to create your own subclassed items
273
on a Drag&Drop operation or on save/load of data.
274
Please read KDGanttView::createNewItem() for details.
276
\param KDGanttViewItemTypeAsString the type of the new item as string.
277
Is not Task, Summary or Event but another name for subclassed items.
278
Usually the value is used what KDGanttViewItem::typeString() returns for that subclass.
279
\param parent item of the new item. May be 0. If 0 the new item becomes a root item in this KDGantt view.
280
\param previous the item behind the new one should appear. May be 0.
281
\param lvtext the text to show in the list view
282
\param name the name by which the item can be identified. If no name
283
is specified, a unique name will be generated
284
\return the newly created item
288
void KDGanttView::vScrollBarAction( int action )
290
//qDebug() << "vScrollBarAction " << action ;
291
switch ( mRepaintMode ) {
296
if ( action == 2 || action == 1 )
306
void KDGanttView::hScrollBarAction( int action )
308
//qDebug() << "hScrollBarAction " << action;
309
if ( action == 2 ) { // left
311
} else if ( action == 1 ) {
314
switch ( mRepaintMode ) {
319
if ( action == 2 || action == 1 )
329
KDGanttViewItem* KDGanttView::createUserDefinedItem( QString kdGanttViewItemTypeAsString,
330
KDGanttViewItem* parent,
331
KDGanttViewItem* after,
332
const QString& lvtext,
333
const QString& name )
335
Q_UNUSED( kdGanttViewItemTypeAsString )
340
qDebug() << "KDGanttView::createUserDefinedItem: Unknown type " << kdGanttViewItemTypeAsString;
344
Creates a KDGanttViewItem according to the specification in the parameters.
345
Calls KDGanttView::createUserDefinedItem() for a user defined item type.
346
Reimplement this virtual method in a subclass of KDGanttView to define specific behaviour when adding new
347
standard items and user defined (subclassed) items.
348
In general it is not needed to reimplement this virtual method and it is sufficient to reimplement
349
KDGanttView::createUserDefinedItem() only.
350
You can find details about subclassing and needed reimplementation of methods in the manual chapter
351
"Subclassing of KDGanttView and KDGanttViewItem" and there is a detailed real world
352
example program "timerTrackerApp" provided which demonstrates all reimplementations needed for
353
a proper implementation of subclassing.
354
We give here a short overview of the problems and solutions.
355
Well, there is in general no problem if you subclass KDGanttView.
356
But if you subclass a KDGanttViewItem
357
(to be more precise: A KDGanttViewTaskItem, KDGanttViewSummaryItem or KDGanttViewEventItem)
358
and you enable Drag&Drop (DnD) or you want to save/load configuration data via
359
KDGanttView::loadProject() or KDGanttView::saveProject() there is a problem:
360
When DnD is performed or load/save is called there are items created automatically in KDGantt and added
361
to KDGanttView. But if you drag a subclassed item you want to create an instance of that
362
subclass on a drop event, of course.
363
For that reason this method KDGanttView::createUserDefinedItem() is called every time a new item is created
364
internally in KDGantt.
365
Such that if you subclass a KDGanttViewItem you should subclass KDGanttView as well and reimplement
366
KDGanttView::createUserDefinedItem() and
367
KDGanttViewItem::typeString().
368
It is a good idea to reimplement
369
KDGanttViewItem::userWriteToElement() and
370
KDGanttViewItem::userReadFromElement()
371
as well to preserve item subclass specific properties during DnD or save/load.
372
If you want some specific behaviour on dropping standard types you have to reimplement this method
373
KDGanttView::createNewItem() as well.
375
\param KDGanttViewItemTypeAsString the type of the new item as string.
376
May be Task, Summary or Event for standard KDGanttViewItems. Should be another name for subclassed items.
377
Usually the value is used what KDGanttViewItem::typeString() returns for that subclass.
378
Calls createUserDefinedItem() if such a non standard type name is passed.
379
\param parent item of the new item. May be 0. If 0 the new item becomes a root item in this KDGantt view.
380
\param previous the item behind the new one should appear. May be 0.
381
\param lvtext the text to show in the list view
382
\param name the name by which the item can be identified. If no name
383
is specified, a unique name will be generated
384
\return the newly created item
385
\sa createUserDefinedItem()
387
KDGanttViewItem* KDGanttView::createNewItem( QString KDGanttViewItemTypeAsString,
388
KDGanttViewItem* parent,
389
KDGanttViewItem* after,
390
const QString& lvtext,
391
const QString& name )
393
KDGanttViewItem* retItem = 0;
394
KDGanttViewItem::Type type = KDGanttViewItem::stringToType( KDGanttViewItemTypeAsString );
396
case KDGanttViewItem::Event:
399
retItem = new KDGanttViewEventItem( parent, after, lvtext, name);
401
retItem = new KDGanttViewEventItem( parent, lvtext, name);
404
retItem = new KDGanttViewEventItem( this, after, lvtext, name);
406
retItem = new KDGanttViewEventItem( this, lvtext, name);
409
case KDGanttViewItem::Summary:
412
retItem = new KDGanttViewSummaryItem( parent, after, lvtext, name);
414
retItem = new KDGanttViewSummaryItem( parent, lvtext, name);
417
retItem = new KDGanttViewSummaryItem( this, after, lvtext, name);
419
retItem = new KDGanttViewSummaryItem( this, lvtext, name);
422
case KDGanttViewItem::Task:
425
retItem = new KDGanttViewTaskItem( parent, after, lvtext, name);
427
retItem = new KDGanttViewTaskItem( parent, lvtext, name);
430
retItem = new KDGanttViewTaskItem( this, after, lvtext, name);
432
retItem = new KDGanttViewTaskItem( this, lvtext, name);
435
case KDGanttViewItem::UnknownType:
436
retItem = createUserDefinedItem( KDGanttViewItemTypeAsString,parent,after,lvtext,name );
439
qDebug() << "Unknown type in KDGanttView::createNewItem()";
444
Sets the column col of the list view to the width w .
445
\param col column number of list view. col number 0 is the first column.
446
\param w the width of the column
449
void KDGanttView::setListViewColumnWidth ( int col, int w )
451
myListView->setColumnWidth ( col, w );
455
Returns a pointer to the header of the list view.
456
The header is not visible per default.
457
To show/hide the header you have to call setHeaderVisible()
458
in order to get the internal layout properly updated.
460
\return a pointer to the header of the list view.
461
\sa setHeaderVisible(), headerVisible()
463
QHeader * KDGanttView::listViewHeader () const
465
return myListView->header();
469
Sets all list view items with subitems which may be expanded recursively to expanded state.
470
It makes sure that the item which was currently visible
471
at the top of the list view before the operation is visible after the operation.
474
void KDGanttView::setAllOpen()
477
KDGanttViewItem* curItem = (KDGanttViewItem*) myListView->itemAt( QPoint ( myListView->width() - 10 , 5 ));
478
bool block = myTimeTable->blockUpdating();
479
myTimeTable->setBlockUpdating( true );
480
KDGanttViewItem* temp = firstChild();
482
temp->setAllSubitemsExpanded( true );
483
temp = temp->nextSibling();
485
myTimeTable->setBlockUpdating( block );
486
myTimeTable->updateMyContent();
487
if ( curItem && ! block ) {
488
myListView->ensureItemVisible( curItem );
493
Sets all list view items with subitems recursively to closed state.
494
It makes sure that the item which was currently visible
495
at the top of the list view before the operation is visible after the operation.
498
void KDGanttView::setAllClose()
500
KDGanttViewItem* curItem = (KDGanttViewItem*) myListView->itemAt( QPoint ( myListView->width() - 10 , 5 ));
501
bool block = myTimeTable->blockUpdating();
502
myTimeTable->setBlockUpdating( true );
503
KDGanttViewItem* temp = firstChild();
505
temp->setAllSubitemsExpanded( false );
506
temp = temp->nextSibling();
508
myTimeTable->setBlockUpdating( block );
509
myTimeTable->updateMyContent();
510
if ( curItem && !block ) {
511
myListView->ensureItemVisible( curItem );
517
Enables or disables updating of the content of the Gantt view.
518
To avoid flickering in the Gantt view while inserting large amounts
519
of Gantt items, you should call
521
bool upd = KDGanttView::getUpdateEnabled();
522
KDGanttView::settUpdateEnabled( false );
523
... insert items here ...
524
KDGanttView::settUpdateEnabled( upd );
526
With this code, you avoid unwanted side effects with other parts in
527
your code, where you disable (and re-enable) the update.
529
When calling setUpdateEnabled( true ),
530
all the content is recomputed, resized, and updated.
532
Before calling show() for the first time, updating is disabled.
533
When calling show(), updating is automatically enabled.
535
\param enable if true, the content of the Gantt view is updated after
536
every insertion of a new item.
537
\sa getUpdateEnabled()
539
void KDGanttView::setUpdateEnabled( bool enable )
541
myTimeTable->setBlockUpdating( !enable );
543
QTimer::singleShot( 0, this, SLOT ( updateGanttContent() ) );
544
//updateGanttContent();
547
void KDGanttView::updateGanttContent()
549
myTimeTable->updateMyContent();
550
myCanvasView->setMyContentsHeight( 0 );
554
Returns whether updating is enabled or not.
556
\return true, if updating is enabled
557
\sa setUpdateEnabled()
560
bool KDGanttView::getUpdateEnabled() const
562
return !myTimeTable->blockUpdating();
566
Sets the maximum width of the Gantt view part widget in pixels.
567
The largest allowed width is 32767.
568
Note that this does not set the maximum width of the Gantt view content,
569
it sets the maximum width of the Gantt view widget itself.
570
\param w the maximum width
573
void KDGanttView::setGanttMaximumWidth( int w )
575
myTimeHeader->setMaximumWidth ( w );
578
Returns the maximum width of the Gantt view part widget in pixels.
579
The default maximum width is 32767 pixels.
581
\return the maximum width of the Gantt view part widget in pixels.
584
int KDGanttView::ganttMaximumWidth() const
586
return myTimeHeader->maximumWidth();
590
Updates the content of the GanttView and shows it.
591
Automatically sets setUpdateEnabled( true ).
592
\sa setUpdateEnabled()
595
void KDGanttView::showEvent( QShowEvent * event )
597
if ( event->spontaneous() ) {
598
KDGanttMinimizeSplitter::showEvent( event );
602
myTimeTable->setBlockUpdating( false );
603
if (myCanvasView->horizontalScrollBar()->value() > 0 )
604
myCanvasView->horizontalScrollBar()->setValue(myCanvasView->horizontalScrollBar()->value()-1 );
606
myCanvasView->horizontalScrollBar()->setValue(1 );
607
myTimeTable->updateMyContent();
609
KDGanttMinimizeSplitter::showEvent( event );
611
myCanvasView->setMyContentsHeight( 0 );
612
if ( fCenterTimeLineAfterShow ) {
613
fCenterTimeLineAfterShow = false;
614
centerTimeline (dtCenterTimeLineAfterShow);
619
The closing is rejected, if a repainting is currently being done.
620
\param alsoDelete if true, the widget is deleted
621
\return true, if the widget was closed
624
void KDGanttView::closeEvent( QCloseEvent * event )
626
//qDebug() << "close ";
627
if ( closingBlocked ) {
631
KDGanttMinimizeSplitter::closeEvent( event );
636
Returns a useful size for the view.
638
sizeHint().width() of the list view + width of TimeTable
640
height() of TimeHeader + height() of TimeTable + height() of Legend (if shown)
643
QSize KDGanttView::sizeHint() const
645
bool block = myTimeTable->blockUpdating();
646
myTimeTable->setBlockUpdating( false );
647
myTimeTable->updateMyContent();
648
/* The below causes recursive calls to various size updating methods, which
649
* cause QCanvas to hide and show items like mad, which is very slow. If
650
* there is a legitimate gui updating issue here somewhere, it will need
651
* to be solved differently.
653
//qApp->processEvents();
654
int hintHeight = myTimeHeader->height();
655
int legendHeight = 0;
656
if ( showLegendButton() )
657
legendHeight = myLegend->height();
658
int listViewHeaderHeight = 0;
659
if ( headerVisible() )
660
listViewHeaderHeight = myListView->header()->height();
661
if ( hintHeight < legendHeight+listViewHeaderHeight )
662
hintHeight = legendHeight + listViewHeaderHeight;
663
hintHeight += myListView->horizontalScrollBar()->height();
664
if ( myLegend->isShown() )
665
hintHeight += myLegend->legendSizeHint().height() +10;
666
hintHeight += myTimeTable->minimumHeight()+myListView->frameWidth()*2+2;
667
int hintWid = myListView->sizeHint().width();
668
//hintWid += myTimeHeader->mySizeHint+myCanvasView->verticalScrollBar()->width();
669
hintWid += myCanvasView->sizeHint().width();
670
// add 10 for the splitter-bars
671
// qDebug() << "sizehint " << hintWid+10 << " " << hintHeight;
672
myTimeTable->setBlockUpdating( block );
673
return QSize( hintWid+10, hintHeight );
678
Specifies whether the legend button should be visible. By default,
681
\param show true to show the legend button, false to hide it
682
\sa showLegendButton()
684
void KDGanttView::setShowLegendButton( bool show )
686
_showLegendButton = show;
691
slotHeaderSizeChanged();
696
Returns whether the legend button is visible.
698
\return whether the legend button is visible
699
\sa setShowLegendButton()
701
bool KDGanttView::showLegendButton() const
703
return _showLegendButton;
708
Specifies whether the listview header should be visible. By default,
711
\param visible true to make the header visible, false to make it invisible
712
\sa listViewHeader ()
714
void KDGanttView::setHeaderVisible( bool visible )
717
myListView->header()->show();
719
myListView->header()->hide();
720
_showHeader = visible;
721
slotHeaderSizeChanged();
726
Returns whether the listview header is visible.
728
\return whether the header is visible
729
\sa listViewHeader ()
731
bool KDGanttView::headerVisible() const
738
Returns the corresponding date and time of the coordinate X in the
741
\param coordX the coordinate to search for
742
\param global true if coordX is a global position, false otherwise
743
\return the date and time at coordinate X in the Gantt view.
745
QDateTime KDGanttView::getDateTimeForCoordX(int coordX, bool global ) const
747
// default for myTimeHeader->getDateTimeForIndex() is local
748
return myTimeHeader->getDateTimeForIndex(coordX, !global );
753
Implements a casted pass-through of the selectionChanged() signal.
755
void KDGanttView::slotSelectionChanged( QListViewItem* item )
757
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
759
emit lvSelectionChanged( gItem );
764
Implements a casted pass-through of the mouseButtonClicked() signal.
765
Signals itemLeftClicked() , itemMidClicked() are emitted as well.
767
void KDGanttView::slotmouseButtonClicked ( int button, QListViewItem * item,
768
const QPoint & pos, int c )
770
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
771
emit lvMouseButtonClicked ( button , gItem, pos, c );
772
if (gItem == 0 && myCurrentItem != 0 ) {
774
emit lvCurrentChanged( gItem );
776
if (gItem != 0 && myCurrentItem == 0 ) {
777
myCurrentItem = gItem;
778
emit lvCurrentChanged( gItem );
781
// removed - makes no sense!
782
//emit mouseButtonClicked ( button , gItem, pos, c );
786
emit lvItemLeftClicked( gItem );
787
emit itemLeftClicked( gItem );
790
emit lvItemMidClicked( gItem );
791
emit itemMidClicked( gItem );
799
Implements a casted pass-through of the contextMenuRequested() signal.
800
The signal itemRightClicked() is emitted as well;
801
the position is the global position.
803
void KDGanttView::slotcontextMenuRequested ( QListViewItem * item, const QPoint & pos, int col )
805
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
806
emit lvContextMenuRequested ( gItem, pos, col );
807
emit lvItemRightClicked( gItem );
808
emit itemRightClicked( gItem );
812
Implements a casted pass-through of the collapsed() signal.
814
void KDGanttView::slotItemCollapsed ( QListViewItem * item )
817
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
818
emit itemCollapsed ( gItem );
824
Implements a casted pass-through of the expanded() signal.
826
void KDGanttView::slotItemExpanded ( QListViewItem * item )
829
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
830
emit itemExpanded( gItem );
837
void KDGanttView::emptySpaceDoubleClicked( QMouseEvent * e )
839
emit dateTimeDoubleClicked( getDateTimeForCoordX( e->x(), false ) );
844
Implements a casted pass-through of the currentChanged() signal.
846
void KDGanttView::slotCurrentChanged ( QListViewItem * item )
848
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
849
myCurrentItem = gItem;
850
emit lvCurrentChanged( gItem );
855
Implements a casted pass-through of the itemRenamed() signal.
857
void KDGanttView::slotItemRenamed ( QListViewItem * item , int col,
858
const QString & text )
860
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
861
emit lvItemRenamed( gItem, col, text );
866
Implements a casted pass-through of the mouseButtonPressed() signal.
868
void KDGanttView::slotMouseButtonPressed ( int button, QListViewItem * item,
869
const QPoint & pos, int c )
871
KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
872
emit lvMouseButtonPressed( button, gItem, pos, c );
877
Specifies whether the content should be repainted after scrolling or
880
\param mode If No, there is no repainting after scrolling. This is
882
If Medium, there is extra repainting after releasing the
883
scrollbar. This provides fast scrolling with updated content
884
after scrolling. Recommended, when repaint problems occur.
885
This is the default value after startup.
886
If Always, there is an extra update after every move of the
887
scrollbar. This entails slow scrolling with updated
890
void KDGanttView::setRepaintMode( RepaintMode mode )
893
QScrollBar *cvh, *cvv;
894
cvh = myCanvasView->horizontalScrollBar();
895
cvv = myCanvasView->verticalScrollBar();
898
cvh->disconnect( this );
899
cvv->disconnect( this );
901
#if QT_VERSION < 0x040000
902
connect( myCanvasView->horizontalScrollBar(), SIGNAL( prevLine () ) ,this, SLOT( addTickLeft()));
903
connect( myCanvasView->horizontalScrollBar(), SIGNAL( nextLine () ) ,this, SLOT( addTickRight()));
910
connect( cvv, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
911
connect( cvh, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
912
#if QT_VERSION < 0x040000
913
connect( cvv, SIGNAL (nextLine () ) ,this, SLOT(forceRepaint()));
914
connect( cvh, SIGNAL (nextLine () ) ,this, SLOT(forceRepaint()));
915
connect( cvv, SIGNAL (prevLine () ) ,this, SLOT(forceRepaint()));
916
connect( cvh, SIGNAL (prevLine () ) ,this, SLOT(forceRepaint()));
920
#if QT_VERSION < 0x040000
921
connect( cvv, SIGNAL (valueChanged ( int ) ) ,this, SLOT(forceRepaint( int )));
922
connect( cvh, SIGNAL (valueChanged ( int ) ) ,this, SLOT(forceRepaint( int )));
924
connect( cvv, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
925
connect( cvh, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
931
void KDGanttView::forceRepaint( int )
933
if ( myTimeTable->blockUpdating() )
935
// qDebug() << "forceRepaint( int ) ";
936
myTimeTable->setAllChanged();
937
myTimeTable->update();
941
void KDGanttView::slotHeaderSizeChanged()
943
int legendHeight = 0;
944
if ( showLegendButton() )
946
int listViewHeaderHeight = 0;
947
if ( headerVisible() )
948
listViewHeaderHeight = myListView->header()->height();
949
int timeHeaderHeight = myTimeHeader->height()+myTimeHeaderScroll->frameWidth()*2;;
950
int diffY = timeHeaderHeight-legendHeight-listViewHeaderHeight;
952
spacerLeft->setFixedHeight( 0 );
953
spacerRight->setFixedHeight(-diffY);
955
spacerRight->setFixedHeight( 0 );
956
spacerLeft->setFixedHeight( diffY );
958
myLegend->setFixedHeight( legendHeight );
959
myTimeHeaderContainer->setFixedHeight( timeHeaderHeight );
964
Specifies whether the legend should be shown as a dock window or not.
966
\param show if true, show legend as a dock window
967
\sa showLegend(), legendIsDockwindow(), legendDockwindow()
968
*/void KDGanttView::setLegendIsDockwindow( bool show )
970
bool isdock = myLegend->asDockwindow();
971
if ( show != isdock ) {
972
myLegend->setAsDockwindow(show);
973
// legend is cleared - reinit legend with list
975
for ( li = myLegendItems.first(); li; li = myLegendItems.next() ) {
977
myLegend->addLegendItem(li->shape, li->color, li->text,li->shape2, li->color2, li->text2 );
979
myLegend->addLegendItem(li->shape, li->color, li->text );
986
Returns whether the legend is shown as a dock window
988
\return true if the legend is shown as a dock window
989
\sa setShowLegend(), setLegendIsDockwindow(), legendDockwindow()
990
*/bool KDGanttView::legendIsDockwindow() const
992
return myLegend->asDockwindow();
997
Returns the pointer to the legend dock window.
998
DO NOT DELETE THIS POINTER!
999
If the legend is not a dock window, 0 is returned
1000
To set the legend as a dock window, call
1001
KDGanttView::setLegendIsDockwindow( true );
1003
\return the pointer to the legend dock window
1004
0 is returned, if the legend is no dock window
1005
DO NOT DELETE THIS POINTER!
1006
\sa setShowLegend(), setLegendIsDockwindow(),legendIsDockwindow()
1008
QDockWindow* KDGanttView::legendDockwindow() const
1010
return myLegend->dockwindow();
1015
Specifies whether the legend should be shown or not. Besides setting
1016
this programmatically, the user can also show/hide the legend by
1017
using the button provided for this purpose.
1019
\param show force legend to be shown
1022
void KDGanttView::setShowLegend( bool show )
1024
myLegend->showMe(show);
1029
Returns whether the legend is currently shown. The visibility of the
1030
legend can be changed both by \a setShowLegend(), and interactively
1033
\return true if the legend is currently visible
1036
bool KDGanttView::showLegend() const
1038
return myLegend->isShown();
1043
Specifies whether the listview of the Gantt view should be shown or
1046
\param show pass true in order to show the listview and false in
1050
void KDGanttView::setShowListView( bool show )
1052
if(listViewIsVisible == show) return;
1053
listViewIsVisible = show;
1054
if (listViewIsVisible)
1055
myListView->parentWidget()->show();
1057
myListView->parentWidget()->hide();
1062
Returns whether the listview of the Gantt view is shown or not.
1064
\return true if the listview is shown
1065
\sa setShowListView()
1067
bool KDGanttView::showListView() const
1069
return listViewIsVisible;
1074
Specifies whether it should be possible to edit the appearance of a
1075
Gantt item visually in a dialog by double-clicking the item.
1077
\param enable pass true in order to enable the visual editor and
1078
false in order to turn it off
1082
void KDGanttView::setEditorEnabled( bool enable )
1084
editorIsEnabled = enable;
1089
Returns whether it is possible to edit the appearance of a Gantt
1090
item visually in a dialog by double-clicking the item.
1092
\return true if visual editing is enabled, false otherwise
1093
\sa setEditorEnabled()
1096
bool KDGanttView::editorEnabled() const
1098
return editorIsEnabled;
1103
Specifies whether the Gantt chart is user-editable.
1105
\param editable pass true in order to get a user-editable Gantt
1106
chart, pass false in order to get a read-only chart
1110
void KDGanttView::setEditable( bool editable )
1112
chartIsEditable = editable;
1117
Returns whether the Gantt chart is user-editable
1119
\return true if the Gantt chart is user-editable
1123
bool KDGanttView::editable() const
1125
return chartIsEditable;
1130
Saves the state of the Gantt view in an IO device in XML format. The saved
1131
data can be reloaded with \a loadProject().
1133
\param device a pointer to the IO device in which to store the Gantt
1135
\return true if the data could be written, false if an error
1140
bool KDGanttView::saveProject( QIODevice* device )
1144
QDomDocument doc = saveXML();
1145
if( device->isOpen() )
1147
if( device->open( IO_WriteOnly ) ) {
1148
QTextStream ts( device );
1149
ts << doc.toString();
1157
Loads a previously saved state of the Gantt view. All current
1158
settings and items are discarded before loading the data.
1160
\param device a pointer to the IO device from which to load the
1162
\return true if the file could be read, false if an error
1167
bool KDGanttView::loadProject( QIODevice* device )
1171
if( device->isOpen() )
1173
if( device->open( IO_ReadOnly ) ) {
1174
QDomDocument doc( "GanttView" );
1176
int errline, errcol;
1177
if ( !doc.setContent( device, &err, &errline, &errcol ) ) {
1178
qDebug() << "KDGantt::Error parsing XML data at line " << errline << ". Message is: ";
1185
return loadXML( doc );
1190
// slot, can be connected to menu action
1191
// Note: This should possibly have a setup dialog so the user can print
1192
// something other than the default
1193
void KDGanttView::print()
1199
Sends a Gantt view to a printer. The printer should already be set
1200
up for printing (by calling QPrintDialog).
1201
If the printer is not set up, QPrintDialog is called before printing
1203
You can specify, whether the ListView, TimeLine, or Legend will be
1204
printed. All combinations of these three widgets are allowed.
1206
\param printer a pointer to the printer to print on. If printer is
1207
0, the method creates a temporary printer and discards it when it is
1209
\param printListView if true, the list view is printed
1210
\param printTimeLine if true, the time line is printed
1211
\param printLegend if true, the legend is printed
1216
void KDGanttView::print( QPrinter* printer ,
1217
bool printListView, bool printTimeLine,
1220
bool deletePrinter = false;
1222
printer = new QPrinter();
1223
deletePrinter = true;
1224
QPrintDialog dialog(printer);
1225
if ( !dialog.exec() ) {
1230
// now we have a printer to print on
1231
QPainter p( printer );
1232
// get the paper metrics
1234
// get the size of the desired output for scaling.
1235
// here we want to print all: ListView, TimeLine, and Legend
1236
// for this purpose, we call drawContents() with a 0 pointer as painter
1237
QSize size = drawContents( 0, printListView, printTimeLine, printLegend );
1239
// at the top, we want to print current time/date
1240
QString date = "Printing Time: " + QDateTime::currentDateTime().toString();
1241
int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height();
1242
p.drawText( 0, 0, date );
1244
// compute the scale
1245
#if QT_VERSION >= 0x040000
1246
dx = (float) printer->width() / (float)size.width();
1247
dy = (float)(printer->height() - ( 2 * hei )) / (float)size.height();
1249
QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer );
1250
dx = (float) m.width() / (float)size.width();
1251
dy = (float)(m.height() - ( 2 * hei )) / (float)size.height();
1254
// scale to fit the width or height of the paper
1260
p.scale( scale, scale );
1261
// now printing with y offset: 2 hei
1262
p.translate( 0, 2*hei );
1263
drawContents( &p, printListView, printTimeLine, printLegend );
1264
// the drawContents() has the side effect, that the painter translation is
1265
// after drawContents() set to the bottom of the painted stuff
1267
// p.drawText(0, 0, "printend");
1268
// would be painted directly below the paintout of drawContents()
1270
if ( deletePrinter )
1276
Paints a Gantt view on a QPainter.
1277
You can specify, whether the list view, the time line, or the legend
1279
All combinations of these three widgets are allowed.
1280
Returns the size of the painted area.
1281
Paints the list view in the top-left corner, the time line to the
1282
right of the list view, and the legend below the list view.
1283
If called with \a p = 0, nothing is painted and only
1284
the size of the painted area is computed.
1285
This is useful for determining only the painted area and setting
1286
the scale of the painter, before calling this method with a painter.
1287
In order to get the output fitted to your paper and your printer,
1289
QSize size = drawContents( 0, printListView, printTimeLine, printLegend );
1290
//then compute the scale
1291
dx = paper.width() / size.width();
1292
dy = paper.height() / size.height();
1293
//then make float scale to fit the width or height of the paper
1298
// then set the scale
1299
p.scale( scale, scale );
1300
// and now call drawContents with painter p
1301
drawContents( &p, printListView, printTimeLine, printLegend );
1303
For a detailed example, please see the commented source code in
1304
KDGanttView::print(...)
1306
\param p a pointer to the painter to paint on. If p is
1307
0, nothing is painted and only the size of the painted area is computed
1308
\param drawListView if true, the list view is painted
1309
\param drawTimeLine if true, the time line is painted
1310
\param drawLegend if true, the legend is painted
1311
\return the size of the painted area
1314
QSize KDGanttView::drawContents( QPainter* p,
1315
bool drawListView , bool drawTimeLine, bool drawLegend )
1318
int lvX, lvY, thX, thY, tlX, tlY, lwX, lwY, allX, allY;
1319
lvX = myListView->contentsWidth();
1320
lvY = myTimeTable->minimumHeight() + 2;
1321
thX = myTimeHeader->width();
1322
thY = myTimeHeader->height();
1323
tlX = myCanvasView->canvas()->width();
1325
lwX = myLegend->legendSize().width();
1326
lwY = myLegend->legendSize().height();
1329
if ( drawListView ) {
1333
if ( drawTimeLine ) {
1342
size = QSize( allX, allY );
1345
if ( drawListView ) {
1348
p->translate( 0, temp );
1349
if ( headerVisible() ) {
1350
p->translate( 0, -myListView->header()->height());
1351
int cou = myListView->header()->count();
1353
QRect rect ( 0,0,0, myListView->header()->height());
1354
for ( iii = 0; iii < cou; ++iii ) {
1355
rect.setLeft ( myListView->header()->sectionPos( iii ) );
1356
rect.setRight ( myListView->header()->sectionPos( iii ) + myListView->header()->sectionSize (iii));
1357
myListView->header()->paintSection ( p, myListView->header()->mapToIndex (iii), rect );
1359
p->translate( 0, myListView->header()->height());
1361
myListView->drawToPainter( p );
1362
p->translate( lvX, -temp);
1364
if ( drawTimeLine ) {
1365
p->translate( myCanvasView->frameWidth(), 0);
1366
myTimeHeader->repaintMe( 0, myTimeHeader->width(), p );
1367
p->translate( -myCanvasView->frameWidth(), thY);
1368
myCanvasView->drawToPainter( p );
1370
p->translate( -lvX, tlY);
1372
p->translate( 0, tlY);
1375
p->translate( -lvX, 0 );
1378
myLegend->drawToPainter( p );
1379
p->translate( 0, lwY );
1386
Zooms into the Gantt chart. Values less than 1 mean zooming in,
1387
values greater than 1 mean zooming out. A zooming factor of exactly
1388
1.0 means original size.
1390
\param factor the zoom factor
1391
\param absolute if true, factor is interpreted absolutely, if false,
1392
factor is interpreted relatively to the current zoom factor
1394
\sa zoomToSelection()
1398
void KDGanttView::setZoomFactor( double factor, bool absolute )
1400
myTimeHeader->zoom(factor,absolute);
1405
Returns the current zoom factor.
1407
\return the current zoom factor
1408
\sa zoomToFit(), zoomToSelection(), setZoomFactor()
1411
double KDGanttView::zoomFactor() const
1413
return myTimeHeader->zoomFactor();
1418
Zooms such that the Gantt chart is less than the available space of the widget.
1422
\sa zoomToSelection()
1425
void KDGanttView::zoomToFit()
1427
myTimeHeader->zoomToFit();
1432
Zooms so that at least the selected time period is visible after the zoom.
1434
\param start the start datetime of the selected period
1435
\param end the end datetime of the selected period
1437
\sa zoomToSelectionAndSetStartEnd()
1443
void KDGanttView::zoomToSelection( const QDateTime& start, const QDateTime& end )
1446
myTimeHeader->zoomToSelection( start, end);
1450
Sets the horizon start and end to the selected time period.
1451
Zooms so that at least the selected time period is visible after the zoom.
1453
\param start the start datetime of the selected period
1454
\param end the end datetime of the selected period
1456
\sa zoomToSelection()
1462
void KDGanttView::zoomToSelectionAndSetStartEnd( const QDateTime& start, const QDateTime& end )
1465
myTimeHeader->setHorizonStart(start);
1466
myTimeHeader->setHorizonEnd(start);
1467
myTimeHeader->zoomToSelection( start, end);
1469
myTimeHeader->zoomToSelectionAndSetStartEnd( start, end);
1474
Makes sure that the specified Gantt item is visible without
1477
\sa center(), centerTimelineAfterShow()
1479
void KDGanttView::ensureVisible( KDGanttViewItem* item )
1481
if ( item == 0 ) return;
1482
myListView->ensureItemVisible (item);
1487
Makes sure that the specified QDateTime is in the center of the
1488
visible Gantt chart (if possible).
1489
If you want to center the timeline when the KDGanttView is hidden,
1490
calling centerTimelineAfterShow() is the better alternative.
1491
There are three possibilities what does happen with the timeline
1492
if you call this method:
1493
If the specified QDateTime is within the datetime range of
1494
horizonStart() and horizonEnd() then the specified QDateTime is made visible
1495
on the timeline and the specified QDateTime is centered, if possible.
1496
(It is not possible to center it if the specified QDateTime is too near to the
1497
horizonStart() or horizonEnd(), of course.)
1498
If userHorizonChangeEnabled() is enabled and the specified QDateTime
1499
is not within the datetime range of horizonStart() and horizonEnd()
1500
then horizonStart() and horizonEnd() are moved such that
1501
the specified QDateTime is in the center of the new horizonStart() and horizonEnd()
1502
and the timeline is displayed centered on the specified QDateTime.
1504
\sa center(), centerTimelineAfterShow() userHorizonChangeEnabled()
1506
void KDGanttView::centerTimeline( const QDateTime& center )
1508
myTimeHeader->centerDateTime( center, mUserHorizonChangeEnabled );
1513
Makes sure that the specified QDateTime is in the center of the
1514
visible Gantt chart (if possible). If the KDGanttView is currently
1515
hidden, this method resets the center once again after the next
1516
show() call. Use this method if you want to center the timeline when
1517
the KDGanttView is hidden. After calling KDGanttView::show(), there
1518
may be computations of the sizes of the widgets and subwidgets and
1519
of the automatically computed start datetime. This method ensures
1520
that the center of the timeline is to be properly reset after
1523
\sa center(), centerTimeline()
1525
void KDGanttView::centerTimelineAfterShow( const QDateTime& center )
1527
myTimeHeader->centerDateTime( center );
1528
if ( isVisible() ) return;
1529
dtCenterTimeLineAfterShow = center;
1530
fCenterTimeLineAfterShow = true;
1534
Sets the timeline to the horizon start.
1537
void KDGanttView::setTimelineToStart()
1539
myCanvasView->horizontalScrollBar()->setValue( 0 );
1544
Sets the timeline to the horizon end.
1546
void KDGanttView::setTimelineToEnd()
1548
myCanvasView->horizontalScrollBar()->setValue(myCanvasView->horizontalScrollBar()->maximum());
1553
Add \a num minor ticks of the current scale of the timeline
1554
to the start of the timeline.
1555
The timeline is not set automatically at the start.
1556
Call \a setTimelineToStart() to ensure that the timeline is at the start
1557
after calling this method.
1559
\param num the number of minor ticks which should be added
1560
\sa addTicksRight(),setTimelineToStart(), setTimelineToEnd()
1562
void KDGanttView::addTicksLeft( int num )
1564
myTimeHeader->addTickLeft( num );
1569
Add \a num minor ticks of the current scale of the timeline
1570
to the end of the timeline.
1571
The timeline is not set automatically at the end.
1572
Call \a setTimelineToEnd() to ensure that the timeline is at the end
1573
after calling this method.
1574
\param num the number of minor ticks which should be added
1575
\sa addTicksLeft(),setTimelineToStart(), setTimelineToEnd()
1577
void KDGanttView::addTicksRight( int num )
1579
myTimeHeader->addTickRight( num );
1584
Makes sure that the specified Gantt item is in the center of the
1585
visible Gantt chart (if possible).
1587
void KDGanttView::center( KDGanttViewItem* item )
1589
ensureVisible(item);
1590
int x = myListView->contentsWidth()/2;
1591
int y = myListView->itemPos (item );
1592
myListView->center(x,y);
1597
Specifies whether task links should be shown.
1599
\param show true for showing task links, false for not showing them
1600
\sa showTaskLinks(), KDGanttViewTaskLink
1602
void KDGanttView::setShowTaskLinks( bool show )
1604
myTimeTable->setShowTaskLinks(show);
1610
Returns whether task links should be shown.
1612
\return true if task links are shown, false otherwise
1613
\sa setShowTaskLinks(), KDGanttViewTaskLink
1615
bool KDGanttView::showTaskLinks() const
1617
return myTimeTable->showTaskLinks();
1622
Sets the font in the left list view widget and
1623
in the right time header widget.
1624
The settings of the fonts in the time table widget are not effected.
1626
\param font the new font of the widget
1628
void KDGanttView::setFont(const QFont& font)
1630
myListView->setFont(font);
1631
myListView->repaint();
1632
myTimeHeader->setFont(font);
1633
myLegend->setFont( font );
1634
QWidget::setFont( font );
1636
QTimer::singleShot( 0, this, SLOT( slotHeaderSizeChanged() ) );
1641
Specifies whether the configure popup menu should be shown on
1642
right click on the time header widget.
1643
This menu lets the user quickly change
1645
the scale mode (minute, hour, day, week, month, auto) ,
1650
The default setting is not to show the popup menu.
1651
This functionality must be enabled explicitly by the application
1653
You can disable each submenu of the popmenu.
1655
\param show true in order to show the popup menu, false in order not
1656
to. The default is true.
1657
\param showZoom show the zoom submenu, default: true
1658
\param showScale show the scale submenu, default: true
1659
\param showTime show the time format submenu, default: true
1660
\param showYear show the year format submenu, default: true
1661
\param showGrid show the grid submenu, default: true
1662
\param showPrint show the print submenu, default: false
1664
void KDGanttView::setShowHeaderPopupMenu( bool show,
1672
if ( show && myTimeHeader->showPopupMenu() ) return;
1673
myTimeHeader->setShowPopupMenu( show,showZoom,showScale,showTime,
1674
showYear,showGrid,showPrint );
1679
Returns whether the configure popup menu should be shown on right
1680
click on the time header widget.
1682
\return true if the popup menu should be shown
1684
bool KDGanttView::showHeaderPopupMenu() const
1686
return myTimeHeader->showPopupMenu();
1688
//****************************************************
1692
Specifies whether the add item popup menu should be shown on
1693
right click on the time table widget.
1694
This menu lets the user quickly add new items to the Gantt view
1695
(as root, as child or after an item).
1696
It also offers cutting and pasting of items.
1698
The default setting is that the popup menu is not shown.
1699
It must be enabled by the program.
1701
\param show true in order to show popup menu, false in order not to
1704
void KDGanttView::setShowTimeTablePopupMenu( bool show )
1706
myCanvasView->setShowPopupMenu( show );
1711
Returns whether the add item popup menu should be shown on right
1712
click on the time table widget.
1714
\return true if the popup menu should be shown
1716
bool KDGanttView::showTimeTablePopupMenu() const
1718
return myCanvasView->showPopupMenu();
1723
Sets the shapes for a certain type of Gantt item. Not all items use
1724
all three shapes (e.g., only summary items use the middle shape).
1726
This setting overrides any shape settings made on individual items.
1727
These settings will be taken as initial values of any newly created
1728
item of this certain type.
1729
See also the documentation of the KDGanttViewItem class.
1731
\param type the type of Gantt items for which to set the shapes
1732
\param start the shape to use for the beginning of the item
1733
\param middle the shape to use for the middle of the item
1734
\param end the shape to use for the end of the item
1735
\param overwriteExisting if true, overwrites existing shape settings
1736
in the individual items
1739
void KDGanttView::setShapes( KDGanttViewItem::Type type,
1740
KDGanttViewItem::Shape start,
1741
KDGanttViewItem::Shape middle,
1742
KDGanttViewItem::Shape end,
1743
bool overwriteExisting )
1745
if ( overwriteExisting ) {
1746
QListViewItemIterator it(myListView);
1747
for ( ; it.current(); ++it ) {
1748
if ( ((KDGanttViewItem*)it.current())->type() == type)
1749
((KDGanttViewItem*)it.current())->setShapes(start,middle, end );
1752
int index = getIndex( type );
1758
myDefaultShape [index*3] = start;
1759
myDefaultShape [index*3+1] = middle;
1760
myDefaultShape [index*3+2] = end;
1761
undefinedShape[index] = false;
1766
Queries the shapes for a particular type of Gantt item.
1768
\param type the type of Gantt items for which to query the shapes
1769
\param start the start shape is returned in this parameter
1770
\param middle the middle shape is returned in this parameter
1771
\param end the end shape is returned in this parameter
1772
\return true if there was a general shape set for the specified
1773
type. If the return value is false, the values of the three shape
1774
parameters are undefined.
1777
bool KDGanttView::shapes( KDGanttViewItem::Type type,
1778
KDGanttViewItem::Shape& start,
1779
KDGanttViewItem::Shape& middle,
1780
KDGanttViewItem::Shape& end ) const
1782
int index = getIndex( type );
1788
start = myDefaultShape [index*3];
1789
middle = myDefaultShape [index*3+1];
1790
end = myDefaultShape [index*3+2];
1791
return !undefinedShape[index];
1796
Sets the colors for a certain type of Gantt item. Not all items use
1797
all three colors (e.g., only summary items use the middle color).
1799
This setting overrides any color settings made on individual items.
1800
These settings will be taken as initial values of any newly created
1801
item of this certain type.
1802
See also the description of the KDGanttViewItem class.
1804
\param type the type of Gantt items for which to set the colors
1805
\param start the color to use for the beginning of the item
1806
\param middle the color to use for the middle of the item
1807
\param end the color to use for the end of the item
1808
\param overwriteExisting if true, overwrites existing color settings
1810
\sa colors(), setDefaultColors(), defaultColors()
1812
void KDGanttView::setColors( KDGanttViewItem::Type type,
1813
const QColor& start, const QColor& middle,
1815
bool overwriteExisting )
1817
if ( overwriteExisting ) {
1818
QListViewItemIterator it(myListView);
1819
for ( ; it.current(); ++it ) {
1820
if ( ((KDGanttViewItem*)it.current())->type() == type)
1821
((KDGanttViewItem*)it.current())->setColors(start,middle, end );
1824
int index = getIndex( type );
1825
if (index < 0) return;
1826
myColor [index*3] = start;
1827
myColor [index*3+1] = middle;
1828
myColor [index*3+2] = end;
1829
undefinedColor[index] = false;
1834
Queries the colors for a particular type of Gantt item.
1836
\param type the type of Gantt items for which to query the colors
1837
\param start the start color is returned in this parameter
1838
\param middle the middle color is returned in this parameter
1839
\param end the end color is returned in this parameter
1840
\return true if there was a general color set for the specified
1841
type. If the return value is false, the values of the three color
1842
parameters are undefined.
1843
\sa setColors(), setDefaultColor(), defaultColor()
1845
bool KDGanttView::colors( KDGanttViewItem::Type type,
1846
QColor& start, QColor& middle, QColor& end ) const
1848
int index = getIndex( type );
1849
if (index < 0) return false;
1850
start = myColor [index*3];
1851
middle = myColor [index*3+1];
1852
end = myColor [index*3+2];
1853
return !undefinedColor[index];
1858
Sets the highlight colors for a certain type of Gantt item. Not
1859
all items use all three highlight colors (e.g., only summary items
1860
use the middle highlight color).
1862
This setting overrides any highlight color settings made on
1864
These settings will be taken as initial values of any newly created
1865
item of this certain type.
1866
See also the description of the KDGanttViewItem class.
1868
\param type the type of Gantt items for which to set the highlight colors
1869
\param start the highlight color to use for the beginning of the item
1870
\param middle the highlight color to use for the middle of the item
1871
\param end the highlight color to use for the end of the item
1872
\param overwriteExisting if true, overwrites existing color settings
1873
in the individual items
1874
\sa highlightColors(), setDefaultHighlightColor(), defaultHighlightColor()
1876
void KDGanttView::setHighlightColors( KDGanttViewItem::Type type,
1877
const QColor& start,
1878
const QColor& middle,
1880
bool overwriteExisting )
1882
if ( overwriteExisting ) {
1883
QListViewItemIterator it(myListView);
1884
for ( ; it.current(); ++it ) {
1885
if ( ((KDGanttViewItem*)it.current())->type() == type)
1886
((KDGanttViewItem*)it.current())->setHighlightColors(start,middle, end );
1889
int index = getIndex( type );
1890
if (index < 0) return;
1892
myColorHL [index*3] = start;
1893
myColorHL [index*3+1] = middle;
1894
myColorHL [index*3+2] = end;
1895
undefinedColorHL[index] = false;
1901
Queries the highlight colors for a particular type of Gantt item.
1903
\param type the type of Gantt items for which to query the highlight
1905
\param start the start highlight color is returned in this parameter
1906
\param middle the middle highlight color is returned in this parameter
1907
\param end the end highlight color is returned in this parameter
1908
\return true if there was a general highlight color set for the specified
1909
type. If the return value is false, the values of the three highlight color
1910
parameters are undefined.
1911
\sa setHighlightColors(), setDefaultHighlightColor(),
1912
defaultHighlightColor()
1914
bool KDGanttView::highlightColors( KDGanttViewItem::Type type,
1915
QColor& start, QColor& middle,
1918
int index = getIndex( type );
1919
if (index < 0) return false;
1921
start = myColorHL [index*3];
1922
middle = myColorHL [index*3+1];
1923
end = myColorHL [index*3+2];
1924
return !undefinedColorHL[index];
1929
Sets the color used for texts in the Gantt chart.
1930
Overrides all individual settings of the Gantt items.
1932
\param color the text color to use
1935
void KDGanttView::setTextColor( const QColor& color )
1937
QListViewItemIterator it(myListView);
1938
for ( ; it.current(); ++it ) {
1939
((KDGanttViewItem*)it.current())->setTextColor(color);
1941
myTextColor = color;
1946
Returns the color used for texts in the Gantt chart.
1948
\return the color used for texts in the Gantt chart.
1951
QColor KDGanttView::textColor() const
1958
Specifies the brush in which the 'showNoInformation' line of items
1961
\param brush the brush of the 'showNoInformation' lines
1962
\sa KDGanttViewItem::showNoInformation(),
1963
KDGanttViewItem::setShowNoInformation(),
1964
KDGanttView::noInformationBrush()
1967
void KDGanttView::setNoInformationBrush( const QBrush& brush )
1969
myTimeTable->setNoInformationBrush( brush );
1974
Returns the brush of the 'showNoInformation' lines
1975
\return the brush of the 'showNoInformation' lines
1976
\sa KDGanttViewItem::showNoInformation(), KDGanttViewItem::setShowNoInformation(),
1977
setNoInformationBrush()
1979
QBrush KDGanttView::noInformationBrush() const
1981
return myTimeTable->noInformationBrush();
1986
Removes all items from the legend.
1990
void KDGanttView::clearLegend( )
1992
setShowLegend( false );
1993
myLegend->clearLegend();
1994
myLegendItems.setAutoDelete( true );
1995
myLegendItems.clear();
2000
Adds an item to the legend.
2002
\param shape the shape to display
2003
\param shapeColor the color in which to display the shape
2004
\param text the text to display
2007
void KDGanttView::addLegendItem( KDGanttViewItem::Shape shape,
2008
const QColor& shapeColor,
2009
const QString& text )
2011
myLegend->addLegendItem( shape,shapeColor,text );
2012
legendItem* item = new legendItem;
2013
item->shape = shape;
2014
item->color = shapeColor;
2017
myLegendItems.append( item );
2021
Adds an item to the legend with two shapes and text right of the shapes.
2022
The text may be empty.
2024
\param shape the first shape to display
2025
\param shapeColor the color in which to display the first shape
2026
\param text the text to display right of the first shape. may be empty.
2027
\param shape2 the second shape to display
2028
\param shapeColor2 the color in which to display the second shape
2029
\param text2 the text to display right of the second shape. may be empty.
2032
void KDGanttView::addLegendItem( KDGanttViewItem::Shape shape,
2033
const QColor& shapeColor,
2034
const QString& text,
2035
KDGanttViewItem::Shape shape2,
2036
const QColor& shapeColor2,
2037
const QString& text2 )
2039
myLegend->addLegendItem( shape,shapeColor,text,shape2,shapeColor2,text2 );
2040
legendItem* item = new legendItem;
2041
item->shape = shape;
2042
item->color = shapeColor;
2045
item->shape2 = shape2;
2046
item->color2 = shapeColor2;
2047
item->text2 = text2;
2049
myLegendItems.append( item );
2055
Sets the start of the horizon of the Gantt chart. If \a start is
2056
null, the horizon start is computed automatically.
2058
\param start the start of the horizon
2061
void KDGanttView::setHorizonStart( const QDateTime& start )
2063
myTimeHeader->setHorizonStart(start);
2068
Returns the start of the horizon of the Gantt chart.
2070
\return the start of the horizon of the Gantt chart
2071
\sa setHorizonStart()
2073
QDateTime KDGanttView::horizonStart() const
2075
return myTimeHeader->horizonStart();
2080
Sets the end of the horizon of the Gantt chart. If \a end is
2081
null, the horizon end is computed automatically.
2083
\param end the end of the horizon
2086
void KDGanttView::setHorizonEnd( const QDateTime& end )
2088
myTimeHeader->setHorizonEnd(end);
2093
Returns the end of the horizon of the Gantt chart.
2095
\return the end of the horizon of the Gantt chart
2099
QDateTime KDGanttView::horizonEnd() const
2101
return myTimeHeader->horizonEnd();
2105
Configures the unit of the lower scale of the header. The higher
2106
unit is computed automatically. Does not update the header.
2107
Usually used to avoid flicker if immediately another header changing operation follows.
2109
\param unit the unit of the lower scale of the header.
2110
\sa scale() setScale()
2112
void KDGanttView::setScaleSilent( Scale unit )
2114
myTimeHeader->setScale( unit, false );
2118
Configures the unit of the lower scale of the header. The higher
2119
unit is computed automatically.
2121
\param unit the unit of the lower scale of the header.
2122
\sa scale() setScaleSilent()
2124
void KDGanttView::setScale( Scale unit )
2126
myTimeHeader->setScale( unit );
2131
Returns the unit of the lower scale of the header.
2133
\return the unit of the lower scale of the header.
2136
KDGanttView::Scale KDGanttView::scale() const
2138
return myTimeHeader->scale();
2143
Sets the maximum allowed time scale of the lower scale of the header.
2145
\param unit the unit of the lower scale of the header.
2148
void KDGanttView::setMaximumScale( Scale unit )
2150
myTimeHeader->setMaximumScale( unit );
2155
Returns the maximum allowed time scale of the lower scale of the header.
2157
\return the unit of the lower scale of the header.
2160
KDGanttView::Scale KDGanttView::maximumScale() const
2162
return myTimeHeader->maximumScale();
2167
Sets the minimum allowed time scale of the lower scale of the header.
2169
\param unit the unit of the lower scale of the header.
2172
void KDGanttView::setMinimumScale( Scale unit )
2174
myTimeHeader->setMinimumScale( unit );
2179
Returns the minimum allowed time scale of the lower scale of the header.
2181
\return the unit of the lower scale of the header.
2184
KDGanttView::Scale KDGanttView::minimumScale() const
2186
return myTimeHeader->minimumScale();
2191
Sets the absolute number of minor ticks, if scaling is set to Auto.
2192
If the scale mode is set to Auto, then the actual scale and
2193
the minorScaleCount is automatically computed, such that there are
2196
\param count the number of minor ticks
2197
\sa autoScaleMinorTickCount(),setScale(),scale()
2199
void KDGanttView::setAutoScaleMinorTickCount( int count )
2201
myTimeHeader->setAutoScaleMinorTickCount( count );
2206
Returns the absolut number of minor ticks, if scaling is set to Auto
2208
\return the absolut number of minor ticks
2209
\sa setAutoScaleMinorTickCount(),setScale(),scale()
2211
int KDGanttView::autoScaleMinorTickCount() const
2213
return myTimeHeader->autoScaleMinorTickCount();
2218
Sets the minimum width that a column needs to have. If the size of the
2219
Gantt chart and the scale would make it necessary to go below this
2220
limit otherwise, the chart will automatically be made less exact.
2222
\param width the minimum column width
2223
\sa minimumColumnWidth()
2225
void KDGanttView::setMinimumColumnWidth( int width )
2227
myTimeHeader->setMinimumColumnWidth( width );
2232
Returns the minimum width a column needs to have.
2234
\return the column minimum width
2235
\sa setMinimumColumnWidth()
2237
int KDGanttView::minimumColumnWidth() const
2239
return myTimeHeader->minimumColumnWidth();
2244
Specifies the format in which to display years. If no years are
2245
shown, this method has no effect.
2247
\param format the year format
2248
\sa yearFormat(), setHourFormat(), hourFormat()
2250
void KDGanttView::setYearFormat( YearFormat format )
2252
myTimeHeader->setYearFormat(format );
2257
Returns the format in which to display years.
2259
\return the year format
2260
\sa setYearFormat(), setHourFormat(), hourFormat()
2262
KDGanttView::YearFormat KDGanttView::yearFormat() const
2264
return myTimeHeader->yearFormat();
2269
Specifies the format in which to display hours. If no hours are
2270
shown, this method has no effect.
2272
\param format the hour format
2273
\sa hourFormat(), setYearFormat(), yearFormat()
2276
void KDGanttView::setHourFormat( HourFormat format )
2278
myTimeHeader->setHourFormat( format );
2283
Returns the format in which to display hours.
2285
\return the hour format
2286
\sa setHourFormat(), setYearFormat(), yearFormat()
2289
KDGanttView::HourFormat KDGanttView::hourFormat() const
2291
return myTimeHeader->hourFormat();
2296
Hides/shows the grid for the major ticks of the time header in the gantt view.
2298
\param show Which grid to show. Possible values are ShowMajorTicks,
2299
ShowMinorTicks and ShowNoTicks.
2302
void KDGanttView::setShowTicks( ShowTicksType show )
2304
myTimeHeader->setShowTicks(show );
2309
Returns which type of grid is shown.
2311
\return type of grid: ShowMajorTicks, ShowMinorTicks or ShowNoTicks
2314
KDGanttView::ShowTicksType KDGanttView::showTicks() const
2316
return myTimeHeader->showTicks();
2322
Sets the background color for the column closest to \a column.
2323
It can be specified whether the color should be shown in all scales or
2324
only in specific scales.
2325
If you want to define the color only for the daily view, specify
2326
mini and maxi as Day.
2327
If there is no value specified for mini and maxi, the color for the column
2328
is shown on all scales. Note that it is possible that there are two
2329
values for a column in a scale. In this case, the shown color is unspecified.
2331
\param column the column to set the background color for
2332
\param color the background color
2333
\param mini show the colour only in scales greater than this
2334
\param maxi show the colour only in scales lesser than this
2335
\sa columnBackgroundColor(), setWeekendBackgroundColor(),
2336
weekendBackgroundColor()
2338
void KDGanttView::setColumnBackgroundColor( const QDateTime& column,
2339
const QColor& color ,
2340
Scale mini, Scale maxi )
2342
myTimeHeader->setColumnBackgroundColor( column, color,mini,maxi );
2347
Sets the background color for a time interval given by \a start and
2348
\a end. \a start may be later than \a end. If there is already a
2349
background interval with the same \a start and \a end values
2350
defined, the values (i.e. const QColor& color , Scale mini, Scale
2351
maxi) of this background interval are changed. Change the times of
2352
an already defined interval with \a changeBackgroundInterval().
2353
Delete an already defined interval with \a
2354
deleteBackgroundInterval().
2356
It can be defined, whether the color should be shown in all scales or
2357
only in specific scales.
2358
If you want to define the color only for the daily view, scecify
2359
mini and maxi as Day.
2360
If there is no value for mini/maxi specified, the color for the columns
2361
is shown in all scales.
2363
\param start start datetime of the time interval
2364
\param end end datetime of the time interval
2365
\param priority paint priority. May be 0 to 10.
2366
An interval with higher priority is painted over other intervals.
2367
\param color the background color
2368
\param mini show the color only in scales greater than this
2369
\param maxi show the color only in scales lesser than this
2370
\sa changeBackgroundInterval(), deleteBackgroundInterval(),
2371
columnBackgroundColor(), setWeekendBackgroundColor(),
2372
weekendBackgroundColor()
2374
void KDGanttView::setIntervalBackgroundColor( const QDateTime& start,
2375
const QDateTime& end,
2376
const QColor& color ,
2378
Scale mini, Scale maxi )
2380
myTimeHeader->setIntervalBackgroundColor( start, end, color, priority, mini,maxi );
2385
Changes the times of an already defined background color interval.
2386
The new values \a startnew and \a endnew should not be datetime
2387
values of an already defined background color interval.
2388
If that is the case, nothing is changed and false is returned.
2390
\param oldstart the start date and time of the interval to change
2391
\param oldend the end date and time of the interval to change
2392
\param newstart the new start date and time
2393
\param newend the new end date and time
2394
\return true, if there is a backgroundcolor interval with values
2395
\a start and \a end found and the new values \a startnew and \a endnew
2396
are not datetime values of an already defined background color interval.
2397
Returns false otherwise.
2398
\sa changeBackgroundInterval(), deleteBackgroundInterval(),
2399
columnBackgroundColor(), setWeekendBackgroundColor(),
2400
weekendBackgroundColor()
2402
bool KDGanttView::changeBackgroundInterval( const QDateTime& oldstart,
2403
const QDateTime& oldend,
2404
const QDateTime& newstart,
2405
const QDateTime& newend )
2407
return myTimeHeader->changeBackgroundInterval( oldstart, oldend,
2412
Deletes an already defined background color interval.
2414
\param start start datetime of time interval
2415
\param end end datetime of time interval
2416
\return true, if there is a backgroundcolor interval with values
2417
\a start and \a end found (and hence deleted).
2418
\sa changeBackgroundInterval(), columnBackgroundColor()
2420
bool KDGanttView::deleteBackgroundInterval( const QDateTime& start,
2421
const QDateTime& end)
2423
return myTimeHeader->deleteBackgroundInterval( start, end );
2428
Adds a filled rectangle for a time interval given by \a start and
2429
\a end, across all tasks. \a start may be later than \a end.
2430
\sa KDIntervalColorRectangle
2432
void KDGanttView::addIntervalBackgroundColor( KDIntervalColorRectangle* newItem )
2434
myTimeHeader->addIntervalBackgroundColor( newItem );
2438
Removes all background color settings set with setColumnBackgroundColor()
2439
and setIntervalBackgroundColor().
2440
Does not affect the settings of setWeekendBackgroundColor().
2442
\sa setColumnBackgroundColor(), setWeekendBackgroundColor(),
2443
weekendBackgroundColor(), setIntervalBackgroundColor()
2445
void KDGanttView::clearBackgroundColor()
2447
myTimeHeader->clearBackgroundColor();
2452
Returns the background color for the column closest to \a column.
2454
\param column the column to query the background color for
2455
\return the background color of the specified color
2456
\sa setColumnBackgroundColor(), setWeekendBackgroundColor(),
2457
weekendBackgroundColor()
2459
QColor KDGanttView::columnBackgroundColor( const QDateTime& column ) const
2461
return myTimeHeader->columnBackgroundColor( column ) ;
2466
Specifies the background color for weekend days. If no individual
2467
days are visible on the Gantt chart, this method has no visible
2470
\param color the background color to use for weekend days.
2471
\sa weekendBackgroundColor(), setWeekendDays(), weekendDays()
2473
void KDGanttView::setWeekendBackgroundColor( const QColor& color )
2475
myTimeHeader->setWeekendBackgroundColor( color );
2480
Returns the background color for weekend days.
2482
\return the background color for weekend days
2483
\sa setWeekendBackgroundColor(), setWeekendDays(), weekendDays()
2485
QColor KDGanttView::weekendBackgroundColor() const
2487
return myTimeHeader->weekendBackgroundColor();
2492
Specifies the background color for weekday days. If no individual
2493
days are visible on the Gantt chart, this method has no visible
2494
effect. The days are specified as an intervals of integer values
2495
where 1 means Monday and 7 means Sunday.
2497
\param color the background color to use for weekend days.
2498
\param weekday the day of the week (Monday = 1, Sunday = 7)
2499
\sa weekendBackgroundColor(), setWeekendDays(), weekendDays()
2501
void KDGanttView::setWeekdayBackgroundColor( const QColor& color, int weekday )
2503
myTimeHeader->setWeekdayBackgroundColor( color, weekday );
2508
Returns the background color for weekday days.
2510
\param weekday the day of the week (Monday = 1, Sunday = 7)
2511
\return the background color for weekend days
2512
\sa setWeekendBackgroundColor(), setWeekendDays(), weekendDays()
2514
QColor KDGanttView::weekdayBackgroundColor(int weekday) const
2516
return myTimeHeader->weekdayBackgroundColor( weekday);
2522
Defines which days are considered weekends. The days are specified
2523
as an interval of integer values where 1 means Monday and 7 means
2524
Sunday. In order to define a weekend from Sunday to Monday, specify
2527
\param start the first day of the weekend
2528
\param end the last day of the weekend
2529
\sa weekendDays(), setWeekendBackgroundColor(), weekendBackgroundColor()
2531
void KDGanttView::setWeekendDays( int start, int end )
2533
myTimeHeader->setWeekendDays( start, end );
2538
Returns which days are considered weekends.
2540
\param start in this parameter, the first day of the weekend is returned
2541
\param end in this parameter, the end day of the weekend is returned
2542
\sa setWeekendDays(), setWeekendBackgroundColor(), weekendBackgroundColor()
2544
void KDGanttView::weekendDays( int& start, int& end ) const
2546
myTimeHeader->weekendDays( start, end );
2551
\fn void KDGanttView::itemLeftClicked( KDGanttViewItem* )
2553
This signal is emitted when the user clicks on an item with the left
2559
\fn void KDGanttView::itemMidClicked( KDGanttViewItem* )
2561
This signal is emitted when the user clicks on an item with the middle
2567
\fn void KDGanttView::itemRightClicked( KDGanttViewItem* )
2569
This signal is emitted when the user clicks on an item with the right
2575
\fn void KDGanttView::itemDoubleClicked( KDGanttViewItem* )
2577
This signal is emitted when the user double-clicks an item.
2582
\fn void KDGanttView::itemConfigured( KDGanttViewItem* )
2584
This signal is emitted when the user has configured an item
2585
visually. This signal is emitted on every mouse move when the user
2586
is changing an item.
2587
That means this signal is emitted every time when the user is about
2588
to configure an item.
2592
\fn void KDGanttView::itemChanged( KDGanttViewItem* )
2594
This signal is emitted after the mouse key is released
2595
when the user has configured an item visually.
2596
That means this signal is emitted after the user has finished
2597
the configured of an item.
2598
/sa itemConfigured()
2604
\fn void KDGanttView::taskLinkLeftClicked( KDGanttViewTaskLink* )
2606
This signal is emitted when the user clicks on a task link with the
2612
\fn void KDGanttView::taskLinkMidClicked( KDGanttViewTaskLink* )
2614
This signal is emitted when the user clicks on a task link with the
2615
middle mouse button.
2620
\fn void KDGanttView::taskLinkRightClicked( KDGanttViewTaskLink* )
2622
This signal is emitted when the user clicks on a task link with the
2628
\fn void KDGanttView::taskLinkDoubleClicked( KDGanttViewTaskLink* )
2630
This signal is emitted when the user double-clicks a task link.
2635
\enum KDGanttView::YearFormat
2637
This enum is used to specify the year format used in the header.
2642
\enum KDGanttView::HourFormat
2644
This enum is used to specify the hour format used in the header.
2649
\enum KDGanttView::Scale
2651
This enum is used to specify the units of the scales in the header.
2658
Sets the number of ticks in the major scale.
2660
\param count the number of ticks in the major scale
2661
\sa majorScaleCount(), setMinorScaleCount(), minorScaleCount()
2663
void KDGanttView::setMajorScaleCount( int count )
2665
myTimeHeader->setMajorScaleCount(count );
2670
Returns the number of ticks per unit in the major scale.
2672
\return the number of ticks in the major scale
2673
\sa setMajorScaleCount(), setMinorScaleCount(), minorScaleCount()
2675
int KDGanttView::majorScaleCount() const
2677
return myTimeHeader->majorScaleCount();
2682
Sets the number of ticks in the minor scale.
2684
\param count the number of ticks in the minor scale
2685
\sa minorScaleCount, setMajorScaleCount, majorScaleCount()
2687
void KDGanttView::setMinorScaleCount( int count )
2689
myTimeHeader->setMinorScaleCount(count );
2694
Returns the number of ticks per unit in the minor scale.
2696
\return the number of ticks in the minor scale
2697
\sa setMinorScaleCount(), setMajorScaleCount(), majorScaleCount()
2699
int KDGanttView::minorScaleCount() const
2701
return myTimeHeader->minorScaleCount();
2707
Sets the default color for a particular type of Gantt item that is
2708
used for the item if no specific start, middle, or end colors are
2711
\param type the type of Gantt items for which to query the highlight
2713
\param color the default color to use
2714
\param overwriteExisting if true, existing settings for individual
2715
items are overwritten
2716
\sa defaultColor(), setColors(), colors()
2718
void KDGanttView::setDefaultColor( KDGanttViewItem::Type type,
2719
const QColor& color,
2720
bool overwriteExisting )
2722
if ( overwriteExisting ) {
2723
QListViewItemIterator it(myListView);
2724
for ( ; it.current(); ++it ) {
2725
if ( ((KDGanttViewItem*)it.current())->type() == type)
2726
((KDGanttViewItem*)it.current())->setDefaultColor(color );
2729
int index = getIndex( type );
2730
myDefaultColor [index] = color;
2736
Returns the default color for a particular type of Gantt item that
2737
is used for the item if no specific start, middle, or end colors are
2740
\param type the type of Gantt items for which to query the highlight
2742
\return color the default color used
2743
\sa setDefaultColor(), setColors(), colors()
2745
QColor KDGanttView::defaultColor( KDGanttViewItem::Type type ) const
2747
int index = getIndex( type );
2748
return myDefaultColor [index];
2753
Sets the default highlighting color for a particular type of
2754
Gantt item that is used for the item if no specific start, middle,
2755
or end colors are set.
2757
\param type the type of Gantt items for which to query the highlight
2759
\param color the default highlighting color to use
2760
\param overwriteExisting if true, existing color settings in
2761
individual items are overwritten
2762
\sa defaultHighlightColor(), setHighlightColors(), highlightColors()
2764
void KDGanttView::setDefaultHighlightColor( KDGanttViewItem::Type type,
2765
const QColor& color,
2766
bool overwriteExisting )
2768
if ( overwriteExisting ) {
2769
QListViewItemIterator it(myListView);
2770
for ( ; it.current(); ++it ) {
2771
if ( ((KDGanttViewItem*)it.current())->type() == type)
2772
((KDGanttViewItem*)it.current())->setDefaultHighlightColor(color );
2775
int index = getIndex( type );
2776
myDefaultColorHL [index] = color;
2782
Returns the default highlighting color for a particular type of
2783
Gantt item that is used for the item if no specific start, middle,
2784
or end colors are set.
2786
\param type the type of Gantt items for which to query the highlight
2788
\return color the default highlighting color used
2789
\sa setDefaultHighlightColor(), setHighlightColors(), highlightColors()
2791
QColor KDGanttView::defaultHighlightColor( KDGanttViewItem::Type type ) const
2793
int index = getIndex( type );
2794
return myDefaultColorHL [index];
2799
Returns the first item in the Gantt view.
2801
\return the first item in the Gantt view, 0 if there are no items
2803
KDGanttViewItem* KDGanttView::firstChild() const
2805
return (KDGanttViewItem*)myListView->firstChild();
2809
This method turns calendar mode on and off. In calendar mode, only
2810
those items can be opened which have subitems which have
2811
subitems. I.e., if an item contains multiple calendars, it can be
2812
opened, but not a calendar item itself. If you want to use this
2813
GanttView as a calendar view, you have to call
2814
setDisplaySubitemsAsGroup( true ); to use the root items as calendar
2815
items. To create new calendar entries for these root items, create
2816
a new KDGanttViewTaskItem with this root item as a parent. If you
2817
want an item with subitems to behave like a calendar (which is
2818
possibly empty at startup), please call setIsCalendar( true ); for
2821
\param mode if true, the calendar view mode is turned on
2822
if false, the calendar view mode is turned off
2823
\sa setDisplaySubitemsAsGroup(), displaySubitemsAsGroup(), calendarMode()
2825
void KDGanttView::setCalendarMode( bool mode )
2827
myListView->setCalendarMode( mode );
2832
Returns true, if the Gantt view is in calendar mode. See
2833
setCalendarMode() for the meaning of calendar mode.
2835
\return returns true, if the Gantt view is in calendermode
2836
\sa setCalendarMode()
2838
bool KDGanttView::calendarMode() const
2840
return myListView->calendarMode();
2846
This method specifies whether hidden subitems should be displayed.
2847
It iterates over all KDGanttViewItems in this Gantt view
2848
and sets their displaySubitemsAsGroup() property.
2849
All newly created items will have this setting by default.
2850
\param show if true, the hidden subitems are displayed in all items of
2852
\sa KDGanttViewItem::setDisplaySubitemsAsGroup(), KDGanttViewItem::displaySubitemsAsGroup()
2854
void KDGanttView::setDisplaySubitemsAsGroup( bool show )
2856
QListViewItemIterator it( myListView );
2857
for ( ; it.current(); ++it ) {
2858
KDGanttViewItem* currentItem = ( KDGanttViewItem* )it.current();
2859
currentItem->setDisplaySubitemsAsGroup( show );
2861
_displaySubitemsAsGroup = show;
2866
Returns, whether new items are created with the
2867
displayHiddenSubitems property.
2868
\return true, if hidden subitems should be displayed on newly created items.
2869
\sa setDisplaySubitemsAsGroup(),
2870
KDGanttViewItem::setDisplaySubitemsAsGroup(),
2871
KDGanttViewItem::displaySubitemsAsGroup()
2873
bool KDGanttView::displaySubitemsAsGroup() const
2875
return _displaySubitemsAsGroup;
2880
This method specifies whether tasks where the start time and the end
2881
time are the same are displayed
2882
as a line over the full height of the Gantt view.
2883
\param show if true, tasks with starttime == endtime are displayed
2886
void KDGanttView::setDisplayEmptyTasksAsLine( bool show )
2888
_displayEmptyTasksAsLine = show;
2893
Returns, whether tasks where the start time and the end time are the
2895
as a line over the full height of the Gantt view.
2896
\return true, if empty tasks are displayed as line.
2898
bool KDGanttView::displayEmptyTasksAsLine() const
2900
return _displayEmptyTasksAsLine;
2905
Defines the horizontal background lines of the Gantt chart.
2906
Call setHorBackgroundLines()
2907
(equivalent to setHorBackgroundLines( 2, QBrush( QColor ( 240,240,240 )) ) )
2908
to draw a light grey horizontal background line for every second Gantt item.
2909
Call setHorBackgroundLines(0) in order to not show horizontal
2911
You may specify the number of lines and the brush of the lines.
2913
\param count for count >= 2, every count line gets a backgroud
2915
for count < 2, no background lines are drawn
2916
\param brush the brush of the lines
2918
void KDGanttView::setHorBackgroundLines( int count, QBrush brush )
2920
myTimeTable->setHorBackgroundLines( count, brush );
2925
Returns the definition of the horizontal background lines of the
2928
\param brush the brush of the lines
2929
\return every nth line gets a background specified by brush
2930
if 0 is returned, no backgroud lines are drawn
2933
int KDGanttView::horBackgroundLines( QBrush& brush ) const
2935
return myTimeTable->horBackgroundLines( brush );
2940
Returns the last item in the Gantt view
2942
\return the last item in the Gantt view, 0 if there are no items
2944
KDGanttViewItem* KDGanttView::lastItem() const
2946
return (KDGanttViewItem*)myListView->lastItem ();
2951
Returns the list of task links in the Gantt view.
2953
\return the list of task links in the Gantt view
2955
QPtrList<KDGanttViewTaskLink> KDGanttView::taskLinks() const
2957
QPtrList<KDGanttViewTaskLink> retVal = myTimeTable->taskLinks();
2963
Returns the list of task link groups in the Gantt view.
2965
\return the list of task link groups in the Gantt view
2967
QPtrList<KDGanttViewTaskLinkGroup> KDGanttView::taskLinkGroups() const
2969
return myTaskLinkGroupList;
2974
Reads the parameters of the view from an XML document.
2975
\param doc the XML document to read from
2976
\return true if the parameters could be read, false if a file
2977
format error occurred
2980
bool KDGanttView::loadXML( const QDomDocument& doc )
2982
bool block = getUpdateEnabled();
2983
setUpdateEnabled( false );
2984
QDomElement docRoot = doc.documentElement(); // ChartParams element
2985
QDomNode node = docRoot.firstChild();
2986
while( !node.isNull() ) {
2987
QDomElement element = node.toElement();
2988
if( !element.isNull() ) { // was really an element
2989
QString tagName = element.tagName();
2990
if( tagName == "ShowLegend" ) {
2992
if( KDGanttXML::readBoolNode( element, value ) )
2993
setShowLegend( value );
2994
} else if( tagName == "ShowLegendButton" ) {
2996
if( KDGanttXML::readBoolNode( element, value ) )
2997
setShowLegendButton( value );
2998
} else if( tagName == "LegendIsDockWindow" ) {
3000
if( KDGanttXML::readBoolNode( element, value ) )
3001
setLegendIsDockwindow( value );
3002
} else if( tagName == "ShowListView" ) {
3004
if( KDGanttXML::readBoolNode( element, value ) )
3005
setShowListView( value );
3006
} else if( tagName == "ShowHeader" ) {
3008
if( KDGanttXML::readBoolNode( element, value ) )
3009
setHeaderVisible( value );
3010
} else if( tagName == "ShowTaskLinks" ) {
3012
if( KDGanttXML::readBoolNode( element, value ) )
3013
setShowTaskLinks( value );
3014
} else if( tagName == "EditorEnabled" ) {
3016
if( KDGanttXML::readBoolNode( element, value ) )
3017
setEditorEnabled( value );
3018
} else if( tagName == "DisplayEmptyTasksAsLine" ) {
3020
if( KDGanttXML::readBoolNode( element, value ) )
3021
setDisplayEmptyTasksAsLine( value );
3022
} else if( tagName == "GlobalFont" ) {
3024
if( KDGanttXML::readFontNode( element, font ) )
3026
} else if( tagName == "HorizonStart" ) {
3028
if( KDGanttXML::readDateTimeNode( element, value ) )
3029
setHorizonStart( value );
3030
} else if( tagName == "HorizonEnd" ) {
3032
if( KDGanttXML::readDateTimeNode( element, value ) )
3033
setHorizonEnd( value );
3034
} else if( tagName == "Scale" ) {
3036
if( KDGanttXML::readStringNode( element, value ) )
3037
setScale( stringToScale( value ) );
3038
} else if( tagName == "MinimumScale" ) {
3040
if( KDGanttXML::readStringNode( element, value ) )
3041
setMinimumScale( stringToScale( value ) );
3042
} else if( tagName == "MaximumScale" ) {
3044
if( KDGanttXML::readStringNode( element, value ) )
3045
setMaximumScale( stringToScale( value ) );
3046
} else if( tagName == "YearFormat" ) {
3048
if( KDGanttXML::readStringNode( element, value ) )
3049
setYearFormat( stringToYearFormat( value ) );
3050
} else if( tagName == "HourFormat" ) {
3052
if( KDGanttXML::readStringNode( element, value ) )
3053
setHourFormat( stringToHourFormat( value ) );
3054
} else if( tagName == "ShowMinorTicks" ) {
3056
if( KDGanttXML::readBoolNode( element, value ) ) {
3057
if ( value ) setShowTicks( ShowMinorTicks );
3059
} else if( tagName == "ShowMajorTicks" ) {
3061
if( KDGanttXML::readBoolNode( element, value ) ) {
3062
if ( value ) setShowTicks( ShowMajorTicks );
3064
} else if( tagName == "ShowTicks" ) {
3066
if( KDGanttXML::readIntNode( element, value ) )
3067
setShowTicks( (ShowTicksType)value );
3068
} else if( tagName == "DragEnabled" ) {
3070
if( KDGanttXML::readBoolNode( element, value ) )
3071
setDragEnabled( value );
3072
} else if( tagName == "DropEnabled" ) {
3074
if( KDGanttXML::readBoolNode( element, value ) )
3075
setDropEnabled( value );
3076
} else if( tagName == "TickcountForTimeline" ) {
3078
if( KDGanttXML::readIntNode( element, value ) )
3079
setAddTickcountForTimeline( value );
3080
} else if( tagName == "DisplaySubitemsAsGroup" ) {
3082
if( KDGanttXML::readBoolNode( element, value ) )
3083
_displaySubitemsAsGroup = value;
3084
} else if( tagName == "WeekScaleShowNumber" ) {
3086
if( KDGanttXML::readBoolNode( element, value ) )
3087
setWeekScaleShowNumber( value );
3088
} else if( tagName == "WeekStartsMonday" ) {
3090
if( KDGanttXML::readBoolNode( element, value ) )
3091
setWeekStartsMonday( value );
3092
} else if( tagName == "UserHorizonChangeEnabled" ) {
3094
if( KDGanttXML::readBoolNode( element, value ) )
3095
setUserHorizonChangeEnabled( value );
3096
} else if( tagName == "TimeHeaderDatetimeFormatHour" ) {
3098
if( KDGanttXML::readStringNode( element, value ) )
3099
setTimeHeaderDatetimeFormatHour( value );
3100
} else if( tagName == "TimeHeaderDatetimeFormatSecond" ) {
3102
if( KDGanttXML::readStringNode( element, value ) )
3103
setTimeHeaderDatetimeFormatSecond( value );
3104
} else if( tagName == "TimeHeaderDatetimeFormatMinute" ) {
3106
if( KDGanttXML::readStringNode( element, value ) )
3107
setTimeHeaderDatetimeFormatMinute( value );
3108
} else if( tagName == "TimeHeaderDateFormatDay" ) {
3110
if( KDGanttXML::readStringNode( element, value ) )
3111
setTimeHeaderDateFormatDay( value );
3112
} else if( tagName == "TimeHeaderDateFormatWeek" ) {
3114
if( KDGanttXML::readStringNode( element, value ) )
3115
setTimeHeaderDateFormatWeek( value );
3116
} else if( tagName == "TimeHeaderDateFormatMonth" ) {
3118
if( KDGanttXML::readStringNode( element, value ) )
3119
setTimeHeaderDateFormatMonth( value );
3120
} else if( tagName == "TimeHeaderTooltipDateTimeFormat" ) {
3122
if( KDGanttXML::readStringNode( element, value ) )
3123
setTimeHeaderTooltipDateTimeFormat( value );
3124
} else if( tagName == "CalendarMode" ) {
3126
if( KDGanttXML::readBoolNode( element, value ) )
3127
setCalendarMode( value );
3128
} else if( tagName == "Editable" ) {
3130
if( KDGanttXML::readBoolNode( element, value ) )
3131
setEditable( value );
3132
} else if( tagName == "TextColor" ) {
3134
if( KDGanttXML::readColorNode( element, value ) )
3135
setTextColor( value );
3136
} else if( tagName == "MajorScaleCount" ) {
3138
if( KDGanttXML::readIntNode( element, value ) )
3139
setMajorScaleCount( value );
3140
} else if( tagName == "MinorScaleCount" ) {
3142
if( KDGanttXML::readIntNode( element, value ) )
3143
setMinorScaleCount( value );
3144
} else if( tagName == "AutoScaleMinorTickCount" ) {
3146
if( KDGanttXML::readIntNode( element, value ) )
3147
setAutoScaleMinorTickCount( value );
3148
} else if( tagName == "MinimumColumnWidth" ) {
3150
if( KDGanttXML::readIntNode( element, value ) )
3151
setMinimumColumnWidth( value );
3152
} else if( tagName == "GanttMaximumWidth" ) {
3154
if( KDGanttXML::readIntNode( element, value ) )
3155
setGanttMaximumWidth( value );
3156
} else if( tagName == "Backgroundlines" ) {
3159
QDomNode node = element.firstChild();
3160
while( !node.isNull() ) {
3161
QDomElement element = node.toElement();
3162
if( !element.isNull() ) {
3163
QString tagName = element.tagName();
3164
if( tagName == "BackGroundBrush" )
3165
KDGanttXML::readBrushNode( element, value );
3166
else if( tagName == "LineCount" )
3167
KDGanttXML::readIntNode( element, linecount );
3169
node = node.nextSibling();
3172
setHorBackgroundLines( linecount, value );
3173
} else if( tagName == "NoInformationBrush" ) {
3175
if( KDGanttXML::readBrushNode( element, value ) )
3176
setNoInformationBrush( value );
3177
} else if( tagName == "GanttViewBackgroundColor" ) {
3179
if( KDGanttXML::readColorNode( element, value ) )
3180
setGvBackgroundColor( value );
3181
} else if( tagName == "ListViewBackgroundColor" ) {
3183
if( KDGanttXML::readColorNode( element, value ) )
3184
setLvBackgroundColor( value );
3185
} else if( tagName == "TimeHeaderBackgroundColor" ) {
3187
if( KDGanttXML::readColorNode( element, value ) )
3188
setTimeHeaderBackgroundColor( value );
3189
} else if( tagName == "LegendHeaderBackgroundColor" ) {
3191
if( KDGanttXML::readColorNode( element, value ) )
3192
setLegendHeaderBackgroundColor( value );
3193
} else if( tagName == "WeekendBackgroundColor" ) {
3195
if( KDGanttXML::readColorNode( element, value ) )
3196
setWeekendBackgroundColor( value );
3197
} else if( tagName == "WeekdayBackgroundColor" ) {
3198
QDomNode node = element.firstChild();
3201
while( !node.isNull() ) {
3202
QDomElement element = node.toElement();
3203
if( !element.isNull() ) { // was really an elemente
3204
QString tagName = element.tagName();
3205
if( tagName == "Day" ) {
3207
if( KDGanttXML::readIntNode( element, value ) )
3209
} else if( tagName == "Color" ) {
3211
if( KDGanttXML::readColorNode( element, value ) )
3214
qDebug() << "Unrecognized tag name: " << tagName;
3218
node = node.nextSibling();
3221
if( day && color.isValid() )
3222
setWeekdayBackgroundColor( color, day );
3223
} else if( tagName == "WeekendDays" ) {
3224
QString startString = element.attribute( "Start" );
3225
QString endString = element.attribute( "End" );
3226
bool startOk = false, endOk = false;
3227
int start = startString.toInt( &startOk );
3228
int end = startString.toInt( &endOk );
3229
if( startOk && endOk )
3230
setWeekendDays( start, end );
3231
} else if( tagName == "ZoomFactor" ) {
3233
if( KDGanttXML::readDoubleNode( element, value ) )
3234
setZoomFactor( value, true );
3235
} else if( tagName == "ShowHeaderPopupMenu" ) {
3237
if( KDGanttXML::readBoolNode( element, value ) )
3238
setShowHeaderPopupMenu( value );
3239
} else if( tagName == "ShowTimeTablePopupMenu" ) {
3241
if( KDGanttXML::readBoolNode( element, value ) )
3242
setShowTimeTablePopupMenu( value );
3243
} else if( tagName == "Shapes" ) {
3244
QDomNode node = element.firstChild();
3245
bool undefinedShape = false;
3246
while( !node.isNull() ) {
3247
QDomElement element = node.toElement();
3248
if( !element.isNull() ) { // was really an elemente
3249
QString tagName = element.tagName();
3250
if( tagName == "Event" ) {
3251
KDGanttViewItem::Shape startShape, middleShape, endShape;
3252
startShape = KDGanttViewItem::TriangleDown;
3253
middleShape = KDGanttViewItem::TriangleDown;
3254
endShape = KDGanttViewItem::TriangleDown;
3255
QDomNode node = element.firstChild();
3256
while( !node.isNull() ) {
3257
QDomElement element = node.toElement();
3258
if( !element.isNull() ) { // was really an elemente
3259
QString tagName = element.tagName();
3260
if( tagName == "Start" ) {
3262
if( KDGanttXML::readStringNode( element, value ) )
3263
startShape = KDGanttViewItem::stringToShape( value );
3264
if ( value == "Undefined" )
3265
undefinedShape = true;
3266
} else if( tagName == "Middle" ) {
3268
if( KDGanttXML::readStringNode( element, value ) )
3269
middleShape = KDGanttViewItem::stringToShape( value );
3270
if ( value == "Undefined" )
3271
undefinedShape = true;
3272
} else if( tagName == "End" ) {
3274
if( KDGanttXML::readStringNode( element, value ) )
3275
endShape = KDGanttViewItem::stringToShape( value );
3276
if ( value == "Undefined" )
3277
undefinedShape = true;
3279
qDebug() << "Unrecognized tag name: " << tagName;
3283
node = node.nextSibling();
3285
if ( ! undefinedShape )
3286
setShapes( KDGanttViewItem::Event, startShape,
3287
middleShape, endShape, false );
3288
undefinedShape = false;
3289
} else if( tagName == "Task" ) {
3290
KDGanttViewItem::Shape startShape, middleShape, endShape;
3291
startShape = KDGanttViewItem::TriangleDown;
3292
middleShape = KDGanttViewItem::TriangleDown;
3293
endShape = KDGanttViewItem::TriangleDown;
3294
QDomNode node = element.firstChild();
3295
while( !node.isNull()) {
3296
QDomElement element = node.toElement();
3297
if( !element.isNull() ) { // was really an elemente
3298
QString tagName = element.tagName();
3299
if( tagName == "Start" ) {
3301
if( KDGanttXML::readStringNode( element, value ) )
3302
startShape = KDGanttViewItem::stringToShape( value );
3303
if ( value == "Undefined" )
3304
undefinedShape = true;
3305
} else if( tagName == "Middle" ) {
3307
if( KDGanttXML::readStringNode( element, value ) )
3308
middleShape = KDGanttViewItem::stringToShape( value );
3309
if ( value == "Undefined" )
3310
undefinedShape = true;
3311
} else if( tagName == "End" ) {
3313
if( KDGanttXML::readStringNode( element, value ) )
3314
endShape = KDGanttViewItem::stringToShape( value );
3315
if ( value == "Undefined" )
3316
undefinedShape = true;
3318
qDebug() << "Unrecognized tag name: " << tagName;
3322
node = node.nextSibling();
3324
if ( ! undefinedShape )
3325
setShapes( KDGanttViewItem::Task, startShape, middleShape, endShape, false );
3326
undefinedShape = false;
3327
} else if( tagName == "Summary" ) {
3328
KDGanttViewItem::Shape startShape, middleShape, endShape;
3329
startShape = KDGanttViewItem::TriangleDown;
3330
middleShape = KDGanttViewItem::TriangleDown;
3331
endShape = KDGanttViewItem::TriangleDown;
3332
QDomNode node = element.firstChild();
3333
while( !node.isNull() ) {
3334
QDomElement element = node.toElement();
3335
if( !element.isNull() ) { // was really an elemente
3336
QString tagName = element.tagName();
3337
if( tagName == "Start" ) {
3339
if( KDGanttXML::readStringNode( element, value ) )
3340
startShape = KDGanttViewItem::stringToShape( value );
3341
if ( value == "Undefined" )
3342
undefinedShape = true;
3343
} else if( tagName == "Middle" ) {
3345
if( KDGanttXML::readStringNode( element, value ) )
3346
middleShape = KDGanttViewItem::stringToShape( value );
3347
if ( value == "Undefined" )
3348
undefinedShape = true;
3349
} else if( tagName == "End" ) {
3351
if( KDGanttXML::readStringNode( element, value ) )
3352
endShape = KDGanttViewItem::stringToShape( value );
3353
if ( value == "Undefined" )
3354
undefinedShape = true;
3356
qDebug() << "Unrecognized tag name: " << tagName;
3360
node = node.nextSibling();
3362
if ( ! undefinedShape )
3363
setShapes( KDGanttViewItem::Summary, startShape,
3364
middleShape, endShape, false );
3365
undefinedShape = false;
3367
qDebug() << "Unrecognized tag name: " << tagName;
3371
node = node.nextSibling();
3373
} else if( tagName == "Colors" ) {
3374
QDomNode node = element.firstChild();
3375
while( !node.isNull()) {
3376
QDomElement element = node.toElement();
3377
if( !element.isNull() ) { // was really an elemente
3378
QString tagName = element.tagName();
3379
if( tagName == "Event" ) {
3380
QColor startColor, middleColor, endColor;
3381
QDomNode node = element.firstChild();
3382
while( !node.isNull() ) {
3383
QDomElement element = node.toElement();
3384
if( !element.isNull() ) { // was really an elemente
3385
QString tagName = element.tagName();
3386
if( tagName == "Start" ) {
3388
if( KDGanttXML::readColorNode( element, value ) )
3390
} else if( tagName == "Middle" ) {
3392
if( KDGanttXML::readColorNode( element, value ) )
3393
middleColor = value;
3394
} else if( tagName == "End" ) {
3396
if( KDGanttXML::readColorNode( element, value ) )
3399
qDebug() << "Unrecognized tag name: " << tagName;
3403
node = node.nextSibling();
3405
setColors( KDGanttViewItem::Event, startColor,
3406
middleColor, endColor, false );
3407
} else if( tagName == "Task" ) {
3408
QColor startColor, middleColor, endColor;
3409
QDomNode node = element.firstChild();
3410
while( !node.isNull() ) {
3411
QDomElement element = node.toElement();
3412
if( !element.isNull() ) { // was really an elemente
3413
QString tagName = element.tagName();
3414
if( tagName == "Start" ) {
3416
if( KDGanttXML::readColorNode( element, value ) )
3418
} else if( tagName == "Middle" ) {
3420
if( KDGanttXML::readColorNode( element, value ) )
3421
middleColor = value;
3422
} else if( tagName == "End" ) {
3424
if( KDGanttXML::readColorNode( element, value ) )
3427
qDebug() << "Unrecognized tag name: " << tagName;
3431
node = node.nextSibling();
3433
setColors( KDGanttViewItem::Task, startColor,
3434
middleColor, endColor, false );
3435
} else if( tagName == "Summary" ) {
3436
QColor startColor, middleColor, endColor;
3437
QDomNode node = element.firstChild();
3438
while( !node.isNull() ) {
3439
QDomElement element = node.toElement();
3440
if( !element.isNull() ) { // was really an elemente
3441
QString tagName = element.tagName();
3442
if( tagName == "Start" ) {
3444
if( KDGanttXML::readColorNode( element, value ) )
3446
} else if( tagName == "Middle" ) {
3448
if( KDGanttXML::readColorNode( element, value ) )
3449
middleColor = value;
3450
} else if( tagName == "End" ) {
3452
if( KDGanttXML::readColorNode( element, value ) )
3455
qDebug() << "Unrecognized tag name: " << tagName;
3459
node = node.nextSibling();
3461
setColors( KDGanttViewItem::Summary, startColor,
3462
middleColor, endColor , false);
3464
qDebug() << "Unrecognized tag name: " << tagName;
3468
node = node.nextSibling();
3470
} else if( tagName == "DefaultColors" ) {
3471
QDomNode node = element.firstChild();
3472
while( !node.isNull() ) {
3473
QDomElement element = node.toElement();
3474
if( !element.isNull() ) { // was really an element
3475
QString tagName = element.tagName();
3476
if( tagName == "Event" ) {
3478
if( KDGanttXML::readColorNode( element, value ) )
3479
setDefaultColor( KDGanttViewItem::Event,
3481
} else if( tagName == "Task" ) {
3483
if( KDGanttXML::readColorNode( element, value ) )
3484
setDefaultColor( KDGanttViewItem::Task,
3486
} else if( tagName == "Summary" ) {
3488
if( KDGanttXML::readColorNode( element, value ) )
3489
setDefaultColor( KDGanttViewItem::Summary,
3492
qDebug() << "Unrecognized tag name: " << tagName;
3497
node = node.nextSibling();
3499
} else if( tagName == "HighlightColors" ) {
3500
QDomNode node = element.firstChild();
3501
while( !node.isNull() ) {
3502
QDomElement element = node.toElement();
3503
if( !element.isNull() ) { // was really an elemente
3504
QString tagName = element.tagName();
3505
if( tagName == "Event" ) {
3506
QColor startColor, middleColor, endColor;
3507
QDomNode node = element.firstChild();
3508
while( !node.isNull() ) {
3509
QDomElement element = node.toElement();
3510
if( !element.isNull() ) { // was really an elemente
3511
QString tagName = element.tagName();
3512
if( tagName == "Start" ) {
3514
if( KDGanttXML::readColorNode( element, value ) )
3516
} else if( tagName == "Middle" ) {
3518
if( KDGanttXML::readColorNode( element, value ) )
3519
middleColor = value;
3520
} else if( tagName == "End" ) {
3522
if( KDGanttXML::readColorNode( element, value ) )
3525
qDebug() << "Unrecognized tag name: " << tagName;
3529
node = node.nextSibling();
3531
setHighlightColors( KDGanttViewItem::Event,
3533
middleColor, endColor, false );
3534
} else if( tagName == "Task" ) {
3535
QColor startColor, middleColor, endColor;
3536
QDomNode node = element.firstChild();
3537
while( !node.isNull() ) {
3538
QDomElement element = node.toElement();
3539
if( !element.isNull() ) { // was really an elemente
3540
QString tagName = element.tagName();
3541
if( tagName == "Start" ) {
3543
if( KDGanttXML::readColorNode( element, value ) )
3545
} else if( tagName == "Middle" ) {
3547
if( KDGanttXML::readColorNode( element, value ) )
3548
middleColor = value;
3549
} else if( tagName == "End" ) {
3551
if( KDGanttXML::readColorNode( element, value ) )
3554
qDebug() << "Unrecognized tag name: " << tagName;
3558
node = node.nextSibling();
3560
setHighlightColors( KDGanttViewItem::Task,
3562
middleColor, endColor , false);
3563
} else if( tagName == "Summary" ) {
3564
QColor startColor, middleColor, endColor;
3565
QDomNode node = element.firstChild();
3566
while( !node.isNull() ) {
3567
QDomElement element = node.toElement();
3568
if( !element.isNull() ) { // was really an elemente
3569
QString tagName = element.tagName();
3570
if( tagName == "Start" ) {
3572
if( KDGanttXML::readColorNode( element, value ) )
3574
} else if( tagName == "Middle" ) {
3576
if( KDGanttXML::readColorNode( element, value ) )
3577
middleColor = value;
3578
} else if( tagName == "End" ) {
3580
if( KDGanttXML::readColorNode( element, value ) )
3583
qDebug() << "Unrecognized tag name: " << tagName;
3587
node = node.nextSibling();
3589
setHighlightColors( KDGanttViewItem::Summary,
3591
middleColor, endColor, false );
3593
qDebug() << "Unrecognized tag name: " << tagName;
3597
node = node.nextSibling();
3599
} else if( tagName == "DefaultHighlightColors" ) {
3600
QDomNode node = element.firstChild();
3601
while( !node.isNull() ) {
3602
QDomElement element = node.toElement();
3603
if( !element.isNull() ) { // was really an element
3604
QString tagName = element.tagName();
3605
if( tagName == "Event" ) {
3607
if( KDGanttXML::readColorNode( element, value ) )
3608
setDefaultHighlightColor( KDGanttViewItem::Event,
3610
} else if( tagName == "Task" ) {
3612
if( KDGanttXML::readColorNode( element, value ) )
3613
setDefaultHighlightColor( KDGanttViewItem::Task,
3615
} else if( tagName == "Summary" ) {
3617
if( KDGanttXML::readColorNode( element, value ) )
3618
setDefaultHighlightColor( KDGanttViewItem::Summary,
3621
qDebug() << "Unrecognized tag name: " << tagName;
3626
node = node.nextSibling();
3628
} else if( tagName == "Items" ) {
3629
QDomNode node = element.firstChild();
3630
KDGanttViewItem* previous = 0;
3631
while( !node.isNull() ) {
3632
QDomElement element = node.toElement();
3633
if( !element.isNull() ) { // was really an element
3634
QString tagName = element.tagName();
3635
if( tagName == "Item" ) {
3636
KDGanttViewItem* newItem;
3639
KDGanttViewItem::createFromDomElement( this,
3644
KDGanttViewItem::createFromDomElement( this,
3649
qDebug() << "Unrecognized tag name: " << tagName;
3654
node = node.nextSibling();
3656
} else if( tagName == "TaskLinks" ) {
3657
QDomNode node = element.firstChild();
3658
while( !node.isNull() ) {
3659
QDomElement element = node.toElement();
3660
if( !element.isNull() ) { // was really an element
3661
QString tagName = element.tagName();
3662
if( tagName == "TaskLink" )
3663
KDGanttViewTaskLink::createFromDomElement( element );
3665
qDebug() << "Unrecognized tag name: " << tagName;
3670
node = node.nextSibling();
3672
} else if( tagName == "TaskLinkGroups" ) {
3673
QDomNode node = element.firstChild();
3674
while( !node.isNull() ) {
3675
QDomElement element = node.toElement();
3676
if( !element.isNull() ) { // was really an element
3677
QString tagName = element.tagName();
3678
if( tagName == "TaskLinkGroup" )
3679
KDGanttViewTaskLinkGroup::createFromDomElement( element );
3681
qDebug() << "Unrecognized tag name: " << tagName;
3685
node = node.nextSibling();
3687
} else if( tagName == "ColumnBackgroundColors" ) {
3688
QDomNode node = element.firstChild();
3689
while( !node.isNull() ) {
3690
QDomElement element = node.toElement();
3691
if( !element.isNull() ) { // was really an element
3692
QString tagName = element.tagName();
3693
if( tagName == "ColumnBackgroundColor" ) {
3694
QDomNode node = element.firstChild();
3697
Scale mini = Minute;
3699
while( !node.isNull() ) {
3700
QDomElement element = node.toElement();
3701
if( !element.isNull() ) { // was
3704
QString tagName = element.tagName();
3705
if( tagName == "DateTime" ) {
3707
if( KDGanttXML::readDateTimeNode( element, value ) )
3709
} else if( tagName == "Color" ) {
3711
if( KDGanttXML::readColorNode( element, value ) )
3713
} else if( tagName == "MinScale" ) {
3715
if( KDGanttXML::readStringNode( element, value ) )
3716
mini = stringToScale( value );
3717
} else if( tagName == "MaxScale" ) {
3719
if( KDGanttXML::readStringNode( element, value ) )
3720
maxi = stringToScale( value );
3722
qDebug() << "Unrecognized tag name: " << tagName;
3727
node = node.nextSibling();
3729
setColumnBackgroundColor( dateTime, color, mini, maxi );
3731
qDebug() << "Unrecognized tag name: " << tagName;
3735
node = node.nextSibling();
3737
} else if( tagName == "IntervalBackgroundColors" ) {
3738
QDomNode node = element.firstChild();
3739
while( !node.isNull() ) {
3740
QDomElement element = node.toElement();
3741
if( !element.isNull() ) { // was really an element
3742
QString tagName = element.tagName();
3743
if( tagName == "IntervalBackgroundColor" ) {
3744
QDomNode node = element.firstChild();
3748
Scale mini = Minute;
3751
while( !node.isNull() ) {
3752
QDomElement element = node.toElement();
3753
if( !element.isNull() ) { // was
3756
QString tagName = element.tagName();
3757
if( tagName == "DateTimeEnd" ) {
3759
if( KDGanttXML::readDateTimeNode( element, value ) )
3761
} else if( tagName == "Priority" ) {
3763
if( KDGanttXML::readIntNode( element, value ) )
3765
} else if( tagName == "DateTimeStart" ) {
3767
if( KDGanttXML::readDateTimeNode( element, value ) )
3769
} else if( tagName == "Color" ) {
3771
if( KDGanttXML::readColorNode( element, value ) )
3773
} else if( tagName == "MinScale" ) {
3775
if( KDGanttXML::readStringNode( element, value ) )
3776
mini = stringToScale( value );
3777
} else if( tagName == "MaxScale" ) {
3779
if( KDGanttXML::readStringNode( element, value ) )
3780
maxi = stringToScale( value );
3782
qDebug() << "Unrecognized tag name: " << tagName;
3786
node = node.nextSibling();
3788
//setIntervalBackgroundColor( dateTime, ente, color, prio, mini, maxi );
3789
KDIntervalColorRectangle* icr = new KDIntervalColorRectangle( this );
3790
icr->setDateTimes( dateTime, ente );
3791
icr->setColor( color );
3795
addIntervalBackgroundColor(icr);
3798
qDebug() << "Unrecognized tag name: " << tagName;
3802
node = node.nextSibling();
3804
} else if( tagName == "LegendItems" ) {
3805
QDomNode node = element.firstChild();
3806
while( !node.isNull() ) {
3807
QDomElement element = node.toElement();
3808
if( !element.isNull() ) { // was really an element
3809
QString tagName = element.tagName();
3810
if( tagName == "LegendItem" ) {
3811
KDGanttViewItem::Shape tempLegendShape;
3812
tempLegendShape = KDGanttViewItem::TriangleDown;
3813
QColor tempLegendColor;
3814
QString tempLegendString;
3815
KDGanttViewItem::Shape tempLegendShape2;
3816
tempLegendShape2 = KDGanttViewItem::TriangleDown;
3817
QColor tempLegendColor2;
3818
QString tempLegendString2;
3821
QDomNode node = element.firstChild();
3822
while( !node.isNull() ) {
3823
QDomElement element = node.toElement();
3824
if( !element.isNull() ) { // was really an element
3825
QString tagName = element.tagName();
3826
if( tagName == "Shape" ) {
3828
if( KDGanttXML::readStringNode( element, value ) )
3829
tempLegendShape = KDGanttViewItem::stringToShape( value );
3832
} else if( tagName == "Color" ) {
3834
if( KDGanttXML::readColorNode( element, value ) )
3835
tempLegendColor = value;
3838
} else if( tagName == "Text" ) {
3840
if( KDGanttXML::readStringNode( element, value ) )
3841
tempLegendString = value;
3844
} else if( tagName == "Shape2" ) {
3847
if( KDGanttXML::readStringNode( element, value ) )
3848
tempLegendShape2 = KDGanttViewItem::stringToShape( value );
3851
} else if( tagName == "Color2" ) {
3854
if( KDGanttXML::readColorNode( element, value ) )
3855
tempLegendColor2 = value;
3858
} else if( tagName == "Text2" ) {
3861
if( KDGanttXML::readStringNode( element, value ) )
3862
tempLegendString2 = value;
3866
qDebug() << "Unrecognized tag name: " << tagName;
3870
node = node.nextSibling();
3874
addLegendItem( tempLegendShape,
3879
tempLegendString2 );
3881
addLegendItem( tempLegendShape,
3884
//qDebug() << "Adding legend item " << tempLegendString;
3887
qDebug() << "Unrecognized tag name: " << tagName;
3891
node = node.nextSibling();
3893
} else if( tagName == "UserSavedData" ) {
3894
userReadFromElement( element );
3896
qDebug() << "Unrecognized tag name: " << tagName;
3901
node = node.nextSibling();
3903
setUpdateEnabled( block );
3904
return true; /* FIXME: Do real error-reporting. The ASSERT's should be "return false" stmnts */
3909
Saves the parameters of the view parameters to an XML document.
3911
\param withPI pass true to store processing instructions, false to
3913
\return the XML document that represents the parameters
3916
QDomDocument KDGanttView::saveXML( bool withPI ) const
3918
// Create an initial DOM document
3919
QString docstart = "<GanttView/>";
3921
QDomDocument doc( "GanttView" );
3922
doc.setContent( docstart );
3924
QDomProcessingInstruction pin = doc.createProcessingInstruction( "kdgantt", "version=\"1.0\" encoding=\"UTF-8\"" ) ;
3925
doc.appendChild ( pin );
3928
QDomElement docRoot = doc.documentElement();
3929
docRoot.setAttribute( "xmlns", "http://www.klaralvdalens-datakonsult.se/kdgantt" );
3930
docRoot.setAttribute( "xmlns:xsi", "http://www.w3.org/2000/10/XMLSchema-instance" );
3931
docRoot.setAttribute( "xsi:schemaLocation", "http://www.klaralvdalens-datakonsult.se/kdgantt" );
3933
// the ShowLegend element
3934
KDGanttXML::createBoolNode( doc, docRoot, "ShowLegend", showLegend() );
3936
// the ShowLegendButton element
3937
KDGanttXML::createBoolNode( doc, docRoot, "ShowLegendButton",
3938
showLegendButton() );
3940
// the LegendIsDockWindow element
3941
KDGanttXML::createBoolNode( doc, docRoot, "LegendIsDockWindow",
3942
legendIsDockwindow() );
3944
// the ShowListView element
3945
KDGanttXML::createBoolNode( doc, docRoot, "ShowListView", showListView() );
3947
// the ShowHeader element
3948
KDGanttXML::createBoolNode( doc, docRoot, "ShowHeader", headerVisible() );
3950
// the ShowTaskLinks element
3951
KDGanttXML::createBoolNode( doc, docRoot, "ShowTaskLinks", showTaskLinks() );
3953
// the EditorEnabled element
3954
KDGanttXML::createBoolNode( doc, docRoot, "EditorEnabled", editorEnabled() );
3956
// the global font element
3957
KDGanttXML::createFontNode( doc, docRoot, "GlobalFont", font() );
3959
// the DisplayEmptyTasksAsLine element
3960
KDGanttXML::createBoolNode( doc, docRoot, "DisplayEmptyTasksAsLine",
3961
displayEmptyTasksAsLine() );
3963
// the HorizonStart element
3964
KDGanttXML::createDateTimeNode( doc, docRoot, "HorizonStart", horizonStart() );
3966
// the HorizonEnd element
3967
KDGanttXML::createDateTimeNode( doc, docRoot, "HorizonEnd", horizonEnd() );
3969
// the Scale, MinimumScale, MaximumScale elements
3970
KDGanttXML::createStringNode( doc, docRoot, "Scale", scaleToString( scale() ) );
3971
KDGanttXML::createStringNode( doc, docRoot, "MinimumScale",
3972
scaleToString( minimumScale() ) );
3973
KDGanttXML::createStringNode( doc, docRoot, "MaximumScale",
3974
scaleToString( maximumScale() ) );
3976
// the YearFormat element
3977
KDGanttXML::createStringNode( doc, docRoot, "YearFormat",
3978
yearFormatToString( yearFormat() ) );
3980
// the HourFormat element
3981
KDGanttXML::createStringNode( doc, docRoot, "HourFormat",
3982
hourFormatToString( hourFormat() ) );
3984
// the ShowTicks element
3985
KDGanttXML::createIntNode( doc, docRoot, "ShowTicks", showTicks() );
3987
// the Editable element
3988
KDGanttXML::createBoolNode( doc, docRoot, "Editable", editable() );
3990
// the TextColor element
3991
KDGanttXML::createColorNode( doc, docRoot, "TextColor", textColor() );
3993
// the MajorScaleCount element
3994
KDGanttXML::createIntNode( doc, docRoot, "MajorScaleCount", majorScaleCount() );
3996
// the MinorScaleCount element
3997
KDGanttXML::createIntNode( doc, docRoot, "MinorScaleCount", minorScaleCount() );
3999
// the AutoScaleMinorTickCount element
4000
KDGanttXML::createIntNode( doc, docRoot, "AutoScaleMinorTickCount",
4001
autoScaleMinorTickCount() );
4003
// the MinimumColumnWidth element
4004
KDGanttXML::createIntNode( doc, docRoot, "MinimumColumnWidth",
4005
minimumColumnWidth() );
4007
// the GanttMaximumWidth element
4008
KDGanttXML::createIntNode( doc, docRoot, "GanttMaximumWidth",
4009
ganttMaximumWidth() );
4012
int backgroundlines = horBackgroundLines( backBrush );
4013
if ( backgroundlines ) {
4014
QDomElement backElement = doc.createElement( "Backgroundlines" );
4015
docRoot.appendChild( backElement );
4016
KDGanttXML::createBrushNode( doc, backElement, "BackGroundBrush",backBrush );
4017
KDGanttXML::createIntNode( doc, backElement, "LineCount", backgroundlines );
4019
// the NoInformationBrush element
4020
KDGanttXML::createBrushNode( doc, docRoot, "NoInformationBrush",
4021
noInformationBrush() );
4023
// the GanttViewBackgroundColor element
4024
KDGanttXML::createColorNode( doc, docRoot, "GanttViewBackgroundColor",
4025
gvBackgroundColor() );
4027
// the ListViewBackgroundColor element
4028
KDGanttXML::createColorNode( doc, docRoot, "ListViewBackgroundColor",
4029
lvBackgroundColor() );
4031
// the TimeHeaderBackgroundColor element
4032
KDGanttXML::createColorNode( doc, docRoot, "TimeHeaderBackgroundColor",
4033
timeHeaderBackgroundColor() );
4035
// the LegendHeaderBackgroundColor element
4036
KDGanttXML::createColorNode( doc, docRoot, "LegendHeaderBackgroundColor",
4037
legendHeaderBackgroundColor() );
4039
// the WeekendBackgroundColor element
4040
KDGanttXML::createColorNode( doc, docRoot, "WeekendBackgroundColor",
4041
weekendBackgroundColor() );
4043
// the WeekdayBackgroundColor elements
4044
for( int weekday = 1; weekday <= 7; weekday++ ) {
4045
QColor color = weekdayBackgroundColor( weekday );
4046
if( color.isValid() ) {
4047
QDomElement weekendBackgroundColorElement = doc.createElement( "WeekdayBackgroundColor" );
4048
docRoot.appendChild( weekendBackgroundColorElement );
4049
KDGanttXML::createIntNode( doc, weekendBackgroundColorElement,
4051
KDGanttXML::createColorNode( doc, weekendBackgroundColorElement,
4056
// the WeekendDays element
4057
QDomElement weekendDaysElement = doc.createElement( "WeekendDays" );
4058
docRoot.appendChild( weekendDaysElement );
4059
int weekendStart, weekendEnd;
4060
weekendDays( weekendStart, weekendEnd );
4061
weekendDaysElement.setAttribute( "Start", weekendStart );
4062
weekendDaysElement.setAttribute( "End", weekendStart );
4064
// the ZoomFactor element
4065
KDGanttXML::createDoubleNode( doc, docRoot, "ZoomFactor",
4068
// the ShowHeaderPopupMenu element
4069
KDGanttXML::createBoolNode( doc, docRoot, "ShowHeaderPopupMenu",
4070
showHeaderPopupMenu() );
4072
// the ShowTimeTablePopupMenu element
4073
KDGanttXML::createBoolNode( doc, docRoot, "ShowTimeTablePopupMenu",
4074
showTimeTablePopupMenu() );
4076
// the Shapes element
4077
QDomElement shapesElement = doc.createElement( "Shapes" );
4078
docRoot.appendChild( shapesElement );
4079
QDomElement shapesEventElement = doc.createElement( "Event" );
4080
shapesElement.appendChild( shapesEventElement );
4081
KDGanttViewItem::Shape start, middle, end;
4082
if( shapes( KDGanttViewItem::Event, start, middle, end ) ) {
4083
KDGanttXML::createStringNode( doc, shapesEventElement, "Start",
4084
KDGanttViewItem::shapeToString( start ) );
4085
KDGanttXML::createStringNode( doc, shapesEventElement, "Middle",
4086
KDGanttViewItem::shapeToString( middle ) );
4087
KDGanttXML::createStringNode( doc, shapesEventElement, "End",
4088
KDGanttViewItem::shapeToString( end ) );
4090
KDGanttXML::createStringNode( doc, shapesEventElement, "Start",
4092
KDGanttXML::createStringNode( doc, shapesEventElement, "Middle",
4094
KDGanttXML::createStringNode( doc, shapesEventElement, "End",
4097
QDomElement shapesTaskElement = doc.createElement( "Task" );
4098
shapesElement.appendChild( shapesTaskElement );
4099
if( shapes( KDGanttViewItem::Task, start, middle, end ) ) {
4100
KDGanttXML::createStringNode( doc, shapesTaskElement, "Start",
4101
KDGanttViewItem::shapeToString( start ) );
4102
KDGanttXML::createStringNode( doc, shapesTaskElement, "Middle",
4103
KDGanttViewItem::shapeToString( middle ) );
4104
KDGanttXML::createStringNode( doc, shapesTaskElement, "End",
4105
KDGanttViewItem::shapeToString( end ) );
4107
KDGanttXML::createStringNode( doc, shapesTaskElement, "Start",
4109
KDGanttXML::createStringNode( doc, shapesTaskElement, "Middle",
4111
KDGanttXML::createStringNode( doc, shapesTaskElement, "End",
4114
QDomElement shapesSummaryElement = doc.createElement( "Summary" );
4115
shapesElement.appendChild( shapesSummaryElement );
4116
if( shapes( KDGanttViewItem::Event, start, middle, end ) ) {
4117
KDGanttXML::createStringNode( doc, shapesSummaryElement, "Start",
4118
KDGanttViewItem::shapeToString( start ) );
4119
KDGanttXML::createStringNode( doc, shapesSummaryElement, "Middle",
4120
KDGanttViewItem::shapeToString( middle ) );
4121
KDGanttXML::createStringNode( doc, shapesSummaryElement, "End",
4122
KDGanttViewItem::shapeToString( end ) );
4124
KDGanttXML::createStringNode( doc, shapesSummaryElement, "Start",
4126
KDGanttXML::createStringNode( doc, shapesSummaryElement, "Middle",
4128
KDGanttXML::createStringNode( doc, shapesSummaryElement, "End",
4132
// the Colors element
4133
QDomElement colorsElement = doc.createElement( "Colors" );
4134
docRoot.appendChild( colorsElement );
4135
QDomElement colorsEventElement = doc.createElement( "Event" );
4136
colorsElement.appendChild( colorsEventElement );
4137
QColor startColor, middleColor, endColor;
4138
colors( KDGanttViewItem::Event, startColor, middleColor, endColor );
4139
KDGanttXML::createColorNode( doc, colorsEventElement, "Start", startColor );
4140
KDGanttXML::createColorNode( doc, colorsEventElement, "Middle", middleColor );
4141
KDGanttXML::createColorNode( doc, colorsEventElement, "End", endColor );
4142
QDomElement colorsTaskElement = doc.createElement( "Task" );
4143
colorsElement.appendChild( colorsTaskElement );
4144
colors( KDGanttViewItem::Task, startColor, middleColor, endColor );
4145
KDGanttXML::createColorNode( doc, colorsTaskElement, "Start", startColor );
4146
KDGanttXML::createColorNode( doc, colorsTaskElement, "Middle", middleColor );
4147
KDGanttXML::createColorNode( doc, colorsTaskElement, "End", endColor );
4148
QDomElement colorsSummaryElement = doc.createElement( "Summary" );
4149
colorsElement.appendChild( colorsSummaryElement );
4150
colors( KDGanttViewItem::Event, startColor, middleColor, endColor );
4151
KDGanttXML::createColorNode( doc, colorsSummaryElement, "Start", startColor );
4152
KDGanttXML::createColorNode( doc, colorsSummaryElement, "Middle", middleColor );
4153
KDGanttXML::createColorNode( doc, colorsSummaryElement, "End", endColor );
4155
// the DefaultColor element
4156
QDomElement defaultColorsElement = doc.createElement( "DefaultColors" );
4157
docRoot.appendChild( defaultColorsElement );
4158
KDGanttXML::createColorNode( doc, defaultColorsElement, "Event",
4159
defaultColor( KDGanttViewItem::Event ) );
4160
KDGanttXML::createColorNode( doc, defaultColorsElement, "Task",
4161
defaultColor( KDGanttViewItem::Task ) );
4162
KDGanttXML::createColorNode( doc, defaultColorsElement, "Summary",
4163
defaultColor( KDGanttViewItem::Summary ) );
4166
// the HighlightColors element
4167
QDomElement highlightColorsElement = doc.createElement( "HighlightColors" );
4168
docRoot.appendChild( highlightColorsElement );
4169
QDomElement highlightColorsEventElement = doc.createElement( "Event" );
4170
highlightColorsElement.appendChild( highlightColorsEventElement );
4171
highlightColors( KDGanttViewItem::Event, startColor, middleColor, endColor );
4172
KDGanttXML::createColorNode( doc, highlightColorsEventElement, "Start", startColor );
4173
KDGanttXML::createColorNode( doc, highlightColorsEventElement, "Middle", middleColor );
4174
KDGanttXML::createColorNode( doc, highlightColorsEventElement, "End", endColor );
4175
QDomElement highlightColorsTaskElement = doc.createElement( "Task" );
4176
highlightColorsElement.appendChild( highlightColorsTaskElement );
4177
highlightColors( KDGanttViewItem::Task, startColor, middleColor, endColor );
4178
KDGanttXML::createColorNode( doc, highlightColorsTaskElement, "Start", startColor );
4179
KDGanttXML::createColorNode( doc, highlightColorsTaskElement, "Middle", middleColor );
4180
KDGanttXML::createColorNode( doc, highlightColorsTaskElement, "End", endColor );
4181
QDomElement highlightColorsSummaryElement = doc.createElement( "Summary" );
4182
highlightColorsElement.appendChild( highlightColorsSummaryElement );
4183
highlightColors( KDGanttViewItem::Event, startColor, middleColor, endColor );
4184
KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Start", startColor );
4185
KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Middle", middleColor );
4186
KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "End", endColor );
4188
// the DefaultHighlightColor element
4189
QDomElement defaultHighlightColorsElement = doc.createElement( "DefaultHighlightColors" );
4190
docRoot.appendChild( defaultHighlightColorsElement );
4191
KDGanttXML::createColorNode( doc, defaultHighlightColorsElement, "Event",
4192
defaultHighlightColor( KDGanttViewItem::Event ) );
4193
KDGanttXML::createColorNode( doc, defaultHighlightColorsElement, "Task",
4194
defaultHighlightColor( KDGanttViewItem::Task ) );
4195
KDGanttXML::createColorNode( doc, defaultHighlightColorsElement, "Summary",
4196
defaultHighlightColor( KDGanttViewItem::Summary ) );
4199
// the Items element
4200
QDomElement itemsElement = doc.createElement( "Items" );
4201
docRoot.appendChild( itemsElement );
4202
KDGanttViewItem* currentItem = firstChild();
4203
while( currentItem ) {
4204
currentItem->createNode( doc, itemsElement );
4205
currentItem = currentItem->nextSibling();
4208
// the TaskLinks element
4209
QDomElement taskLinksElement = doc.createElement( "TaskLinks" );
4210
docRoot.appendChild( taskLinksElement );
4211
QPtrList<KDGanttViewTaskLink> taskLinkList = taskLinks();
4212
KDGanttViewTaskLink* currentTL = 0;
4213
for( currentTL = taskLinkList.first(); currentTL;
4214
currentTL = taskLinkList.next() )
4215
currentTL->createNode( doc, taskLinksElement );
4217
// the TaskLinkGroups element
4218
QDomElement taskLinkGroupsElement = doc.createElement( "TaskLinkGroups" );
4219
docRoot.appendChild( taskLinkGroupsElement );
4220
QPtrList<KDGanttViewTaskLinkGroup> taskLinkGroupList = taskLinkGroups();
4221
KDGanttViewTaskLinkGroup* currentTLG = 0;
4222
for( currentTLG = taskLinkGroupList.first(); currentTLG;
4223
currentTLG = taskLinkGroupList.next() )
4224
currentTLG->createNode( doc, taskLinkGroupsElement );
4226
// the ColumnBackgroundColors element
4227
QDomElement columnBackgroundColorsElement =
4228
doc.createElement( "ColumnBackgroundColors" );
4229
docRoot.appendChild( columnBackgroundColorsElement );
4230
KDTimeHeaderWidget::ColumnColorList ccList =
4231
myTimeHeader->columnBackgroundColorList();
4232
for( KDTimeHeaderWidget::ColumnColorList::iterator it = ccList.begin();
4233
it != ccList.end(); ++it ) {
4234
QDomElement columnBackgroundColorElement =
4235
doc.createElement( "ColumnBackgroundColor" );
4236
columnBackgroundColorsElement.appendChild( columnBackgroundColorElement );
4237
KDGanttXML::createDateTimeNode( doc, columnBackgroundColorElement,
4238
"DateTime", (*it).datetime );
4239
KDGanttXML::createColorNode( doc, columnBackgroundColorElement,
4240
"Color", (*it).color );
4241
KDGanttXML::createStringNode( doc, columnBackgroundColorElement, "MinScale", scaleToString( (*it).minScaleView ) );
4242
KDGanttXML::createStringNode( doc, columnBackgroundColorElement, "MaxScale", scaleToString( (*it).maxScaleView ) );
4245
// the IntervalBackgroundColors element
4246
columnBackgroundColorsElement =
4247
doc.createElement( "IntervalBackgroundColors" );
4248
docRoot.appendChild( columnBackgroundColorsElement );
4249
KDTimeHeaderWidget::IntervalColorList icList = myTimeHeader->intervalBackgroundColorList();
4250
for( KDTimeHeaderWidget::IntervalColorList::iterator it = icList.begin();
4251
it != icList.end(); ++it ) {
4252
QDomElement columnBackgroundColorElement =
4253
doc.createElement( "IntervalBackgroundColor" );
4254
columnBackgroundColorsElement.appendChild( columnBackgroundColorElement );
4255
KDGanttXML::createDateTimeNode( doc, columnBackgroundColorElement,
4256
"DateTimeStart", (*it)->start() );
4257
KDGanttXML::createDateTimeNode( doc, columnBackgroundColorElement,
4258
"DateTimeEnd", (*it)->end() );
4259
KDGanttXML::createColorNode( doc, columnBackgroundColorElement,
4260
"Color", (*it)->color() );
4261
//KDGanttXML::createIntNode( doc, columnBackgroundColorElement, "Priority", (*it).priority );
4262
//KDGanttXML::createStringNode( doc, columnBackgroundColorElement, "MinScale", scaleToString( (*it).minScaleView ) );
4263
//KDGanttXML::createStringNode( doc, columnBackgroundColorElement, "MaxScale", scaleToString( (*it).maxScaleView ) );
4266
// the LegendItems element
4267
QDomElement legendItemsElement =
4268
doc.createElement( "LegendItems" );
4269
docRoot.appendChild( legendItemsElement );
4270
legendItem* current;
4271
QPtrListIterator<legendItem> lit( myLegendItems );
4272
while( ( current = lit.current() ) ) {
4274
QDomElement legendItemElement = doc.createElement( "LegendItem" );
4275
legendItemsElement.appendChild( legendItemElement );
4276
KDGanttXML::createStringNode( doc, legendItemElement, "Shape",
4277
KDGanttViewItem::shapeToString( current->shape ) );
4278
KDGanttXML::createColorNode( doc, legendItemElement, "Color",
4280
KDGanttXML::createStringNode( doc, legendItemElement, "Text",
4282
if ( current->has2 ) {
4283
KDGanttXML::createStringNode( doc, legendItemElement, "Shape2",
4284
KDGanttViewItem::shapeToString( current->shape2 ) );
4285
KDGanttXML::createColorNode( doc, legendItemElement, "Color2",
4287
KDGanttXML::createStringNode( doc, legendItemElement, "Text2",
4292
// the DragEnabled element
4293
KDGanttXML::createBoolNode( doc, docRoot, "DragEnabled", isDragEnabled() );
4295
// the DropEnabled element
4296
KDGanttXML::createBoolNode( doc, docRoot, "DropEnabled", isDropEnabled() );
4298
// the CalendarMode element
4299
KDGanttXML::createBoolNode( doc, docRoot, "CalendarMode", calendarMode() );
4300
KDGanttXML::createIntNode( doc, docRoot, "TickcountForTimeline", addTickcountForTimeline() );
4302
KDGanttXML::createBoolNode( doc, docRoot, "DisplaySubitemsAsGroup", displaySubitemsAsGroup() );
4303
KDGanttXML::createBoolNode( doc, docRoot, "WeekScaleShowNumber",weekScaleShowNumber() );
4304
KDGanttXML::createBoolNode( doc, docRoot, "WeekStartsMonday", weekStartsMonday() );
4305
KDGanttXML::createBoolNode( doc, docRoot, "UserHorizonChangeEnabled", userHorizonChangeEnabled() );
4307
KDGanttXML::createStringNode( doc, docRoot, "TimeHeaderDatetimeFormatHour",timeHeaderDatetimeFormatHour() );
4308
KDGanttXML::createStringNode( doc, docRoot, "TimeHeaderDatetimeFormatMinute", timeHeaderDatetimeFormatMinute() );
4309
KDGanttXML::createStringNode( doc, docRoot, "TimeHeaderDatetimeFormatSecond", timeHeaderDatetimeFormatSecond() );
4310
KDGanttXML::createStringNode( doc, docRoot, "TimeHeaderDateFormatDay", timeHeaderDateFormatDay() );
4311
KDGanttXML::createStringNode( doc, docRoot, "TimeHeaderDateFormatWeek", timeHeaderDateFormatWeek() );
4312
KDGanttXML::createStringNode( doc, docRoot, "TimeHeaderDateFormatMonth", timeHeaderDateFormatMonth() );
4313
KDGanttXML::createStringNode( doc, docRoot, "TimeHeaderTooltipDateTimeFormat", timeHeaderTooltipDateTimeFormat() );
4314
QDomElement userElement = doc.createElement( "UserSavedData" );
4315
docRoot.appendChild( userElement );
4316
userWriteToElement( doc, userElement );
4321
This virtual method does nothing.
4322
Reimplement it to save your own data to the QDomElement.
4323
The data can be read with userReadFromElement().
4324
The body contains a small example to write an int value and a QString,
4325
which is commented out.
4326
This method is automatically called from KDGanttView::saveXML( bool withPI )
4327
which is called from KDGanttView::saveProject().
4329
\param doc the DOM document to which the node belongs
4330
\param parentElement the element into which to insert user defined data
4331
\sa userReadFromElement()
4333
void KDGanttView::userWriteToElement( QDomDocument& doc,
4334
QDomElement& userElement ) const
4337
Q_UNUSED( userElement );
4338
// example for writing user defined data
4340
int userNumber = 815;
4341
QString userData = "this is saved text from the user";
4342
KDGanttXML::createStringNode( doc, userElement, "ExampleText", userData );
4343
KDGanttXML::createIntNode( doc, userElement, "ExampleNumber", userNumber );
4348
This virtual method does nothing.
4349
Reimplement it to read your own data from the QDomElement.
4350
The data was written from userWriteToElement().
4351
The body contains a small example to read an int value and a QString,
4352
which is commented out.
4353
This method is automatically called from
4354
loadXML() which is called from KDGanttView::loadProject().
4356
\param doc the DOM document to which the node belongs
4357
\param parentElement the element which contains user defined data
4358
\sa userWriteToElement() createFromDomElement() loadFromDomElement()
4360
void KDGanttView::userReadFromElement( QDomElement& element )
4362
Q_UNUSED( element );
4363
// example for reading user defined data
4366
QString userData = "";
4367
QDomNode node = element.firstChild();
4368
while( !node.isNull() ) {
4369
QDomElement userElement = node.toElement();
4370
QString tagName = userElement.tagName();
4371
if ( tagName == "ExampleNumber" ) {
4373
if( KDGanttXML::readIntNode( userElement, value ) )
4375
} else if ( tagName == "ExampleText" ) {
4377
if( KDGanttXML::readStringNode( userElement, value ) )
4381
node = node.nextSibling();
4383
qDebug() <<"User data read: " << userNumber << " " << userData;
4387
QString KDGanttView::scaleToString( Scale scale )
4409
KDGanttView::Scale KDGanttView::stringToScale( const QString& string )
4412
if( string == "Second" )
4414
else if( string == "Minute" )
4416
else if( string == "Hour" )
4418
else if( string == "Day" )
4420
else if( string == "Week" )
4422
else if( string == "Month" )
4424
else if( string == "Auto" )
4431
QString KDGanttView::yearFormatToString( YearFormat format )
4438
case TwoDigitApostrophe:
4439
return "TwoDigitApostrophe";
4447
KDGanttView::YearFormat KDGanttView::stringToYearFormat( const QString& string )
4449
if( string == "FourDigit" )
4451
else if( string == "TwoDigit" )
4453
else if( string == "TwoDigitApostrophe" )
4454
return TwoDigitApostrophe;
4455
else if( string == "NoDate" )
4462
QString KDGanttView::hourFormatToString( HourFormat format )
4469
case Hour_24_FourDigit:
4470
return "Hour_24_FourDigit";
4476
KDGanttView::HourFormat KDGanttView::stringToHourFormat( const QString& string )
4478
if( string == "Hour_12" )
4480
else if( string == "Hour_24" )
4483
return Hour_24_FourDigit;
4487
void KDGanttView::addTaskLinkGroup(KDGanttViewTaskLinkGroup* group)
4489
if ( group == 0 ) return;
4490
if (myTaskLinkGroupList.isEmpty()) {
4491
myTaskLinkGroupList.append(group);
4494
if (myTaskLinkGroupList.find(group) == -1)
4495
myTaskLinkGroupList.append(group);
4499
void KDGanttView::removeTaskLinkGroup(KDGanttViewTaskLinkGroup* group)
4501
myTaskLinkGroupList.remove(group);
4506
This slot is called when a new item has been added to the Gantt
4507
view. It will show the item attribute dialog in case the item is
4508
editable. \a item is a pointer to the item that has been created.
4510
void KDGanttView::editItem( KDGanttViewItem* item)
4514
if ( editorEnabled() ) {
4515
if ( item->editable() ) {
4516
#if QT_VERSION < 0x040000
4517
if ( !myItemAttributeDialog ) {
4518
myItemAttributeDialog = new itemAttributeDialog();
4519
myItemAttributeDialog->resize( myItemAttributeDialog->minimumSizeHint() );
4521
myItemAttributeDialog->reset( item );
4522
myItemAttributeDialog->show();
4530
This method returns the pixmap used for a certain shape, in the
4531
selected color and size.
4533
\param shape the shape to generate
4534
\param shapeColor the foreground color of the shape
4535
\param backgroundColor the background color of the shape
4536
\param itemSize the size of the shape
4537
\return the generated shape pixmap
4539
QPixmap KDGanttView::getPixmap( KDGanttViewItem::Shape shape,
4540
const QColor& shapeColor,
4541
const QColor& backgroundColor, int itemSize)
4543
// 10 is a good value as size
4544
int size = itemSize+2;
4545
int hei = ( itemSize/3 ) / 2;
4546
QPixmap p = QPixmap( size+4, size+4 );
4547
p.fill( backgroundColor );
4548
QPainter paint (&p);
4549
QBrush b = QBrush ( Qt::SolidPattern );
4550
b.setColor( shapeColor );
4551
paint.setBrush( b );
4552
QPen pen( Qt::black, 1 ) ;
4553
paint.setPen( pen );
4555
case KDGanttViewItem::TriangleDown:{
4556
QPointArray arr = QPointArray(3);
4557
arr.setPoint(0,-size/2,-hei);
4558
arr.setPoint(1,size/2,-hei);
4559
arr.setPoint(2,0,((size/2)-hei));
4560
arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
4561
paint.drawPolygon( arr );
4564
case KDGanttViewItem::TriangleUp :{
4565
QPointArray arr = QPointArray(3);
4566
arr.setPoint(0,-size/2,hei);
4567
arr.setPoint(1,size/2,hei);
4568
arr.setPoint(2,0,(-size/2)+hei);
4569
arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
4570
paint.drawPolygon( arr );
4573
case KDGanttViewItem::Diamond :{
4574
QPointArray arr = QPointArray(4);
4575
arr.setPoint(0,0,-size/2);
4576
arr.setPoint(1,size/2,0);
4577
arr.setPoint(2,0,size/2);
4578
arr.setPoint(3,-size/2,0);
4579
arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
4580
paint.drawPolygon( arr );
4583
case KDGanttViewItem::Square :{
4584
QPointArray arr = QPointArray(4);
4585
arr.setPoint(0,-size/2,-size/2);
4586
arr.setPoint(1,size/2,-size/2);
4587
arr.setPoint(2,size/2,size/2);
4588
arr.setPoint(3,-size/2,size/2);
4589
arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
4590
paint.drawPolygon( arr );
4593
case KDGanttViewItem::Circle :{
4594
paint.drawEllipse( 2, 2, size, size);
4602
int KDGanttView::getIndex( KDGanttViewItem::Type type) const
4606
case (KDGanttViewItem::Event):
4609
case (KDGanttViewItem::Task):
4612
case (KDGanttViewItem::Summary):
4622
void KDGanttView::initDefaults()
4625
// We have 3 item types. Set all undefined to true.
4626
for (i = 0;i<3;++i) {
4627
undefinedShape[i] = true;
4628
undefinedColor[i] = true;
4629
undefinedColorHL[i] = true;
4631
// setting the default colors
4632
myDefaultColor [ getIndex( KDGanttViewItem::Event ) ] = Qt::blue; //event
4633
myDefaultColorHL [ getIndex( KDGanttViewItem::Event ) ] = Qt::red;
4634
myDefaultColor [ getIndex( KDGanttViewItem::Task ) ] = Qt::green;//task
4635
myDefaultColorHL [ getIndex( KDGanttViewItem::Task ) ] = Qt::red;
4636
myDefaultColor [ getIndex( KDGanttViewItem::Summary ) ] = Qt::cyan;//summary
4637
myDefaultColorHL [ getIndex( KDGanttViewItem::Summary ) ] = Qt::red;
4639
// setting the default shape types
4640
// currently, we take for each item for all three shapes (start, middle, end) the same default shape
4641
for (i = 0;i<3;++i) {
4642
myDefaultShape [3*getIndex( KDGanttViewItem::Event )+ i] = KDGanttViewItem::Diamond; //event
4643
myDefaultShape [3*getIndex( KDGanttViewItem::Task ) +i] = KDGanttViewItem::Square; //task
4644
myDefaultShape [3*getIndex( KDGanttViewItem::Summary ) +i] = KDGanttViewItem::TriangleDown; //summary
4652
Calls to this method are passed through to the underlying \a QListView.
4654
int KDGanttView::addColumn( const QString& label, int width )
4656
return myListView->addColumn( label, width );
4661
Calls to this method are passed through to the underlying \a QListView.
4664
int KDGanttView::addColumn( const QIconSet& iconset, const QString& label,
4667
return myListView->addColumn( iconset, label, width );
4672
Calls to this method are passed through to the underlying \a QListView.
4674
void KDGanttView::removeColumn( int index )
4676
myListView->removeColumn( index );
4681
Calls to this method are passed through to the underlying \a QListView.
4683
KDGanttViewItem* KDGanttView::selectedItem() const
4685
return static_cast<KDGanttViewItem*>( myListView->selectedItem() );
4690
Calls to this method are passed through to the underlying \a QListView.
4692
void KDGanttView::setSelected( KDGanttViewItem* item, bool selected )
4694
myListView->setSelected( item, selected );
4699
Returns the pointer to the Gantt item with the name \a name.
4700
(i.e., listViewText() == name).
4701
If no item is found, the return value is 0.
4702
If there is more than one item with the same name in the Gantt view,
4703
the first item found will be returned. This may not necessarily be
4704
the first item in the listview.
4706
\param name the name of the Gantt item
4707
\return the pointer to the item with name \a name. O, if there is no item
4708
in the Gantt view with this name.
4711
KDGanttViewItem* KDGanttView::getItemByName( const QString& name ) const
4713
KDGanttViewItem* temp = firstChild(),* ret;
4715
if ( (ret = temp->getChildByName( name ) ) )
4717
temp = temp->nextSibling();
4722
Returns the pointer to the Gantt item with the uid \a uid.
4723
If no item is found, the return value is 0.
4724
The uid of an item is not set automatically,
4725
it has to be set by the programmer.
4726
If there is more than one item with the same uid in the Gantt view,
4727
the first item found will be returned. This may not necessarily be
4728
the first item in the listview.
4730
\param uid the uid of the requested KDGanttViewItem item
4731
\param a pointer to a KDGanttViewItem which children are searched for the
4733
pass 0 to search in all KDGanttViewItems in the Gantt view.
4734
\return the pointer to the item with uid \a uid. O, if there is no item
4735
in the Gantt view with this name.
4736
\sa KDGanttViewItem::getChildByUid() KDGanttViewItem::uid() KDGanttViewItem::setUid()
4739
KDGanttViewItem* KDGanttView::getItemByUid( const QString& uid, KDGanttViewItem* parentItem ) const
4741
if ( parentItem != 0 )
4742
return parentItem->getChildByUid( uid );
4744
KDGanttViewItem* temp = firstChild(),* ret;
4746
if ( (ret = temp->getChildByUid( uid ) ) )
4748
temp = temp->nextSibling();
4755
Returns the pointer to the Gantt item at the position \a pos in the
4757
The position \a pos is a global position.
4758
If no item is found, 0 is returned.
4760
\param pos the (global) position of the Gantt item
4761
\return the pointer to the item with position \a pos. O, if there is
4762
no item in the list view at this position.
4765
KDGanttViewItem* KDGanttView::getItemByListViewPos( const QPoint& pos ) const
4767
return static_cast<KDGanttViewItem*>( myListView->itemAt(myListView->mapFromGlobal(pos) ));
4772
Returns the pointer to the Gantt item at the position \a pos in the
4774
The position \a pos is a global position.
4775
If no items are found, or the item is disabled, 0 is returned.
4776
If there is more than one item with the same position in the Gantt view,
4777
the first item found will be returned. This is not necessarily the
4778
first item in the listview.
4780
\param pos the (global) position of the Gantt item
4781
\return the pointer to the item with position \a pos. O, if there is no item
4782
in the Gantt view at this position.
4785
KDGanttViewItem* KDGanttView::getItemByGanttViewPos( const QPoint& pos ) const
4787
KDGanttViewItem* item;
4788
QPoint local = myCanvasView->mapFromGlobal(pos);
4790
QCanvasItemList il = myTimeTable->collisions( myCanvasView->viewportToContents( local ));
4791
QCanvasItemList::Iterator it;
4792
for ( it = il.begin(); it != il.end(); ++it ) {
4793
if ( myCanvasView->getType(*it) == Type_is_KDGanttViewItem) {
4794
item = myCanvasView->getItem(*it);
4795
if ( item->enabled() )
4804
Returns the pointer to the Gantt item at the position \a pos in the
4805
list view part of the Gantt view.
4806
The position \a pos is a global position if parameter \a global is true.
4807
If the vertical part (y coordinate) of \a pos
4808
(mapped to local coordinates) is less than 0 or
4809
larger than the height of the listview, 0 is returned.
4810
The horizontal part (x coordinate) of \a pos is ignored.
4811
\param pos the position of the Gantt item
4812
\param global if true, pos is assumed to be global
4813
\return the pointer to the item with position \a pos. O, if there is no item
4814
in the Gantt view at this position.
4817
KDGanttViewItem* KDGanttView::getItemAt( const QPoint& pos, bool global ) const
4819
KDGanttViewItem* item;
4820
KDGanttViewItem* retItem = 0;
4823
y = myCanvasView->viewport()->mapFromGlobal(pos).y()+myCanvasView->contentsY ();
4826
item = firstChild();
4827
while ( item != 0 ) {
4828
int yc = item->itemPos();
4829
if ( yc <= y && y < yc + item->height()) {
4833
item = item->itemBelow();
4839
This sets to count of minor ticks that are added to the timeline if the user
4840
expand the horizon by pressing the arrow buttons of the horizontal scrollbar of the gantt view.
4841
\param count the tick count
4842
in the Gantt view at this position.
4843
\sa addTickcountForTimeline()
4846
void KDGanttView::setAddTickcountForTimeline( int count )
4848
mAddTickcountForTimeline = count;
4851
Returns the count for adding ticks to the timeline if the user clicks on the arrow
4852
buttons of the horizontal scrollbar of the gantt view.
4854
\return the tick count
4855
\sa setAddTickcountForTimeline()
4857
int KDGanttView::addTickcountForTimeline() const
4859
return mAddTickcountForTimeline;
4862
void KDGanttView::addTickRight()
4864
if ( !mFixedHorizon && _enableAdding && myCanvasView->horizontalScrollBar()->value() == myCanvasView->horizontalScrollBar()->maximum()) {
4865
//myCanvasView->horizontalScrollBar()->blockSignals( true );
4866
myTimeHeader->addTickRight();
4867
//myCanvasView->horizontalScrollBar()->blockSignals( false );
4868
myCanvasView->updateHorScrollBar();
4873
void KDGanttView::addTickLeft()
4875
if (!mUserHorizonChangeEnabled) {
4876
emit addOneTickLeft();
4879
if ( myCanvasView->horizontalScrollBar()->value() == 0 ) {
4880
myTimeHeader->addTickLeft( mAddTickcountForTimeline );
4882
if ( !mFixedHorizon && _enableAdding && myCanvasView->horizontalScrollBar()->value() == 0 ) {
4883
myCanvasView->horizontalScrollBar()->blockSignals( true );
4884
myTimeHeader->addTickLeft();
4885
myCanvasView->horizontalScrollBar()->blockSignals( false );
4886
setTimelineToStart();
4891
void KDGanttView::enableAdding( int val )
4893
_enableAdding = ( val == 0 || val == myCanvasView->horizontalScrollBar()->maximum());
4898
Returns the number of ( toplevel ) root items in the Gantt view.
4900
\return the number of ( toplevel ) root items in the Gantt view.
4902
int KDGanttView::childCount() const
4904
return myListView->childCount();
4908
Clears the complete content of the Gant view.
4911
the legend and the legend items,
4913
the tasklink groups and
4914
the background color settings for columns/time interval in the gantt view.
4917
void KDGanttView::clearAll()
4919
bool block = myTimeTable->blockUpdating();
4920
myTimeTable->setBlockUpdating( true );
4922
clearBackgroundColor();
4923
setHorBackgroundLines( 0 );
4924
QPtrList<KDGanttViewTaskLink> tll = taskLinks();
4925
tll.setAutoDelete( true );
4927
QPtrList<KDGanttViewTaskLinkGroup> tlg = myTaskLinkGroupList;
4928
tlg.setAutoDelete( true );
4931
myTimeTable->setBlockUpdating( block );
4934
Removes all items from the Gantt view.
4936
void KDGanttView::clear()
4938
if ( ! childCount() ) return;
4939
bool block = myTimeTable->blockUpdating();
4940
myTimeTable->setBlockUpdating( true );
4941
myListView->clear();
4942
// in Qt3 wee need the processEvents(); to fix a crash
4943
// in Qt4 with Qt3 compat it crashes here
4944
// I had a look at the Q3ListView source code:
4945
// in theory it may not crash ... in theory
4946
#if QT_VERSION < 0x040000
4947
qApp->processEvents();
4949
myTimeTable->setBlockUpdating( false );
4950
myTimeTable->updateMyContent();
4951
#if QT_VERSION < 0x040000
4952
qApp->processEvents();
4954
myTimeTable->setBlockUpdating( block );
4959
Passes on the signal from the list view.
4961
void KDGanttView::slot_lvDropped(QDropEvent* e, KDGanttViewItem* droppedItem, KDGanttViewItem* itemBelowMouse )
4963
emit dropped( e, droppedItem, itemBelowMouse);
4967
Implements a pass-through to the list view.
4969
QDragObject * KDGanttView::dragObject ()
4971
return myListView->dragObject ();
4976
Implements a pass-through to the list view.
4978
void KDGanttView::startDrag ()
4980
//myListView->pt_startDrag ();
4985
This method is overridden for internal purposes.
4988
// This overridden method is not called any more, as it is deprecated"
4989
void KDGanttView::setPaletteBackgroundColor( const QColor& col)
4991
QPalette pal = palette();
4992
pal.setColor( backgroundRole(), col );
4993
QWidget::setPalette( pal );
4994
timeHeaderSpacerWidget->setPalette( pal );
4999
Sets the background color of the Gantt view.
5001
\param c the background color of the Gantt view.
5002
\sa gvBackgroundColor()
5004
void KDGanttView::setGvBackgroundColor ( const QColor & c )
5006
myTimeTable->setBackgroundColor( c );
5011
Sets the background color of the time header.
5013
\param c the background color of the time header.
5014
\sa timeHeaderBackgroundColor()
5016
void KDGanttView::setTimeHeaderBackgroundColor ( const QColor & c )
5019
pal.setColor( myTimeHeader->backgroundRole(), c );
5021
myTimeHeader->setPalette( pal );
5022
//rightWidget->setPalette( pal );
5024
pal.setColor( timeHeaderSpacerWidget->backgroundRole(), c );
5025
timeHeaderSpacerWidget->setPalette( pal );
5030
Sets the background color of the legend header.
5032
\param c the background color of the legend header
5033
\sa legendHeaderBackgroundColor()
5035
void KDGanttView::setLegendHeaderBackgroundColor ( const QColor & c )
5038
pal.setColor( myLegend->backgroundRole(), c );
5039
myLegend->setPalette( pal );
5041
pal.setColor( leftWidget->backgroundRole(), c );
5042
leftWidget->setPalette( pal );
5047
Sets the background color of the list view.
5049
\param c the background color of the list view
5050
\sa lvBackgroundColor()
5052
void KDGanttView::setLvBackgroundColor ( const QColor & c )
5055
pal.setColor( myListView->viewport()->backgroundRole(), c );
5056
myListView->viewport()->setPalette( pal );
5061
Returns the background color of the list view.
5063
\return the background color of the list view
5064
\sa setLvBackgroundColor()
5066
QColor KDGanttView::lvBackgroundColor ( )const
5068
return myListView->viewport()->palette().color(myListView->viewport()->backgroundRole());
5073
Returns the background color of the Gantt view.
5075
\return the background color of the Gantt view
5076
\sa setGvBackgroundColor()
5078
QColor KDGanttView::gvBackgroundColor () const
5080
return myTimeTable->backgroundColor( );
5085
Returns the background color of the time header.
5087
\return the background color of the time header
5088
\sa setTimeHeaderBackgroundColor()
5090
QColor KDGanttView::timeHeaderBackgroundColor () const
5092
return myTimeHeader->palette().color(myTimeHeader->backgroundRole());
5097
Returns the background color of the legend header.
5099
\return the background color of the legend header
5100
\sa setLegendHeaderBackgroundColor()
5102
QColor KDGanttView::legendHeaderBackgroundColor () const
5104
return myLegend->palette().color(myLegend->backgroundRole());
5109
Adds a widget to the spacer widget above the list view part and
5110
below the ShowLegendButton. To assign all the space above the
5111
Listview to the spacer widget, hide the ShowLegendButton by calling
5112
setShowLegendButton( false ). The spacer widget is a QHBox. You
5113
may add as many widgets as you want. They are ordered horizontally
5114
from left to right. To remove a widget from the spacer widget, call
5115
widget->reparent(newParent,...) or delete the widget. Since the spacer
5116
is a QHBox, the layout of the added widgets is managed by this
5119
\param w A pointer to the widget to be added.
5120
\sa setShowLegendButton( )
5122
void KDGanttView::addUserdefinedLegendHeaderWidget( QWidget * w )
5125
w->setParent ( spacerLeft );
5126
spacerLeftLayout->addWidget( w );
5132
Specifies whether drag operations are allowed in the Gantt
5133
view. Recurses over all items contained in the Gantt view and
5134
enables or disabled them for dragging.
5136
\param b true if dragging is enabled, false if dragging is disabled
5137
\sa isDragEnabled(), setDropEnabled(), isDropEnabled(), setDragDropEnabled()
5139
void KDGanttView::setDragEnabled( bool b )
5142
QListViewItemIterator it( myListView );
5143
for ( ; it.current(); ++it ) {
5144
(( KDGanttViewItem* )it.current())->setDragEnabled(b);
5151
Specifies whether drop operations are allowed in the Gantt
5152
view. Recurses over all items contained in the Gantt view and
5153
enables or disabled them for dropping.
5155
\param b true if dragging is enabled, false if dragging is disabled
5156
\sa setDropEnabled(), setDragEnabled(), isDragEnabled(), setDragDropEnabled()
5158
void KDGanttView::setDropEnabled( bool b )
5162
//myListView->setAcceptDrops( b );
5163
QListViewItemIterator it( myListView );
5164
for ( ; it.current(); ++it ) {
5165
(( KDGanttViewItem* )it.current())->setDropEnabled(b);
5171
Combines setDragEnabled() and setDropEnabled() in one convenient
5174
\param b true if dragging and dropping are enabled, false if
5175
dragging and dropping are disabled
5176
\sa setDragEnabled(), setDropEnabled()
5178
void KDGanttView::setDragDropEnabled( bool b )
5180
setDropEnabled( b );
5181
setDragEnabled( b );
5186
Returns whether dragging is enabled for this Gantt view.
5188
\return true if dragging is enabled
5189
\sa setDragEnabled(), setDragDropEnabled()
5191
bool KDGanttView::isDragEnabled() const
5193
return fDragEnabled;
5198
Returns whether dropping is enabled for this Gantt view.
5200
\return true if dropping is enabled
5201
\sa setDropEnabled(), setDragDropEnabled()
5203
bool KDGanttView::isDropEnabled() const
5205
return fDropEnabled;
5210
\deprecated Use isDragEnabled() instead
5212
bool KDGanttView::dragEnabled() const
5214
return isDragEnabled();
5219
\deprecated Use isDropEnabled() instead
5221
bool KDGanttView::dropEnabled() const
5223
return isDropEnabled();
5228
This virtual method makes it possible to specify user-defined drop
5229
handling. The method is called directly before the internal drop
5230
handling is executed. Return false to execute internal drop
5231
handling. Return true to not execute internal drop handling. In
5232
order to specify user-defined drop handling, subclass
5233
KDGanttView and reimplement this method.
5235
\param e The QDropEvent
5236
Note: e->source() is a pointer to the KDGanttView from which the drag started.
5237
I.e., if e->source() == this, this drag is an internal drag.
5238
\param droppedItem 0, if this is a drag operation from another
5239
KDGanttView instance.
5240
If this drag is an internal drag (i.e., within the KDGanttView),
5241
this parameter points to the dropped item.
5242
\param itemBelowMouse a pointer to the item below the dragged
5243
item (i.e., below the mouse).
5244
If you accept, the dragged item may be inserted
5245
in the KDGanttView as a child of this item.
5246
The value is 0 if there is no item below the dragged item,
5247
and the dragged item will be inserted as a root item.
5249
\return false, when the internal drop handling should be executed
5250
true, when the internal drop handling should not be executed
5251
\sa lvDropEvent(), lvStartDrag()
5253
bool KDGanttView::lvDropEvent ( QDropEvent* e,
5254
KDGanttViewItem* droppedItem,
5255
KDGanttViewItem* itemBelowMouse )
5258
Q_UNUSED( droppedItem );
5259
Q_UNUSED( itemBelowMouse );
5261
// Example code for user defined behaviour:
5262
// we want to accept the usual drags and the drags of files, which may be
5263
// a saved Gantt file.
5264
// Please uncomment the following lines for this behaviour
5265
// You have to uncomment lines in lvDragMoveEvent() and llvDragEnterEvent() as well
5267
// ************** begin example ************
5269
if ( QUriDrag::canDecode( e ) ) {
5271
QUriDrag::decode( e, lst );
5272
// we try the first file of icon-url-list
5273
QString str = lst.at ( 0 );
5274
// remove file: at beginning of string
5275
str = str.right( str.length() - 5 );
5277
info.setFile( str ) ;
5278
if ( info.isFile() ) {
5279
if (!QMessageBox::information( this, "KDGantt Drag&Drop test",
5280
"Try to insert file: "+ str + " ?",
5281
"&Okay", "&Cancel",0,1 ) ) {
5283
loadProject( &file ) ;
5288
// *********** end example ****************
5294
This virtual method specifies whether a drag enter event may be
5296
To accept a drag enter event, call e->accept( true );
5297
To not accept a drag enter evente, call e->accept( false );
5298
This method does nothing but accepting the drag enter event, in case
5299
decoding is possible.
5300
In order to define accepting drops for particular items yourself,
5301
subclass KDGanttView and reimplement this method.
5303
\param e The QDragMoveEvent
5304
Note: e->source() is a pointer to the KDGanttView, the drag started from.
5305
I.e., if e->source() == this, this drag is an internal drag.
5307
\sa lvDropEvent(), lvStartDrag(), lvDragMoveEvent()
5309
void KDGanttView::lvDragEnterEvent ( QDragEnterEvent * e)
5311
// the standard behaviour:
5312
// accept drag enter events, if KDGanttViewItemDrag can decode the event
5313
// e->accept(KDGanttViewItemDrag::canDecode(e) );
5315
if ( KDGanttViewItemDrag::canDecode(e) ) {
5316
e->setAccepted( true);
5320
// example code for user defined behaviour:
5321
// we want to accecpt the usual drags and the drags of files, which may be
5322
// a saved Gantt file
5323
// Please uncomment the following lines for this behaviour
5324
// You have to uncomment lines in lvDragMoveEvent() and lvDropEvent () as well
5326
// if ( QUriDrag::canDecode( e ) ) {
5331
e->setAccepted( false );
5336
This virtual method specifies whether a drop event may be accepted or not.
5337
To accept a drop event, call e->accept( true );
5338
To not accept a drop event, call e->accept( false );
5339
This method does nothing but allowing to execute the internal
5340
drag move event handling.
5342
In order to specify user-defined drop acceptance for particular
5343
items, subclass KDGanttView and reimplement this method.
5345
\param e The QDragMoveEvent
5346
Note: e->source() is a pointer to the KDGanttView, the drag started from.
5347
I.e. if e->source() == this, this drag is an internal drag.
5348
draggedItem 0, if this is a drag operation from another KDGanttView instance.
5349
If this drag is an internal drag (i.e., within the KDGanttView),
5350
this parameter points to the dragged item.
5351
itemBelowMouse a pointer to the item below the dragged item
5352
(i.e., below the mouse).
5353
If you accept the drop, the dragged item will be inserted
5354
in the KDGanttView as a child of this item.
5355
The value is 0 if there is no item below the dragged item,
5356
and the dragged item will be inserted as a root item.
5357
\return false, when the internal drag move event handling should be executed
5358
true, when the internal drag move event handling should not
5359
be executed; usually you should return true,
5360
if you have called e->accept( true ) before.
5361
\sa lvDropEvent(), lvStartDrag()
5363
bool KDGanttView::lvDragMoveEvent ( QDragMoveEvent* /*e*/,
5364
KDGanttViewItem* /* draggedItem*/,
5365
KDGanttViewItem* /*itemBelowMouse*/)
5369
// To generally block items to be inserted as root items, subclass KDGanttView
5370
// and reimplement this method with to following code uncommented:
5372
// if ( !itemBelowMouse ) {
5373
// e->accept( false );
5379
// To allow the drags of files, which may be
5380
// a saved Gantt file, subclass KDGanttView
5381
// and reimplement this method with to following code uncommented:
5383
// if ( QUriDrag::canDecode( e ) ) {
5389
// normal behaviour - the internal drag move event handling should be executed
5395
This virtual method creates a QDragObject and starts a drag for a
5397
In order to prevent drags of particular items, subclass from
5398
KDGanttView and reimplement this method.
5400
\param item the KDGanttViewItem, which should be dragged
5401
\sa lvDropEvent(), lvDragMoveEvent()
5403
void KDGanttView::lvStartDrag (KDGanttViewItem* item)
5405
QDragObject* d = new KDGanttViewItemDrag(item, this, "itemdrag" );
5406
// call d->drag() to start the dragging
5407
// d->drag() returns true, if a move was requested as a drag
5408
// if a copy (by pressing the <Ctrl>-key) was performed, d->drag() returns false
5409
// In order to avoid starting drags for particular items, subclass KDGanttView
5410
// an reimplement this method.
5411
// insert here some code like
5412
// if ( item->parent() )
5414
// This particular code will make it impossible to drag other items but root items.
5422
Sets the width of the list view. Space will be taken from or given
5425
\param w the width of the list view
5428
void KDGanttView::setListViewWidth( int w )
5430
int sw = mySplitter->width();
5431
QValueList<int> list;
5434
mySplitter->setSizes( list );
5439
Returns the width of the list view.
5441
\return the width of the list view
5442
\sa setListViewWidth()
5444
int KDGanttView::listViewWidth( )
5446
return leftWidget->width();
5451
Sets the scrollbar mode of the listview. The default is always off.
5452
Possible values are always on, always off and auto.
5453
It only makes sense to set this to always off
5454
if setGvVScrollBarMode() is set to always on.
5456
\param m the scrollbar mode.
5457
\sa setGvVScrollBarMode( )
5459
void KDGanttView::setLvVScrollBarMode( QScrollView::ScrollBarMode m )
5461
myListView->setVScrollBarMode ( m );
5466
Sets the scrollbar mode of the time table. The default is auto.
5467
Possible values are auto, always on and always off.
5468
It only makes sense to set this to always off
5469
if setLvVScrollBarMode() is set to always on or auto.
5471
\param m The scrollbar mode.
5472
\sa setLvVScrollBarMode( )
5474
void KDGanttView::setGvVScrollBarMode( QScrollView::ScrollBarMode m )
5476
myCanvasView->setMyVScrollBarMode ( m );
5478
if ( m == QScrollView::Auto )
5479
qDebug() "KDGanttView::setListViewVScrollBarMode: QScrollView::Auto not supported. Nothing changed. ";
5482
myCanvasView->setMyVScrollBarMode ( m );
5483
if ( m == QScrollView::AlwaysOn )
5484
timeHeaderSpacerWidget->setFixedWidth(myCanvasView->verticalScrollBar()->width() );
5486
timeHeaderSpacerWidget->setFixedWidth( 0 );
5492
void KDGanttView::itemAboutToBeDeleted( KDGanttViewItem * item)
5494
#if QT_VERSION < 0x040000
5495
if ( myItemAttributeDialog && myItemAttributeDialog->getItem() == item ) {
5496
myItemAttributeDialog->reset( 0 );
5499
emit itemDeleted( item );
5504
Specifies whether the user can expand the horizon
5505
by pressing the arrow buttons of the horizontal scrollbar of the gantt view.
5506
The default value for a newly created gantt chart is true.
5507
If set to false, the signal addOneTickLeft() or addOneTickRight() is emitted,
5508
depending on the arrow button the user pressed.
5510
\param show if true, the user can expand the horizon.
5511
\sa userHorizonChangeEnabled() addOneTickLeft() addOneTickRight()
5514
void KDGanttView::setUserHorizonChangeEnabled( bool b )
5516
mUserHorizonChangeEnabled = b;
5521
Returns whether the user can expand the horizon
5522
by clicking the scrollbar buttons.
5524
\return true if the user can expand the horizon
5525
\sa setUserHorizonChangeEnabled()
5526
*/bool KDGanttView::userHorizonChangeEnabled() const
5528
return mUserHorizonChangeEnabled;
5532
This method is provided for convenience and as an example
5533
how to set the user defined date time formats.
5534
It sets the formats to formats which are used in Germany.
5536
setTimeHeaderTooltipDateTimeFormat( "dddd, dd. MMMM yyyy - h:mm:ss" );
5537
setHourFormat(Hour_24_FourDigit);
5538
setWeekScaleShowNumber( true );
5539
setWeekStartsMonday( true );
5540
setTimeHeaderDateFormatWeek( " d. MMM 'yy" );
5541
setTimeHeaderDateFormatDay( " d. MMM 'yy" );
5542
setTimeHeaderDatetimeFormatHour( "dddd, dd. MMM 'yy" );
5543
setTimeHeaderDatetimeFormatMinute( "ddd, dd. MMM h:mm" );
5545
\sa setTimeHeaderTooltipDateTimeFormat () setTimeHeaderDateFormatMonth() setTimeHeaderDateFormatWeek() setTimeHeaderDateFormatDay() setTimeHeaderDatetimeFormatMinute () setTimeHeaderDatetimeFormatHour() setWeekStartsMonday() setWeekScaleShowNumber()
5548
void KDGanttView::setGermanDateTimeFormat()
5550
setTimeHeaderTooltipDateTimeFormat( "dddd, dd. MMMM yyyy - h:mm:ss" );
5551
setHourFormat(Hour_24_FourDigit);
5552
setWeekScaleShowNumber( true );
5553
setWeekStartsMonday( true );
5554
setTimeHeaderDateFormatWeek( " d. MMM 'yy" );
5555
setTimeHeaderDateFormatDay( " d. MMM 'yy" );
5556
setTimeHeaderDatetimeFormatHour( "dddd, dd. MMM 'yy" );
5557
setTimeHeaderDatetimeFormatMinute( "ddd, dd. MMM h:mm" );
5558
//setTimeHeaderDatetimeFormatSecond( "dddd, dd. MMM h:mm" );
5562
Returns the user defined datetime format of the time header tooltip.
5563
Returns an empty string as default, i.e. if there is no user defined format.
5564
You can find details about the possible format itself in the Qt documentation of:
5565
QDateTime::toString ( const QString & format ) const
5566
QDate::toString( const QString & format )
5567
QTime::toString( const QString & format )
5569
\return user defined datetime format of the time header tooltip
5570
\sa setTimeHeaderTooltipDateTimeFormat ()
5572
QString KDGanttView::timeHeaderTooltipDateTimeFormat() const
5574
return myTimeHeader->tooltipDateTimeFormat();
5577
Sets the user defined datetime format of the time header tooltip.
5578
As default datetime format of the time header tooltip the return value of QDateTime::toString () is used..
5579
You can find details about the possible user defined format itself in the Qt documentation of:
5580
QDateTime::toString ( const QString & format ) const
5581
QDate::toString( const QString & format )
5582
QTime::toString( const QString & format )
5584
\param the datetime format of time header tooltip. To unset the user defined format pass an empty string.
5585
\sa timeHeaderTooltipDateTimeFormat()
5587
void KDGanttView::setTimeHeaderTooltipDateTimeFormat( const QString& fmt )
5589
myTimeHeader->setTooltipDateTimeFormat( fmt );
5593
Returns the user defined date format for the upper date row of the time header if the time header scale is set to month.
5594
Returns an empty string as default, i.e. if there is no user defined format.
5595
You can find details about the possible format itself in the Qt documentation of:
5596
QDateTime::toString ( const QString & format ) const
5597
QDate::toString( const QString & format )
5598
QTime::toString( const QString & format )
5600
\return user defined date format of the time header in monthly scale
5601
\sa setTimeHeaderDateFormatMonth()
5603
QString KDGanttView::timeHeaderDateFormatMonth() const
5605
return myTimeHeader->dateFormatMonth();
5609
Sets the user defined date format for the upper date row of the time header if the time header scale is set to month.
5610
You can find details about the possible user defined format itself in the Qt documentation of:
5611
QDateTime::toString ( const QString & format ) const
5612
QDate::toString( const QString & format )
5613
QTime::toString( const QString & format )
5615
\param the user defined date format of the time header in monthly scale
5616
\sa timeHeaderDateFormatMonth()
5618
void KDGanttView::setTimeHeaderDateFormatMonth( const QString& fmt )
5620
myTimeHeader->setDateFormatMonth( fmt );
5624
Returns the user defined date format for the upper date row of the time header if the time header scale is set to week.
5625
Returns an empty string as default, i.e. if there is no user defined format.
5626
You can find details about the possible format itself in the Qt documentation of:
5627
QDateTime::toString ( const QString & format ) const
5628
QDate::toString( const QString & format )
5629
QTime::toString( const QString & format )
5631
\return user defined date format of the time header in weekly scale
5632
\sa setTimeHeaderDateFormatWeek()
5634
QString KDGanttView::timeHeaderDateFormatWeek() const
5636
return myTimeHeader->dateFormatWeek();
5639
Sets the user defined date format for the upper date row of the time header if the time header scale is set to week.
5640
You can find details about the possible user defined format itself in the Qt documentation of:
5641
QDateTime::toString ( const QString & format ) const
5642
QDate::toString( const QString & format )
5643
QTime::toString( const QString & format )
5645
\param the user defined date format of the time header in weekly scale
5646
\sa timeHeaderDateFormatWeek()
5648
void KDGanttView::setTimeHeaderDateFormatWeek( const QString& fmt )
5650
myTimeHeader->setDateFormatWeek( fmt );
5653
Returns the user defined date format for the upper date row of the time header if the time header scale is set to day.
5654
Returns an empty string as default, i.e. if there is no user defined format.
5655
You can find details about the possible format itself in the Qt documentation of:
5656
QDateTime::toString ( const QString & format ) const
5657
QDate::toString( const QString & format )
5658
QTime::toString( const QString & format )
5660
\return user defined date format of the time header in daily scale
5661
\sa setTimeHeaderDateFormatDay()
5663
QString KDGanttView::timeHeaderDateFormatDay() const
5665
return myTimeHeader->dateFormatDay();
5668
Sets the user defined date format for the upper date row of the time header if the time header scale is set to day.
5669
You can find details about the possible user defined format itself in the Qt documentation of:
5670
QDateTime::toString ( const QString & format ) const
5671
QDate::toString( const QString & format )
5672
QTime::toString( const QString & format )
5674
\param the user defined date format of the time header in daily scale
5675
\sa timeHeaderDateFormatDay()
5677
void KDGanttView::setTimeHeaderDateFormatDay( const QString& fmt )
5679
myTimeHeader->setDateFormatDay( fmt );
5685
Returns the user defined datetime format for the upper date row of the time header if the time header scale is set to second.
5686
Returns an empty string as default, i.e. if there is no user defined format.
5687
You can find details about the possible format itself in the Qt documentation of:
5688
QDateTime::toString ( const QString & format ) const
5689
QDate::toString( const QString & format )
5690
QTime::toString( const QString & format )
5692
\return user defined date format of the time header in secondly scale
5693
\sa setTimeHeaderDateFormatSecond()
5695
QString KDGanttView::timeHeaderDatetimeFormatSecond() const
5697
return myTimeHeader->datetimeFormatSecond();
5700
Sets the user defined date format for the upper date row of the time header if the time header scale is set to second.
5701
You can find details about the possible user defined format itself in the Qt documentation of:
5702
QDateTime::toString ( const QString & format ) const
5703
QDate::toString( const QString & format )
5704
QTime::toString( const QString & format )
5706
\param the user defined date format of the time header in secondly scale
5707
\sa timeHeaderDateFormatMinute()
5709
void KDGanttView::setTimeHeaderDatetimeFormatSecond( const QString& fmt )
5711
myTimeHeader->setDatetimeFormatSecond( fmt );
5715
Returns the user defined datetime format for the upper date row of the time header if the time header scale is set to minute.
5716
Returns an empty string as default, i.e. if there is no user defined format.
5717
You can find details about the possible format itself in the Qt documentation of:
5718
QDateTime::toString ( const QString & format ) const
5719
QDate::toString( const QString & format )
5720
QTime::toString( const QString & format )
5722
\return user defined date format of the time header in minutely scale
5723
\sa setTimeHeaderDateFormatMinute()
5725
QString KDGanttView::timeHeaderDatetimeFormatMinute() const
5727
return myTimeHeader->datetimeFormatMinute();
5730
Sets the user defined date format for the upper date row of the time header if the time header scale is set to minute.
5731
You can find details about the possible user defined format itself in the Qt documentation of:
5732
QDateTime::toString ( const QString & format ) const
5733
QDate::toString( const QString & format )
5734
QTime::toString( const QString & format )
5736
\param the user defined date format of the time header in minutely scale
5737
\sa timeHeaderDateFormatMinute()
5739
void KDGanttView::setTimeHeaderDatetimeFormatMinute( const QString& fmt )
5741
myTimeHeader->setDatetimeFormatMinute( fmt );
5746
Returns the user defined datetime format for the upper date row of the time header if the time header scale is set to hour.
5747
Returns an empty string as default, i.e. if there is no user defined format.
5748
You can find details about the possible format itself in the Qt documentation of:
5749
QDateTime::toString ( const QString & format ) const
5750
QDate::toString( const QString & format )
5751
QTime::toString( const QString & format )
5753
\return user defined date format of the time header in hourly scale
5754
\sa setTimeHeaderDateFormatHour()
5756
QString KDGanttView::timeHeaderDatetimeFormatHour() const
5758
return myTimeHeader->datetimeFormatHour();
5761
Sets the user defined date format for the upper date row of the time header if the time header scale is set to hour.
5762
You can find details about the possible user defined format itself in the Qt documentation of:
5763
QDateTime::toString ( const QString & format ) const
5764
QDate::toString( const QString & format )
5765
QTime::toString( const QString & format )
5767
\param the user defined date format of the time header in hourly scale
5768
\sa timeHeaderDateFormatHour()
5770
void KDGanttView::setTimeHeaderDatetimeFormatHour( const QString& fmt )
5772
myTimeHeader->setDatetimeFormatHour( fmt );
5775
Sets the week start to monday. The default week start is sunday.
5776
This value is used in the time header to compute week starts for weekly scales.
5777
If the global scale is set to day the upper row of the time header displays a weekly scale.
5778
If the global scale is set to week the lower row of the time header displays a weekly scale.
5781
\param pass true to set week start to monday
5782
pass false to set week start to sunday
5783
\sa weekStartsMonday()
5785
void KDGanttView::setWeekStartsMonday( bool b )
5787
myTimeHeader->setWeekStartsMonday( b );
5791
Returns true if the week start is monday, false if the week start is sunday
5793
\return true if the week start is monday, false if the week start is sunday
5794
\sa setWeekStartsMonday()
5796
bool KDGanttView::weekStartsMonday() const
5798
return myTimeHeader->weekStartsMonday();
5801
Sets to display week numbers if the global scale is set to week.
5802
The ISO week numbering is used, i.e. the first week (week 1) of the year
5803
is the first week which contains a Thursday.
5806
\param pass true to display numbers of weeks
5807
pass false display numbers of the day of the date where the week starts
5808
\sa weekStartsMonday()
5810
void KDGanttView::setWeekScaleShowNumber( bool b )
5812
myTimeHeader->setWeekScaleShowNumber( b );
5815
Returns true if the week scale displays week number.
5816
The ISO week numbering is used, i.e. the first week (week 1) of the year
5817
is the first week which contains a Thursday.
5819
\return true if the week scale displays week number
5820
\sa setWeekScaleShowNumber()
5822
bool KDGanttView::weekScaleShowNumber() const
5824
return myTimeHeader->weekScaleShowNumber();
5827
Returns the week number for a given Date.
5828
The ISO week numbering is used, i.e. the first week (week 1) of the year
5829
is the first week which contains a Thursday.
5831
\param date the date
5832
\return the week number for the date
5833
\sa setWeekScaleShowNumber() weekScaleShowNumber()
5835
int KDGanttView::getWeekOfYear( const QDate& date )
5837
return myTimeHeader->getWeekOfYear( date );
5841
This method is provided for convenience.
5842
It returns the current day.
5843
\return the current day
5846
QDate KDGanttView::yesterday() const
5848
return myTimeHeader->yesterday() ;
5851
This method is provided for convenience.
5852
It returns the current day.
5855
QDate KDGanttView::today() const
5857
return myTimeHeader->today() ;
5860
This method is provided for convenience.
5861
It returns the current day.
5862
\return the next day
5864
QDate KDGanttView::tomorrow() const
5866
return myTimeHeader->tomorrow() ;
5869
This method is provided for convenience.
5870
It returns the start of the current week
5871
depending on the value weekStartsOnMonday().
5872
\return the start of current week
5874
QDate KDGanttView::currentWeek() const
5876
return myTimeHeader->currentWeek() ;
5879
This method is provided for convenience.
5880
It returns the start of the last week
5881
(the week before current week)
5882
depending on the value weekStartsOnMonday().
5883
\return the start of last week (the week before current week)
5885
QDate KDGanttView::lastWeek() const
5887
return myTimeHeader->lastWeek() ;
5890
This method is provided for convenience.
5891
It returns the first day of the current month.
5892
\return first day of the current month
5894
QDate KDGanttView::currentMonth() const
5896
return myTimeHeader->currentMonth() ;
5899
This method is provided for convenience.
5900
It returns the first day of last month.
5901
\return first day of last month
5903
QDate KDGanttView::lastMonth() const
5905
return myTimeHeader->lastMonth() ;
5908
This method is provided for convenience.
5909
It returns first day of the current year.
5910
\return first day of the current year
5912
QDate KDGanttView::currentYear() const
5914
return myTimeHeader->currentYear() ;
5917
This method is provided for convenience.
5918
It returns first day of the last year.
5919
\return first day of the last year
5921
QDate KDGanttView::lastYear() const
5923
return myTimeHeader->lastYear() ;
5927
This slot is provided for convenience.
5928
It centers the timeline on start of today.
5930
void KDGanttView::gotoToday()
5932
myTimeHeader->centerToday();
5935
This slot is provided for convenience.
5936
It centers the timeline on start of yesterday.
5938
void KDGanttView::gotoYesterday()
5940
myTimeHeader->centerYesterday();
5943
This slot is provided for convenience.
5944
It centers the timeline on start of current week.
5946
void KDGanttView::gotoCurrentWeek()
5948
myTimeHeader->centerCurrentWeek();
5951
This slot is provided for convenience.
5952
It centers the timeline on start of last week .
5954
void KDGanttView::gotoLastWeek()
5956
myTimeHeader->centerLastWeek();
5959
This slot is provided for convenience.
5960
It centers the timeline on start of current month.
5962
void KDGanttView::gotoCurrentMonth()
5964
myTimeHeader->centerCurrentMonth();
5967
This slot is provided for convenience.
5968
It centers the timeline on start of last month.
5970
void KDGanttView::gotoLastMonth()
5972
myTimeHeader->centerLastMonth();
5975
This slot is provided for convenience.
5976
It centers the timeline on start of current year.
5978
void KDGanttView::gotoCurrentYear()
5980
myTimeHeader->centerCurrentYear();
5983
This slot is provided for convenience.
5984
It centers the timeline on start of last year.
5986
void KDGanttView::gotoLastYear()
5988
myTimeHeader->centerLastYear();
5991
This slot is provided for convenience.
5992
It selects today as displayed timespan
5993
and makes sure that the selected timespan
5994
is visible in the gantt view
5995
and sets the timeline start to the start
5996
of the selected timespan.
5997
The scale is set to KDGanttView::Hour.
5999
void KDGanttView::selectToday()
6001
myTimeHeader->showToday();
6004
This slot is provided for convenience.
6005
It selects yesterday as displayed timespan
6006
and makes sure that the selected timespan
6007
is visible in the gantt view
6008
and sets the timeline start to the start
6009
of the selected timespan.
6010
The scale is set to KDGanttView::Hour.
6012
void KDGanttView::selectYesterday()
6014
myTimeHeader->showYesterday();
6017
This slot is provided for convenience.
6018
It selects the current week as displayed timespan
6019
and makes sure that the selected timespan
6020
is visible in the gantt view
6021
and sets the timeline start to the start
6022
of the selected timespan.
6023
The scale is set to KDGanttView::Day.
6025
void KDGanttView::selectCurrentWeek()
6027
myTimeHeader->showCurrentWeek();
6030
This slot is provided for convenience.
6031
It selects the last week as displayed timespan
6032
and makes sure that the selected timespan
6033
is visible in the gantt view
6034
and sets the timeline start to the start
6035
of the selected timespan.
6036
The scale is set to KDGanttView::Day.
6038
void KDGanttView::selectLastWeek()
6040
myTimeHeader->showLastWeek();
6043
This slot is provided for convenience.
6044
It selects the current month as displayed timespan
6045
and makes sure that the selected timespan
6046
is visible in the gantt view
6047
and sets the timeline start to the start
6048
of the selected timespan.
6049
The scale is set to KDGanttView::Day.
6051
void KDGanttView::selectCurrentMonth()
6053
myTimeHeader->showCurrentMonth();
6056
This slot is provided for convenience.
6057
It selects the last month as displayed timespan
6058
and makes sure that the selected timespan
6059
is visible in the gantt view
6060
and sets the timeline start to the start
6061
of the selected timespan.
6062
The scale is set to KDGanttView::Day.
6064
void KDGanttView::selectLastMonth()
6066
myTimeHeader->showLastMonth();
6069
This slot is provided for convenience.
6070
It selects the current year as displayed timespan
6071
and makes sure that the selected timespan
6072
is visible in the gantt view
6073
and sets the timeline start to the start
6074
of the selected timespan.
6075
The scale is set to KDGanttView::Month.
6077
void KDGanttView::selectCurrentYear()
6079
myTimeHeader->showCurrentYear();
6082
This slot is provided for convenience.
6083
It selects the last year as displayed timespan
6084
and makes sure that the selected timespan
6085
is visible in the gantt view
6086
and sets the timeline start to the start
6087
of the selected timespan.
6088
The scale is set to KDGanttView::Month.
6090
void KDGanttView::selectLastYear()
6092
myTimeHeader->showLastYear();
6096
\fn void KDGanttView::setConnectorEnabled(int connector, bool state)
6098
Enable or disable a connector.
6100
\param connector The connector to set.
6101
\param state The state the connector is set to.
6102
\sa isConnectorEnabled()
6104
void KDGanttView::setConnectorEnabled(int connector, bool state)
6106
myCanvasView->setConnectorEnabled(connector, state);
6110
\fn void KDGanttView::isConnectorEnabled()
6112
See if a connector is enabled or disabled.
6114
\param connector The connector to check.
6115
\return The state of the connector.
6116
\sa setConnectorEnabled()
6118
bool KDGanttView::isConnectorEnabled(int connector) const
6120
return myCanvasView->isConnectorEnabled(connector);
6124
\fn void KDGanttView::setAllConnectorsEnabled(bool state)
6126
Enable or disable all connectors.
6128
\param state The state the connectors are set to.
6130
void KDGanttView::setAllConnectorsEnabled(bool state)
6132
myCanvasView->setAllConnectorsEnabled(state);
6136
\fn void KDGanttView::setAutoScrollEnabled( bool state );
6138
Enables/disables scrolling when LMB is down.
6140
\param state If true, auto scrolling is enabled.
6142
void KDGanttView::setAutoScrollEnabled(bool state)
6144
myCanvasView->autoScrollEnabled = state;
6149
\fn addOneTickLeft();
6151
This signal is emitted when userHorizonChangeEnabled() is set to false
6152
and the slider of the vertical scrollbar of the gantt view is on the left side
6153
and the user clicks the "left" arrow of the scrollbar
6154
\sa setUserHorizonChangeEnabled() userHorizonChangeEnabled() addOneTickLeft()
6158
\fn addOneTickRight();
6160
This signal is emitted when userHorizonChangeEnabled() is set to false
6161
and the slider of the vertical scrollbar of the gantt view is on the right side
6162
and the user clicks the "right" arrow of the scrollbar
6163
\sa setUserHorizonChangeEnabled() userHorizonChangeEnabled() addOneTickRight()
6167
\fn void KDGanttView:: itemDeleted( KDGanttViewItem* );
6169
This signal is emitted when a gantt item is deleted.
6170
When the signal is emitted the pointer points to an existing KDGanttViewItem.
6171
This pointer will become invalid immediately after returning of the signal.
6176
\fn void KDGanttView::timeIntervalSelected( const QDateTime& start, const QDateTime& end);
6178
This signal is emitted when the user selects a time
6179
interval with the mouse on the time header connect this signal to
6180
the slot void zoomToSelection( const QDateTime& start, const
6181
QDateTime& end) to obtain automatic zooming.
6186
\fn void KDGanttView::timeIntervallSelected( const QDateTime& start, const QDateTime& end);
6188
\deprecated This signal is deprecated, do not use it in new code;
6189
use timeIntervalSelected() instead. timeIntervallSelected() will be
6190
removed in future versions.
6195
\fn void KDGanttView::rescaling( Scale )
6197
This signal is emitted if another scale is chosen than the
6198
specified one: i.e. if the horizon has a very wide range from
6199
start to end and as scale is chosen minute it may be that the
6200
size of the Gantt widget would become more than 32000 pixels. In
6201
this case the scale is automatically changed to Hour and
6202
rescaling( Hour ) is emitted. If the widget size would be still
6203
more than 32000 pixels, the scale is automatically changed to day
6204
and rescaling( Day ) is emitted. In the new scale, the
6205
minortickcount is increased such that the horizon will fit in the
6206
maximum size of 32000 pixels.
6211
\fn void KDGanttView::gvCurrentChanged( KDGanttViewItem* item )
6213
This signal is emitted whenever the user clicks on the Gantt view
6214
\a item parameter is 0, if no item was clicked
6219
\fn void KDGanttView::gvItemLeftClicked( KDGanttViewItem* )
6221
This signal is emitted whenever the user clicks into the Gantt view
6222
with the left mouse button.
6227
\fn void KDGanttView::gvItemMidClicked( KDGanttViewItem* )
6229
This signal is emitted whenever the user clicks into the Gantt view
6230
with the middle mouse button.
6234
\fn void KDGanttView::gvItemRightClicked( KDGanttViewItem* )
6236
This signal is emitted whenever the user clicks into the Gantt view
6237
with the right mouse button.
6241
\fn void KDGanttView::gvMouseButtonClicked ( int button, KDGanttViewItem* item, const QPoint & pos)
6243
This signal is emitted when the user clicks into the Gantt view with
6244
any mouse button. Notice that \a pos is the absolute mouse position.
6248
\fn void KDGanttView::gvItemDoubleClicked( KDGanttViewItem* )
6250
This signal is emitted whenever the user double-clicks into the Gantt view.
6254
\fn void KDGanttView::gvContextMenuRequested ( KDGanttViewItem * item, const QPoint & pos )
6256
This signal is emitted when the user requests a context menu in the
6257
Gantt view. Notice that \a pos is the absolute mouse position.
6262
\fn void KDGanttView::lvCurrentChanged( KDGanttViewItem* item )
6264
This signal is emitted whenever the user clicks on the list view
6265
\a item parameter is 0, if no item was clicked
6270
\fn void KDGanttView::lvItemLeftClicked( KDGanttViewItem* )
6272
This signal is emitted whenever the user clicks into the list view
6273
with the left mouse button.
6278
\fn void KDGanttView::lvItemMidClicked( KDGanttViewItem* )
6280
This signal is emitted whenever the user clicks into the list view
6281
with the middle mouse button.
6285
\fn void KDGanttView::lvItemRightClicked( KDGanttViewItem* )
6287
This signal is emitted whenever the user clicks into the list view
6288
with the right mouse button.
6292
\fn void KDGanttView::lvMouseButtonPressed ( int button,
6293
KDGanttViewItem* item, const QPoint & pos, int col)
6295
This signal is emitted when the user presses any mouse button in the
6296
list view. Notice that \a pos is the absolute mouse position.
6300
\fn void KDGanttView::lvMouseButtonClicked ( int button,
6301
KDGanttViewItem* item, const QPoint & pos, int col)
6303
This signal is emitted when the user clicks into the
6304
list view with any mouse button . Notice that \a pos is the absolute
6309
\fn void KDGanttView::lvItemDoubleClicked( KDGanttViewItem* )
6311
This signal is emitted whenever the user double-clicks into the list view.
6315
\fn void KDGanttView::lvItemRenamed( KDGanttViewItem*, int col,
6316
const QString& text )
6318
This signal is emitted whenever the user changes the name of an item
6319
in the list view using in-place editing. \a text contains the new
6320
text in the list view.
6324
\fn void KDGanttView::lvContextMenuRequested( KDGanttViewItem *
6325
item, const QPoint & pos, int col )
6327
This signal is emitted when the user requests a context menu in the
6328
list view. Notice that \a pos is the absolute mouse position.
6332
\fn void KDGanttView::lvSelectionChanged( KDGanttViewItem* )
6334
This signal is emitted whenever the user changes the selection in
6340
\fn void KDGanttView::dropped ( QDropEvent * e, KDGanttViewItem* droppedItem, KDGanttViewItem* itemBelowMouse)
6342
This signal is emitted whenever a Gantt item is dropped onto the
6343
Gantt view. \a droppedItem is 0, if this is a drag operation from
6344
another KDGanttView instance. If this drag is an internal drag
6345
(i.e. within the KDGanttView), this parameter points to the dropped item.
6346
\a itemBelowMouse is a pointer to the item below the dragged
6347
item (i.e., below the mouse). The dragged item may be inserted
6348
in the KDGanttView as a child of this item.
6349
If The value is 0, if there is no item below the dragged item,
6350
and the dragged item will be inserted as a root item.
6352
In order to get user-defined behavior for drop events, reimplement
6353
KDGanttView::lvDropEvent()
6358
\enum KDGanttView::RepaintMode
6360
Please see setRepaintMode() for a description of the values of this
6365
\fn void gvCreateTaskLink( KDGanttViewItem* fr, int fc, KDGanttViewItem* to, int tc)
6367
This signal is emitted whenever two items shall be linked.
6369
\param fr The item to link from.
6370
\param fc The KDGanttViewItem::Connector to link from.
6371
\param to The item to link to.
6372
\param tc The KDGanttViewItem::Connector to link to.
6375
#include "KDGanttView.moc"