官术网_书友最值得收藏!

How it works...

Qt 5 objects, especially the main window, has a dozen of built-in callbacks that exist as virtual functions. These functions can be overridden to perform your intended behavior when called. Qt 5 may invoke these callback functions when its expected condition has been met, such as a keyboard button has been pressed, the mouse cursor has been moved, the window has been resized, and so on.

The functions that we declared in the mainwindow.h file are virtual functions that are built into the QWidget class. We are just overriding it with our own code to define its new behavior when it's called.

Do take note that you must call setMouseTracking(true) for both MainWindow and centralWidget for the mouseMoveEvent() callback to work.

主站蜘蛛池模板: 普兰店市| 利川市| 阳新县| 二连浩特市| 晋城| 丹凤县| 滁州市| 松滋市| 万载县| 鄂州市| 临漳县| 康马县| 阳信县| 夏津县| 黄平县| 澄迈县| 迁西县| 会东县| 兴和县| 利川市| 全州县| 金华市| 庆云县| 南安市| 乌鲁木齐县| 望城县| 安泽县| 昭通市| 九江市| 永定县| 嘉祥县| 桂阳县| 广河县| 磐石市| 虞城县| 晋中市| 马关县| 沙雅县| 雷山县| 红河县| 汕头市|