NUANCED ORIGINS. “Although the carpel appears to be a modified leaf, it may be more directly related to sporophylls, or leaves that carry spore-producing organs. As the carpel is female, it has traditionally been regarded as derived from megasporophylls that would have subtended ovules in the pre-angiosperm lineage. Accordingly, the carpel would be directly homologous to such gymnosperm organs as the female cone scales of conifers.”
https://academic.oup.com/jxb/article/57/10/2143/471376/An-evolutionary-perspective-on-the-regulation-of