Add "index" parameter to addLineWidget() to support finer control on the ordering of line widgets.

Previously, addLineWidget() only appends to the end of existing widgets. This change enables splicing line widgets at any specified index.