MCPcopy Create free account
hub / github.com/KDE/kdevelop / data

Method data

kdevplatform/shell/launchconfigurationdialog.cpp:561–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559}
560
561QVariant LaunchConfigurationsModel::data(const QModelIndex& index, int role) const
562{
563 if( index.isValid() && index.column() >= 0 && index.column() < 2 )
564 {
565 auto* t = static_cast<TreeItem*>( index.internalPointer() );
566 switch( role )
567 {
568 case Qt::DisplayRole:
569 {
570 auto* li = dynamic_cast<LaunchItem*>( t );
571 if( li )
572 {
573 if( index.column() == 0 )
574 {
575 return li->launch->name();
576 } else if( index.column() == 1 )
577 {
578 return li->launch->type()->name();
579 }
580 }
581 auto* pi = dynamic_cast<ProjectItem*>( t );
582 if( pi && index.column() == 0 )
583 {
584 return pi->project->name();
585 }
586 auto* gpi = dynamic_cast<GenericPageItem*>( t );
587 if( gpi && index.column() == 0 )
588 {
589 return gpi->text;
590 }
591 auto* lmi = dynamic_cast<LaunchModeItem*>( t );
592 if( lmi )
593 {
594 if( index.column() == 0 )
595 {
596 return lmi->mode->name();
597 } else if( index.column() == 1 )
598 {
599 LaunchConfiguration* l = configForIndex( index );
600 return l->type()->launcherForId( l->launcherForMode( lmi->mode->id() ) )->name();
601 }
602 }
603 break;
604 }
605 case Qt::DecorationRole:
606 {
607 auto* li = dynamic_cast<LaunchItem*>( t );
608 if( index.column() == 0 && li )
609 {
610 return li->launch->type()->icon();
611 }
612 auto* lmi = dynamic_cast<LaunchModeItem*>( t );
613 if( lmi && index.column() == 0 )
614 {
615 return lmi->mode->icon();
616 }
617 if ( index.column() == 0 && !index.parent().isValid() ) {
618 if (index.row() == 0) {

Callers 3

selectionChangedMethod · 0.45
setDataMethod · 0.45
setEditorDataMethod · 0.45

Calls 11

launcherForIdMethod · 0.80
launcherForModeMethod · 0.80
QVariantClass · 0.50
isValidMethod · 0.45
columnMethod · 0.45
nameMethod · 0.45
typeMethod · 0.45
idMethod · 0.45
iconMethod · 0.45
parentMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected