From 8ea82a849c4385dd5bfd42442dd24ad772fafabd Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Wed, 4 Sep 2024 19:41:15 +0200 Subject: [PATCH] Spreadsheet: Double click separator to resize to content Qt handles resize to content on double clicking the separator in the header, by default. However this does not work in FreeCAD. There are no comments on why this was done and is therefore treated as bug instead of feature. Manual testing has been performed after the change and: * Scaling by double clicking separator in header works * Sizes are correctly stored in sheet when resizing to content --- src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp | 8 -------- src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp index f0ae0de079..b86cbb44c7 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.cpp @@ -92,14 +92,6 @@ void SpreadsheetDelegate::onEditorFinishedWithKey(int key, Qt::KeyboardModifiers Q_EMIT finishedWithKey(key, modifiers); } -QSize SpreadsheetDelegate::sizeHint(const QStyleOptionViewItem& option, - const QModelIndex& index) const -{ - Q_UNUSED(option); - Q_UNUSED(index); - return {}; -} - static inline void drawBorder(QPainter* painter, const QStyleOptionViewItem& option, unsigned flags, diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.h b/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.h index 7036ffd3e5..7ae2fe0338 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.h +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetDelegate.h @@ -47,8 +47,6 @@ public: void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; - - QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override; void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;