Convert ShaderView to QWidget.

This commit is contained in:
Shaun Reed 2025-03-23 15:43:10 -04:00
parent 6218928e15
commit 48598de9c8
2 changed files with 11 additions and 6 deletions

View File

@ -37,10 +37,8 @@ ToolBox::ToolBox(QWidget * parent) :
// Shader views.
ui->page_shaders->setLayout(shaderForm_);
shaderForm_->addRow(vertex_.path.label, vertex_.path.value);
shaderForm_->addRow(vertex_.editor);
shaderForm_->addRow(fragment_.path.label, fragment_.path.value);
shaderForm_->addRow(fragment_.editor);
shaderForm_->addRow(reinterpret_cast<QWidget *>(&vertex_));
shaderForm_->addRow(reinterpret_cast<QWidget *>(&fragment_));
}
void ToolBox::updateFocus(const QString & name)

View File

@ -122,16 +122,23 @@ namespace Qtk
};
SpinBoxHorizontal3D transformPanel_, scalePanel_;
class ShaderView
class ShaderView final : QWidget
{
public:
explicit ShaderView(QWidget * parent = nullptr,
const char * l = "ShaderView:") :
path(parent, l), editor(new QTextEdit(parent))
layout(new QVBoxLayout(this)), path(parent, l),
editor(new QTextEdit(parent))
{
auto * pathLayout = new QHBoxLayout;
pathLayout->addWidget(path.label);
pathLayout->addWidget(path.value);
layout->addLayout(pathLayout);
layout->addWidget(editor);
editor->setReadOnly(true);
}
QVBoxLayout * layout;
/// Shader name and path on disk.
ObjectDetails::Item path;
/// Read-only (for now) display of the shader source code.