Spreadsheet: Clear line edit on top when current cell is cleared.

This commit is contained in:
Eivind Kvedalen 2016-01-02 20:34:54 +01:00
parent 5f26cd9d7c
commit 160d88c883
2 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Eivind Kvedalen (eivind@kvedalen.name) 2015 *
* Copyright (c) Eivind Kvedalen (eivind@kvedalen.name) 2015-2016 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@ -99,6 +99,8 @@ SheetView::SheetView(Gui::Document *pcDocument, App::DocumentObject *docObj, QWi
columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, _1, _2));
rowHeightChangedConnection = sheet->rowHeightChanged.connect(bind(&SheetView::resizeRow, this, _1, _2));
connect( model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(modelUpdated(const QModelIndex &, const QModelIndex &)));
QPalette palette = ui->cells->palette();
palette.setColor(QPalette::Base, QColor(255, 255, 255));
palette.setColor(QPalette::Text, QColor(0, 0, 0));
@ -246,6 +248,16 @@ void SheetView::rowResizeFinished()
newRowSizes.clear();
}
void SheetView::modelUpdated(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
const QModelIndex & current = ui->cells->currentIndex();
if (current < topLeft || bottomRight < current)
return;
updateContentLine();
}
void SheetView::columnResized(int col, int oldSize, int newSize)
{
newColumnSizes[col] = newSize;

View File

@ -86,6 +86,7 @@ protected Q_SLOTS:
void rowResized(int row, int oldSize, int newSize);
void columnResizeFinished();
void rowResizeFinished();
void modelUpdated(const QModelIndex & topLeft, const QModelIndex & bottomRight);
protected:
void updateContentLine();
void setCurrentCell(QString str);