Commit 345fb25b authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Let class SelectDiagramWidget use ComboBoxWidgetBase as base class

Fixup of commit f0b38d10.
parent 1e4efa2c
......@@ -27,18 +27,8 @@
* @param parent parent widget
*/
SelectDiagramWidget::SelectDiagramWidget(const QString &title, QWidget *parent)
: QWidget(parent)
: ComboBoxWidgetBase(title, QString(), parent)
{
QHBoxLayout *layout = new QHBoxLayout;
layout->setContentsMargins(0,0,0,0);
m_label = new QLabel(title, this);
layout->addWidget(m_label);
m_editField = new KComboBox(this);
m_editField->setEditable(true);
layout->addWidget(m_editField, 2);
setLayout(layout);
}
/**
......@@ -71,17 +61,6 @@ void SelectDiagramWidget::setupWidget(Uml::DiagramType::Enum type, const QString
m_editField->setCurrentIndex(currentIndex);
}
}
/**
* Add this widget to a given grid layout. Umbrello dialogs places labels in column 0
* and the editable field in column 1.
* @param layout The layout to which the widget should be added
* @param row The row in the grid layout where the widget should be placed
*/
void SelectDiagramWidget::addToLayout(QGridLayout *layout, int row)
{
layout->addWidget(m_label, row, 0);
layout->addWidget(m_editField, row, 1);
}
/**
* Return current text
......
......@@ -13,31 +13,21 @@
#include "basictypes.h"
#include <QWidget>
class KComboBox;
class QGridLayout;
class QLabel;
#include "comboboxwidgetbase.h"
/**
* This widget provides selecting a diagram from the list of currently available diagrams
* @author Ralf Habacker
*/
class SelectDiagramWidget : public QWidget
class SelectDiagramWidget : public ComboBoxWidgetBase
{
Q_OBJECT
public:
explicit SelectDiagramWidget(const QString &title, QWidget *parent = nullptr);
void setupWidget(Uml::DiagramType::Enum type, const QString &currentName, const QString &excludeName, bool withNewEntry = true);
void addToLayout(QGridLayout *layout, int row);
QString currentText();
Uml::ID::Type currentID();
protected:
QLabel *m_label;
KComboBox *m_editField;
};
#endif // SELECTDIAGRAMWIDGET_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment