Merge pull request #1300 from arummler/fix-qobject

Fix missing Q_OBJECT
This commit is contained in:
ispyisail
2026-10-04 11:44:13 +13:00
committed by GitHub
2 changed files with 36 additions and 31 deletions
@@ -48,42 +48,28 @@
#include <QMenu>
#include <QRegularExpressionValidator>
/**
@brief The EditorDelegate class
This delegate is only use for disable the edition of the first
column of the information tree widget
*/
class EditorDelegate : public QItemDelegate
QWidget* EditorDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
public:
EditorDelegate(QObject *parent) :
QItemDelegate(parent)
{}
QWidget* createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const override
if(index.column() == 1)
{
if(index.column() == 1)
{
const QString key = index.sibling(index.row(), 0)
.data(Qt::UserRole).toString();
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);
{
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 nullptr;
return QItemDelegate::createEditor(parent, option, index);
}
};
return nullptr;
}
/**
* @brief ElementPropertiesEditorWidget::ElementPropertiesEditorWidget
@@ -23,6 +23,7 @@
#include <QAbstractButton>
#include <QDialog>
#include <QItemDelegate>
class QTableWidget;
class QSpinBox;
@@ -36,6 +37,24 @@ namespace Ui {
class ElementPropertiesEditorWidget;
}
/**
@brief The EditorDelegate class
This delegate is only use for disable the edition of the first
column of the information tree widget
*/
class EditorDelegate : public QItemDelegate
{
Q_OBJECT
public:
EditorDelegate(QObject *parent) :
QItemDelegate(parent)
{}
QWidget* createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
};
/**
@brief The ElementPropertiesEditorWidget class
This class provide a dialog for edit various property of element, like