| 27 | #include <KToggleAction> |
| 28 | |
| 29 | NotebookView::NotebookView(Notebook* worksheet) |
| 30 | : QWidget() |
| 31 | , m_notebook(worksheet) { |
| 32 | auto* layout = new QHBoxLayout(this); |
| 33 | layout->setContentsMargins(0, 0, 0, 0); |
| 34 | m_part = worksheet->part(); |
| 35 | if (m_part) { |
| 36 | layout->addWidget(m_part->widget()); |
| 37 | initActions(); |
| 38 | connect(m_notebook, &Notebook::requestProjectContextMenu, this, &NotebookView::createContextMenu); |
| 39 | connect(m_notebook, &Notebook::statusChanged, this, &NotebookView::statusChanged); |
| 40 | } else { |
| 41 | QString msg = QStringLiteral("<b>") + i18n("Failed to initialize %1.", m_notebook->backendName()) + QStringLiteral("</b><br>"); |
| 42 | msg += worksheet->error(); |
| 43 | QLabel* label = new QLabel(msg); |
| 44 | label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
| 45 | layout->addWidget(label); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | void NotebookView::initActions() { |
| 50 | m_actionGroup = new QActionGroup(this); |
nothing calls this directly
no test coverage detected