QT 菜单中添加Qcheckbox复选框

发布时间 2023-10-21 10:14:35作者: 红湿处
// 回放
    auto widget = new QWidget;
    {
        auto checkbox = new QCheckBox("回放");
        auto layout = new QHBoxLayout;
        layout->addWidget(checkbox);
        layout->setContentsMargins(5,1,5,1);
        widget->setLayout(layout);

        auto action = new QWidgetAction(playback);
        action->setDefaultWidget(widget);
        playback->addAction(action); // playback 菜单
    }