开发者

Selecting Frames in Qt

开发者 https://www.devze.com 2023-01-06 00:40 出处:网络
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 s

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消