.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "cchapterwindow.h"
|
||||
#include "ui_cchapterwindow.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
@@ -14,6 +16,21 @@ cChapterWindow::cChapterWindow(QWidget *parent) :
|
||||
|
||||
m_lpSceneModel = new QStandardItemModel(0, 1);
|
||||
ui->m_lpSceneList->setModel(m_lpSceneModel);
|
||||
|
||||
connect(ui->m_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpPart, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpPart, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpSceneList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpSceneList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpText, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpText, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
}
|
||||
|
||||
cChapterWindow::~cChapterWindow()
|
||||
|
||||
+14
-4
@@ -30,7 +30,7 @@
|
||||
<widget class="cTextEdit" name="m_lpText"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
<widget class="cLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
@@ -43,7 +43,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
@@ -56,7 +56,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QTreeView" name="m_lpSceneList">
|
||||
<widget class="cTreeView" name="m_lpSceneList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -82,7 +82,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_lpPart">
|
||||
<widget class="cLineEdit" name="m_lpPart">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -98,6 +98,16 @@
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cTreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ctreeview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
|
||||
+78
-1
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "cimagewidget.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
@@ -13,6 +15,81 @@ cCharacterWindow::cCharacterWindow(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->m_lpTab->setCurrentIndex(0);
|
||||
|
||||
connect(ui->m_lpFirstName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpFirstName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpMiddleName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpMiddleName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpLastName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpLastName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpMainCharacter, SIGNAL(gotFocus(cCheckBox*)), (cMainWindow*)parent, SLOT(onCheckBoxGotFocus(cCheckBox*)));
|
||||
connect(ui->m_lpMainCharacter, SIGNAL(lostFocus(cCheckBox*)), (cMainWindow*)parent, SLOT(onCheckBoxLostFocus(cCheckBox*)));
|
||||
|
||||
connect(ui->m_lpCreature, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpCreature, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpTitle, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpTitle, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpMale, SIGNAL(gotFocus(cRadioButton*)), (cMainWindow*)parent, SLOT(onRadioButtonGotFocus(cRadioButton*)));
|
||||
connect(ui->m_lpMale, SIGNAL(lostFocus(cRadioButton*)), (cMainWindow*)parent, SLOT(onRadioButtonLostFocus(cRadioButton*)));
|
||||
|
||||
connect(ui->m_lpFemale, SIGNAL(gotFocus(cRadioButton*)), (cMainWindow*)parent, SLOT(onRadioButtonGotFocus(cRadioButton*)));
|
||||
connect(ui->m_lpFemale, SIGNAL(lostFocus(cRadioButton*)), (cMainWindow*)parent, SLOT(onRadioButtonLostFocus(cRadioButton*)));
|
||||
|
||||
connect(ui->m_lpOther, SIGNAL(gotFocus(cRadioButton*)), (cMainWindow*)parent, SLOT(onRadioButtonGotFocus(cRadioButton*)));
|
||||
connect(ui->m_lpOther, SIGNAL(lostFocus(cRadioButton*)), (cMainWindow*)parent, SLOT(onRadioButtonLostFocus(cRadioButton*)));
|
||||
|
||||
connect(ui->m_lpDayOfBirth, SIGNAL(gotFocus(cDateEdit*)), (cMainWindow*)parent, SLOT(onDateEditGotFocus(cDateEdit*)));
|
||||
connect(ui->m_lpDayOfBirth, SIGNAL(lostFocus(cDateEdit*)), (cMainWindow*)parent, SLOT(onDateEditLostFocus(cDateEdit*)));
|
||||
|
||||
connect(ui->m_lpDayOfDeath, SIGNAL(gotFocus(cDateEdit*)), (cMainWindow*)parent, SLOT(onDateEditGotFocus(cDateEdit*)));
|
||||
connect(ui->m_lpDayOfDeath, SIGNAL(lostFocus(cDateEdit*)), (cMainWindow*)parent, SLOT(onDateEditLostFocus(cDateEdit*)));
|
||||
|
||||
connect(ui->m_lpPlaceOfBirth, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpPlaceOfBirth, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpPlaceOfDeath, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpPlaceOfDeath, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpHeight, SIGNAL(gotFocus(cDoubleSpinBox*)), (cMainWindow*)parent, SLOT(onDoubleSpinBoxGotFocus(cDoubleSpinBox*)));
|
||||
connect(ui->m_lpHeight, SIGNAL(lostFocus(cDoubleSpinBox*)), (cMainWindow*)parent, SLOT(onDoubleSpinBoxLostFocus(cDoubleSpinBox*)));
|
||||
|
||||
connect(ui->m_lpWeight, SIGNAL(gotFocus(cDoubleSpinBox*)), (cMainWindow*)parent, SLOT(onDoubleSpinBoxGotFocus(cDoubleSpinBox*)));
|
||||
connect(ui->m_lpWeight, SIGNAL(lostFocus(cDoubleSpinBox*)), (cMainWindow*)parent, SLOT(onDoubleSpinBoxLostFocus(cDoubleSpinBox*)));
|
||||
|
||||
connect(ui->m_lpFigure, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpFigure, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpSkin, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpSkin, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpNature, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpNature, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpHairColor, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpHairColor, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpHairCut, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpHairCut, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpHairLength, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpHairLength, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpSchool, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpSchool, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpSpokenLanguages, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpSpokenLanguages, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpJob, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpJob, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
}
|
||||
|
||||
cCharacterWindow::~cCharacterWindow()
|
||||
@@ -55,7 +132,7 @@ void cCharacterWindow::setCharacter(cCharacter* lpCharacter)
|
||||
ui->m_lpHairCut->setText(lpCharacter->hairCut());
|
||||
ui->m_lpHairLength->setText(lpCharacter->hairLength());
|
||||
ui->m_lpSchool->setText(lpCharacter->school());
|
||||
ui->m_lpspokenLanguages->setText(lpCharacter->spokenLanguages());
|
||||
ui->m_lpSpokenLanguages->setText(lpCharacter->spokenLanguages());
|
||||
ui->m_lpJob->setHtml(lpCharacter->job());
|
||||
ui->m_lpDescription->setDocument(lpCharacter->description());
|
||||
|
||||
|
||||
+58
-26
@@ -17,7 +17,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="m_lpTab">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_lpBasic">
|
||||
<attribute name="title">
|
||||
@@ -27,7 +27,7 @@
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0,0,0,0,0,0,0,0,0">
|
||||
<item row="9" column="1" colspan="5">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
@@ -40,17 +40,17 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_lpHeight">
|
||||
<widget class="cDoubleSpinBox" name="m_lpHeight">
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="m_lpCreature"/>
|
||||
<widget class="cLineEdit" name="m_lpCreature"/>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLineEdit" name="m_lpPlaceOfBirth"/>
|
||||
<widget class="cLineEdit" name="m_lpPlaceOfBirth"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="label_11">
|
||||
@@ -93,10 +93,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDateEdit" name="m_lpDayOfDeath"/>
|
||||
<widget class="cDateEdit" name="m_lpDayOfDeath"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDateEdit" name="m_lpDayOfBirth"/>
|
||||
<widget class="cDateEdit" name="m_lpDayOfBirth"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
@@ -109,10 +109,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLineEdit" name="m_lpPlaceOfDeath"/>
|
||||
<widget class="cLineEdit" name="m_lpPlaceOfDeath"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="m_lpMainCharacter">
|
||||
<widget class="cCheckBox" name="m_lpMainCharacter">
|
||||
<property name="text">
|
||||
<string>Main Character</string>
|
||||
</property>
|
||||
@@ -129,7 +129,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QDoubleSpinBox" name="m_lpWeight">
|
||||
<widget class="cDoubleSpinBox" name="m_lpWeight">
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -166,7 +166,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_lpFirstName"/>
|
||||
<widget class="cLineEdit" name="m_lpFirstName"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
@@ -179,7 +179,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="m_lpMiddleName"/>
|
||||
<widget class="cLineEdit" name="m_lpMiddleName"/>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="label_5">
|
||||
@@ -192,10 +192,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLineEdit" name="m_lpLastName"/>
|
||||
<widget class="cLineEdit" name="m_lpLastName"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_lpTitle"/>
|
||||
<widget class="cLineEdit" name="m_lpTitle"/>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QLabel" name="label_3">
|
||||
@@ -228,13 +228,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QLineEdit" name="m_lpHairColor"/>
|
||||
<widget class="cLineEdit" name="m_lpHairColor"/>
|
||||
</item>
|
||||
<item row="6" column="5">
|
||||
<widget class="QLineEdit" name="m_lpHairCut"/>
|
||||
<widget class="cLineEdit" name="m_lpHairCut"/>
|
||||
</item>
|
||||
<item row="7" column="5">
|
||||
<widget class="QLineEdit" name="m_lpHairLength"/>
|
||||
<widget class="cLineEdit" name="m_lpHairLength"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
@@ -247,7 +247,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLineEdit" name="m_lpFigure"/>
|
||||
<widget class="cLineEdit" name="m_lpFigure"/>
|
||||
</item>
|
||||
<item row="8" column="4">
|
||||
<widget class="QLabel" name="label_21">
|
||||
@@ -270,7 +270,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QLineEdit" name="m_lpSkin"/>
|
||||
<widget class="cLineEdit" name="m_lpSkin"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
@@ -303,16 +303,16 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<widget class="QLineEdit" name="m_lpNature"/>
|
||||
<widget class="cLineEdit" name="m_lpNature"/>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QTextEdit" name="m_lpSchool"/>
|
||||
<widget class="cTextEdit" name="m_lpSchool"/>
|
||||
</item>
|
||||
<item row="8" column="3">
|
||||
<widget class="QTextEdit" name="m_lpspokenLanguages"/>
|
||||
<widget class="cTextEdit" name="m_lpSpokenLanguages"/>
|
||||
</item>
|
||||
<item row="8" column="5">
|
||||
<widget class="QTextEdit" name="m_lpJob"/>
|
||||
<widget class="cTextEdit" name="m_lpJob"/>
|
||||
</item>
|
||||
<item row="1" column="5" rowspan="4">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
@@ -321,21 +321,21 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="m_lpMale">
|
||||
<widget class="cRadioButton" name="m_lpMale">
|
||||
<property name="text">
|
||||
<string>Male</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="m_lpFemale">
|
||||
<widget class="cRadioButton" name="m_lpFemale">
|
||||
<property name="text">
|
||||
<string>Female</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="m_lpOther">
|
||||
<widget class="cRadioButton" name="m_lpOther">
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
@@ -394,6 +394,38 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>ccheckbox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cRadioButton</class>
|
||||
<extends>QRadioButton</extends>
|
||||
<header>cradiobutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cDateEdit</class>
|
||||
<extends>QDateEdit</extends>
|
||||
<header>cdateedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>cdoublespinbox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpFirstName</tabstop>
|
||||
<tabstop>m_lpDescription</tabstop>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "ccheckbox.h"
|
||||
|
||||
|
||||
cCheckBox::cCheckBox(QWidget* parent) :
|
||||
QCheckBox(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void cCheckBox::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QCheckBox::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cCheckBox::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QCheckBox::focusOutEvent(event);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#ifndef CCHECKBOX_H
|
||||
#define CCHECKBOX_H
|
||||
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cCheckBox : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cCheckBox(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cCheckBox* lpCheckBox);
|
||||
void lostFocus(cCheckBox* lpCheckBox);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cCheckBox*)
|
||||
|
||||
#endif // CCHECKBOX_H
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "ccombobox.h"
|
||||
|
||||
|
||||
cComboBox::cComboBox(QWidget* parent) :
|
||||
QComboBox(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void cComboBox::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QComboBox::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cComboBox::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QComboBox::focusOutEvent(event);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#ifndef CCOMBOBOX_H
|
||||
#define CCOMBOBOX_H
|
||||
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cComboBox(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cComboBox* lpComboBox);
|
||||
void lostFocus(cComboBox* lpComboBox);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cComboBox*)
|
||||
|
||||
#endif // CCOMBOBOX_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "cdateedit.h"
|
||||
|
||||
|
||||
cDateEdit::cDateEdit(QWidget* parent) :
|
||||
QDateEdit(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void cDateEdit::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QDateEdit::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cDateEdit::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QDateEdit::focusOutEvent(event);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#ifndef CDATEEDIT_H
|
||||
#define CDATEEDIT_H
|
||||
|
||||
|
||||
#include <QDateEdit>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cDateEdit : public QDateEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cDateEdit(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cDateEdit* lpDateEdit);
|
||||
void lostFocus(cDateEdit* lpDateEdit);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cDateEdit*)
|
||||
|
||||
#endif // CDATEEDIT_H
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "cdatetimeedit.h"
|
||||
|
||||
|
||||
cDateTimeEdit::cDateTimeEdit(QWidget* parent) :
|
||||
QDateTimeEdit(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void cDateTimeEdit::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QDateTimeEdit::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cDateTimeEdit::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QDateTimeEdit::focusOutEvent(event);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef CDATETIMEEDIT_H
|
||||
#define CDATETIMEEDIT_H
|
||||
|
||||
|
||||
#include <QDateTimeEdit>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cDateTimeEdit : public QDateTimeEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cDateTimeEdit(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cDateTimeEdit* lpDateTimeEdit);
|
||||
void lostFocus(cDateTimeEdit* lpDateTimeEdit);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cDateTimeEdit*)
|
||||
|
||||
#endif // CDATETIMEEDIT_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "cdoublespinbox.h"
|
||||
|
||||
cDoubleSpinBox::cDoubleSpinBox(QWidget* parent) :
|
||||
QDoubleSpinBox(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void cDoubleSpinBox::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QDoubleSpinBox::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cDoubleSpinBox::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QDoubleSpinBox::focusOutEvent(event);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef CDOUBLESPINBOX_H
|
||||
#define CDOUBLESPINBOX_H
|
||||
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cDoubleSpinBox : public QDoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cDoubleSpinBox(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cDoubleSpinBox* lpDoubleSpinBox);
|
||||
void lostFocus(cDoubleSpinBox* lpDoubleSpinBox);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cDoubleSpinBox*)
|
||||
|
||||
#endif // CDOUBLESPINBOX_H
|
||||
@@ -1,12 +1,17 @@
|
||||
#include "cimagewidget.h"
|
||||
#include "ui_cimagewidget.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
|
||||
cImageWidget::cImageWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::cImageWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
}
|
||||
|
||||
cImageWidget::~cImageWidget()
|
||||
|
||||
+8
-1
@@ -23,7 +23,7 @@
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="m_lpImage">
|
||||
@@ -52,6 +52,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "clineedit.h"
|
||||
|
||||
|
||||
cLineEdit::cLineEdit(QWidget* parent) :
|
||||
QLineEdit(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void cLineEdit::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QLineEdit::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cLineEdit::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QLineEdit::focusOutEvent(event);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#ifndef CLINEEDIT_H
|
||||
#define CLINEEDIT_H
|
||||
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cLineEdit(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cLineEdit* lpLineEdit);
|
||||
void lostFocus(cLineEdit* lpLineEdit);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cLineEdit*)
|
||||
|
||||
#endif // CLINEEDIT_H
|
||||
+256
-123
@@ -1,7 +1,10 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
#include "ui_cmainwindow.h"
|
||||
|
||||
#include "ctextdocument.h"
|
||||
#include "ctextedit.h"
|
||||
|
||||
#include "cpartwindow.h"
|
||||
|
||||
@@ -32,11 +35,20 @@ cMainWindow::cMainWindow(QWidget *parent) :
|
||||
m_lpPlaceModel(0),
|
||||
m_lpObjectModel(0),
|
||||
m_bUpdatingTab(false),
|
||||
m_lpStoryBook(0)
|
||||
m_lpStoryBook(0),
|
||||
m_lpFileMenu(0),
|
||||
m_lpEditMenu(0),
|
||||
m_lpTextMenu(0),
|
||||
m_lpFileToolBar(0),
|
||||
m_lpEditToolBar(0),
|
||||
m_lpTextToolBar(0),
|
||||
m_lpFormatToolBar(0)
|
||||
{
|
||||
initUI();
|
||||
createActions();
|
||||
|
||||
//disableTextEdit();
|
||||
|
||||
QString szPath = QDir::homePath() + QDir::separator() + "OneDrive - WINDESIGN" + QDir::separator() + "__BOOKS__" + QDir::separator() + "qtStoryWriter" + QDir::separator() + "rückwärts.storyWriter" ;
|
||||
m_lpStoryBook = new cStoryBook(szPath);
|
||||
m_lpStoryBook->fillOutlineList(ui->m_lpOutlineList);
|
||||
@@ -56,6 +68,26 @@ cMainWindow::~cMainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QAction* cMainWindow::actionAlignLeft()
|
||||
{
|
||||
return(m_lpActionAlignLeft);
|
||||
}
|
||||
|
||||
QAction* cMainWindow::actionAlignCenter()
|
||||
{
|
||||
return(m_lpActionAlignCenter);
|
||||
}
|
||||
|
||||
QAction* cMainWindow::actionAlignRight()
|
||||
{
|
||||
return(m_lpActionAlignRight);
|
||||
}
|
||||
|
||||
QAction* cMainWindow::actionAlignJustify()
|
||||
{
|
||||
return(m_lpActionAlignJustify);
|
||||
}
|
||||
|
||||
void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -132,95 +164,91 @@ void cMainWindow::createActions()
|
||||
void cMainWindow::createFileActions()
|
||||
{
|
||||
QAction* lpAction;
|
||||
QToolBar* lpToolBar = addToolBar(tr("File Actions"));
|
||||
QMenu* lpMenu = menuBar()->addMenu(tr("&File"));
|
||||
|
||||
m_lpFileMenu = menuBar()->addMenu(tr("&File"));
|
||||
m_lpFileToolBar = addToolBar(tr("File Actions"));
|
||||
|
||||
const QIcon newIcon = QIcon::fromTheme("document-new", QIcon(":/images/mac/filenew.png"));
|
||||
lpAction = lpMenu->addAction(newIcon, tr("&New"), this, &cMainWindow::onFileNew);
|
||||
lpToolBar->addAction(lpAction);
|
||||
lpAction = m_lpFileMenu->addAction(newIcon, tr("&New"), this, &cMainWindow::onFileNew);
|
||||
m_lpFileToolBar->addAction(lpAction);
|
||||
lpAction->setPriority(QAction::LowPriority);
|
||||
lpAction->setShortcut(QKeySequence::New);
|
||||
|
||||
const QIcon openIcon = QIcon::fromTheme("document-open", QIcon(":/images/mac/fileopen.png"));
|
||||
lpAction = lpMenu->addAction(openIcon, tr("&Open..."), this, &cMainWindow::onFileOpen);
|
||||
lpAction = m_lpFileMenu->addAction(openIcon, tr("&Open..."), this, &cMainWindow::onFileOpen);
|
||||
lpAction->setShortcut(QKeySequence::Open);
|
||||
lpToolBar->addAction(lpAction);
|
||||
m_lpFileToolBar->addAction(lpAction);
|
||||
|
||||
lpMenu->addSeparator();
|
||||
m_lpFileMenu->addSeparator();
|
||||
|
||||
const QIcon saveIcon = QIcon::fromTheme("document-save", QIcon(":/images/mac/filesave.png"));
|
||||
m_lpActionSave = lpMenu->addAction(saveIcon, tr("&Save"), this, &cMainWindow::onFileSave);
|
||||
m_lpActionSave = m_lpFileMenu->addAction(saveIcon, tr("&Save"), this, &cMainWindow::onFileSave);
|
||||
m_lpActionSave->setShortcut(QKeySequence::Save);
|
||||
m_lpActionSave->setEnabled(false);
|
||||
lpToolBar->addAction(m_lpActionSave);
|
||||
m_lpFileToolBar->addAction(m_lpActionSave);
|
||||
|
||||
lpAction = lpMenu->addAction(tr("Save &As..."), this, &cMainWindow::onFileSaveAs);
|
||||
lpAction = m_lpFileMenu->addAction(tr("Save &As..."), this, &cMainWindow::onFileSaveAs);
|
||||
lpAction->setPriority(QAction::LowPriority);
|
||||
lpMenu->addSeparator();
|
||||
m_lpFileMenu->addSeparator();
|
||||
|
||||
#ifndef QT_NO_PRINTER
|
||||
const QIcon printIcon = QIcon::fromTheme("document-print", QIcon(":/images/mac/fileprint.png"));
|
||||
lpAction = lpMenu->addAction(printIcon, tr("&Print..."), this, &cMainWindow::onFilePrint);
|
||||
lpAction = m_lpFileMenu->addAction(printIcon, tr("&Print..."), this, &cMainWindow::onFilePrint);
|
||||
lpAction->setPriority(QAction::LowPriority);
|
||||
lpAction->setShortcut(QKeySequence::Print);
|
||||
lpToolBar->addAction(lpAction);
|
||||
m_lpFileToolBar->addAction(lpAction);
|
||||
|
||||
const QIcon filePrintIcon = QIcon::fromTheme("fileprint", QIcon(":/images/mac/fileprint.png"));
|
||||
lpMenu->addAction(filePrintIcon, tr("Print Preview..."), this, &cMainWindow::onFilePrintPreview);
|
||||
m_lpFileMenu->addAction(filePrintIcon, tr("Print Preview..."), this, &cMainWindow::onFilePrintPreview);
|
||||
|
||||
const QIcon exportPdfIcon = QIcon::fromTheme("exportpdf", QIcon(":/images/mac/exportpdf.png"));
|
||||
lpAction = lpMenu->addAction(exportPdfIcon, tr("&Export PDF..."), this, &cMainWindow::onFilePrintPdf);
|
||||
lpAction = m_lpFileMenu->addAction(exportPdfIcon, tr("&Export PDF..."), this, &cMainWindow::onFilePrintPdf);
|
||||
lpAction->setPriority(QAction::LowPriority);
|
||||
lpAction->setShortcut(Qt::CTRL + Qt::Key_D);
|
||||
lpToolBar->addAction(lpAction);
|
||||
m_lpFileToolBar->addAction(lpAction);
|
||||
|
||||
lpMenu->addSeparator();
|
||||
m_lpFileMenu->addSeparator();
|
||||
#endif
|
||||
|
||||
lpAction = lpMenu->addAction(tr("&Quit"), this, &QWidget::close);
|
||||
lpAction = m_lpFileMenu->addAction(tr("&Quit"), this, &QWidget::close);
|
||||
lpAction->setShortcut(Qt::CTRL + Qt::Key_Q);
|
||||
}
|
||||
|
||||
void cMainWindow::createEditActions()
|
||||
{
|
||||
QToolBar* lpToolBar = addToolBar(tr("Edit Actions"));
|
||||
QMenu* lpMenu = menuBar()->addMenu(tr("&Edit"));
|
||||
m_lpEditMenu = menuBar()->addMenu(tr("&Edit"));
|
||||
m_lpEditToolBar = addToolBar(tr("Edit Actions"));
|
||||
|
||||
const QIcon undoIcon = QIcon::fromTheme("edit-undo", QIcon(":/images/mac/editundo.png"));
|
||||
// m_lpActionUndo = lpMenu->addAction(undoIcon, tr("&Undo"), textEdit, &QTextEdit::undo);
|
||||
m_lpActionUndo = lpMenu->addAction(undoIcon, tr("&Undo"), this, &cMainWindow::onSpecialUndo);
|
||||
m_lpActionUndo = m_lpEditMenu->addAction(undoIcon, tr("&Undo"));
|
||||
m_lpActionUndo->setShortcut(QKeySequence::Undo);
|
||||
lpToolBar->addAction(m_lpActionUndo);
|
||||
m_lpEditToolBar->addAction(m_lpActionUndo);
|
||||
|
||||
const QIcon redoIcon = QIcon::fromTheme("edit-redo", QIcon(":/images/mac/editredo.png"));
|
||||
// m_lpActionRedo = lpMenu->addAction(redoIcon, tr("&Redo"), textEdit, &QTextEdit::redo);
|
||||
m_lpActionRedo = lpMenu->addAction(redoIcon, tr("&Redo"), this, &cMainWindow::onSpecialRedo);
|
||||
m_lpActionRedo = m_lpEditMenu->addAction(redoIcon, tr("&Redo"));
|
||||
m_lpActionRedo->setPriority(QAction::LowPriority);
|
||||
m_lpActionRedo->setShortcut(QKeySequence::Redo);
|
||||
lpToolBar->addAction(m_lpActionRedo);
|
||||
lpMenu->addSeparator();
|
||||
m_lpEditToolBar->addAction(m_lpActionRedo);
|
||||
m_lpEditMenu->addSeparator();
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
const QIcon cutIcon = QIcon::fromTheme("edit-cut", QIcon(":/images/mac/editcut.png"));
|
||||
// m_lpActionCut = lpMenu->addAction(cutIcon, tr("Cu&t"), textEdit, &QTextEdit::cut);
|
||||
m_lpActionCut = lpMenu->addAction(cutIcon, tr("Cu&t"), this, &cMainWindow::onSpecialCut);
|
||||
m_lpActionCut = m_lpEditMenu->addAction(cutIcon, tr("Cu&t"));
|
||||
m_lpActionCut->setPriority(QAction::LowPriority);
|
||||
m_lpActionCut->setShortcut(QKeySequence::Cut);
|
||||
lpToolBar->addAction(m_lpActionCut);
|
||||
m_lpEditToolBar->addAction(m_lpActionCut);
|
||||
|
||||
const QIcon copyIcon = QIcon::fromTheme("edit-copy", QIcon(":/images/mac/editcopy.png"));
|
||||
// m_lpActionCopy = lpMenu->addAction(copyIcon, tr("&Copy"), textEdit, &QTextEdit::copy);
|
||||
m_lpActionCopy = lpMenu->addAction(copyIcon, tr("&Copy"), this, &cMainWindow::onSpecialCopy);
|
||||
m_lpActionCopy = m_lpEditMenu->addAction(copyIcon, tr("&Copy"));
|
||||
m_lpActionCopy->setPriority(QAction::LowPriority);
|
||||
m_lpActionCopy->setShortcut(QKeySequence::Copy);
|
||||
lpToolBar->addAction(m_lpActionCopy);
|
||||
m_lpEditToolBar->addAction(m_lpActionCopy);
|
||||
|
||||
const QIcon pasteIcon = QIcon::fromTheme("edit-paste", QIcon(":/images/mac/editpaste.png"));
|
||||
// m_lpActionPaste = lpMenu->addAction(pasteIcon, tr("&Paste"), textEdit, &QTextEdit::paste);
|
||||
m_lpActionPaste = lpMenu->addAction(pasteIcon, tr("&Paste"), this, &cMainWindow::onSpecialPaste);
|
||||
m_lpActionPaste = m_lpEditMenu->addAction(pasteIcon, tr("&Paste"));
|
||||
m_lpActionPaste->setPriority(QAction::LowPriority);
|
||||
m_lpActionPaste->setShortcut(QKeySequence::Paste);
|
||||
lpToolBar->addAction(m_lpActionPaste);
|
||||
m_lpEditToolBar->addAction(m_lpActionPaste);
|
||||
if(const QMimeData* md = QApplication::clipboard()->mimeData())
|
||||
m_lpActionPaste->setEnabled(md->hasText());
|
||||
#endif
|
||||
@@ -228,40 +256,40 @@ void cMainWindow::createEditActions()
|
||||
|
||||
void cMainWindow::createTextActions()
|
||||
{
|
||||
QToolBar* lpToolBar = addToolBar(tr("Format Actions"));
|
||||
QMenu* lpMenu = menuBar()->addMenu(tr("F&ormat"));
|
||||
m_lpTextMenu = menuBar()->addMenu(tr("F&ormat"));
|
||||
m_lpTextToolBar = addToolBar(tr("Format Actions"));
|
||||
|
||||
const QIcon boldIcon = QIcon::fromTheme("format-text-bold", QIcon(":/images/mac/textbold.png"));
|
||||
m_lpActionTextBold = lpMenu->addAction(boldIcon, tr("&Bold"), this, &cMainWindow::onTextBold);
|
||||
m_lpActionTextBold = m_lpTextMenu->addAction(boldIcon, tr("&Bold"));
|
||||
m_lpActionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
|
||||
m_lpActionTextBold->setPriority(QAction::LowPriority);
|
||||
QFont bold;
|
||||
bold.setBold(true);
|
||||
m_lpActionTextBold->setFont(bold);
|
||||
lpToolBar->addAction(m_lpActionTextBold);
|
||||
m_lpTextToolBar->addAction(m_lpActionTextBold);
|
||||
m_lpActionTextBold->setCheckable(true);
|
||||
|
||||
const QIcon italicIcon = QIcon::fromTheme("format-text-italic", QIcon(":/images/mac/textitalic.png"));
|
||||
m_lpActionTextItalic = lpMenu->addAction(italicIcon, tr("&Italic"), this, &cMainWindow::onTextItalic);
|
||||
m_lpActionTextItalic = m_lpTextMenu->addAction(italicIcon, tr("&Italic"));
|
||||
m_lpActionTextItalic->setPriority(QAction::LowPriority);
|
||||
m_lpActionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
|
||||
QFont italic;
|
||||
italic.setItalic(true);
|
||||
m_lpActionTextItalic->setFont(italic);
|
||||
lpToolBar->addAction(m_lpActionTextItalic);
|
||||
m_lpTextToolBar->addAction(m_lpActionTextItalic);
|
||||
m_lpActionTextItalic->setCheckable(true);
|
||||
|
||||
const QIcon underlineIcon = QIcon::fromTheme("format-text-underline", QIcon(":/images/mac/textunder.png"));
|
||||
m_lpActionTextUnderline = lpMenu->addAction(underlineIcon, tr("&Underline"), this, &cMainWindow::onTextUnderline);
|
||||
m_lpActionTextUnderline = m_lpTextMenu->addAction(underlineIcon, tr("&Underline"));
|
||||
m_lpActionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
|
||||
m_lpActionTextUnderline->setPriority(QAction::LowPriority);
|
||||
QFont underline;
|
||||
underline.setUnderline(true);
|
||||
m_lpActionTextUnderline->setFont(underline);
|
||||
lpToolBar->addAction(m_lpActionTextUnderline);
|
||||
m_lpTextToolBar->addAction(m_lpActionTextUnderline);
|
||||
m_lpActionTextUnderline->setCheckable(true);
|
||||
|
||||
lpMenu->addSeparator();
|
||||
m_lpTextMenu->addSeparator();
|
||||
|
||||
const QIcon leftIcon = QIcon::fromTheme("format-justify-left", QIcon(":/images/mac/textleft.png"));
|
||||
m_lpActionAlignLeft = new QAction(leftIcon, tr("&Left"), this);
|
||||
@@ -285,67 +313,107 @@ void cMainWindow::createTextActions()
|
||||
m_lpActionAlignJustify->setPriority(QAction::LowPriority);
|
||||
|
||||
// Make sure the alignLeft is always left of the alignRight
|
||||
QActionGroup* alignGroup = new QActionGroup(this);
|
||||
connect(alignGroup, &QActionGroup::triggered, this, &cMainWindow::onTextAlign);
|
||||
m_lpAlignGroup = new QActionGroup(this);
|
||||
|
||||
if(QApplication::isLeftToRight())
|
||||
{
|
||||
alignGroup->addAction(m_lpActionAlignLeft);
|
||||
alignGroup->addAction(m_lpActionAlignCenter);
|
||||
alignGroup->addAction(m_lpActionAlignRight);
|
||||
m_lpAlignGroup->addAction(m_lpActionAlignLeft);
|
||||
m_lpAlignGroup->addAction(m_lpActionAlignCenter);
|
||||
m_lpAlignGroup->addAction(m_lpActionAlignRight);
|
||||
}
|
||||
else
|
||||
{
|
||||
alignGroup->addAction(m_lpActionAlignRight);
|
||||
alignGroup->addAction(m_lpActionAlignCenter);
|
||||
alignGroup->addAction(m_lpActionAlignLeft);
|
||||
m_lpAlignGroup->addAction(m_lpActionAlignRight);
|
||||
m_lpAlignGroup->addAction(m_lpActionAlignCenter);
|
||||
m_lpAlignGroup->addAction(m_lpActionAlignLeft);
|
||||
}
|
||||
alignGroup->addAction(m_lpActionAlignJustify);
|
||||
m_lpAlignGroup->addAction(m_lpActionAlignJustify);
|
||||
|
||||
lpToolBar->addActions(alignGroup->actions());
|
||||
lpMenu->addActions(alignGroup->actions());
|
||||
m_lpTextToolBar->addActions(m_lpAlignGroup->actions());
|
||||
m_lpTextMenu->addActions(m_lpAlignGroup->actions());
|
||||
|
||||
lpMenu->addSeparator();
|
||||
m_lpTextMenu->addSeparator();
|
||||
|
||||
QPixmap pix(16, 16);
|
||||
pix.fill(Qt::black);
|
||||
m_lpActionTextColor = lpMenu->addAction(pix, tr("&Color..."), this, &cMainWindow::onTextColor);
|
||||
lpToolBar->addAction(m_lpActionTextColor);
|
||||
m_lpActionTextColor = m_lpTextMenu->addAction(pix, tr("&Color..."));
|
||||
m_lpTextToolBar->addAction(m_lpActionTextColor);
|
||||
|
||||
lpToolBar = addToolBar(tr("Format Actions"));
|
||||
lpToolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
|
||||
m_lpFormatToolBar = addToolBar(tr("Format Actions"));
|
||||
m_lpFormatToolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
|
||||
addToolBarBreak(Qt::TopToolBarArea);
|
||||
addToolBar(lpToolBar);
|
||||
addToolBar(m_lpFormatToolBar);
|
||||
|
||||
m_lpComboStyle = new QComboBox(lpToolBar);
|
||||
lpToolBar->addWidget(m_lpComboStyle);
|
||||
m_lpComboStyle->addItem("Standard");
|
||||
m_lpComboStyle->addItem("Bullet List (Disc)");
|
||||
m_lpComboStyle->addItem("Bullet List (Circle)");
|
||||
m_lpComboStyle->addItem("Bullet List (Square)");
|
||||
m_lpComboStyle->addItem("Ordered List (Decimal)");
|
||||
m_lpComboStyle->addItem("Ordered List (Alpha lower)");
|
||||
m_lpComboStyle->addItem("Ordered List (Alpha upper)");
|
||||
m_lpComboStyle->addItem("Ordered List (Roman lower)");
|
||||
m_lpComboStyle->addItem("Ordered List (Roman upper)");
|
||||
m_lpComboFont = new QFontComboBox(m_lpFormatToolBar);
|
||||
m_lpFormatToolBar->addWidget(m_lpComboFont);
|
||||
m_focusException.append(m_lpComboFont);
|
||||
|
||||
connect(m_lpComboStyle, QOverload<int>::of(&QComboBox::activated), this, &cMainWindow::onTextStyle);
|
||||
|
||||
m_lpComboFont = new QFontComboBox(lpToolBar);
|
||||
lpToolBar->addWidget(m_lpComboFont);
|
||||
connect(m_lpComboFont, QOverload<const QString &>::of(&QComboBox::activated), this, &cMainWindow::onTextFamily);
|
||||
|
||||
m_lpComboSize = new QComboBox(lpToolBar);
|
||||
m_lpComboSize = new QComboBox(m_lpFormatToolBar);
|
||||
m_lpComboSize->setObjectName("comboSize");
|
||||
lpToolBar->addWidget(m_lpComboSize);
|
||||
m_lpFormatToolBar->addWidget(m_lpComboSize);
|
||||
m_lpComboSize->setEditable(true);
|
||||
|
||||
const QList<int> standardSizes = QFontDatabase::standardSizes();
|
||||
foreach(int size, standardSizes)
|
||||
m_lpComboSize->addItem(QString::number(size));
|
||||
m_lpComboSize->setCurrentIndex(standardSizes.indexOf(QApplication::font().pointSize()));
|
||||
m_focusException.append(m_lpComboSize);
|
||||
}
|
||||
|
||||
connect(m_lpComboSize, QOverload<const QString &>::of(&QComboBox::activated), this, &cMainWindow::onTextSize);
|
||||
void cMainWindow::disableTextEdit()
|
||||
{
|
||||
m_lpEditMenu->setEnabled(false);
|
||||
m_lpEditToolBar->setEnabled(false);
|
||||
m_lpTextMenu->setEnabled(false);
|
||||
m_lpTextToolBar->setEnabled(false);
|
||||
m_lpFormatToolBar->setEnabled(false);
|
||||
}
|
||||
|
||||
void cMainWindow::prepareTextEdit(cTextEdit* lpTextEdit)
|
||||
{
|
||||
m_lpEditMenu->setEnabled(true);
|
||||
m_lpEditToolBar->setEnabled(true);
|
||||
m_lpTextMenu->setEnabled(true);
|
||||
m_lpTextToolBar->setEnabled(true);
|
||||
m_lpFormatToolBar->setEnabled(true);
|
||||
|
||||
connect(m_lpActionTextBold, &QAction::triggered, lpTextEdit, &cTextEdit::onTextBold);
|
||||
connect(m_lpActionTextItalic, &QAction::triggered, lpTextEdit, &cTextEdit::onTextItalic);
|
||||
connect(m_lpActionTextUnderline, &QAction::triggered, lpTextEdit, &cTextEdit::onTextUnderline);
|
||||
|
||||
connect(m_lpActionTextColor, &QAction::triggered, lpTextEdit, &cTextEdit::onTextColor);
|
||||
|
||||
connect(lpTextEdit->document(), &cTextDocument::undoAvailable, m_lpActionUndo, &QAction::setEnabled);
|
||||
connect(lpTextEdit->document(), &cTextDocument::redoAvailable, m_lpActionRedo, &QAction::setEnabled);
|
||||
m_lpActionUndo->setEnabled(lpTextEdit->document()->isUndoAvailable());
|
||||
m_lpActionRedo->setEnabled(lpTextEdit->document()->isRedoAvailable());
|
||||
|
||||
connect(m_lpActionUndo, &QAction::triggered, lpTextEdit, &cTextEdit::undo);
|
||||
connect(m_lpActionRedo, &QAction::triggered, lpTextEdit, &cTextEdit::redo);
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
m_lpActionCut->setEnabled(false);
|
||||
m_lpActionCopy->setEnabled(false);
|
||||
|
||||
disconnect(m_lpActionCut, SIGNAL(triggered(bool)));
|
||||
disconnect(m_lpActionCopy, SIGNAL(triggered(bool)));
|
||||
disconnect(m_lpActionPaste, SIGNAL(triggered(bool)));
|
||||
|
||||
connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &cMainWindow::onClipboardDataChanged);
|
||||
|
||||
connect(m_lpActionCut, SIGNAL(triggered(bool)), lpTextEdit, SLOT(cut()));
|
||||
connect(m_lpActionCopy, SIGNAL(triggered(bool)), lpTextEdit, SLOT(copy()));
|
||||
connect(m_lpActionPaste, SIGNAL(triggered(bool)), lpTextEdit, SLOT(paste()));
|
||||
#endif
|
||||
|
||||
connect(m_lpAlignGroup, &QActionGroup::triggered, lpTextEdit, &cTextEdit::onTextAlign);
|
||||
|
||||
connect(m_lpComboFont, QOverload<const QString &>::of(&QComboBox::activated), lpTextEdit, &cTextEdit::onTextFamily);
|
||||
connect(m_lpComboSize, QOverload<const QString &>::of(&QComboBox::activated), lpTextEdit, &cTextEdit::onTextSize);
|
||||
|
||||
connect(lpTextEdit, &cTextEdit::fontChanged, this, &cMainWindow::onFontChanged);
|
||||
connect(lpTextEdit, &cTextEdit::colorChanged, this, &cMainWindow::onColorChanged);
|
||||
connect(lpTextEdit, &cTextEdit::alignmentChanged, this, &cMainWindow::onAlignmentChanged);
|
||||
}
|
||||
|
||||
void cMainWindow::updateWindowTitle()
|
||||
@@ -365,6 +433,87 @@ void cMainWindow::updateWindowTitle()
|
||||
setWindowTitle(QString("\"%1\" by %2 - qtStoryWriter").arg(szTitle).arg(szAuthor));
|
||||
}
|
||||
|
||||
void cMainWindow::onTextEditGotFocus(cTextEdit* lpTextEdit)
|
||||
{
|
||||
prepareTextEdit(lpTextEdit);
|
||||
}
|
||||
|
||||
void cMainWindow::onTextEditLostFocus(cTextEdit* /*lpTextEdit*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onLineEditGotFocus(cLineEdit* /*lpLineEdit*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onLineEditLostFocus(cLineEdit* /*lpLineEdit*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onTreeViewGotFocus(cTreeView* /*lpTreeView*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onTreeViewLostFocus(cTreeView * /*lpTreeView*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onCheckBoxGotFocus(cCheckBox* /*lpCheckBox*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onCheckBoxLostFocus(cCheckBox* /*lpCheckBox*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onRadioButtonGotFocus(cRadioButton* /*lpRadioButton*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onRadioButtonLostFocus(cRadioButton* /*lpRadioButton*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onDateEditGotFocus(cDateEdit* /*lpDateEdit*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onDateEditLostFocus(cDateEdit* /*lpDateEdit*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onDoubleSpinBoxGotFocus(cDoubleSpinBox* /*lpDoubleSpinBox*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onDoubleSpinBoxLostFocus(cDoubleSpinBox* /*lpDoubleSpinBox*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onDateTimeEditGotFocus(cDateTimeEdit* /*lpDateTimeEdit*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onDateTimeEditLostFocus(cDateTimeEdit* /*lpDateTimeEdit*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onComboBoxGotFocus(cComboBox* /*lpComboBox*/)
|
||||
{
|
||||
disableTextEdit();
|
||||
}
|
||||
|
||||
void cMainWindow::onComboBoxLostFocus(cComboBox* /*lpComboBox*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onMainTabCurrentChanged(int /*index*/)
|
||||
{
|
||||
if(m_bUpdatingTab)
|
||||
@@ -721,54 +870,38 @@ void cMainWindow::onFilePrintPdf()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onTextBold()
|
||||
void cMainWindow::onClipboardDataChanged()
|
||||
{
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
if(const QMimeData *md = QApplication::clipboard()->mimeData())
|
||||
m_lpActionPaste->setEnabled(md->hasText());
|
||||
#endif
|
||||
}
|
||||
|
||||
void cMainWindow::onTextItalic()
|
||||
void cMainWindow::onFontChanged(const QFont& font)
|
||||
{
|
||||
m_lpComboFont->setCurrentIndex(m_lpComboFont->findText(QFontInfo(font).family()));
|
||||
m_lpComboSize->setCurrentIndex(m_lpComboSize->findText(QString::number(font.pointSize())));
|
||||
m_lpActionTextBold->setChecked(font.bold());
|
||||
m_lpActionTextItalic->setChecked(font.italic());
|
||||
m_lpActionTextUnderline->setChecked(font.underline());
|
||||
}
|
||||
|
||||
void cMainWindow::onTextUnderline()
|
||||
void cMainWindow::onColorChanged(const QColor& color)
|
||||
{
|
||||
QPixmap pix(16, 16);
|
||||
pix.fill(color);
|
||||
m_lpActionTextColor->setIcon(pix);
|
||||
}
|
||||
|
||||
void cMainWindow::onTextAlign(QAction *a)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onTextFamily(const QString &f)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onTextSize(const QString &p)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onTextStyle(int styleIndex)
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onTextColor()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onSpecialUndo()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onSpecialRedo()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onSpecialCut()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onSpecialCopy()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onSpecialPaste()
|
||||
void cMainWindow::onAlignmentChanged(const Qt::Alignment &alignment)
|
||||
{
|
||||
if(alignment & Qt::AlignLeft)
|
||||
m_lpActionAlignLeft->setChecked(true);
|
||||
else if(alignment & Qt::AlignHCenter)
|
||||
m_lpActionAlignCenter->setChecked(true);
|
||||
else if(alignment & Qt::AlignRight)
|
||||
m_lpActionAlignRight->setChecked(true);
|
||||
else if(alignment & Qt::AlignJustify)
|
||||
m_lpActionAlignJustify->setChecked(true);
|
||||
}
|
||||
|
||||
+55
-17
@@ -3,6 +3,15 @@
|
||||
|
||||
|
||||
#include "cstorybook.h"
|
||||
#include "ctextedit.h"
|
||||
#include "clineedit.h"
|
||||
#include "ctreeview.h"
|
||||
#include "ccheckbox.h"
|
||||
#include "cradiobutton.h"
|
||||
#include "cdateedit.h"
|
||||
#include "cdoublespinbox.h"
|
||||
#include "cdatetimeedit.h"
|
||||
#include "ccombobox.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMdiSubWindow>
|
||||
@@ -14,6 +23,8 @@
|
||||
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include <QActionGroup>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class cMainWindow;
|
||||
@@ -24,12 +35,36 @@ class cMainWindow : public QMainWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cMainWindow(QWidget *parent = 0);
|
||||
explicit cMainWindow(QWidget* parent = 0);
|
||||
~cMainWindow();
|
||||
|
||||
void updateWindowTitle();
|
||||
|
||||
QAction* actionAlignLeft();
|
||||
QAction* actionAlignCenter();
|
||||
QAction* actionAlignRight();
|
||||
QAction* actionAlignJustify();
|
||||
|
||||
private slots:
|
||||
void onTextEditGotFocus(cTextEdit* lpTextEdit);
|
||||
void onTextEditLostFocus(cTextEdit* lpTextEdit);
|
||||
void onLineEditGotFocus(cLineEdit* lpLineEdit);
|
||||
void onLineEditLostFocus(cLineEdit* lpLineEdit);
|
||||
void onTreeViewGotFocus(cTreeView* lpTreeView);
|
||||
void onTreeViewLostFocus(cTreeView* lpTreeView);
|
||||
void onCheckBoxGotFocus(cCheckBox* CheckBox);
|
||||
void onCheckBoxLostFocus(cCheckBox* lpCheckBox);
|
||||
void onRadioButtonGotFocus(cRadioButton* lpRadioButton);
|
||||
void onRadioButtonLostFocus(cRadioButton* lpRadioButton);
|
||||
void onDateEditGotFocus(cDateEdit* lpDateEdit);
|
||||
void onDateEditLostFocus(cDateEdit* lpDateEdit);
|
||||
void onDoubleSpinBoxGotFocus(cDoubleSpinBox* lpDoubleSpinBox);
|
||||
void onDoubleSpinBoxLostFocus(cDoubleSpinBox* lpDoubleSpinBox);
|
||||
void onDateTimeEditGotFocus(cDateTimeEdit* lpDateTimeEdit);
|
||||
void onDateTimeEditLostFocus(cDateTimeEdit* lpDateTimeEdit);
|
||||
void onComboBoxGotFocus(cComboBox* lpComboBox);
|
||||
void onComboBoxLostFocus(cComboBox* lpComboBox);
|
||||
|
||||
void onMainTabCurrentChanged(int index);
|
||||
void onMainTabTabCloseRequested(int index);
|
||||
void onMdiAreaSubWindowActivated(QMdiSubWindow *arg1);
|
||||
@@ -58,22 +93,11 @@ private slots:
|
||||
void onFilePrintPreview();
|
||||
void onFilePrintPdf();
|
||||
|
||||
void onTextBold();
|
||||
void onTextItalic();
|
||||
void onTextUnderline();
|
||||
void onClipboardDataChanged();
|
||||
|
||||
void onTextFamily(const QString &f);
|
||||
void onTextSize(const QString &p);
|
||||
void onTextStyle(int styleIndex);
|
||||
void onTextColor();
|
||||
|
||||
void onTextAlign(QAction *a);
|
||||
|
||||
void onSpecialUndo();
|
||||
void onSpecialRedo();
|
||||
void onSpecialCut();
|
||||
void onSpecialCopy();
|
||||
void onSpecialPaste();
|
||||
void onFontChanged(const QFont& font);
|
||||
void onColorChanged(const QColor& color);
|
||||
void onAlignmentChanged(const Qt::Alignment& alignment);
|
||||
|
||||
private:
|
||||
Ui::cMainWindow* ui;
|
||||
@@ -85,6 +109,16 @@ private:
|
||||
bool m_bUpdatingTab;
|
||||
cStoryBook* m_lpStoryBook;
|
||||
|
||||
QList<QWidget*> m_focusException;
|
||||
|
||||
QMenu* m_lpFileMenu;
|
||||
QMenu* m_lpEditMenu;
|
||||
QMenu* m_lpTextMenu;
|
||||
|
||||
QToolBar* m_lpFileToolBar;
|
||||
QToolBar* m_lpEditToolBar;
|
||||
QToolBar* m_lpTextToolBar;
|
||||
QToolBar* m_lpFormatToolBar;
|
||||
QAction* m_lpActionSave;
|
||||
QAction* m_lpActionUndo;
|
||||
QAction* m_lpActionRedo;
|
||||
@@ -104,7 +138,8 @@ private:
|
||||
QAction* m_lpActionCopy;
|
||||
QAction* m_lpActionPaste;
|
||||
|
||||
QComboBox* m_lpComboStyle;
|
||||
QActionGroup* m_lpAlignGroup;
|
||||
|
||||
QFontComboBox* m_lpComboFont;
|
||||
QComboBox* m_lpComboSize;
|
||||
|
||||
@@ -115,6 +150,9 @@ private:
|
||||
void createEditActions();
|
||||
void createTextActions();
|
||||
|
||||
void disableTextEdit();
|
||||
void prepareTextEdit(cTextEdit* lpTextEdit);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
};
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "cimagewidget.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
@@ -12,6 +14,15 @@ cObjectWindow::cObjectWindow(QWidget *parent) :
|
||||
m_lpObject(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->m_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpType, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpType, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
}
|
||||
|
||||
cObjectWindow::~cObjectWindow()
|
||||
|
||||
+15
-3
@@ -27,10 +27,10 @@
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0">
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="m_lpType"/>
|
||||
<widget class="cLineEdit" name="m_lpType"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
<widget class="cLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
@@ -53,7 +53,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
@@ -115,6 +115,18 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
<tabstop>m_lpDescription</tabstop>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "cpartwindow.h"
|
||||
#include "ui_cpartwindow.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
@@ -14,6 +16,18 @@ cPartWindow::cPartWindow(QWidget *parent) :
|
||||
|
||||
m_lpChapterModel = new QStandardItemModel(0, 1);
|
||||
ui->m_lpChapterList->setModel(m_lpChapterModel);
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpText, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpText, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpChapterList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpChapterList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
}
|
||||
|
||||
cPartWindow::~cPartWindow()
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
|
||||
void setPart(cPart* lpPart, cChapterList* lpChapterList);
|
||||
cPart* part();
|
||||
|
||||
private:
|
||||
Ui::cPartWindow* ui;
|
||||
cPart* m_lpPart;
|
||||
|
||||
+13
-3
@@ -27,7 +27,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
<widget class="cLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="cTextEdit" name="m_lpText"/>
|
||||
@@ -43,7 +43,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
@@ -56,7 +56,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QTreeView" name="m_lpChapterList">
|
||||
<widget class="cTreeView" name="m_lpChapterList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -81,6 +81,16 @@
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cTreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ctreeview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "cimagewidget.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
@@ -12,6 +14,18 @@ cPlaceWindow::cPlaceWindow(QWidget *parent) :
|
||||
m_lpPlace(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->m_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpType, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpType, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpLocation, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpLocation, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
}
|
||||
|
||||
cPlaceWindow::~cPlaceWindow()
|
||||
|
||||
+16
-4
@@ -47,7 +47,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="m_lpType"/>
|
||||
<widget class="cLineEdit" name="m_lpType"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
@@ -60,7 +60,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
<widget class="cLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
@@ -73,10 +73,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLineEdit" name="m_lpLocation"/>
|
||||
<widget class="cLineEdit" name="m_lpLocation"/>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="5">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -128,6 +128,18 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
<tabstop>m_lpType</tabstop>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "cradiobutton.h"
|
||||
|
||||
|
||||
cRadioButton::cRadioButton(QWidget* parent) :
|
||||
QRadioButton(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void cRadioButton::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QRadioButton::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cRadioButton::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QRadioButton::focusOutEvent(event);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef CRADIOBUTTON_H
|
||||
#define CRADIOBUTTON_H
|
||||
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cRadioButton : public QRadioButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cRadioButton(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cRadioButton* lpRadioButton);
|
||||
void lostFocus(cRadioButton* lpRadioButton);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cRadioButton*)
|
||||
|
||||
#endif // CRADIOBUTTON_H
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "cimagewidget.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
@@ -28,6 +30,24 @@ cRechercheWindow::cRechercheWindow(QWidget *parent) :
|
||||
connect(ui->m_lpCharacterList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onCharacterDoubleClicked(QModelIndex)));
|
||||
connect(ui->m_lpPlaceList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onPlaceDoubleClicked(QModelIndex)));
|
||||
connect(ui->m_lpObjectList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onObjectDoubleClicked(QModelIndex)));
|
||||
|
||||
connect(ui->m_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpLink, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpLink, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpCharacterList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpCharacterList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
|
||||
connect(ui->m_lpObjectList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpObjectList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
|
||||
connect(ui->m_lpPlaceList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpPlaceList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
}
|
||||
|
||||
cRechercheWindow::~cRechercheWindow()
|
||||
|
||||
+23
-6
@@ -37,7 +37,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
@@ -50,10 +50,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
<widget class="cLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="m_lpLink"/>
|
||||
<widget class="cLineEdit" name="m_lpLink"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
@@ -117,7 +117,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpCharacterList">
|
||||
<widget class="cTreeView" name="m_lpCharacterList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -131,7 +131,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpObjectList">
|
||||
<widget class="cTreeView" name="m_lpObjectList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -145,7 +145,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpPlaceList">
|
||||
<widget class="cTreeView" name="m_lpPlaceList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -157,6 +157,23 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cTreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ctreeview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
<tabstop>m_lpLink</tabstop>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "cscenewindow.h"
|
||||
#include "ui_cscenewindow.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
@@ -42,6 +44,42 @@ cSceneWindow::cSceneWindow(QWidget *parent) :
|
||||
connect(ui->m_lpCharacterList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onCharacterDoubleClicked(QModelIndex)));
|
||||
connect(ui->m_lpPlaceList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onPlaceDoubleClicked(QModelIndex)));
|
||||
connect(ui->m_lpObjectList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onObjectDoubleClicked(QModelIndex)));
|
||||
|
||||
connect(ui->m_lpPart, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpPart, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpChapter, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpChapter, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*)));
|
||||
connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*)));
|
||||
|
||||
connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
|
||||
connect(ui->m_lpCharacterList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpCharacterList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
|
||||
connect(ui->m_lpObjectList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpObjectList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
|
||||
connect(ui->m_lpPlaceList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*)));
|
||||
connect(ui->m_lpPlaceList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*)));
|
||||
|
||||
connect(ui->m_lpState, SIGNAL(gotFocus(cComboBox*)), (cMainWindow*)parent, SLOT(onComboBoxGotFocus(cComboBox*)));
|
||||
connect(ui->m_lpState, SIGNAL(lostFocus(cComboBox*)), (cMainWindow*)parent, SLOT(onComboBoxLostFocus(cComboBox*)));
|
||||
|
||||
connect(ui->m_lpStartedAt, SIGNAL(gotFocus(cDateTimeEdit*)), (cMainWindow*)parent, SLOT(onDateTimeEditGotFocus(cDateTimeEdit*)));
|
||||
connect(ui->m_lpStartedAt, SIGNAL(lostFocus(cDateTimeEdit*)), (cMainWindow*)parent, SLOT(onDateTimeEditLostFocus(cDateTimeEdit*)));
|
||||
|
||||
connect(ui->m_lpFinishedAt, SIGNAL(gotFocus(cDateTimeEdit*)), (cMainWindow*)parent, SLOT(onDateTimeEditGotFocus(cDateTimeEdit*)));
|
||||
connect(ui->m_lpFinishedAt, SIGNAL(lostFocus(cDateTimeEdit*)), (cMainWindow*)parent, SLOT(onDateTimeEditLostFocus(cDateTimeEdit*)));
|
||||
|
||||
connect(ui->m_lpTargetDate, SIGNAL(gotFocus(cDateTimeEdit*)), (cMainWindow*)parent, SLOT(onDateTimeEditGotFocus(cDateTimeEdit*)));
|
||||
connect(ui->m_lpTargetDate, SIGNAL(lostFocus(cDateTimeEdit*)), (cMainWindow*)parent, SLOT(onDateTimeEditLostFocus(cDateTimeEdit*)));
|
||||
|
||||
connect(ui->m_lpText, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*)));
|
||||
connect(ui->m_lpText, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*)));
|
||||
}
|
||||
|
||||
cSceneWindow::~cSceneWindow()
|
||||
|
||||
+32
-12
@@ -19,7 +19,7 @@
|
||||
<item row="3" column="0" colspan="8">
|
||||
<widget class="QTabWidget" name="m_lpTabs">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_lpTabDescription">
|
||||
<attribute name="title">
|
||||
@@ -27,7 +27,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
<widget class="cTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -37,7 +37,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpCharacterList">
|
||||
<widget class="cTreeView" name="m_lpCharacterList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -57,7 +57,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpPlaceList">
|
||||
<widget class="cTreeView" name="m_lpPlaceList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -77,7 +77,7 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpObjectList">
|
||||
<widget class="cTreeView" name="m_lpObjectList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -94,7 +94,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QDateTimeEdit" name="m_lpFinishedAt">
|
||||
<widget class="cDateTimeEdit" name="m_lpFinishedAt">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -121,7 +121,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
<widget class="cLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="8">
|
||||
<widget class="cTextEdit" name="m_lpText"/>
|
||||
@@ -157,10 +157,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="m_lpState"/>
|
||||
<widget class="cComboBox" name="m_lpState"/>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QDateTimeEdit" name="m_lpStartedAt">
|
||||
<widget class="cDateTimeEdit" name="m_lpStartedAt">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -177,7 +177,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="7">
|
||||
<widget class="QDateTimeEdit" name="m_lpTargetDate"/>
|
||||
<widget class="cDateTimeEdit" name="m_lpTargetDate"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
@@ -190,14 +190,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="m_lpPart">
|
||||
<widget class="cLineEdit" name="m_lpPart">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="m_lpChapter">
|
||||
<widget class="cLineEdit" name="m_lpChapter">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -213,6 +213,26 @@
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>clineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cTreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ctreeview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>ccombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>cDateTimeEdit</class>
|
||||
<extends>QDateTimeEdit</extends>
|
||||
<header>cdatetimeedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
|
||||
+184
@@ -1,14 +1,34 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "ctextedit.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QFileInfo>
|
||||
#include <QFile>
|
||||
#include <QImageReader>
|
||||
|
||||
#include <QFocusEvent>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QTextList>
|
||||
#include <QColorDialog>
|
||||
|
||||
|
||||
cTextEdit::cTextEdit(QWidget* parent) :
|
||||
QTextEdit(parent)
|
||||
{
|
||||
connect(this, &cTextEdit::currentCharFormatChanged, this, &cTextEdit::onCurrentCharFormatChanged);
|
||||
connect(this, &cTextEdit::cursorPositionChanged, this, &cTextEdit::onCursorPositionChanged);
|
||||
|
||||
foreach(QWidget *w, qApp->topLevelWidgets())
|
||||
{
|
||||
m_lpMainWindow = qobject_cast<cMainWindow*>(w);
|
||||
if(m_lpMainWindow)
|
||||
return;
|
||||
}
|
||||
m_lpMainWindow = 0;
|
||||
}
|
||||
|
||||
cTextEdit::cTextEdit(const QString& text, QWidget* parent) :
|
||||
@@ -61,3 +81,167 @@ void cTextEdit::dropTextFile(const QUrl& url)
|
||||
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
textCursor().insertText(file.readAll());
|
||||
}
|
||||
|
||||
void cTextEdit::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QTextEdit::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cTextEdit::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QTextEdit::focusOutEvent(event);
|
||||
}
|
||||
|
||||
void cTextEdit::onCurrentCharFormatChanged(const QTextCharFormat &format)
|
||||
{
|
||||
fontChanged(format.font());
|
||||
colorChanged(format.foreground().color());
|
||||
}
|
||||
|
||||
void cTextEdit::onCursorPositionChanged()
|
||||
{
|
||||
alignmentChanged(alignment());
|
||||
}
|
||||
|
||||
void cTextEdit::onTextBold(bool isChecked)
|
||||
{
|
||||
QTextCharFormat fmt;
|
||||
fmt.setFontWeight(isChecked ? QFont::Bold : QFont::Normal);
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
}
|
||||
|
||||
void cTextEdit::onTextUnderline(bool isChecked)
|
||||
{
|
||||
QTextCharFormat fmt;
|
||||
fmt.setFontUnderline(isChecked);
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
}
|
||||
|
||||
void cTextEdit::onTextItalic(bool isChecked)
|
||||
{
|
||||
QTextCharFormat fmt;
|
||||
fmt.setFontItalic(isChecked);
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
}
|
||||
|
||||
void cTextEdit::onTextAlign(QAction *a)
|
||||
{
|
||||
if(!m_lpMainWindow)
|
||||
return;
|
||||
|
||||
if(a == m_lpMainWindow->actionAlignLeft())
|
||||
setAlignment(Qt::AlignLeft | Qt::AlignAbsolute);
|
||||
else if(a == m_lpMainWindow->actionAlignCenter())
|
||||
setAlignment(Qt::AlignHCenter);
|
||||
else if(a == m_lpMainWindow->actionAlignRight())
|
||||
setAlignment(Qt::AlignRight | Qt::AlignAbsolute);
|
||||
else if(a == m_lpMainWindow->actionAlignJustify())
|
||||
setAlignment(Qt::AlignJustify);
|
||||
}
|
||||
|
||||
void cTextEdit::onTextFamily(const QString &f)
|
||||
{
|
||||
QTextCharFormat fmt;
|
||||
fmt.setFontFamily(f);
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
}
|
||||
|
||||
void cTextEdit::onTextSize(const QString &p)
|
||||
{
|
||||
qreal pointSize = p.toFloat();
|
||||
if(p.toFloat() > 0)
|
||||
{
|
||||
QTextCharFormat fmt;
|
||||
fmt.setFontPointSize(pointSize);
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
}
|
||||
}
|
||||
|
||||
void cTextEdit::onTextColor()
|
||||
{
|
||||
QColor col = QColorDialog::getColor(textColor(), this);
|
||||
if(!col.isValid())
|
||||
return;
|
||||
QTextCharFormat fmt;
|
||||
fmt.setForeground(col);
|
||||
mergeFormatOnWordOrSelection(fmt);
|
||||
// colorChanged(col);
|
||||
}
|
||||
|
||||
void cTextEdit::onTextStyle(int styleIndex)
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
|
||||
if(styleIndex != 0)
|
||||
{
|
||||
QTextListFormat::Style style = QTextListFormat::ListDisc;
|
||||
|
||||
switch(styleIndex)
|
||||
{
|
||||
default:
|
||||
case 1:
|
||||
style = QTextListFormat::ListDisc;
|
||||
break;
|
||||
case 2:
|
||||
style = QTextListFormat::ListCircle;
|
||||
break;
|
||||
case 3:
|
||||
style = QTextListFormat::ListSquare;
|
||||
break;
|
||||
case 4:
|
||||
style = QTextListFormat::ListDecimal;
|
||||
break;
|
||||
case 5:
|
||||
style = QTextListFormat::ListLowerAlpha;
|
||||
break;
|
||||
case 6:
|
||||
style = QTextListFormat::ListUpperAlpha;
|
||||
break;
|
||||
case 7:
|
||||
style = QTextListFormat::ListLowerRoman;
|
||||
break;
|
||||
case 8:
|
||||
style = QTextListFormat::ListUpperRoman;
|
||||
break;
|
||||
}
|
||||
|
||||
cursor.beginEditBlock();
|
||||
|
||||
QTextBlockFormat blockFmt = cursor.blockFormat();
|
||||
QTextListFormat listFmt;
|
||||
|
||||
if(cursor.currentList())
|
||||
{
|
||||
listFmt = cursor.currentList()->format();
|
||||
}
|
||||
else
|
||||
{
|
||||
listFmt.setIndent(blockFmt.indent() + 1);
|
||||
blockFmt.setIndent(0);
|
||||
cursor.setBlockFormat(blockFmt);
|
||||
}
|
||||
|
||||
listFmt.setStyle(style);
|
||||
|
||||
cursor.createList(listFmt);
|
||||
|
||||
cursor.endEditBlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextBlockFormat bfmt;
|
||||
bfmt.setObjectIndex(-1);
|
||||
cursor.mergeBlockFormat(bfmt);
|
||||
}
|
||||
}
|
||||
|
||||
void cTextEdit::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
|
||||
{
|
||||
QTextCursor cursor = textCursor();
|
||||
if(!cursor.hasSelection())
|
||||
cursor.select(QTextCursor::WordUnderCursor);
|
||||
cursor.mergeCharFormat(format);
|
||||
mergeCurrentCharFormat(format);
|
||||
}
|
||||
|
||||
+43
-4
@@ -3,20 +3,59 @@
|
||||
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cMainWindow;
|
||||
|
||||
class cTextEdit : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cTextEdit(QWidget* parent = Q_NULLPTR);
|
||||
cTextEdit(const QString& text, QWidget* parent = Q_NULLPTR);
|
||||
|
||||
bool canInsertFromMimeData(const QMimeData* source) const;
|
||||
void insertFromMimeData(const QMimeData* source);
|
||||
bool canInsertFromMimeData(const QMimeData* source) const;
|
||||
void insertFromMimeData(const QMimeData* source);
|
||||
|
||||
signals:
|
||||
void gotFocus(cTextEdit* lpTextEdit);
|
||||
void lostFocus(cTextEdit* lpTextEdit);
|
||||
|
||||
void fontChanged(const QFont& font);
|
||||
void colorChanged(const QColor& color);
|
||||
void alignmentChanged(const Qt::Alignment& alignment);
|
||||
|
||||
public slots:
|
||||
void onTextBold(bool isChecked);
|
||||
void onTextUnderline(bool isChecked);
|
||||
void onTextItalic(bool isChecked);
|
||||
|
||||
void onTextAlign(QAction *a);
|
||||
|
||||
void onTextFamily(const QString &f);
|
||||
void onTextSize(const QString &p);
|
||||
void onTextStyle(int styleIndex);
|
||||
|
||||
void onTextColor();
|
||||
|
||||
void onCurrentCharFormatChanged(const QTextCharFormat &format);
|
||||
void onCursorPositionChanged();
|
||||
|
||||
private:
|
||||
void dropImage(const QUrl& url, const QImage& image);
|
||||
void dropTextFile(const QUrl& url);
|
||||
cMainWindow* m_lpMainWindow;
|
||||
|
||||
void dropImage(const QUrl& url, const QImage& image);
|
||||
void dropTextFile(const QUrl& url);
|
||||
|
||||
void mergeFormatOnWordOrSelection(const QTextCharFormat& format);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cTextEdit*)
|
||||
|
||||
#endif // CTEXTEDIT_H
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "ctreeview.h"
|
||||
|
||||
cTreeView::cTreeView(QWidget* parent) :
|
||||
QTreeView(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void cTreeView::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
gotFocus(this);
|
||||
QTreeView::focusInEvent(event);
|
||||
}
|
||||
|
||||
void cTreeView::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
lostFocus(this);
|
||||
QTreeView::focusOutEvent(event);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#ifndef CTREEVIEW_H
|
||||
#define CTREEVIEW_H
|
||||
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
class cTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cTreeView(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
signals:
|
||||
void gotFocus(cTreeView* lpTreeView);
|
||||
void lostFocus(cTreeView* lpTreeView);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cTreeView*)
|
||||
|
||||
#endif // CTREEVIEW_H
|
||||
@@ -14,6 +14,7 @@ int main(int argc, char *argv[])
|
||||
QSettings settings;
|
||||
|
||||
cMainWindow w;
|
||||
|
||||
if(settings.value("main/maximized").toBool())
|
||||
w.showMaximized();
|
||||
else
|
||||
|
||||
+18
-2
@@ -65,7 +65,15 @@ SOURCES += \
|
||||
cobjectwindow.cpp \
|
||||
cplacewindow.cpp \
|
||||
crecherchewindow.cpp \
|
||||
cmdisubwindow.cpp
|
||||
cmdisubwindow.cpp \
|
||||
clineedit.cpp \
|
||||
ctreeview.cpp \
|
||||
ccheckbox.cpp \
|
||||
cradiobutton.cpp \
|
||||
cdateedit.cpp \
|
||||
cdoublespinbox.cpp \
|
||||
ccombobox.cpp \
|
||||
cdatetimeedit.cpp
|
||||
|
||||
HEADERS += \
|
||||
cmainwindow.h \
|
||||
@@ -92,7 +100,15 @@ HEADERS += \
|
||||
cobjectwindow.h \
|
||||
cplacewindow.h \
|
||||
crecherchewindow.h \
|
||||
cmdisubwindow.h
|
||||
cmdisubwindow.h \
|
||||
clineedit.h \
|
||||
ctreeview.h \
|
||||
ccheckbox.h \
|
||||
cradiobutton.h \
|
||||
cdateedit.h \
|
||||
cdoublespinbox.h \
|
||||
ccombobox.h \
|
||||
cdatetimeedit.h
|
||||
|
||||
FORMS += \
|
||||
cmainwindow.ui \
|
||||
|
||||
Reference in New Issue
Block a user