C++ (Qt)void NSHeaderView::processHeadClick( int logicalIndex ){if (QApplication::keyboardModifiers() & Qt::ShiftModifier) { if (!sortOrder.contains(logicalIndex)) {setSortIndicator (logicalIndex, Qt::AscendingOrder ); sortOrderNums.append(logicalIndex);} else if (sortOrder[logicalIndex]==Qt::AscendingOrder) {sortOrder.remove(logicalIndex); sortOrderNums.removeOne(logicalIndex);} }else { sortOrder.clear(); sortOrderNums.clear(); setSortIndicator (logicalIndex, Qt::AscendingOrder); sortOrderNums.append(logicalIndex); }sortmodel->sort(0);}
QVariant NSSortFilterProxyModel::data(const QModelIndex &index, int role) const{ // это QVariant data = QSortFilterProxyModel::data(index, role); // вместо этого/* Q_D(const QSortFilterProxyModel); QModelIndex source_index = mapToSource(index); if (index.isValid() && !source_index.isValid()) return QVariant(); QVariant data = d->model->data(source_index, role);*/ if (data.type()==QVariant::Bool) { if (data.toString()=="true") return QVariant("Да"); if (data.toString()=="false") return QVariant(""); } return data;}
class A{public: virtual ~A {} virtual int testfunc() { return 0; }}class B : public A{public: int testfunc() { return 1; }}class C : public B{public: int testfunc() { return 2; }}