summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2017-06-19 10:41:28 +0200
committerRalf Habacker <[email protected]>2017-06-19 11:01:04 +0200
commitbd7859a0d0474f1cd33c80b6ff66067beec55bad (patch)
tree72bc15fdbb5417f45fc1d02ec718b9244cb7cd30
parentd6da482b1859727fcddf2a0c62a6a0bda8444385 (diff)
Refactor class AssociationGeneralPage to use class DocumentationWidget.
CCBUG:381391
-rw-r--r--umbrello/dialogs/pages/associationgeneralpage.cpp17
-rw-r--r--umbrello/dialogs/pages/associationgeneralpage.h4
-rw-r--r--umbrello/dialogs/widgets/documentationwidget.cpp2
-rw-r--r--umbrello/dialogs/widgets/documentationwidget.h6
4 files changed, 11 insertions, 18 deletions
diff --git a/umbrello/dialogs/pages/associationgeneralpage.cpp b/umbrello/dialogs/pages/associationgeneralpage.cpp
index 48fe845..660ce28 100644
--- a/umbrello/dialogs/pages/associationgeneralpage.cpp
+++ b/umbrello/dialogs/pages/associationgeneralpage.cpp
@@ -16,6 +16,7 @@
#include "assocrules.h"
#include "debug_utils.h"
#include "dialog_utils.h"
+#include "documentationwidget.h"
#include "objectwidget.h"
#include "umldoc.h"
#include "umlobject.h"
@@ -77,11 +78,8 @@ void AssociationGeneralPage::constructWidget()
// group boxes for name+type, documentation properties
QGroupBox *nameAndTypeGB = new QGroupBox(this);
- QGroupBox *docGB = new QGroupBox(this);
nameAndTypeGB->setTitle(i18n("Properties"));
- docGB->setTitle(i18n("Documentation"));
topLayout->addWidget(nameAndTypeGB);
- topLayout->addWidget(docGB);
m_pNameAndTypeLayout = new QGridLayout(nameAndTypeGB);
m_pNameAndTypeLayout->setSpacing(6);
@@ -182,14 +180,9 @@ void AssociationGeneralPage::constructWidget()
#endif
m_pNameAndTypeLayout->addWidget(m_pTypeCB, 1, 1);
- // document
- QHBoxLayout * docLayout = new QHBoxLayout(docGB);
- docLayout->setMargin(margin);
-
- m_doc = new KTextEdit(docGB);
- docLayout->addWidget(m_doc);
- m_doc->setText(m_pAssociationWidget->documentation());
- m_doc->setWordWrapMode(QTextOption::WordWrap);
+ // documentation
+ m_docWidget = new DocumentationWidget(m_pAssociationWidget, this);
+ topLayout->addWidget(m_docWidget);
}
void AssociationGeneralPage::slotStereoCheckboxChanged(int state)
@@ -222,7 +215,7 @@ void AssociationGeneralPage::apply()
int comboBoxItem = m_pTypeCB->currentIndex();
Uml::AssociationType::Enum newType = m_AssocTypes[comboBoxItem];
m_pAssociationWidget->setAssociationType(newType);
- m_pAssociationWidget->setDocumentation(m_doc->toPlainText());
+ m_docWidget->apply();
if (m_pStereoChkB && m_pStereoChkB->isChecked()) {
QString stereo = m_pAssocNameComB->currentText();
// keep the order
diff --git a/umbrello/dialogs/pages/associationgeneralpage.h b/umbrello/dialogs/pages/associationgeneralpage.h
index 5ef6a71..cc4e47a 100644
--- a/umbrello/dialogs/pages/associationgeneralpage.h
+++ b/umbrello/dialogs/pages/associationgeneralpage.h
@@ -18,12 +18,12 @@
#include <QWidget>
class AssociationWidget;
+class DocumentationWidget;
class QCheckBox;
class QGridLayout;
class QLabel;
class KComboBox;
class KLineEdit;
-class KTextEdit;
class ObjectWidget;
class UMLDoc;
class UMLObject;
@@ -57,7 +57,7 @@ private:
so we can translate both ways */
QList<Uml::AssociationType::Enum> m_AssocTypes;
QStringList m_AssocTypeStrings;
- KTextEdit *m_doc;
+ DocumentationWidget *m_docWidget;
AssociationWidget *m_pAssociationWidget;
ObjectWidget *m_pWidget;
diff --git a/umbrello/dialogs/widgets/documentationwidget.cpp b/umbrello/dialogs/widgets/documentationwidget.cpp
index 28c107f..4936fbd 100644
--- a/umbrello/dialogs/widgets/documentationwidget.cpp
+++ b/umbrello/dialogs/widgets/documentationwidget.cpp
@@ -36,7 +36,7 @@ DocumentationWidget::DocumentationWidget(UMLObject *o, QWidget *parent) :
init(o->doc());
}
-DocumentationWidget::DocumentationWidget(UMLWidget *w, QWidget *parent) :
+DocumentationWidget::DocumentationWidget(WidgetBase *w, QWidget *parent) :
QWidget(parent),
m_object(0),
m_widget(w)
diff --git a/umbrello/dialogs/widgets/documentationwidget.h b/umbrello/dialogs/widgets/documentationwidget.h
index d5c2f9c..3395c35 100644
--- a/umbrello/dialogs/widgets/documentationwidget.h
+++ b/umbrello/dialogs/widgets/documentationwidget.h
@@ -15,7 +15,7 @@
class CodeTextEdit;
class UMLObject;
-class UMLWidget;
+class WidgetBase;
class KTextEdit;
@@ -27,7 +27,7 @@ class DocumentationWidget : public QWidget
Q_OBJECT
public:
explicit DocumentationWidget(UMLObject *o, QWidget *parent = 0);
- explicit DocumentationWidget(UMLWidget *w, QWidget *parent = 0);
+ explicit DocumentationWidget(WidgetBase *w, QWidget *parent = 0);
~DocumentationWidget();
void apply();
@@ -37,7 +37,7 @@ protected:
KTextEdit *m_editField;
CodeTextEdit *m_codeEditField;
UMLObject *m_object;
- UMLWidget *m_widget;
+ WidgetBase *m_widget;
void init(const QString &text);
};