summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2014-12-19 01:34:21 +0100
committerRalf Habacker <[email protected]>2015-05-13 17:52:06 +0200
commitba065e711b7369ae433460ab4ff4c03814395f8f (patch)
tree3b00dbaff872ed075e5d30f96ded45ab489c0bed
parent61581bda7d1b558be940dc60f6b366dba925242b (diff)
Refactor setup of style, association role and font pages to use createPage() in class DialogBase.
CCBUG:97291
-rw-r--r--umbrello/dialogs/multipagedialogbase.cpp39
-rw-r--r--umbrello/dialogs/multipagedialogbase.h1
2 files changed, 21 insertions, 19 deletions
diff --git a/umbrello/dialogs/multipagedialogbase.cpp b/umbrello/dialogs/multipagedialogbase.cpp
index 87646c2..bec4c3d 100644
--- a/umbrello/dialogs/multipagedialogbase.cpp
+++ b/umbrello/dialogs/multipagedialogbase.cpp
@@ -269,12 +269,10 @@ void MultiPageDialogBase::applyGeneralPage(AssociationWidget *widget)
*/
KPageWidgetItem *MultiPageDialogBase::setupFontPage(const QFont &font)
{
- QFrame* page = createPage(i18n("Font"), i18n("Font Settings"), Icon_Utils::it_Properties_Font);
- QHBoxLayout * layout = new QHBoxLayout(page);
- m_fontChooser = new KFontChooser((QWidget*)page, KFontChooser::NoDisplayFlags, QStringList(), 0);
+ m_fontChooser = new KFontChooser(0, KFontChooser::NoDisplayFlags, QStringList(), 0);
m_fontChooser->setFont(font);
- layout->addWidget(m_fontChooser);
- return m_pageItem;
+ return createPage(i18n("Font"), i18n("Font Settings"),
+ Icon_Utils::it_Properties_Font, m_fontChooser);
}
/**
@@ -323,15 +321,20 @@ void MultiPageDialogBase::applyFontPage(AssociationWidget *widget)
*/
KPageWidgetItem *MultiPageDialogBase::setupStylePage(WidgetBase *widget)
{
- QFrame * page;
- if (widget->baseType() == WidgetBase::wt_Association)
- page = createPage(i18nc("style page name", "Style"), i18n("Role Style"), Icon_Utils::it_Properties_Color);
- else
- page = createPage(i18nc("widget style page", "Style"), i18n("Widget Style"), Icon_Utils::it_Properties_Color);
- QHBoxLayout * layout = new QHBoxLayout(page);
- m_pStylePage = new UMLWidgetStylePage(page, widget);
- layout->addWidget(m_pStylePage);
- return m_pageItem;
+ m_pStylePage = new UMLWidgetStylePage(0, widget);
+ return createPage(i18nc("widget style page", "Style"), i18n("Widget Style"),
+ Icon_Utils::it_Properties_Color, m_pStylePage);
+}
+
+/**
+ * Sets up the style page.
+ * @param widget The widget to load the initial data from
+ */
+KPageWidgetItem *MultiPageDialogBase::setupStylePage(AssociationWidget *widget)
+{
+ m_pStylePage = new UMLWidgetStylePage(0, widget);
+ return createPage(i18nc("style page name", "Style"), i18n("Role Style"),
+ Icon_Utils::it_Properties_Color, m_pStylePage);
}
/**
@@ -349,11 +352,9 @@ void MultiPageDialogBase::applyStylePage()
*/
KPageWidgetItem *MultiPageDialogBase::setupAssociationRolePage(AssociationWidget *widget)
{
- QFrame *page = createPage(i18nc("role page name", "Roles"), i18n("Role Settings"), Icon_Utils::it_Properties_Roles);
- QHBoxLayout *layout = new QHBoxLayout(page);
- m_pRolePage = new AssociationRolePage(page, widget);
- layout->addWidget(m_pRolePage);
- return m_pageItem;
+ m_pRolePage = new AssociationRolePage(0, widget);
+ return createPage(i18nc("role page name", "Roles"), i18n("Role Settings"),
+ Icon_Utils::it_Properties_Roles, m_pRolePage);
}
/**
diff --git a/umbrello/dialogs/multipagedialogbase.h b/umbrello/dialogs/multipagedialogbase.h
index 5de9718..9494752 100644
--- a/umbrello/dialogs/multipagedialogbase.h
+++ b/umbrello/dialogs/multipagedialogbase.h
@@ -109,6 +109,7 @@ protected:
void applyFontPage(AssociationWidget *widget);
KPageWidgetItem *setupStylePage(WidgetBase *widget);
+ KPageWidgetItem *setupStylePage(AssociationWidget *widget);
void applyStylePage();
KPageWidgetItem *setupAssociationRolePage(AssociationWidget *widget);