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

Method DescriptorViewer

qrenderdoc/Windows/DescriptorViewer.cpp:1282–1377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1280};
1281
1282DescriptorViewer::DescriptorViewer(ICaptureContext &ctx, QWidget *parent)
1283 : QFrame(parent), ui(new Ui::DescriptorViewer), m_Ctx(ctx)
1284{
1285 ui->setupUi(this);
1286
1287 {
1288 static bool registered = false;
1289 if(!registered)
1290 {
1291 registered = true;
1292 QMetaType::registerComparators<ButtonTag>();
1293 }
1294 }
1295
1296 m_Model = new DescriptorItemModel(ctx, *this, this);
1297
1298 ui->descriptors->setModel(m_Model);
1299
1300 ui->descriptors->setFont(Formatter::PreferredFont());
1301 ui->descriptors->header()->setStretchLastSection(true);
1302 ui->descriptors->header()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
1303 ui->descriptors->header()->setSectionResizeMode(0, QHeaderView::Interactive);
1304
1305 ui->descriptors->header()->setMinimumSectionSize(40);
1306 ui->descriptors->header()->resizeSection(0, 150);
1307
1308 ui->descriptors->header()->setSectionsMovable(false);
1309
1310 ui->descriptors->header()->setCascadingSectionResizes(false);
1311
1312 ButtonDelegate *viewDelegate = new ButtonDelegate(Icons::action_hover(), QString(), this);
1313
1314 viewDelegate->setVisibleTrigger(Qt::DisplayRole,
1315 QVariant::fromValue(ButtonTag(false, Descriptor())));
1316 viewDelegate->setCentred(false);
1317
1318 ui->descriptors->setItemDelegate(viewDelegate);
1319
1320 QObject::connect(viewDelegate, &ButtonDelegate::messageClicked, [this](const QModelIndex &idx) {
1321 ButtonTag tag = idx.data(Qt::DisplayRole).value<ButtonTag>();
1322
1323 if(tag.heap != ResourceId())
1324 {
1325 IDescriptorViewer *viewer = m_Ctx.ViewDescriptorStore(tag.heap);
1326
1327 m_Ctx.AddDockWindow(viewer->Widget(), DockReference::AddTo, this);
1328 return;
1329 }
1330
1331 if(tag.descriptor.type == DescriptorType::Unknown)
1332 return;
1333
1334 if(tag.buffer && tag.descriptor.resource != ResourceId())
1335 {
1336 QString format;
1337
1338 if(tag.descriptor.type == DescriptorType::TypedBuffer ||
1339 tag.descriptor.type == DescriptorType::ReadWriteTypedBuffer)

Callers

nothing calls this directly

Calls 15

fromValueFunction · 0.85
ButtonTagClass · 0.85
connectFunction · 0.85
ShaderResourceClass · 0.85
SubresourceClass · 0.85
headerMethod · 0.80
resizeSectionMethod · 0.80
setVisibleTriggerMethod · 0.80
setCentredMethod · 0.80
QStringFunction · 0.50
DescriptorClass · 0.50
ResourceIdFunction · 0.50

Tested by

no test coverage detected