So I tried to make underlined-centered titles:
The answer for the centered came here and here.
Now my question is, how I make it underlined: with \ul it doesn't work (the file don't compile, and with uline I get ugly underline:

And here is the MWE:
\documentclass{scrartcl}
\usepackage{fontspec,adforn,ulem,soul}
\makeatletter
\addtokomafont{section}{\centering}
\addtokomafont{subsection}{\centering}
\renewcommand{\sectionlinesformat}[4]{%
%\@tempswafalse
\ifstr{#1}{section}{%
{\@hangfrom{{{#3}{#4}\adforn{12}}}}
}
{\ifstr{#1}{subsection}{%
{\@hangfrom{\uline{{{#3}{#4}\adforn{24}}}}}%
}
{\@hangfrom{\hskip#2#3}{#4}}}%
}\makeatother
\begin{document}
\part{ABC}
\section{abc}
\subsection{abcd efgh abcd efgh iiii hhjjgghgg abcd efgh abcd efgh iiii hhjjgghgg abcd efgh abcd efgh iiii hhjjgghgg}
\end{document}
P.S. For the parts I got answer here but it also don't work.
and here is about using \ul or \uline.
And if I'm putting parbox this what I get:
and this is the relevant line:
{\ifstr{#1}{subsection}{%
{\@hangfrom{\uline{\parbox{\linewidth}{{#3}{#4}\adforn{24}}}}}%
}
Do you have any idea how it could work and look properly and the text can be more then one line centered and underlined?
Thank you!!

\@hangfromis wrong and does not make sense. Do you known, what it does? You should remove it and several of the brace-pairs too. Off-topic: Underlining is ugly and AFAIK there are no perfect solutions to do it with LaTeX. – Schweinebacke Mar 15 '19 at 20:53