Spreadsheet: Removed setPosition() function.
This commit is contained in:
parent
b7480210fd
commit
87c6af3547
|
@ -84,8 +84,6 @@ Sheet::Sheet()
|
||||||
ADD_PROPERTY_TYPE(cells, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Cell contents");
|
ADD_PROPERTY_TYPE(cells, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Cell contents");
|
||||||
ADD_PROPERTY_TYPE(columnWidths, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Column widths");
|
ADD_PROPERTY_TYPE(columnWidths, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Column widths");
|
||||||
ADD_PROPERTY_TYPE(rowHeights, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Row heights");
|
ADD_PROPERTY_TYPE(rowHeights, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Row heights");
|
||||||
ADD_PROPERTY_TYPE(currRow, (0), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Current row");
|
|
||||||
ADD_PROPERTY_TYPE(currColumn, (0), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Current column");
|
|
||||||
|
|
||||||
docDeps.setSize(0);
|
docDeps.setSize(0);
|
||||||
|
|
||||||
|
@ -452,18 +450,6 @@ std::map<int, int> Sheet::getRowHeights() const
|
||||||
return rowHeights.getValues();
|
return rowHeights.getValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set selected position for property to \a address.
|
|
||||||
* @param address Target position
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Sheet::setPosition(CellAddress address)
|
|
||||||
{
|
|
||||||
currRow.setValue(address.row());
|
|
||||||
currColumn.setValue(address.col());
|
|
||||||
currRow.purgeTouched();
|
|
||||||
currColumn.purgeTouched();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove all aliases.
|
* @brief Remove all aliases.
|
||||||
|
@ -845,11 +831,6 @@ DocumentObjectExecReturn *Sheet::execute(void)
|
||||||
rowHeights.clearDirty();
|
rowHeights.clearDirty();
|
||||||
columnWidths.clearDirty();
|
columnWidths.clearDirty();
|
||||||
|
|
||||||
positionChanged(CellAddress(currRow.getValue(), currColumn.getValue()));
|
|
||||||
|
|
||||||
currRow.purgeTouched();
|
|
||||||
currColumn.purgeTouched();
|
|
||||||
|
|
||||||
std::set<DocumentObject*> ds(cells.getDocDeps());
|
std::set<DocumentObject*> ds(cells.getDocDeps());
|
||||||
|
|
||||||
// Make sure we don't reference ourselves
|
// Make sure we don't reference ourselves
|
||||||
|
|
|
@ -162,8 +162,6 @@ public:
|
||||||
|
|
||||||
std::map<int, int> getRowHeights() const;
|
std::map<int, int> getRowHeights() const;
|
||||||
|
|
||||||
void setPosition(CellAddress address);
|
|
||||||
|
|
||||||
// Signals
|
// Signals
|
||||||
|
|
||||||
boost::signal<void (Spreadsheet::CellAddress)> cellUpdated;
|
boost::signal<void (Spreadsheet::CellAddress)> cellUpdated;
|
||||||
|
@ -174,9 +172,6 @@ public:
|
||||||
|
|
||||||
boost::signal<void (int, int)> rowHeightChanged;
|
boost::signal<void (int, int)> rowHeightChanged;
|
||||||
|
|
||||||
boost::signal<void (CellAddress)> positionChanged;
|
|
||||||
|
|
||||||
|
|
||||||
/** @name Access properties */
|
/** @name Access properties */
|
||||||
//@{
|
//@{
|
||||||
App::Property* addDynamicProperty(
|
App::Property* addDynamicProperty(
|
||||||
|
@ -285,9 +280,6 @@ protected:
|
||||||
/* Row heights */
|
/* Row heights */
|
||||||
PropertyRowHeights rowHeights;
|
PropertyRowHeights rowHeights;
|
||||||
|
|
||||||
App::PropertyInteger currRow;
|
|
||||||
App::PropertyInteger currColumn;
|
|
||||||
|
|
||||||
/* Dependencies to other documents */
|
/* Dependencies to other documents */
|
||||||
App::PropertyLinkList docDeps;
|
App::PropertyLinkList docDeps;
|
||||||
|
|
||||||
|
|
|
@ -155,10 +155,5 @@
|
||||||
<UserDocu>Get given spreadsheet row height</UserDocu>
|
<UserDocu>Get given spreadsheet row height</UserDocu>
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</Methode>
|
</Methode>
|
||||||
<Methode Name="setPosition">
|
|
||||||
<Documentation>
|
|
||||||
<UserDocu>Set focused cell for attached view(s).</UserDocu>
|
|
||||||
</Documentation>
|
|
||||||
</Methode>
|
|
||||||
</PythonExport>
|
</PythonExport>
|
||||||
</GenerateModel>
|
</GenerateModel>
|
||||||
|
|
|
@ -759,25 +759,6 @@ PyObject* SheetPy::getBackground(PyObject *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* SheetPy::setPosition(PyObject *args)
|
|
||||||
{
|
|
||||||
const char * strAddress;
|
|
||||||
CellAddress address;
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s:setPosition", &strAddress))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
address = stringToAddress(strAddress);
|
|
||||||
getSheetPtr()->setPosition(address);
|
|
||||||
Py_Return;
|
|
||||||
}
|
|
||||||
catch (const Base::Exception & e) {
|
|
||||||
PyErr_SetString(PyExc_ValueError, e.what());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject* SheetPy::setColumnWidth(PyObject *args)
|
PyObject* SheetPy::setColumnWidth(PyObject *args)
|
||||||
{
|
{
|
||||||
const char * columnStr;
|
const char * columnStr;
|
||||||
|
|
|
@ -82,8 +82,6 @@ void CmdSpreadsheetMergeCells::activated(int iMsg)
|
||||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.mergeCells('%s')", sheet->getNameInDocument(),
|
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.mergeCells('%s')", sheet->getNameInDocument(),
|
||||||
i->rangeString().c_str());
|
i->rangeString().c_str());
|
||||||
Gui::Command::commitCommand();
|
Gui::Command::commitCommand();
|
||||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.setPosition('%s')", sheet->getNameInDocument(),
|
|
||||||
ranges[0].address().c_str());
|
|
||||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,6 @@ SheetView::SheetView(Gui::Document *pcDocument, App::DocumentObject *docObj, QWi
|
||||||
|
|
||||||
columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, _1, _2));
|
columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, _1, _2));
|
||||||
rowHeightChangedConnection = sheet->rowHeightChanged.connect(bind(&SheetView::resizeRow, this, _1, _2));
|
rowHeightChangedConnection = sheet->rowHeightChanged.connect(bind(&SheetView::resizeRow, this, _1, _2));
|
||||||
positionChangedConnection = sheet->positionChanged.connect(bind(&SheetView::setPosition, this, _1));
|
|
||||||
|
|
||||||
QPalette palette = ui->cells->palette();
|
QPalette palette = ui->cells->palette();
|
||||||
palette.setColor(QPalette::Base, QColor(255, 255, 255));
|
palette.setColor(QPalette::Base, QColor(255, 255, 255));
|
||||||
|
@ -263,17 +262,6 @@ void SheetView::resizeColumn(int col, int newSize)
|
||||||
ui->cells->setColumnWidth(col, newSize);
|
ui->cells->setColumnWidth(col, newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SheetView::setPosition(CellAddress address)
|
|
||||||
{
|
|
||||||
QModelIndex curr = ui->cells->currentIndex();
|
|
||||||
QModelIndex i = ui->cells->model()->index(address.row(), address.col());
|
|
||||||
|
|
||||||
if (i.isValid() && (curr.row() != address.row() || curr.column() != address.col())) {
|
|
||||||
ui->cells->clearSelection();
|
|
||||||
ui->cells->setCurrentIndex(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SheetView::resizeRow(int col, int newSize)
|
void SheetView::resizeRow(int col, int newSize)
|
||||||
{
|
{
|
||||||
if (ui->cells->verticalHeader()->sectionSize(col) != newSize)
|
if (ui->cells->verticalHeader()->sectionSize(col) != newSize)
|
||||||
|
@ -299,7 +287,6 @@ void SheetView::editingFinished()
|
||||||
void SheetView::currentChanged ( const QModelIndex & current, const QModelIndex & previous )
|
void SheetView::currentChanged ( const QModelIndex & current, const QModelIndex & previous )
|
||||||
{
|
{
|
||||||
updateContentLine();
|
updateContentLine();
|
||||||
sheet->setPosition(CellAddress(current.row(), current.column()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SheetView::updateCell(const App::Property *prop)
|
void SheetView::updateCell(const App::Property *prop)
|
||||||
|
|
|
@ -87,7 +87,6 @@ protected Q_SLOTS:
|
||||||
void columnResizeFinished();
|
void columnResizeFinished();
|
||||||
void rowResizeFinished();
|
void rowResizeFinished();
|
||||||
protected:
|
protected:
|
||||||
void setPosition(Spreadsheet::CellAddress address);
|
|
||||||
void updateContentLine();
|
void updateContentLine();
|
||||||
void setCurrentCell(QString str);
|
void setCurrentCell(QString str);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user