Improve sizing of custom format setcion and use splitter between sides

This commit is contained in:
baldurk
2022-05-25 15:37:44 +01:00
parent 702e361393
commit 91675e8dbb
3 changed files with 54 additions and 45 deletions
+22 -1
View File
@@ -31,6 +31,7 @@
#include <QTextDocument>
#include "Code/QRDUtils.h"
#include "Code/ScintillaSyntax.h"
#include "Widgets/Extended/RDSplitter.h"
#include "scintilla/include/SciLexer.h"
#include "scintilla/include/qt/ScintillaEdit.h"
#include "ui_BufferFormatSpecifier.h"
@@ -125,7 +126,24 @@ BufferFormatSpecifier::BufferFormatSpecifier(QWidget *parent)
formatText->annotationClearAll();
});
ui->mainLayout->insertWidget(0, formatContainer);
QHBoxLayout *hbox = new QHBoxLayout(this);
hbox->setSpacing(0);
hbox->setContentsMargins(2, 2, 2, 2);
QWidget *helpOrFormat = new QWidget(this);
helpOrFormat->setLayout(hbox);
hbox->insertWidget(0, formatContainer);
hbox->insertWidget(1, ui->helpText);
m_Splitter = new RDSplitter(Qt::Horizontal, this);
m_Splitter->setHandleWidth(12);
m_Splitter->setChildrenCollapsible(false);
m_Splitter->addWidget(helpOrFormat);
m_Splitter->addWidget(ui->savedContainer);
ui->formatGroup->layout()->addWidget(m_Splitter);
ui->savedList->setItemDelegate(new FullEditorDelegate(ui->savedList));
ui->savedList->setFont(Formatter::PreferredFont());
@@ -346,6 +364,9 @@ void BufferFormatSpecifier::on_showHelp_toggled(bool help)
{
ui->helpText->setVisible(help);
formatText->parentWidget()->setVisible(!help);
if(help)
ui->verticalLayout->invalidate();
}
void BufferFormatSpecifier::on_loadDef_clicked()
@@ -31,6 +31,7 @@ struct ICaptureContext;
class ScintillaEdit;
class RDTreeWidgetItem;
class RDSplitter;
namespace Ui
{
@@ -98,5 +99,7 @@ private:
ScintillaEdit *formatText;
RDSplitter *m_Splitter = NULL;
QString m_AutoFormat;
};
+29 -44
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>625</width>
<height>395</height>
</rect>
</property>
<property name="windowTitle">
@@ -40,21 +40,21 @@
<property name="title">
<string>Format</string>
</property>
<layout class="QHBoxLayout" name="mainLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
<number>0</number>
</property>
<property name="leftMargin">
<number>2</number>
<number>0</number>
</property>
<property name="topMargin">
<number>2</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>2</number>
<number>0</number>
</property>
<property name="bottomMargin">
<number>2</number>
<number>0</number>
</property>
<item>
<widget class="QTextEdit" name="helpText">
@@ -65,13 +65,13 @@ p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Exhaustive documentation can be found in the &lt;/span&gt;&lt;a href=&quot;https://renderdoc.org/docs/how/how_buffer_format.html&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;online docs&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Buffer format declarations are similar to HLSL or GLSL struct definitions with normal vector, matrix and base types (e.g. &lt;code&gt;float&lt;/code&gt;, &lt;code&gt;float4&lt;/code&gt; or &lt;code&gt;vec4&lt;/code&gt;, etc). In many cases these can be copied and pasted from shader source.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Buffer format declarations are similar to HLSL or GLSL struct definitions with normal vector, matrix and base types (e.g. &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;float&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;float4&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; or &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;vec4&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;, etc). In many cases these can be copied and pasted from shader source.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;You can define and use structs. The buffer format is defined by all global variables. If there are no globals defined, the last struct defined will be used.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Most types that can be declared in shaders can be used, including half, short, as well as the usual int, float. All of these can be matrices or arrays.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Packing/padding rules can be specified with &lt;code&gt;#pack(rules)&lt;/code&gt;. Supported D3D rules: &lt;code&gt;cbuffer&lt;/code&gt;, &lt;code&gt;uav&lt;/code&gt;. Supported GL/VK rules: &lt;code&gt;std140&lt;/code&gt;, &lt;code&gt;std430&lt;/code&gt;, &lt;code&gt;scalar&lt;/code&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Packing/padding rules can be specified with &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;#pack(rules)&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;. Supported D3D rules: &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;cbuffer&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;uav&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;. Supported GL/VK rules: &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;std140&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;std430&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:8pt;&quot;&gt;scalar&lt;/span&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Bitfields are supported using C syntax, enums can be defined but all enum values must have explicit decimal or hexadecimal numerical values.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
@@ -84,42 +84,42 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QWidget" name="savedContainer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
<number>2</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>2</number>
</property>
<item>
<widget class="RDTreeWidget" name="savedList">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="indentation">
<number>0</number>
</property>
@@ -129,21 +129,6 @@ p, li { white-space: pre-wrap; }
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
@@ -177,12 +162,12 @@ p, li { white-space: pre-wrap; }
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>100</width>
<height>20</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>