[Qt-creator] It would be really cool if... } // comment
jhihn at gmx.com
Mon Dec 12 16:24:18 CET 2016
> Sent: Monday, December 12, 2016 at 2:41 AM
> From: "Guenter Schwann" <guenterlists at schwann.at>
> To: "Jason H" <jhihn at gmx.com>, qt-creator <qt-creator at qt-project.org>
> Subject: Re: [Qt-creator] It would be really cool if... } // comment
> Am 09.12.2016 um 19:14 schrieb Jason H:
> > In QML we have lot of closures
> > The bottom of my QML Files is always:
> > ........}
> > ......}
> > ....}
> > ..}
> > }
> > It would be cool if it could tie in with the show-whitespace feature and provide some decoration (not a part of the file)
> > ........} // Row: buttonRow (id: buttonRow)
> > ......} // Column
> > ....} // Flickable
> > ..} //Item
> > } // Rectagle
> > I often use actual comments, but they get messed up via various modifications
> When a file looks like this, I usually split it up.
> Having smaller files/components helps even more to not mess up.
> Usually my QML files are less than 200 lines.
> On the other hand, this could be used for more stuff than just for
> items. For functions, switch, ...
> And in C++ for namespaces, classes, #endif, ...
Well, things were "ok" before (that doesn't mean they are good or even right) But in regular code, there are many more procedural statements that give away what scope you are in. In C++ this is there is generally 2 degrees of immediate nesting: class and member function, or if in code, a nested for/if. However in declarative code, it's (in my experience) 5 or more.
I agree it'd be useful everywhere, but QML is what really made it evident that there's got to be another way.
I realize at the top Qt creator tells you the type, but that's not where I'm looking when I'm reading code, and it is dependent on cursor position.
More information about the Qt-creator