[PATCH] Some fixes
Yuriy Skalko
yuriy.skalko at gmail.com
Thu Feb 18 13:49:40 UTC 2021
Hello,
Please review two attached patches:
1. Now setting of math matrix size by dragging mouse is imprecise due to
Qt limit on min cell size. The patch fixes this.
2. Now Beamer columns have fixed margin size determined by
untranslatable English string. The patch changes it to dynamic.
Yuriy
-------------- next part --------------
From bf9914554df866ddc7740f36f98d8a6d8ac5334d Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 18 Feb 2021 15:36:24 +0200
Subject: [PATCH 1/2] 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 bc2963ba32..80cbe88aec 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 99265266d2..9285db5ceb 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;
};
--
2.28.0.windows.1
-------------- next part --------------
From ffaab2a0b889bbc0967346fda5df5090beb1597d Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 18 Feb 2021 15:38:13 +0200
Subject: [PATCH 2/2] Fix margins for Beamer columns
---
lib/layouts/beamer.layout | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index 61d8823770..a26c409783 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -666,12 +666,12 @@ End
#
-# COLUMS
+# COLUMNS
#
Style Column
Category Columns
- Margin Static
+ Margin Dynamic
LatexType Command
LatexName column
ParSkip 0.5
@@ -689,7 +689,6 @@ Style Column
LabelString "Options"
Tooltip "Column options (see beamer manual)"
EndArgument
- LeftMargin "Start column (increase depth!), width:xx"
LabelFont
Family Roman
Color latex
@@ -699,16 +698,15 @@ End
Style Columns
Category Columns
KeepEmpty 1
- Margin Static
+ Margin First_Dynamic
LatexType Environment
- NextNoIndent 0
+ NextNoIndent 1
ParIndent MM
Align Left
LabelType Static
LabelSep xx
LatexName columns
LabelString "Columns"
- LeftMargin "Columnsxx"
Argument 1
LabelString "Column Placement Options"
Tooltip "Column placement options (t, T, c, b)"
@@ -732,7 +730,6 @@ Style ColumnsCenterAligned
CopyStyle Columns
LatexParam [c]
LabelString "Columns (center aligned)"
- LeftMargin "Columns (center aligned)xx"
ResetArgs 1
End
@@ -740,7 +737,6 @@ Style ColumnsTopAligned
CopyStyle Columns
LatexParam [t]
LabelString "Columns (top aligned)"
- LeftMargin "Columns (top aligned)xx"
ResetArgs 1
End
--
2.28.0.windows.1
More information about the lyx-devel
mailing list