tdf#130857 qt weld: Implement QtInstanceTreeView::set_text
For now, require that the actual column index is passed. The weld::TreeView::set_text doc mentions // col index -1 sets the first text column , but that is not supported yet, so assert a different index is passed for now. Revisit when implementing support for a dialog that actually makes use of this. Change-Id: I8ba6e965ba22542bf3151548200b92c8c6b085d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178061 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
parent
a26173266d
commit
23ea73587a
2 changed files with 14 additions and 3 deletions
|
@ -44,7 +44,7 @@ public:
|
|||
virtual void unselect(int nPos) override;
|
||||
virtual void remove(int pos) override;
|
||||
virtual OUString get_text(int nRow, int nCol = -1) const override;
|
||||
virtual void set_text(int row, const OUString& rText, int col = -1) override;
|
||||
virtual void set_text(int nRow, const OUString& rText, int nCol = -1) override;
|
||||
virtual void set_sensitive(int row, bool bSensitive, int col = -1) override;
|
||||
virtual bool get_sensitive(int row, int col) const override;
|
||||
virtual void set_id(int row, const OUString& rId) override;
|
||||
|
|
|
@ -162,9 +162,20 @@ OUString QtInstanceTreeView::get_text(int nRow, int nCol) const
|
|||
return sText;
|
||||
}
|
||||
|
||||
void QtInstanceTreeView::set_text(int, const OUString&, int)
|
||||
void QtInstanceTreeView::set_text(int nRow, const OUString& rText, int nCol)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
assert(nCol != -1 && "Support for special index -1 (first text column) not implemented yet");
|
||||
|
||||
SolarMutexGuard g;
|
||||
GetQtInstance().RunInMainThread([&] {
|
||||
QStandardItem* pItem = m_pModel->item(nRow, nCol);
|
||||
if (!pItem)
|
||||
{
|
||||
pItem = new QStandardItem;
|
||||
m_pModel->setItem(nRow, nCol, pItem);
|
||||
}
|
||||
pItem->setText(toQString(rText));
|
||||
});
|
||||
}
|
||||
|
||||
void QtInstanceTreeView::set_sensitive(int, bool, int) { assert(false && "Not implemented yet"); }
|
||||
|
|
Loading…
Reference in a new issue