mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Change the vulkan layer warning to be theme-friendly
* The hardcoded background color didn't work on light-on-dark themes, so instead just use the tooltip base color, and darken on hover.
This commit is contained in:
@@ -53,3 +53,10 @@ void RDLabel::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
|
||||
QLabel::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
void RDLabel::leaveEvent(QEvent *event)
|
||||
{
|
||||
emit(leave());
|
||||
|
||||
QLabel::leaveEvent(event);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ signals:
|
||||
void clicked(QMouseEvent *event);
|
||||
void doubleClicked(QMouseEvent *event);
|
||||
void mouseMoved(QMouseEvent *event);
|
||||
void leave();
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -44,4 +45,5 @@ protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
};
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "CaptureDialog.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include "3rdparty/flowlayout/FlowLayout.h"
|
||||
@@ -113,6 +114,31 @@ CaptureDialog::CaptureDialog(ICaptureContext &ctx, OnCaptureMethod captureCallba
|
||||
|
||||
ui->vulkanLayerWarn->setVisible(RENDERDOC_NeedVulkanLayerRegistration(NULL, NULL, NULL));
|
||||
|
||||
QObject::connect(ui->vulkanLayerWarn, &RDLabel::clicked, this,
|
||||
&CaptureDialog::vulkanLayerWarn_mouseClick);
|
||||
|
||||
QPalette pal = ui->vulkanLayerWarn->palette();
|
||||
|
||||
QColor base = pal.color(QPalette::ToolTipBase);
|
||||
|
||||
pal.setColor(QPalette::Foreground, pal.color(QPalette::ToolTipText));
|
||||
|
||||
pal.setColor(QPalette::Window, base);
|
||||
pal.setColor(QPalette::Base, base.darker(120));
|
||||
|
||||
ui->vulkanLayerWarn->setBackgroundRole(QPalette::Window);
|
||||
|
||||
QObject::connect(ui->vulkanLayerWarn, &RDLabel::mouseMoved, [this](QMouseEvent *) {
|
||||
ui->vulkanLayerWarn->setBackgroundRole(QPalette::Base);
|
||||
});
|
||||
QObject::connect(ui->vulkanLayerWarn, &RDLabel::leave,
|
||||
[this]() { ui->vulkanLayerWarn->setBackgroundRole(QPalette::Window); });
|
||||
|
||||
ui->vulkanLayerWarn->setPalette(pal);
|
||||
ui->vulkanLayerWarn->setAutoFillBackground(true);
|
||||
|
||||
ui->vulkanLayerWarn->setMouseTracking(true);
|
||||
|
||||
m_CaptureCallback = captureCallback;
|
||||
m_InjectCallback = injectCallback;
|
||||
|
||||
@@ -231,7 +257,7 @@ void CaptureDialog::on_exePath_textChanged(const QString &text)
|
||||
UpdateGlobalHook();
|
||||
}
|
||||
|
||||
void CaptureDialog::on_vulkanLayerWarn_clicked()
|
||||
void CaptureDialog::vulkanLayerWarn_mouseClick()
|
||||
{
|
||||
QString caption = tr("Configure Vulkan layer settings in registry?");
|
||||
|
||||
|
||||
@@ -90,10 +90,11 @@ private slots:
|
||||
|
||||
void on_toggleGlobal_clicked();
|
||||
|
||||
void on_vulkanLayerWarn_clicked();
|
||||
|
||||
void on_CaptureCallstacks_toggled(bool checked);
|
||||
|
||||
// manual slots
|
||||
void vulkanLayerWarn_mouseClick();
|
||||
|
||||
private:
|
||||
Ui::CaptureDialog *ui;
|
||||
ICaptureContext &m_Ctx;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>578</width>
|
||||
<height>939</height>
|
||||
<height>943</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -294,50 +294,24 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="vulkanLayerWarn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="RDLabel" name="vulkanLayerWarn">
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton {
|
||||
background-color: #ffffdc;
|
||||
border: 1px solid black;
|
||||
}
|
||||
QToolButton:hover {
|
||||
background-color: #ddddbe;
|
||||
}</string>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Warning: Vulkan capture is not configured.
|
||||
Click here to set up Vulkan capture.</string>
|
||||
<string><html><head/><body><table><tr><td valign="middle"><img src=":/information.png"/></td><td><p>Warning: Vulkan capture is not configured.<br/>Click here to set up Vulkan capture.</p></td></tr></table></body></html></string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../Resources/resources.qrc">
|
||||
<normaloff>:/information.png</normaloff>:/information.png</iconset>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::DelayedPopup</enum>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../Resources/resources.qrc">:/information.png</pixmap>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::NoArrow</enum>
|
||||
<property name="margin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -774,6 +748,13 @@ Click here to set up Vulkan capture.</string>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RDLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>Widgets/Extended/RDLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../Resources/resources.qrc"/>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user