7 #include <QtWidgets/QMenu>
8 #include <QApplication>
17 mCurrentContainer =
nullptr;
34 return mDataTableModel;
80 void DataTableWidget::handleContextMenuRequest(
const QPoint &pos)
96 menu.
addAction(
"Change category", [
this](){changePropertyRequested(DataTableModel::propertyType::category);});
97 menu.
addAction(
"Change key", [
this](){changePropertyRequested(DataTableModel::propertyType::key);});
99 menu.
addAction(
"Change value", [
this](){changePropertyRequested(DataTableModel::propertyType::value);});
102 switch(mCurrentObject.
type())
116 void DataTableWidget::adjustTableSizes()
137 if(!mCurrentContainer)
139 const QString propertyString[] = {
"category",
"key",
"type",
"value"};
141 DataTableModel::DataEntry entry = mDataTableModel->
getEntryAtRow(idx.
row());
142 InputDialog ipd(
"Change " + propertyString[(
int)prop],
"Choose new value for the " + propertyString[(
int)prop] +
" field.", entry.getPropertyValueByPropType(prop));
145 QString oldValues[] = {entry.category, entry.key, entry.dataType, entry.value};
146 QString newValues[] = {entry.category, entry.key, entry.dataType, entry.value};
147 newValues[(int)prop] = ipd.textValue();
148 ActionSetObjectData* act =
new ActionSetObjectData(newValues[0], newValues[1], newValues[2], newValues[3]);
149 act->setObject(mCurrentObject);
150 if(prop == DataTableModel::propertyType::category || prop == DataTableModel::propertyType::key)
151 act->setChangeKeyAndOrCategory(oldValues[0], oldValues[1]);
const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > & get_data_map() const
A model to display the data of a DataContainer.
DataEntry getEntryAtRow(int row) const
void updateData(const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string >> &dc)
static QString pyCodeGateData(u32 gateId, QString category, QString key)
static QString pyCodeNetData(u32 netId, QString category, QString key)
static QString pyCodeModuleData(u32 moduleId, QString category, QString key)
The UserActionObject class represents a single object used in UserAction.
UserActionObjectType::ObjectType type() const
const Module * module(const Gate *g, const NodeBoxes &boxes)
QModelIndex currentIndex() const const
virtual bool event(QEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override
void setSelectionMode(QAbstractItemView::SelectionMode mode)
void setText(const QString &text, QClipboard::Mode mode)
void setFrameStyle(int style)
bool isValid() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * sender() const const
virtual QModelIndex indexAt(const QPoint &pos) const const override
void resizeColumnsToContents()
void resizeRowsToContents()
virtual void setModel(QAbstractItemModel *model) override
void setWordWrap(bool on)