Q_PROPERTY的使用说明
MEMBER的使用
class MainWindow : public QMainWindow
{
Q_OBJECT
Q_PROPERTY(QString name MEMBER m_name)
private:
QString m_name;
}
使用方法(见代码):
void MainWindow::on_pushButton_clicked()
{
setProperty("name", "good");
}
void MainWindow::on_pushButton_2_clicked()
{
QString strVal = property("name").toString();
}
本文来自博客园,作者:xingzaicpp,转载请注明原文链接:https://www.cnblogs.com/xingzaicpp/p/16663526.html