How to get correct index in proxy model if sourceModel() is also proxy model?

I have two proxy models that filter columns of my main model. This one also filter rows

LayersProxyModel::LayersProxyModel(QObject* parent) : QSortFilterProxyModel(parent)
{
       
}


bool LayersProxyModel::filterAcceptsColumn(int source_column, 
                                           const QModelIndex &source_parent) const
{
    switch (static_cast<DataBaseModel::Columns>(source_column))
    {
        case DataBaseModel::Columns::LayerName:
            return true;
        default:
            return false;
    }
    return false;
}

bool LayersProxyModel::lessThan(const QModelIndex &left, 
                                const QModelIndex &right) const
{
    int filterColumn = static_cast<int>(DataBaseModel::Columns::LayerName);

    QVariant leftData = sourceModel()->data(left, filterColumn);
    QVariant rightData = sourceModel()->data(right, filterColumn);
    
    // QVariant < QVariant Q_DEPRECATED
    return leftData.toString() < rightData.toString();
}

bool LayersProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
    int filterColumn = static_cast<int>(DataBaseModel::Columns::LayerName);
    
    QModelIndex index = sourceModel()->index(source_row, filterColumn, source_parent);
    QVariant data = sourceModel()->data(index);
    for (int row = 0; row < source_row; ++row)
    {
        QModelIndex previousIndex = sourceModel()->index(row, filterColumn, source_parent);
        if (sourceModel()->data(previousIndex) == data)
        {
            return false;
        }
    }

    return true;
}

This one filter only columns

PacketLayerPurposeProxyModel::PacketLayerPurposeProxyModel(QObject* parent) : 
QSortFilterProxyModel(parent)
{
       
}

bool PacketLayerPurposeProxyModel::filterAcceptsColumn(int source_column, 
                                                       const QModelIndex &source_parent) const
{
  
    switch (static_cast<DataBaseModel::Columns>(source_column))
    {
        case DataBaseModel::Columns::PacketName:
        case DataBaseModel::Columns::LayerName:
        case DataBaseModel::Columns::PurposeName:
        case DataBaseModel::Columns::Manipulators:
            return true;

        default:
            return false;
    }
    return false;
}

What I would like to do:

auto p_l_p_dbmodel = new PacketLayerPurposeProxyModel(p_l_p_tableView);
p_l_p_tableView->setSourceModel(main_model);

LayersProxyModel *layers_proxy_model = new LayersProxyModel(this);
layers_proxy_model->setSourceModel(p_l_p_tableView);

The problem is that when the sourceModel is a proxy model, the index of the column by which I filter is in a different position and I don’t understand how I can translate the index of the source model into the index of the proxy model

bool LayersProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
    int filterColumn = static_cast<int>(DataBaseModel::Columns::LayerName);

***PROBLEM IS HERE
    filterСolumn == 6 but in the proxy model the index of this column is 2 and calling 
    this function returns invalid indexes and the data is not displayed when sourceModel() 
    is a proxy model***

    QModelIndex index = sourceModel()->index(source_row, filterColumn, source_parent);
    QVariant data = sourceModel()->data(index);
    for (int row = 0; row < source_row; ++row)
    {
        QModelIndex previousIndex = sourceModel()->index(row, filterColumn, source_parent);
        if (sourceModel()->data(previousIndex) == data)
        {
            return false;
        }
    }

    return true;
}

Just I have several views and I need to adapt this function to work with both, when source model is a proxy model and when source model is actual model

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật