将
QApplication::style()->drawControl(QStyle::CE_PushButton, &styleOption, painter, m_pushButton);
改为
m_pushButton->style()->drawControl(QStyle::CE_PushButton, &styleOption, painter, m_pushButton);
总结:第二种方式使用的是特定按钮对象的样式,而第一种方式使用的是应用程序的全局样式。选择哪种方式取决于你的需求和设计方案。如果你对按钮的样式进行了自定义,并将其应用于特定按钮对象,则使用第二种方式。如果你希望使用应用程序的默认样式来绘制按钮,则使用第一种方式。