[LyX/master] Fix setting of math matrix size with mouse
Yuriy Skalko
yuriy.skalko at gmail.com
Fri Feb 19 16:02:46 UTC 2021
commit 110862b09f538bd7412f9e747641a8ae14f3f70a
Author: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu Feb 18 15:36:24 2021 +0200
Fix setting of math matrix size with mouse
---
src/frontends/qt/EmptyTable.cpp | 16 ++++++++++++----
src/frontends/qt/EmptyTable.h | 4 ++++
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/frontends/qt/EmptyTable.cpp b/src/frontends/qt/EmptyTable.cpp
index bc2963b..80cbe88 100644
--- a/src/frontends/qt/EmptyTable.cpp
+++ b/src/frontends/qt/EmptyTable.cpp
@@ -22,10 +22,6 @@
* A simple widget for a quick "preview" in TabularCreateDialog
*/
-unsigned int const cellheight = 20;
-unsigned int const cellwidth = 30;
-
-
EmptyTable::EmptyTable(QWidget * parent, int rows, int columns)
: QTableWidget(rows, columns, parent)
{
@@ -34,7 +30,9 @@ EmptyTable::EmptyTable(QWidget * parent, int rows, int columns)
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
viewport()->resize(cellheight * rows, cellwidth * columns);
setSelectionMode(QAbstractItemView::NoSelection);
+ setFocusPolicy(Qt::NoFocus);
setEditTriggers(QAbstractItemView::NoEditTriggers);
+ adjustMinCellSize();
}
@@ -43,6 +41,16 @@ QSize EmptyTable::sizeHint() const
return QSize(cellwidth * (2 + columnCount()), cellheight * (2 + rowCount()));
}
+
+void EmptyTable::adjustMinCellSize()
+{
+ setRowHeight(0, cellheight);
+ cellheight = rowHeight(0);
+ setColumnWidth(0, cellwidth);
+ cellwidth = columnWidth(0);
+}
+
+
void EmptyTable::resetCellSize()
{
for(int i = 0; i < rowCount(); ++i)
diff --git a/src/frontends/qt/EmptyTable.h b/src/frontends/qt/EmptyTable.h
index 9926526..9285db5 100644
--- a/src/frontends/qt/EmptyTable.h
+++ b/src/frontends/qt/EmptyTable.h
@@ -49,6 +49,10 @@ protected:
virtual void resetCellSize();
private:
+ void adjustMinCellSize();
+
+ int cellheight = 20;
+ int cellwidth = 30;
};
More information about the lyx-cvs
mailing list