source code from <<cpp_gui_programming_with_qt4>>, coding by myself