C++ (Qt)bool ItemSort::operator< ( const QTableWidgetItem & other ) const{ if( (this->column() == 0 && other.column() == 0 && other.row() > 0 && this->row() >0)) { if( this->text().toLower().trimmed().startsWith( "каз" )|| this->text().toLower().trimmed().startsWith( "кз" )) return true; if( other.text().toLower().trimmed().startsWith( "каз" )|| other.text().toLower().trimmed().startsWith( "кз" )) return false; if( this->text().toLower().trimmed().startsWith( "рос" )|| other.text().toLower().trimmed().startsWith( "рф" )) return true; if( other.text().toLower().trimmed().startsWith( "рос" )|| other.text().toLower().trimmed().startsWith( "рф" )) return false; } return false;//QTableWidgetItem::operator<( other );}
C++ (Qt)// if (pr1 < pri_Default) return false;// return QTableWidgetItem::operator< (other); // заменить наQTableWidgetItem * itm1 = tableWidget()->itemAt(row(), 3);QTableWidgetItem * itm2 = tableWidget()->itemAt(other.row(), 3);return *itm1 < *itm2;
C++ (Qt)bool ItemSort::operator< ( const QTableWidgetItem & other )const{ if (this->row() == 0){ return false; } if (other.row() == 0) { return false; } int pr1 = GetPriority(*this); int pr2 = GetPriority(other); if (pr1 > pr2) return false; if (pr1 < pr2) return true; QTableWidgetItem * itm1 = _table->itemAt(2,row()); QTableWidgetItem * itm2 = _table->itemAt(2,other.row()); return *itm1 < *itm2; }