mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-08 06:53:41 +00:00
Implement right-click-to-toggle on channels buttons
This commit is contained in:
1 parent
441d136177
commit
3bd6adddc8
3 files changed
+51
-18
No files matched your search
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user