wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
ClockDialog.cpp
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
5
7
8ClockDialog::ClockDialog(const int currentPeriod, QWidget *parent)
9 : QDialog(parent)
10 , m_ui(std::make_unique<ClockDialogUi>())
11{
12 m_ui->setupUi(this);
13
14 // Pre-populate with the last used period so the user doesn't have to re-enter it
15 m_ui->periodSpinBox->setValue(currentPeriod);
16
17 setWindowTitle(tr("Clock Period Selection"));
18
19 connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
20 connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
21}
22
26
28{
29 // Pure accessor: the caller runs exec() and reads this only on QDialog::Accepted.
30 return m_ui->periodSpinBox->value();
31}
ClockDialogUi: hand-written UI class for the ClockDialog.
ClockDialog: dialog for selecting a clock wave's period (in time-step columns).
ClockDialog(const int currentPeriod, QWidget *parent=nullptr)
Constructs the dialog with currentPeriod (in time-step columns) as the initial value.
~ClockDialog() override
int period() const
Returns the selected clock period, in waveform time-step columns.