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 ) { mWidgetOwnsGeometry = value; }
48 void resizeToContents();
51 void changeEvent( QEvent *e )
override;
53 void keyPressEvent( QKeyEvent *e )
override;
56 void updateMinimumSize();
58 bool mWeakEditorMode =
false;
59 int mOriginalWidth = -1;
60 int mOriginalHeight = -1;
61 bool mWidgetOwnsGeometry =
false;
64class QgsTableEditorDelegate :
public QStyledItemDelegate
68 QgsTableEditorDelegate( QObject *parent );
74 void setWeakEditorMode(
bool weakEditorMode );
78 void updateNumericFormatForIndex(
const QModelIndex &index )
const;
81 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem & ,
const QModelIndex &index )
const override;
82 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
83 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
86 bool mWeakEditorMode =
false;
87 mutable QModelIndex mLastIndex;
482 void updateNumericFormatForIndex(
const QModelIndex &index );
488 PresetBackgroundColorRole = Qt::UserRole + 1,
498 void updateHeaders();
500 bool collectConsecutiveRowRange(
const QModelIndexList &list,
int &minRow,
int &maxRow )
const;
501 bool collectConsecutiveColumnRange(
const QModelIndexList &list,
int &minColumn,
int &maxColumn )
const;
502 QList<int> collectUniqueRows(
const QModelIndexList &list )
const;
503 QList<int> collectUniqueColumns(
const QModelIndexList &list )
const;
504 bool isRectangularSelection(
const QModelIndexList &list )
const;
505 bool hasMergedCells(
const QModelIndexList &list )
const;
507 int mBlockSignals = 0;
508 QHash<QTableWidgetItem *, QgsNumericFormat *> mNumericFormats;
509 QMenu *mHeaderMenu =
nullptr;
510 QMenu *mCellMenu =
nullptr;
511 bool mIncludeHeader =
false;
512 bool mFirstSet =
true;
A store for object properties.
Container for all settings relating to text rendering.
QVector< QgsTableRow > QgsTableContents
A set of table rows.