We study local CP-violation on the lattice by measuring the local correlation between the topological charge density and the electric dipole moment of quarks, induced by a constant external magnetic field. This correlator is found to increase linearly with the external field, with the coefficient of proportionality depending only weakly on temperature. Results are obtained on lattices with various spacings, and are extrapolated to the continuum limit after the renormalization of the observables is carried out. This renormalization utilizes the gradient flow for the quark and gluon fields. Our findings suggest that the strength of local CP-violation in QCD with physical quark masses is about an order of magnitude smaller than a model prediction based on nearly massless quarks in domains of constant gluon backgrounds with topological charge. We also show numerical evidence that the observed local CP-violation correlates with spatially extended electric dipole structures in the QCD vacuum.