| 5 | #include <QtWidgets/QHBoxLayout> |
| 6 | |
| 7 | KeyHistoryWidget::KeyHistoryWidget(QWidget *parent, int size) : QWidget{parent} { |
| 8 | QHBoxLayout *hlayout = new QHBoxLayout(); |
| 9 | |
| 10 | m_btnClear = new QPushButton(tr("Clear History")); |
| 11 | m_label = new QLabel(tr("Size")); |
| 12 | m_view = new QPlainTextEdit(); |
| 13 | m_size = new QSpinBox(); |
| 14 | m_spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Preferred); |
| 15 | m_chkBoxVertical = new QCheckBox(tr("Print Vertically")); |
| 16 | |
| 17 | m_view->setReadOnly(true); |
| 18 | m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
| 19 | |
| 20 | hlayout->addWidget(m_btnClear); |
| 21 | hlayout->addSpacerItem(m_spacer); |
| 22 | hlayout->addWidget(m_label); |
| 23 | hlayout->addWidget(m_size); |
| 24 | hlayout->addWidget(m_chkBoxVertical); |
| 25 | |
| 26 | QVBoxLayout *vlayout = new QVBoxLayout(); |
| 27 | vlayout->addWidget(m_view); |
| 28 | vlayout->addLayout(hlayout); |
| 29 | setLayout(vlayout); |
| 30 | |
| 31 | connect(m_btnClear, &QPushButton::clicked, m_view, &QPlainTextEdit::clear); |
| 32 | connect(m_size, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &KeyHistoryWidget::setFontSize); |
| 33 | |
| 34 | setFontSize(size); |
| 35 | } |
| 36 | |
| 37 | KeyHistoryWidget::~KeyHistoryWidget() = default; |
| 38 |
nothing calls this directly
no outgoing calls
no test coverage detected