mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-30 14:54:13 +02:00
Merge pull request #723 from IBSYSLevi/feature/cabinet-layout
Added width/height/depth properties to elements
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include "../../qetapp.h"
|
||||
#include "../../qetinformation.h"
|
||||
#include "ui_elementpropertieseditorwidget.h"
|
||||
#include "../../qetinformation.h"
|
||||
|
||||
#include <QItemDelegate>
|
||||
#include <QComboBox>
|
||||
@@ -45,6 +44,7 @@
|
||||
#include <QSplitter>
|
||||
#include <QShortcut>
|
||||
#include <QMenu>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
/**
|
||||
@brief The EditorDelegate class
|
||||
@@ -64,9 +64,20 @@ class EditorDelegate : public QItemDelegate
|
||||
{
|
||||
if(index.column() == 1)
|
||||
{
|
||||
return QItemDelegate::createEditor(parent,
|
||||
option,
|
||||
index);
|
||||
const QString key = index.sibling(index.row(), 0)
|
||||
.data(Qt::UserRole).toString();
|
||||
|
||||
if (key == QETInformation::ELMT_WIDTH || key == QETInformation::ELMT_HEIGHT || key == QETInformation::ELMT_DEPTH)
|
||||
{
|
||||
auto *line_edit = new QLineEdit(parent);
|
||||
auto *validator = new QETInformation::NumericInfoValidator(line_edit);
|
||||
line_edit->setValidator(validator);
|
||||
line_edit->setPlaceholderText(tr("ex. 80.5"));
|
||||
line_edit->setToolTip(tr("Nombre décimal avec un point comme séparateur (ex. 80.5)"));
|
||||
return line_edit;
|
||||
}
|
||||
|
||||
return QItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user