當前位置:聚美館>智慧生活>心理>

形狀控件怎麼設定形狀

心理 閱讀(2.57W)
形狀控件怎麼設定形狀

首先要響應鼠標事件,然後透過 Style Sheets 改變按鈕的外觀1. 從QPushButton派生一個自己的按鈕類2.在新類的構造函數中 調用 mouseTracking(true)以獲取鼠標移動事件。

3、 重載 mouseMoveEvent(),在該函數中透過StyleSheet改變外觀 如: setStyleSheet("background: yellow”) Qt Style Sheets的使用請參考 Assistance中的內容 和 Style Sheet Example