mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Implement right-click-to-toggle on channels buttons
This commit is contained in:
@@ -504,14 +504,6 @@ TextureViewer::TextureViewer(ICaptureContext &ctx, QWidget *parent)
|
||||
QObject::connect(ui->stencilDisplay, &QToolButton::toggled, this,
|
||||
&TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(ui->flip_y, &QToolButton::toggled, this, &TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(ui->channelRed, &QToolButton::toggled, this,
|
||||
&TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(ui->channelGreen, &QToolButton::toggled, this,
|
||||
&TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(ui->channelBlue, &QToolButton::toggled, this,
|
||||
&TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(ui->channelAlpha, &QToolButton::toggled, this,
|
||||
&TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(ui->gammaDisplay, &QToolButton::toggled, this,
|
||||
&TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(ui->channels, OverloadedSlot<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
@@ -532,6 +524,15 @@ TextureViewer::TextureViewer(ICaptureContext &ctx, QWidget *parent)
|
||||
QObject::connect(ui->rangeWhite, &RDLineEdit::leave, this, &TextureViewer::rangePoint_leave);
|
||||
QObject::connect(ui->rangeWhite, &RDLineEdit::keyPress, this, &TextureViewer::rangePoint_keyPress);
|
||||
|
||||
for(RDToolButton *butt : {ui->channelRed, ui->channelGreen, ui->channelBlue, ui->channelAlpha})
|
||||
{
|
||||
QObject::connect(butt, &RDToolButton::toggled, this, &TextureViewer::channelsWidget_toggled);
|
||||
QObject::connect(butt, &RDToolButton::mouseClicked, this,
|
||||
&TextureViewer::channelsWidget_mouseClicked);
|
||||
QObject::connect(butt, &RDToolButton::doubleClicked, this,
|
||||
&TextureViewer::channelsWidget_mouseClicked);
|
||||
}
|
||||
|
||||
QWidget *renderContainer = ui->renderContainer;
|
||||
|
||||
ui->dockarea->addToolWindow(ui->renderContainer, ToolWindowManager::EmptySpace);
|
||||
@@ -2866,6 +2867,32 @@ void TextureViewer::on_overlay_currentIndexChanged(int index)
|
||||
INVOKE_MEMFN(RT_UpdateAndDisplay);
|
||||
}
|
||||
|
||||
void TextureViewer::channelsWidget_mouseClicked(QMouseEvent *event)
|
||||
{
|
||||
RDToolButton *s = qobject_cast<RDToolButton *>(QObject::sender());
|
||||
|
||||
if(event->button() == Qt::RightButton && s)
|
||||
{
|
||||
bool checkd = false;
|
||||
|
||||
RDToolButton *butts[] = {ui->channelRed, ui->channelGreen, ui->channelBlue, ui->channelAlpha};
|
||||
|
||||
for(RDToolButton *b : butts)
|
||||
{
|
||||
if(b->isChecked() && b != s)
|
||||
checkd = true;
|
||||
if(!b->isChecked() && b == s)
|
||||
checkd = true;
|
||||
}
|
||||
|
||||
ui->channelRed->setChecked(!checkd);
|
||||
ui->channelGreen->setChecked(!checkd);
|
||||
ui->channelBlue->setChecked(!checkd);
|
||||
ui->channelAlpha->setChecked(!checkd);
|
||||
s->setChecked(checkd);
|
||||
}
|
||||
}
|
||||
|
||||
void TextureViewer::range_rangeUpdated()
|
||||
{
|
||||
m_TexDisplay.rangemin = ui->rangeHistogram->blackPoint();
|
||||
@@ -3766,4 +3793,4 @@ void TextureViewer::customShaderModified(const QString &path)
|
||||
QThread::msleep(15);
|
||||
|
||||
reloadCustomShaders(QString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ private slots:
|
||||
|
||||
void customShaderModified(const QString &path);
|
||||
|
||||
void channelsWidget_mouseClicked(QMouseEvent *event);
|
||||
void channelsWidget_toggled(bool checked) { UI_UpdateChannels(); }
|
||||
void channelsWidget_selected(int index) { UI_UpdateChannels(); }
|
||||
private:
|
||||
|
||||
@@ -688,7 +688,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="channelRed">
|
||||
<widget class="RDToolButton" name="channelRed">
|
||||
<property name="toolTip">
|
||||
<string>Show Red (Right click to toggle solo)</string>
|
||||
</property>
|
||||
@@ -707,7 +707,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="channelGreen">
|
||||
<widget class="RDToolButton" name="channelGreen">
|
||||
<property name="toolTip">
|
||||
<string>Show Green (Right click to toggle solo)</string>
|
||||
</property>
|
||||
@@ -726,7 +726,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="channelBlue">
|
||||
<widget class="RDToolButton" name="channelBlue">
|
||||
<property name="toolTip">
|
||||
<string>Show Blue (Right click to toggle solo)</string>
|
||||
</property>
|
||||
@@ -748,7 +748,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="channelAlpha">
|
||||
<widget class="RDToolButton" name="channelAlpha">
|
||||
<property name="toolTip">
|
||||
<string>Show Alpha (Right click to toggle solo)</string>
|
||||
</property>
|
||||
@@ -1266,11 +1266,6 @@ See FAQ on "Gamma display of linear data"</string>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RDLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Widgets/Extended/RDLineEdit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ToolWindowManager</class>
|
||||
<extends>QWidget</extends>
|
||||
@@ -1281,6 +1276,11 @@ See FAQ on "Gamma display of linear data"</string>
|
||||
<extends>QWidget</extends>
|
||||
<header>Widgets/CustomPaintWidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RDLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Widgets/Extended/RDLineEdit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ThumbnailStrip</class>
|
||||
<extends>QWidget</extends>
|
||||
@@ -1298,6 +1298,11 @@ See FAQ on "Gamma display of linear data"</string>
|
||||
<header>Widgets/RangeHistogram.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RDToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>Widgets/Extended/RDToolButton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../Resources/resources.qrc"/>
|
||||
|
||||
Reference in New Issue
Block a user