mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Fix setting of math matrix size with mouse
This commit is contained in:
parent
99f7d7fa74
commit
110862b09f
@ -22,10 +22,6 @@
|
|||||||
* A simple widget for a quick "preview" in TabularCreateDialog
|
* 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)
|
EmptyTable::EmptyTable(QWidget * parent, int rows, int columns)
|
||||||
: QTableWidget(rows, columns, parent)
|
: QTableWidget(rows, columns, parent)
|
||||||
{
|
{
|
||||||
@ -34,7 +30,9 @@ EmptyTable::EmptyTable(QWidget * parent, int rows, int columns)
|
|||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
viewport()->resize(cellheight * rows, cellwidth * columns);
|
viewport()->resize(cellheight * rows, cellwidth * columns);
|
||||||
setSelectionMode(QAbstractItemView::NoSelection);
|
setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
|
setFocusPolicy(Qt::NoFocus);
|
||||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
adjustMinCellSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -43,6 +41,16 @@ QSize EmptyTable::sizeHint() const
|
|||||||
return QSize(cellwidth * (2 + columnCount()), cellheight * (2 + rowCount()));
|
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()
|
void EmptyTable::resetCellSize()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < rowCount(); ++i)
|
for(int i = 0; i < rowCount(); ++i)
|
||||||
|
@ -49,6 +49,10 @@ protected:
|
|||||||
virtual void resetCellSize();
|
virtual void resetCellSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void adjustMinCellSize();
|
||||||
|
|
||||||
|
int cellheight = 20;
|
||||||
|
int cellwidth = 30;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user