本文整理汇总了C++中Load::canFull方法的典型用法代码示例。如果您正苦于以下问题:C++ Load::canFull方法的具体用法?C++ Load::canFull怎么用?C++ Load::canFull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Load
的用法示例。
在下文中一共展示了Load::canFull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
//.........这里部分代码省略.........
QFileDialog save(lApp->mainWidget(), tr("Save File"));
save.setAcceptMode(QFileDialog::AcceptSave);
QFileInfo info(APlayer::instance()->getMedia());
if (info.isFile()){
save.setDirectory(info.absolutePath());
save.selectFile(info.completeBaseName());
}
else{
save.setDirectory(List::instance()->defaultPath(Utils::Danmaku));
}
save.setDefaultSuffix("json");
QStringList type;
type << tr("Bilibili Danmaku Format (*.xml)") << tr("AcFun Danmaku Format (*.json)");
save.setNameFilters(type);
save.connect(&save, &QFileDialog::filterSelected, [&](QString filter){
save.setDefaultSuffix(filter.indexOf("xml") == -1 ? "json" : "xml");
});
if (save.exec() == QDialog::Accepted){
QStringList file = save.selectedFiles();
if (file.size() == 1){
Danmaku::instance()->saveToFile(file.first());
}
}
});
danmV->addAction(saveA);
QAction *fullA = new QAction(tr("Full Danmaku"), this);
fullA->setObjectName("Char");
fullA->setShortcut(Config::getValue("/Shortcut/Char", QString()));
fullA->setEnabled(false);
connect(fullA, &QAction::triggered, [](){
Load *load = Load::instance();
for (const Record &r : Danmaku::instance()->getPool()){
if (load->canFull(&r)){
load->fullDanmaku(&r);
}
}
});
danmV->addAction(fullA);
connect(Danmaku::instance(), &Danmaku::modelReset, [=](){
const QList<Record> &pool = Danmaku::instance()->getPool();
fullA->setEnabled(false);
for (const Record &r : pool){
if (Load::instance()->canFull(&r)){
fullA->setEnabled(true);
break;
}
}
saveA->setEnabled(!pool.isEmpty());
});
connect(danmV, &QTableView::customContextMenuRequested, [=](QPoint p){
QMenu menu(this);
QList<const Comment *>selected;
for (const QModelIndex &index : danmV->selectionModel()->selectedRows()){
selected.append((Comment *)index.data(Qt::UserRole).value<quintptr>());
}
if (!selected.isEmpty()){
connect(menu.addAction(tr("Copy Danmaku")), &QAction::triggered, [&](){
QStringList list;
for (const Comment *c : selected){
list.append(c->string);
}
qApp->clipboard()->setText(list.join('\n'));
});