From 4fcbbd7e219d429e8b84d620af429c4e8e9de294 Mon Sep 17 00:00:00 2001 From: birkeh Date: Fri, 20 Apr 2018 18:10:38 +0200 Subject: [PATCH] . --- cmainwindow.cpp | 29 +++++++++++++------ cmainwindow.ui | 30 +++++++++++++------ cpart.cpp | 1 + cpartwindow.cpp | 26 +++++++++++++++++ cpartwindow.h | 28 ++++++++++++++++++ cpartwindow.ui | 55 +++++++++++++++++++++++++++++++++++ cpartwindow1.ui | 73 +++++++++++++++++++++++++++++++++++++++++++++++ cstorybook.cpp | 3 +- qtStoryWriter.pro | 10 +++++-- 9 files changed, 234 insertions(+), 21 deletions(-) create mode 100644 cpartwindow.cpp create mode 100644 cpartwindow.h create mode 100644 cpartwindow.ui create mode 100644 cpartwindow1.ui diff --git a/cmainwindow.cpp b/cmainwindow.cpp index 72dc014..eea6353 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -3,6 +3,7 @@ #include "ctextdocument.h" +#include "cpartwindow.h" #include "cstructurewindow.h" #include "cwidget.h" @@ -35,18 +36,28 @@ cMainWindow::cMainWindow(QWidget *parent) : updateWindowTitle(); - cStructureWindow* lpStructureWindow = new cStructureWindow(this); - cWidget* lpWidget1 = new cWidget(lpStructureWindow); - lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpStructureWindow)); + cPartWindow* lpPartWindow = new cPartWindow(this); - QMainWindow* lpMainWindow = new QMainWindow(this); - lpMainWindow->setWindowTitle("Bla"); + QStandardItem* lpItem = m_lpOutlineModel->item(0, 0); + cPart* lpPart = qvariant_cast(lpItem->data()); - cWidget* lpWidget2 = new cWidget(lpMainWindow); - lpWidget2->setWindow(ui->m_lpMdiArea->addSubWindow(lpMainWindow)); + lpPartWindow->setPart(lpPart); + cWidget* lpWidget1 = new cWidget(lpPartWindow); + lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpPartWindow)); + ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpPartWindow->windowTitle()); - ui->m_lpMainTab->addTab((QWidget*)lpWidget1, "Structure"); - ui->m_lpMainTab->addTab((QWidget*)lpWidget2, "Bla"); +// cStructureWindow* lpStructureWindow = new cStructureWindow(this); +// cWidget* lpWidget1 = new cWidget(lpStructureWindow); +// lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpStructureWindow)); + +// QMainWindow* lpMainWindow = new QMainWindow(this); +// lpMainWindow->setWindowTitle("Bla"); + +// cWidget* lpWidget2 = new cWidget(lpMainWindow); +// lpWidget2->setWindow(ui->m_lpMdiArea->addSubWindow(lpMainWindow)); + +// ui->m_lpMainTab->addTab((QWidget*)lpWidget1, "Structure"); +// ui->m_lpMainTab->addTab((QWidget*)lpWidget2, "Bla"); } cMainWindow::~cMainWindow() diff --git a/cmainwindow.ui b/cmainwindow.ui index c031aad..ca7fa8d 100644 --- a/cmainwindow.ui +++ b/cmainwindow.ui @@ -28,15 +28,15 @@ QFrame::Sunken - 4 + 0 0 0 - 89 - 433 + 147 + 450 @@ -54,6 +54,9 @@ true + + false + false @@ -69,8 +72,8 @@ 0 0 - 89 - 433 + 147 + 450 @@ -83,11 +86,14 @@ QAbstractItemView::NoEditTriggers - true + false true + + false + false @@ -103,7 +109,7 @@ 0 0 - 79 + 147 450 @@ -116,7 +122,7 @@ 0 0 - 79 + 147 450 @@ -126,6 +132,14 @@ + + + 0 + 0 + 147 + 450 + + Recherche diff --git a/cpart.cpp b/cpart.cpp index 12b6983..1220fec 100644 --- a/cpart.cpp +++ b/cpart.cpp @@ -112,6 +112,7 @@ bool cPartList::load() cTextDocument* lpText = new cTextDocument; if(!ba.isEmpty()) lpText->setHtml(qUncompress(ba)); + lpPart->setText(lpText); } return(true); diff --git a/cpartwindow.cpp b/cpartwindow.cpp new file mode 100644 index 0000000..413d075 --- /dev/null +++ b/cpartwindow.cpp @@ -0,0 +1,26 @@ +#include "cpartwindow.h" +#include "ui_cpartwindow.h" + + +cPartWindow::cPartWindow(QWidget *parent) : + QWidget(parent), + ui(new Ui::cPartWindow), + m_lpPart(0) +{ + ui->setupUi(this); +} + +cPartWindow::~cPartWindow() +{ + delete ui; +} + +void cPartWindow::setPart(cPart* lpPart) +{ + m_lpPart = lpPart; + ui->m_lpName->setText(lpPart->name()); + ui->m_lpDescription->document()->setPlainText(lpPart->description()); + ui->m_lpText->setDocument(lpPart->text()); + + setWindowTitle(tr("[part] - ") + lpPart->name()); +} diff --git a/cpartwindow.h b/cpartwindow.h new file mode 100644 index 0000000..9edc951 --- /dev/null +++ b/cpartwindow.h @@ -0,0 +1,28 @@ +#ifndef CPARTWINDOW_H +#define CPARTWINDOW_H + + +#include "cpart.h" + +#include + + +namespace Ui { +class cPartWindow; +} + +class cPartWindow : public QWidget +{ + Q_OBJECT + +public: + explicit cPartWindow(QWidget *parent = 0); + ~cPartWindow(); + + void setPart(cPart* lpPart); +private: + Ui::cPartWindow* ui; + cPart* m_lpPart; +}; + +#endif // CPARTWINDOW_H diff --git a/cpartwindow.ui b/cpartwindow.ui new file mode 100644 index 0000000..adee7b4 --- /dev/null +++ b/cpartwindow.ui @@ -0,0 +1,55 @@ + + + cPartWindow + + + + 0 + 0 + 725 + 528 + + + + Form + + + + + + + + + + + Name: + + + + + + + Description: + + + + + + + + + + + + + + + + cTextEdit + QTextEdit +
ctextedit.h
+
+
+ + +
diff --git a/cpartwindow1.ui b/cpartwindow1.ui new file mode 100644 index 0000000..390e498 --- /dev/null +++ b/cpartwindow1.ui @@ -0,0 +1,73 @@ + + + cPartWindow + + + + 0 + 0 + 800 + 580 + + + + MainWindow + + + + + + + + + + + + Name: + + + + + + + Description: + + + + + + + + + + + + + + + + + 0 + 0 + 800 + 21 + + + + + + + + cTextEdit + QTextEdit +
ctextedit.h
+
+
+ + m_lpName + m_lpDescription + m_lpText + + + +
diff --git a/cstorybook.cpp b/cstorybook.cpp index 4dbed7c..4b664af 100644 --- a/cstorybook.cpp +++ b/cstorybook.cpp @@ -388,7 +388,8 @@ bool cStoryBook::fillOutlineList(QTreeView* lpView) lpItem->setToolTip(lpPart->description()); part.insert(lpPart->id(), lpItem); lpModel->appendRow(lpItem); - lpView->setFirstColumnSpanned(lpModel->rowCount()-1, lpRootItem->index(), true); + + lpView->setFirstColumnSpanned(lpModel->rowCount()-1, lpModel->invisibleRootItem()->index(), true); } for(int x = 0;x < m_chapterList.count();x++) diff --git a/qtStoryWriter.pro b/qtStoryWriter.pro index e2d9ace..80ec1df 100644 --- a/qtStoryWriter.pro +++ b/qtStoryWriter.pro @@ -53,7 +53,8 @@ SOURCES += \ cpart.cpp \ cchapter.cpp \ cscene.cpp \ - ccharacter.cpp + ccharacter.cpp \ + cpartwindow.cpp HEADERS += \ cmainwindow.h \ @@ -68,11 +69,14 @@ HEADERS += \ cpart.h \ cchapter.h \ cscene.h \ - ccharacter.h + ccharacter.h \ + cpartwindow.h FORMS += \ cmainwindow.ui \ - cstructurewindow.ui + cstructurewindow.ui \ + cpartwindow1.ui \ + cpartwindow.ui DISTFILES += \ storyBook.project