Selecting Frames in Qt
I would like for a user to be able to "delete" a frame from a series of frames in a vertical layout开发者_开发技巧 using the delete/backspace keys on the keyboard, but I do not know how to make it so that a frame is selectable. Does any one know of a way to do this (in C++)?
Thank you in advance!
Derive a new class from QFrame. Then implement some member functions according to your needs. For example, if you want to select the frame with mouse, implement mousePressEvent and if you want to process the delete key, implement keyPressEvent.
Note that you must handle displaying the frame selection by yourself, for example by changing the frame background color.
精彩评论