18#ifndef QGSTABLEEDITORWIDGET_H
19#define QGSTABLEEDITORWIDGET_H
25#include <QPlainTextEdit>
26#include <QStyledItemDelegate>
27#include <QTableWidget>
32class QgsTableEditorTextEdit :
public QPlainTextEdit
36 QgsTableEditorTextEdit( QWidget *parent );
42 void setWeakEditorMode(
bool weakEditorMode );
44 void setWidgetOwnsGeometry(
bool value )
46 mWidgetOwnsGeometry = value;
51 void resizeToContents();
54 void changeEvent( QEvent *e )
override;
56 void keyPressEvent( QKeyEvent *e )
override;
59 void updateMinimumSize();
61 bool mWeakEditorMode =
false;
62 int mOriginalWidth = -1;
63 int mOriginalHeight = -1;
64 bool mWidgetOwnsGeometry =
false;
67class QgsTableEditorDelegate :
public QStyledItemDelegate
71 QgsTableEditorDelegate( QObject *parent );
77 void setWeakEditorMode(
bool weakEditorMode );
81 void updateNumericFormatForIndex(
const QModelIndex &index )
const;
84 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem & ,
const QModelIndex &index )
const override;
85 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
86 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
89 bool mWeakEditorMode =
false;
90 mutable QModelIndex mLastIndex;
485 void updateNumericFormatForIndex(
const QModelIndex &index );
491 PresetBackgroundColorRole = Qt::UserRole + 1,
501 void updateHeaders();
503 bool collectConsecutiveRowRange(
const QModelIndexList &list,
int &minRow,
int &maxRow )
const;
504 bool collectConsecutiveColumnRange(
const QModelIndexList &list,
int &minColumn,
int &maxColumn )
const;
505 QList<int> collectUniqueRows(
const QModelIndexList &list )
const;
506 QList<int> collectUniqueColumns(
const QModelIndexList &list )
const;
507 bool isRectangularSelection(
const QModelIndexList &list )
const;
508 bool hasMergedCells(
const QModelIndexList &list )
const;
510 int mBlockSignals = 0;
511 QHash<QTableWidgetItem *, QgsNumericFormat *> mNumericFormats;
512 QMenu *mHeaderMenu =
nullptr;
513 QMenu *mCellMenu =
nullptr;
514 bool mIncludeHeader =
false;
515 bool mFirstSet =
true;
A store for object properties.
Container for all settings relating to text rendering.
QVector< QgsTableRow > QgsTableContents
A set of table rows.