コード例 #1
0
ファイル: alertsubscription.cpp プロジェクト: g76r/libqron
QVariant AlertSubscriptionData::uiData(int section, int role) const {
    switch(role) {
    case Qt::DisplayRole:
    case Qt::EditRole:
        switch(section) {
        case 0:
            return _id;
        case 1:
            return _pattern;
        case 2:
            return _channelName;
        case 3:
            return _address;
        case 4: {
            QString s;
            if (!_emitMessage.isEmpty())
                s.append(" emitmessage=").append(_emitMessage);
            if (!_cancelMessage.isEmpty())
                s.append(" cancelmessage=").append(_cancelMessage);
            if (!_reminderMessage.isEmpty())
                s.append(" remindermessage=").append(_reminderMessage);
            return s.mid(1);
        }
        case 5: {
            QString s;
            if (!_notifyEmit)
                s.append(" noemitnotify");
            if (!_notifyCancel)
                s.append(" nocancelnotify");
            if (!_notifyReminder)
                s.append(" noremindernotify");
            return s.mid(1);
        }
        case 6:
            return _emitMessage;
        case 7:
            return _cancelMessage;
        case 8:
            return _reminderMessage;
        case 9:
            return _notifyEmit;
        case 10:
            return _notifyCancel;
        case 11:
            return _notifyReminder;
        case 12:
            return _params.toString(false, false);
        }
        break;
    default:
        ;
    }
    return QVariant();
}