This commit is contained in:
2018-04-20 18:10:38 +02:00
parent 38a11586bd
commit 4fcbbd7e21
9 changed files with 234 additions and 21 deletions
+20 -9
View File
@@ -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<cPart*>(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()
+22 -8
View File
@@ -28,15 +28,15 @@
<enum>QFrame::Sunken</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_lpMainToolBoxOutline">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>89</width>
<height>433</height>
<width>147</width>
<height>450</height>
</rect>
</property>
<attribute name="label">
@@ -54,6 +54,9 @@
<property name="animated">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
@@ -69,8 +72,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>89</width>
<height>433</height>
<width>147</width>
<height>450</height>
</rect>
</property>
<attribute name="label">
@@ -83,11 +86,14 @@
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="rootIsDecorated">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
@@ -103,7 +109,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>79</width>
<width>147</width>
<height>450</height>
</rect>
</property>
@@ -116,7 +122,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>79</width>
<width>147</width>
<height>450</height>
</rect>
</property>
@@ -126,6 +132,14 @@
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
<widget class="QWidget" name="m_lpMainToolBoxRecherche">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>147</width>
<height>450</height>
</rect>
</property>
<attribute name="label">
<string>Recherche</string>
</attribute>
+1
View File
@@ -112,6 +112,7 @@ bool cPartList::load()
cTextDocument* lpText = new cTextDocument;
if(!ba.isEmpty())
lpText->setHtml(qUncompress(ba));
lpPart->setText(lpText);
}
return(true);
+26
View File
@@ -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());
}
+28
View File
@@ -0,0 +1,28 @@
#ifndef CPARTWINDOW_H
#define CPARTWINDOW_H
#include "cpart.h"
#include <QWidget>
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
+55
View File
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cPartWindow</class>
<widget class="QWidget" name="cPartWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>725</width>
<height>528</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="1,1,99">
<item row="0" column="1">
<widget class="QLineEdit" name="m_lpName"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="m_lpDescription"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="cTextEdit" name="m_lpText"/>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>cTextEdit</class>
<extends>QTextEdit</extends>
<header>ctextedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
+73
View File
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cPartWindow</class>
<widget class="QMainWindow" name="cPartWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>580</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="1,1,99">
<item row="0" column="1">
<widget class="QLineEdit" name="m_lpName"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="m_lpDescription"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="cTextEdit" name="m_lpText"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>cTextEdit</class>
<extends>QTextEdit</extends>
<header>ctextedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_lpName</tabstop>
<tabstop>m_lpDescription</tabstop>
<tabstop>m_lpText</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
+2 -1
View File
@@ -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++)
+7 -3
View File
@@ -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