MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / data

Method data

launcher/minecraft/PackProfile.cpp:541–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539}
540
541QVariant PackProfile::data(const QModelIndex &index, int role) const
542{
543 if (!index.isValid())
544 return QVariant();
545
546 int row = index.row();
547 int column = index.column();
548
549 if (row < 0 || row >= d->components.size())
550 return QVariant();
551
552 auto patch = d->components.at(row);
553
554 switch (role)
555 {
556 case Qt::CheckStateRole:
557 {
558 switch (column)
559 {
560 case NameColumn: {
561 return patch->isEnabled() ? Qt::Checked : Qt::Unchecked;
562 }
563 default:
564 return QVariant();
565 }
566 }
567 case Qt::DisplayRole:
568 {
569 switch (column)
570 {
571 case NameColumn:
572 return patch->getName();
573 case VersionColumn:
574 {
575 if(patch->isCustom())
576 {
577 return QString("%1 (Custom)").arg(patch->getVersion());
578 }
579 else
580 {
581 return patch->getVersion();
582 }
583 }
584 default:
585 return QVariant();
586 }
587 }
588 case Qt::DecorationRole:
589 {
590 switch(column)
591 {
592 case NameColumn:
593 {
594 auto severity = patch->getProblemSeverity();
595 switch (severity)
596 {
597 case ProblemSeverity::Warning:
598 return "warning";

Callers

nothing calls this directly

Calls 9

QStringClass · 0.85
isEnabledMethod · 0.80
getNameMethod · 0.80
isCustomMethod · 0.80
isValidMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
getVersionMethod · 0.45
getProblemSeverityMethod · 0.45

Tested by

no test coverage detected