On Sunday, 19 July 2026 14:34:24 Pacific Daylight Time Lorn Potter wrote:

> > To make the original more readable, simply use a new blank line after
> the opening brace.
>

Does a blank line following the attached brace help enough?


Consider the following blocks from qtextedit.cpp:


    if (cursor.atBlockStart()

        && (d->autoFormatting & AutoBulletList)

        && (text.size() == 1)

        && (text.at(0) == u'-' || text.at(0) == u'*')

        && (!cursor.currentList())) {


        d->createAutoBulletList();

        e->accept();

        return;

    }


and


    if (!doc->pageSize().isNull()

        && alignmentProperty.userType() == QMetaType::Bool

        && !alignmentProperty.toBool()) {


        d->adjustScrollbars();

        return;

    }


> >...

> and ewww.. that new style would bother me because it looks out of place.


Multiline if statements are one of the weaknesses in K&R braces. The
qtextedit.cpp code handles them cleanly. An Allman brace also works, but it
looks out-of-place when I try it out in qedittext.cpp.
-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to