You must call setNumberOfItems somewhere, in your constructor for example.
If you define it as a slot, you can create a combobox or lineedit with button and use it to change the matrix.