WIP: lib-browser - icons for lib cells.

This commit is contained in:
Matthias Koefferlein 2019-08-03 00:45:42 +02:00
parent 5ec06b9f24
commit 9daf63403a
4 changed files with 25 additions and 9 deletions

View File

@ -1535,12 +1535,16 @@ InstService::configure (const std::string &name, const std::string &value)
m_pcell_parameters.clear ();
m_is_pcell = ex.test ("!") || ! ex.at_end ();
while (! ex.at_end ()) {
std::string n;
ex.read_word_or_quoted (n);
ex.test (":");
ex.read (m_pcell_parameters.insert (std::make_pair (n, tl::Variant ())).first->second);
ex.test (";");
try {
while (! ex.at_end ()) {
std::string n;
ex.read_word_or_quoted (n);
ex.test (":");
ex.read (m_pcell_parameters.insert (std::make_pair (n, tl::Variant ())).first->second);
ex.test (";");
}
} catch (...) {
// ignore errors
}
m_needs_update = true;

View File

@ -737,6 +737,17 @@ CellTreeModel::data (const QModelIndex &index, int role) const
return QVariant ();
#endif
} else if (role == Qt::DecorationRole && (m_flags & WithIcons) != 0) {
// TODO: icons for normal cells too?
if (item->is_pcell ()) {
QIcon icon (":/setup.png");
return QVariant (icon);
} else {
QIcon icon (":/instance.png");
return QVariant (icon);
}
} else {
return QVariant ();

View File

@ -67,7 +67,8 @@ public:
TopCells = 8, // show top cells only
BasicCells = 16, // show basic cells (PCells included, no proxies)
WithVariants = 32, // show PCell variants below PCells
NoPadding = 64 // disable padding of display string with a blank at the beginning and end
WithIcons = 64, // show icons for the top level cell type
NoPadding = 128 // disable padding of display string with a blank at the beginning and end
};
enum Sorting {

View File

@ -790,7 +790,7 @@ LibrariesView::do_update_content (int lib_index)
LibraryTreeWidget *cell_list = new LibraryTreeWidget (cl_frame, "tree", mp_view->view_object_widget ());
cl_ly->addWidget (cell_list);
cell_list->setModel (new CellTreeModel (cell_list, m_libraries [i].get (), CellTreeModel::Flat | CellTreeModel::TopCells | CellTreeModel::BasicCells | CellTreeModel::WithVariants, 0));
cell_list->setModel (new CellTreeModel (cell_list, m_libraries [i].get (), CellTreeModel::Flat | CellTreeModel::TopCells | CellTreeModel::BasicCells | CellTreeModel::WithVariants | CellTreeModel::WithIcons, 0));
cell_list->setUniformRowHeights (true);
pl = cell_list->palette ();
@ -865,7 +865,7 @@ LibrariesView::do_update_content (int lib_index)
CellTreeModel *model = dynamic_cast <CellTreeModel *> (mp_cell_lists [i]->model ());
if (model) {
model->configure (m_libraries [i].get (), CellTreeModel::Flat | CellTreeModel::TopCells | CellTreeModel::BasicCells | CellTreeModel::WithVariants, 0);
model->configure (m_libraries [i].get (), CellTreeModel::Flat | CellTreeModel::TopCells | CellTreeModel::BasicCells | CellTreeModel::WithVariants | CellTreeModel::WithIcons, 0);
}
}