| 25 | #include <QWidget> |
| 26 | |
| 27 | YACReaderTranslator::YACReaderTranslator(Viewer *parent) |
| 28 | : QWidget(parent), drag(false) |
| 29 | { |
| 30 | this->setCursor(QCursor(Qt::ArrowCursor)); |
| 31 | this->setAutoFillBackground(true); |
| 32 | this->setBackgroundRole(QPalette::Window); |
| 33 | |
| 34 | auto layout = new QVBoxLayout(this); |
| 35 | |
| 36 | // TITLE BAR |
| 37 | auto titleBar = new QHBoxLayout(); |
| 38 | closeButton = new QPushButton(this); |
| 39 | closeButton->setFlat(true); |
| 40 | titleLabel = new QLabel(tr("YACReader translator")); |
| 41 | titleBar->addWidget(titleLabel); |
| 42 | titleBar->addStretch(); |
| 43 | closeButton->resize(14, 14); |
| 44 | closeButton->setStyleSheet("QPushButton {margin:0;padding:0;border:none;}"); |
| 45 | titleBar->addWidget(closeButton); |
| 46 | titleBar->setContentsMargins(0, 0, 0, 0); |
| 47 | titleBar->setSpacing(0); |
| 48 | connect(closeButton, &QAbstractButton::clicked, parent, &Viewer::animateHideTranslator); |
| 49 | |
| 50 | layout->addLayout(titleBar); |
| 51 | |
| 52 | // INPUT TEXT |
| 53 | text = new QTextEdit(this); |
| 54 | text->setMinimumHeight(110); |
| 55 | text->setMaximumHeight(110); |
| 56 | layout->addSpacing(12); |
| 57 | layout->addWidget(text); |
| 58 | |
| 59 | // COMBOBOXES |
| 60 | auto combos = new QHBoxLayout(); |
| 61 | from = new QComboBox(this); |
| 62 | to = new QComboBox(this); |
| 63 | from->setFixedHeight(22); |
| 64 | to->setFixedHeight(22); |
| 65 | arrowLabel = new QLabel(this); |
| 66 | searchButton = new QPushButton(this); |
| 67 | searchButton->setFixedSize(22, 22); |
| 68 | combos->addWidget(from, 1); |
| 69 | combos->addSpacing(9); |
| 70 | combos->addWidget(arrowLabel, 0); |
| 71 | combos->addSpacing(9); |
| 72 | combos->addWidget(to, 1); |
| 73 | combos->addSpacing(9); |
| 74 | combos->addWidget(searchButton, 0); |
| 75 | layout->addSpacing(12); |
| 76 | layout->addLayout(combos); |
| 77 | |
| 78 | // RESULTS |
| 79 | auto resultsTitleLayout = new QHBoxLayout(); |
| 80 | resultsTitle = new QLabel(tr("Translation")); |
| 81 | speakButton = new QPushButton(this); |
| 82 | speakButton->setStyleSheet("QPushButton {border:none;}"); |
| 83 | resultsTitleLayout->addWidget(resultsTitle, 0, Qt::AlignVCenter); |
| 84 | resultsTitleLayout->addSpacing(10); |
nothing calls this directly
no test coverage detected