Qt: Connecting protected QListWidget::itemChanged signal to a slot

前端 未结 1 1052
陌清茗
陌清茗 2021-01-21 15:20

I used below syntax in Qt5 according to new connect syntax to avoid type mismatches of slot and signals for a a QListWidget with checkable items.

co         


        
相关标签:
1条回答
  • 2021-01-21 15:25

    You can use the more appropriate syntax according to Qt version:

    #if QT_VERSION >= 0x050000
        connect(item, &QListWidget::itemChanged, this , &MainWindow::checkItemChanged);
    #else
        connect(item, SIGNAL(checkItemChanged), this , SLOT(checkItemChanged));
    #endif
    

    (or the 'old string-based' for all versions).

    0 讨论(0)
提交回复
热议问题