ClickBlurLabel: Create a label which is blurred until it is clicked

This is particularly useful for people who stream their desktop and don't want to accidentally leak their IP or room.
This commit is contained in:
Joshua Vandaële
2025-06-13 22:56:13 +02:00
parent a163877413
commit 8f0ef62a71
6 changed files with 103 additions and 2 deletions

View File

@ -0,0 +1,29 @@
// Copyright 2025 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QLabel>
#include <QStackedWidget>
#include <QWidget>
class ClickBlurLabel final : public QStackedWidget
{
Q_OBJECT
public:
explicit ClickBlurLabel(QWidget* parent = nullptr);
void setText(const QString& text);
QString text() const { return m_normal_label->text(); }
protected:
void mousePressEvent(QMouseEvent* event) override;
private:
// Generates text that "looks correct" but is actually gibberish.
static QString GenerateBlurredText(const QString& text);
QLabel* m_normal_label;
QLabel* m_blurred_label;
};