How to convert Q_ENUM to QString for QT > 5.11 most efficient way?

前端 未结 2 843
借酒劲吻你
借酒劲吻你 2021-01-27 01:55

I read several advices how to get an actual QString from a Q_ENUM value.

Below are 3 possible ways, I came up with, that are compilable constru

2条回答
  •  死守一世寂寞
    2021-01-27 02:24

    Another, more elegant way, is by using QVariant's toString() method:

    QString errStr = QVariant::fromValue(error).toString();
    ui->statusBar->showMessage("Error occured: " + errStr);
    

提交回复
热议问题