logoalt Hacker News

badsectoraculayesterday at 11:07 PM0 repliesview on HN

FWIW it doesn't need to become 500k lines of code... or 13k in QWidget's case :-P. The file is large because it contains the full documentation in addition to the code but also in Qt is a QWidget can also be a (toplevel) window so it needs to support everything a window may want to support, including stuff like setting/getting title, maximize/minimize/etc events, etc.

You can avoid this complexity in the base widget class by placing those elsewhere, e.g. FLTK's base widget class[0] is much smaller at around 500 lines of code (+ documentation comments).

[0] https://github.com/fltk/fltk/blob/master/src/Fl_Widget.cxx