clangformat
This commit is contained in:
parent
f43ee265e8
commit
d08fe2109d
@ -51,8 +51,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
tabWidget = new QTabWidget();
|
||||
|
||||
// Add tree view
|
||||
for(int i=0;i<6;i++)
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
treeView[i] = new TreeView();
|
||||
treeModel[i] = new TreeModel::Model();
|
||||
treeView[i]->setModel(treeModel[i]);
|
||||
@ -96,7 +95,8 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
history_index = 0;
|
||||
auto h = history.at(history_index);
|
||||
selectionModel[h.first]->setCurrentIndex(h.second, QItemSelectionModel::ClearAndSelect);
|
||||
if (tabWidget->currentIndex()!=h.first) tabWidget->setCurrentIndex(h.first);
|
||||
if (tabWidget->currentIndex() != h.first)
|
||||
tabWidget->setCurrentIndex(h.first);
|
||||
updateButtons();
|
||||
});
|
||||
|
||||
@ -108,7 +108,8 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
history_index--;
|
||||
auto h = history.at(history_index);
|
||||
selectionModel[h.first]->setCurrentIndex(h.second, QItemSelectionModel::ClearAndSelect);
|
||||
if (tabWidget->currentIndex()!=h.first) tabWidget->setCurrentIndex(h.first);
|
||||
if (tabWidget->currentIndex() != h.first)
|
||||
tabWidget->setCurrentIndex(h.first);
|
||||
updateButtons();
|
||||
});
|
||||
|
||||
@ -120,7 +121,8 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
history_index++;
|
||||
auto h = history.at(history_index);
|
||||
selectionModel[h.first]->setCurrentIndex(h.second, QItemSelectionModel::ClearAndSelect);
|
||||
if (tabWidget->currentIndex()!=h.first) tabWidget->setCurrentIndex(h.first);
|
||||
if (tabWidget->currentIndex() != h.first)
|
||||
tabWidget->setCurrentIndex(h.first);
|
||||
updateButtons();
|
||||
});
|
||||
|
||||
@ -132,7 +134,8 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
history_index = int(history.size() - 1);
|
||||
auto h = history.at(history_index);
|
||||
selectionModel[h.first]->setCurrentIndex(h.second, QItemSelectionModel::ClearAndSelect);
|
||||
if (tabWidget->currentIndex()!=h.first) tabWidget->setCurrentIndex(h.first);
|
||||
if (tabWidget->currentIndex() != h.first)
|
||||
tabWidget->setCurrentIndex(h.first);
|
||||
updateButtons();
|
||||
});
|
||||
|
||||
@ -143,8 +146,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
history_index = -1;
|
||||
history.clear();
|
||||
int num = tabWidget->currentIndex();
|
||||
if (selectionModel[num]->selectedIndexes().size()> 0)
|
||||
{
|
||||
if (selectionModel[num]->selectedIndexes().size() > 0) {
|
||||
QModelIndex index = selectionModel[num]->selectedIndexes().at(0);
|
||||
if (index.isValid()) {
|
||||
ElementType type = treeModel[num]->nodeFromIndex(index)->type();
|
||||
@ -203,12 +205,17 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
|
||||
connect(propertyEditor->treeWidget(), &QTreeWidget::itemDoubleClicked, this, &DesignWidget::onItemDoubleClicked);
|
||||
connect(propertyEditor, &QtTreePropertyBrowser::hoverPropertyChanged, this, &DesignWidget::onHoverPropertyChanged);
|
||||
|
||||
for(int num=0;num<6;num++) {
|
||||
connect(treeView[num], &TreeView::customContextMenuRequested, [this,num](const QPoint &pos) { prepareMenuTree(num, pos); });
|
||||
connect(treeView[num], &TreeView::doubleClicked, [this](const QModelIndex &index) { onDoubleClicked(index); } );
|
||||
connect(treeView[num], &TreeView::hoverIndexChanged, [this,num](QModelIndex index) { onHoverIndexChanged(num, index); } );
|
||||
for (int num = 0; num < 6; num++) {
|
||||
connect(treeView[num], &TreeView::customContextMenuRequested,
|
||||
[this, num](const QPoint &pos) { prepareMenuTree(num, pos); });
|
||||
connect(treeView[num], &TreeView::doubleClicked, [this](const QModelIndex &index) { onDoubleClicked(index); });
|
||||
connect(treeView[num], &TreeView::hoverIndexChanged,
|
||||
[this, num](QModelIndex index) { onHoverIndexChanged(num, index); });
|
||||
selectionModel[num] = treeView[num]->selectionModel();
|
||||
connect(selectionModel[num], &QItemSelectionModel::selectionChanged, [this,num](const QItemSelection &selected, const QItemSelection &deselected) { onSelectionChanged(num, selected, deselected); });
|
||||
connect(selectionModel[num], &QItemSelectionModel::selectionChanged,
|
||||
[this, num](const QItemSelection &selected, const QItemSelection &deselected) {
|
||||
onSelectionChanged(num, selected, deselected);
|
||||
});
|
||||
}
|
||||
|
||||
history_index = -1;
|
||||
@ -241,7 +248,7 @@ void DesignWidget::addToHistory(int tab, QModelIndex item)
|
||||
int count = int(history.size());
|
||||
for (int i = count - 1; i > history_index; i--)
|
||||
history.pop_back();
|
||||
history.push_back(std::make_pair(tab,item));
|
||||
history.push_back(std::make_pair(tab, item));
|
||||
history_index++;
|
||||
}
|
||||
history_ignore = false;
|
||||
@ -273,7 +280,8 @@ void DesignWidget::newContext(Context *ctx)
|
||||
}
|
||||
auto belGetter = [](Context *ctx, BelId id) { return ctx->getBelName(id); };
|
||||
|
||||
getTreeByElementType(ElementType::BEL)->loadData(std::unique_ptr<TreeModel::ElementXYRoot<BelId>>(
|
||||
getTreeByElementType(ElementType::BEL)
|
||||
->loadData(std::unique_ptr<TreeModel::ElementXYRoot<BelId>>(
|
||||
new TreeModel::ElementXYRoot<BelId>(ctx, belMap, belGetter, ElementType::BEL)));
|
||||
}
|
||||
|
||||
@ -287,7 +295,8 @@ void DesignWidget::newContext(Context *ctx)
|
||||
wireMap[std::pair<int, int>(wire->x, wire->y)].push_back(wireid);
|
||||
}
|
||||
auto wireGetter = [](Context *ctx, WireId id) { return ctx->getWireName(id); };
|
||||
getTreeByElementType(ElementType::WIRE)->loadData(std::unique_ptr<TreeModel::ElementXYRoot<WireId>>(
|
||||
getTreeByElementType(ElementType::WIRE)
|
||||
->loadData(std::unique_ptr<TreeModel::ElementXYRoot<WireId>>(
|
||||
new TreeModel::ElementXYRoot<WireId>(ctx, wireMap, wireGetter, ElementType::WIRE)));
|
||||
}
|
||||
|
||||
@ -300,12 +309,15 @@ void DesignWidget::newContext(Context *ctx)
|
||||
pipMap[std::pair<int, int>(pip->x, pip->y)].push_back(pipid);
|
||||
}
|
||||
auto pipGetter = [](Context *ctx, PipId id) { return ctx->getPipName(id); };
|
||||
getTreeByElementType(ElementType::PIP)->loadData(std::unique_ptr<TreeModel::ElementXYRoot<PipId>>(
|
||||
getTreeByElementType(ElementType::PIP)
|
||||
->loadData(std::unique_ptr<TreeModel::ElementXYRoot<PipId>>(
|
||||
new TreeModel::ElementXYRoot<PipId>(ctx, pipMap, pipGetter, ElementType::PIP)));
|
||||
}
|
||||
#endif
|
||||
getTreeByElementType(ElementType::CELL)->loadData(std::unique_ptr<TreeModel::IdStringList>(new TreeModel::IdStringList(ElementType::CELL)));
|
||||
getTreeByElementType(ElementType::NET)->loadData(std::unique_ptr<TreeModel::IdStringList>(new TreeModel::IdStringList(ElementType::NET)));
|
||||
getTreeByElementType(ElementType::CELL)
|
||||
->loadData(std::unique_ptr<TreeModel::IdStringList>(new TreeModel::IdStringList(ElementType::CELL)));
|
||||
getTreeByElementType(ElementType::NET)
|
||||
->loadData(std::unique_ptr<TreeModel::IdStringList>(new TreeModel::IdStringList(ElementType::NET)));
|
||||
}
|
||||
updateTree();
|
||||
}
|
||||
@ -458,7 +470,8 @@ void DesignWidget::onClickedBel(BelId bel, bool keep)
|
||||
|
||||
Q_EMIT selected(getDecals(ElementType::BEL, ctx->getBelName(bel)), keep);
|
||||
}
|
||||
if (tabWidget->currentIndex()!=0) tabWidget->setCurrentIndex(0);
|
||||
if (tabWidget->currentIndex() != 0)
|
||||
tabWidget->setCurrentIndex(0);
|
||||
selectionModel[0]->setCurrentIndex(getTreeByElementType(ElementType::BEL)->indexFromNode(*item),
|
||||
keep ? QItemSelectionModel::Select : QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
@ -476,7 +489,8 @@ void DesignWidget::onClickedWire(WireId wire, bool keep)
|
||||
|
||||
Q_EMIT selected(getDecals(ElementType::WIRE, ctx->getWireName(wire)), keep);
|
||||
}
|
||||
if (tabWidget->currentIndex()!=1) tabWidget->setCurrentIndex(1);
|
||||
if (tabWidget->currentIndex() != 1)
|
||||
tabWidget->setCurrentIndex(1);
|
||||
selectionModel[1]->setCurrentIndex(getTreeByElementType(ElementType::WIRE)->indexFromNode(*item),
|
||||
keep ? QItemSelectionModel::Select : QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
@ -494,7 +508,8 @@ void DesignWidget::onClickedPip(PipId pip, bool keep)
|
||||
|
||||
Q_EMIT selected(getDecals(ElementType::PIP, ctx->getPipName(pip)), keep);
|
||||
}
|
||||
if (tabWidget->currentIndex()!=2) tabWidget->setCurrentIndex(2);
|
||||
if (tabWidget->currentIndex() != 2)
|
||||
tabWidget->setCurrentIndex(2);
|
||||
selectionModel[2]->setCurrentIndex(getTreeByElementType(ElementType::PIP)->indexFromNode(*item),
|
||||
keep ? QItemSelectionModel::Select : QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
@ -914,8 +929,10 @@ void DesignWidget::onItemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
auto it = getTreeByElementType(type)->nodeForId(ctx->id(selectedProperty->valueText().toStdString()));
|
||||
if (it) {
|
||||
int num = getIndexByElementType(type);
|
||||
if (tabWidget->currentIndex()!=num) tabWidget->setCurrentIndex(num);
|
||||
selectionModel[num]->setCurrentIndex(getTreeByElementType(type)->indexFromNode(*it), QItemSelectionModel::ClearAndSelect);
|
||||
if (tabWidget->currentIndex() != num)
|
||||
tabWidget->setCurrentIndex(num);
|
||||
selectionModel[num]->setCurrentIndex(getTreeByElementType(type)->indexFromNode(*it),
|
||||
QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -937,7 +954,8 @@ void DesignWidget::onSearchInserted()
|
||||
currentIndexTab = tabWidget->currentIndex();
|
||||
}
|
||||
if (currentSearchIndexes.size() > 0 && currentIndex < currentSearchIndexes.size())
|
||||
selectionModel[tabWidget->currentIndex()]->setCurrentIndex(currentSearchIndexes.at(currentIndex), QItemSelectionModel::ClearAndSelect);
|
||||
selectionModel[tabWidget->currentIndex()]->setCurrentIndex(currentSearchIndexes.at(currentIndex),
|
||||
QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
|
||||
void DesignWidget::onHoverIndexChanged(int num, QModelIndex index)
|
||||
|
@ -113,7 +113,7 @@ class DesignWidget : public QWidget
|
||||
QMap<QtProperty *, QString> propertyToId;
|
||||
QMap<QString, QtProperty *> idToProperty;
|
||||
|
||||
std::vector<std::pair<int,QModelIndex>> history;
|
||||
std::vector<std::pair<int, QModelIndex>> history;
|
||||
int history_index;
|
||||
bool history_ignore;
|
||||
|
||||
|
@ -115,10 +115,10 @@ void FPGAViewWidget::initializeGL()
|
||||
QMutexLocker locker(&rendererDataLock_);
|
||||
// Render grid.
|
||||
auto grid = LineShaderData();
|
||||
for (float i = 0.0f; i < 1.0f * ctx_->getGridDimX()+1; i += 1.0f) {
|
||||
for (float i = 0.0f; i < 1.0f * ctx_->getGridDimX() + 1; i += 1.0f) {
|
||||
PolyLine(i, 0.0f, i, 1.0f * ctx_->getGridDimY()).build(grid);
|
||||
}
|
||||
for (float i = 0.0f; i < 1.0f * ctx_->getGridDimY()+1; i += 1.0f) {
|
||||
for (float i = 0.0f; i < 1.0f * ctx_->getGridDimY() + 1; i += 1.0f) {
|
||||
PolyLine(0.0f, i, 1.0f * ctx_->getGridDimX(), i).build(grid);
|
||||
}
|
||||
grid.last_render = 1;
|
||||
|
@ -266,7 +266,7 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode
|
||||
splitx_ = (bound_.x1_ - bound_.x0_) / 2 + bound_.x0_;
|
||||
splity_ = (bound_.y1_ - bound_.y0_) / 2 + bound_.y0_;
|
||||
// Create the new children.
|
||||
children_ = decltype(children_)(new QuadTreeNode<CoordinateT, ElementT>[4] {
|
||||
children_ = decltype(children_)(new QuadTreeNode<CoordinateT, ElementT>[4]{
|
||||
// Note: not using [NW] = QuadTreeNode because that seems to
|
||||
// crash g++ 7.3.0.
|
||||
/* NW */ QuadTreeNode<CoordinateT, ElementT>(BoundingBox(bound_.x0_, bound_.y0_, splitx_, splity_),
|
||||
|
@ -103,8 +103,8 @@ class Item
|
||||
virtual void fetchMore() {}
|
||||
|
||||
virtual boost::optional<Item *> getById(IdString id) { return boost::none; }
|
||||
virtual void search(QList<Item *> &results, QString text, int limit) { }
|
||||
virtual void updateElements(Context *ctx, std::vector<IdString> elements) { }
|
||||
virtual void search(QList<Item *> &results, QString text, int limit) {}
|
||||
virtual void updateElements(Context *ctx, std::vector<IdString> elements) {}
|
||||
|
||||
virtual ~Item()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user