| 15 | #include <QAction> /* Different module in Qt5 vs Qt6 */ |
| 16 | |
| 17 | VisualizerWidget::VisualizerWidget(QWidget *parent, const QString &config) : QWidget{parent} { |
| 18 | QIcon iconRefresh(QPixmap(QStringLiteral(":/icons/resources/icons/refresh.png"))); |
| 19 | QIcon iconLcd(QPixmap(QStringLiteral(":/icons/resources/icons/lcd.png"))); |
| 20 | QIcon iconInfo(QPixmap(QStringLiteral(":/icons/resources/icons/misc.png"))); |
| 21 | |
| 22 | m_group = new QGroupBox(this); |
| 23 | QHBoxLayout *hlayout = new QHBoxLayout(m_group); |
| 24 | |
| 25 | m_config = new QLineEdit(m_group); |
| 26 | m_config->setFocusPolicy(Qt::ClickFocus); |
| 27 | m_btnLcd = new QToolButton(m_group); |
| 28 | m_btnRefresh = new QToolButton(m_group); |
| 29 | m_btnConfig = new QToolButton(m_group); |
| 30 | |
| 31 | m_btnLcd->setIcon(iconLcd); |
| 32 | m_btnRefresh->setIcon(iconRefresh); |
| 33 | m_btnConfig->setIcon(iconInfo); |
| 34 | |
| 35 | hlayout->addWidget(m_config); |
| 36 | hlayout->addWidget(m_btnRefresh); |
| 37 | hlayout->addWidget(m_btnLcd); |
| 38 | hlayout->addWidget(m_btnConfig); |
| 39 | |
| 40 | m_view = new VisualizerDisplayWidget(this); |
| 41 | m_view->setLayoutDirection(Qt::LeftToRight); |
| 42 | |
| 43 | QVBoxLayout *vlayout = new QVBoxLayout(this); |
| 44 | vlayout->addWidget(m_group); |
| 45 | vlayout->addWidget(m_view); |
| 46 | vlayout->addStretch(1); |
| 47 | setLayout(vlayout); |
| 48 | |
| 49 | connect(m_config, &QLineEdit::returnPressed, this, &VisualizerWidget::stringToView); |
| 50 | connect(m_btnRefresh, &QPushButton::clicked, this, &VisualizerWidget::stringToView); |
| 51 | connect(m_btnLcd, &QPushButton::clicked, this, &VisualizerWidget::showPresets); |
| 52 | connect(m_btnConfig, &QPushButton::clicked, this, &VisualizerWidget::showConfig); |
| 53 | |
| 54 | if (config.isEmpty()) { |
| 55 | resetView(); |
| 56 | } else { |
| 57 | m_config->setText(config); |
| 58 | stringToView(); |
| 59 | } |
| 60 | |
| 61 | translate(); |
| 62 | } |
| 63 | |
| 64 | VisualizerWidget::~VisualizerWidget() = default; |
| 65 |
nothing calls this directly
no outgoing calls
no test coverage detected