18 #ifndef QGSTABLEEDITORWIDGET_H
19 #define QGSTABLEEDITORWIDGET_H
24 #include <QTableWidget>
25 #include <QPlainTextEdit>
26 #include <QStyledItemDelegate>
32 class 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;
60 void updateMinimumSize();
62 bool mWeakEditorMode =
false;
63 int mOriginalWidth = -1;
64 int mOriginalHeight = -1;
65 bool mWidgetOwnsGeometry =
false;
69 class QgsTableEditorDelegate :
public QStyledItemDelegate
73 QgsTableEditorDelegate( QObject *parent );
79 void setWeakEditorMode(
bool weakEditorMode );
83 void updateNumericFormatForIndex(
const QModelIndex &index )
const;
86 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem & ,
const QModelIndex &index )
const override;
87 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
88 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
92 bool mWeakEditorMode =
false;
93 mutable QModelIndex mLastIndex;
162 bool hasMixedSelectionNumericFormat();
175 Q_DECL_DEPRECATED QColor selectionForegroundColor()
SIP_DEPRECATED;
186 QColor selectionBackgroundColor();
196 Qt::Alignment selectionHorizontalAlignment();
206 Qt::Alignment selectionVerticalAlignment();
233 double selectionRowHeight();
241 double selectionColumnWidth();
247 double tableRowHeight(
int row );
253 double tableColumnWidth(
int column );
263 void setTableRowHeight(
int row,
double height );
273 void setTableColumnWidth(
int column,
double width );
280 QList<int> rowsAssociatedWithSelection();
287 QList<int> columnsAssociatedWithSelection();
294 QVariantList tableHeaders()
const;
299 bool isHeaderCellSelected();
308 void insertRowsBelow();
315 void insertRowsAbove();
322 void insertColumnsBefore();
329 void insertColumnsAfter();
343 void deleteColumns();
350 void expandRowSelection();
357 void expandColumnSelection();
362 void clearSelectedCells();
372 Q_DECL_DEPRECATED
void setSelectionForegroundColor(
const QColor &color )
SIP_DEPRECATED;
380 void setSelectionBackgroundColor(
const QColor &color );
390 void setSelectionHorizontalAlignment( Qt::Alignment alignment );
400 void setSelectionVerticalAlignment( Qt::Alignment alignment );
407 void setSelectionCellProperty(
const QgsProperty &property );
421 void setSelectionRowHeight(
double height );
428 void setSelectionColumnWidth(
double height );
433 void setIncludeTableHeader(
bool included );
440 void setTableHeaders(
const QVariantList &headers );
443 void keyPressEvent( QKeyEvent *event )
override;
459 void updateNumericFormatForIndex(
const QModelIndex &index );
466 PresetBackgroundColorRole = Qt::UserRole + 1,
476 void updateHeaders();
478 bool collectConsecutiveRowRange(
const QModelIndexList &list,
int &minRow,
int &maxRow )
const;
479 bool collectConsecutiveColumnRange(
const QModelIndexList &list,
int &minColumn,
int &maxColumn )
const;
480 QList< int > collectUniqueRows(
const QModelIndexList &list )
const;
481 QList< int > collectUniqueColumns(
const QModelIndexList &list )
const;
483 int mBlockSignals = 0;
484 QHash< QTableWidgetItem *, QgsNumericFormat * > mNumericFormats;
485 QMenu *mHeaderMenu =
nullptr;
486 bool mIncludeHeader =
false;
487 bool mFirstSet =
true;
489 friend class QgsTableEditorDelegate;
A store for object properties.
Container for all settings relating to text rendering.
QVector< QgsTableRow > QgsTableContents
A set of table rows.