[GB.QT]
* BUG: Block events when setting the number of rows and columns in GridView. That prevents some bad crashes. git-svn-id: svn://localhost/gambas/trunk@1602 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
a224313e1c
commit
e79e4cd192
2 changed files with 10 additions and 35 deletions
|
@ -429,6 +429,7 @@ void MyTable::setNumCols(int newCols)
|
|||
{
|
||||
int i;
|
||||
int col = numCols();
|
||||
bool b;
|
||||
|
||||
if (newCols < 0)
|
||||
return;
|
||||
|
@ -436,22 +437,10 @@ void MyTable::setNumCols(int newCols)
|
|||
_cols = newCols;
|
||||
_item->invalidate();
|
||||
|
||||
/*
|
||||
if (_items)
|
||||
{
|
||||
delete[] _items;
|
||||
_items = (MyTableItem **)0;
|
||||
}
|
||||
|
||||
if (_cols > 0)
|
||||
{
|
||||
_items = new (MyTableItem *)[_cols];
|
||||
for (i = 0; i < _cols; i++)
|
||||
_items[i] = new MyTableItem(this);
|
||||
}
|
||||
*/
|
||||
|
||||
b = signalsBlocked();
|
||||
blockSignals(true);
|
||||
QTable::setNumCols(newCols);
|
||||
blockSignals(b);
|
||||
|
||||
_last_col_width = 0;
|
||||
|
||||
|
@ -472,33 +461,19 @@ void MyTable::setNumCols(int newCols)
|
|||
|
||||
void MyTable::setNumRows(int newRows)
|
||||
{
|
||||
//int i;
|
||||
//int row = numRows();
|
||||
|
||||
//bool r = verticalHeader()->isResizeEnabled();
|
||||
|
||||
//setLeftMargin(fontMetrics().width(QString::number(newRows) + "W"));
|
||||
//verticalHeader()->setResizeEnabled(false);
|
||||
bool b;
|
||||
|
||||
if (newRows < 0)
|
||||
return;
|
||||
|
||||
_rows = newRows;
|
||||
_item->invalidate();
|
||||
|
||||
b = signalsBlocked();
|
||||
blockSignals(true);
|
||||
QTable::setNumRows(newRows);
|
||||
blockSignals(false);
|
||||
|
||||
//verticalHeader()->setResizeEnabled(r);
|
||||
|
||||
/*if (newRows > row)
|
||||
{
|
||||
bool upd = verticalHeader()->isUpdatesEnabled();
|
||||
verticalHeader()->setUpdatesEnabled(false);
|
||||
|
||||
for (i = row; i < newRows; i++)
|
||||
verticalHeader()->setLabel(i, QString::number(i + 1));
|
||||
|
||||
verticalHeader()->setUpdatesEnabled(upd);
|
||||
}*/
|
||||
clearSelection();
|
||||
emit currentChanged(-1, -1);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ public:
|
|||
int findSelection(int row);
|
||||
|
||||
void moveItem(int srow, int scol, int drow, int dcol) { _item->move(srow, scol, drow, dcol); }
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
virtual void setNumCols(int);
|
||||
|
|
Loading…
Reference in a new issue