33 lines
843 B
C++

#pragma once
// MainWindow.hpp
// SPDX-License-Identifier: GPL-3.0-or-later
// Author: Unai Blazquez <unaibg2000@gmail.com>
#include <QLabel>
#include <QString>
#include <QVBoxLayout>
#include <QWidget>
/// @brief Minimal GUI window that displays the last integer received
/// from the ConsumerThread. Never blocks — values arrive via
/// Qt's queued signal/slot mechanism.
class MainWindow : public QWidget
{
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = nullptr);
/// @brief Returns the current text shown in the value label (for testing).
QString lastDisplayedText() const;
public slots:
/// @brief Slot connected to ConsumerThread::valueReceived.
/// Updates the label with the new value.
void onValueReceived(int value);
private:
QLabel* m_title_label;
QLabel* m_value_label;
};