MCPcopy Create free account
hub / github.com/MultiMC/Launcher / data

Method data

launcher/minecraft/PackProfile.cpp:752–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750}
751
752QVariant PackProfile::data(const QModelIndex &index, int role) const
753{
754 if (!index.isValid())
755 return QVariant();
756
757 int row = index.row();
758 int column = index.column();
759
760 if (row < 0 || row >= d->components.size())
761 return QVariant();
762
763 auto patch = d->components.at(row);
764
765 switch (role)
766 {
767 case Qt::CheckStateRole:
768 {
769 switch (column)
770 {
771 case NameColumn: {
772 return patch->isEnabled() ? Qt::Checked : Qt::Unchecked;
773 }
774 default:
775 return QVariant();
776 }
777 }
778 case Qt::DisplayRole:
779 {
780 switch (column)
781 {
782 case NameColumn:
783 return patch->getName();
784 case VersionColumn:
785 {
786 if(patch->isCustom())
787 {
788 return QString("%1 (Custom)").arg(patch->getVersion());
789 }
790 else
791 {
792 return patch->getVersion();
793 }
794 }
795 default:
796 return QVariant();
797 }
798 }
799 case Qt::DecorationRole:
800 {
801 switch(column)
802 {
803 case NameColumn:
804 {
805 auto severity = patch->getProblemSeverity();
806 switch (severity)
807 {
808 case ProblemSeverity::Warning:
809 return "warning";

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected