plan: define MainWindow Qt widget interface
This commit is contained in:
parent
cc29845657
commit
499584f856
32
include/MainWindow.hpp
Normal file
32
include/MainWindow.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
// MainWindow.hpp
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
// 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;
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user