MCPcopy Create free account
hub / github.com/baldurk/renderdoc / updateFormatList

Method updateFormatList

qrenderdoc/Widgets/BufferFormatSpecifier.cpp:266–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void BufferFormatSpecifier::updateFormatList()
267{
268 QString sel;
269
270 RDTreeWidgetItem *item = ui->savedList->selectedItem();
271 if(item)
272 sel = item->text(0);
273
274 {
275 QSignalBlocker block(ui->savedList);
276 int vs = ui->savedList->verticalScrollBar()->value();
277 ui->savedList->beginUpdate();
278
279 ui->savedList->clear();
280
281 int selidx = -1;
282
283 if(!m_AutoFormat.isEmpty())
284 {
285 item = new RDTreeWidgetItem({tr("<Auto-generated>")});
286 item->setItalic(true);
287 ui->savedList->addTopLevelItem(item);
288
289 if(item->text(0) == sel)
290 selidx = 0;
291 }
292
293 QStringList formats = globalFormatList->getFormats();
294
295 for(QString f : formats)
296 {
297 if(f == sel)
298 selidx = ui->savedList->topLevelItemCount();
299
300 ui->savedList->addTopLevelItem(new RDTreeWidgetItem({f}));
301 }
302
303 {
304 item = new RDTreeWidgetItem({tr("New...")});
305 if(item->text(0) == sel)
306 selidx = ui->savedList->topLevelItemCount();
307 item->setEditable(0, true);
308 ui->savedList->addTopLevelItem(item);
309 }
310
311 if(selidx >= 0)
312 ui->savedList->setSelectedItem(ui->savedList->topLevelItem(selidx));
313
314 ui->savedList->resizeColumnToContents(0);
315
316 ui->savedList->endUpdate();
317 ui->savedList->verticalScrollBar()->setValue(vs);
318 }
319
320 on_savedList_itemSelectionChanged();
321}
322
323void BufferFormatSpecifier::on_savedList_keyPress(QKeyEvent *event)

Callers

nothing calls this directly

Calls 15

selectedItemMethod · 0.80
verticalScrollBarMethod · 0.80
beginUpdateMethod · 0.80
addTopLevelItemMethod · 0.80
getFormatsMethod · 0.80
topLevelItemCountMethod · 0.80
setEditableMethod · 0.80
setSelectedItemMethod · 0.80
topLevelItemMethod · 0.80
endUpdateMethod · 0.80
trFunction · 0.50
textMethod · 0.45

Tested by

no test coverage detected