[PD] allow to move sweep sections
Now that we have the feature that sweeps can have vertices as end or begin of a sweep, there is the need for the feature to move sections. For example vertices may only be the last section.
This commit is contained in:
@@ -938,6 +938,9 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW
|
||||
ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
connect(remove, SIGNAL(triggered()), this, SLOT(onDeleteSection()));
|
||||
|
||||
connect(ui->listWidgetReferences->model(),
|
||||
SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved()));
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(PipeView->getObject());
|
||||
@@ -964,6 +967,27 @@ TaskPipeScaling::~TaskPipeScaling()
|
||||
}
|
||||
}
|
||||
|
||||
void TaskPipeScaling::indexesMoved()
|
||||
{
|
||||
QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender());
|
||||
if (!model)
|
||||
return;
|
||||
|
||||
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
|
||||
auto originals = pipe->Sections.getSubListValues();
|
||||
|
||||
QByteArray name;
|
||||
int rows = model->rowCount();
|
||||
for (int i = 0; i < rows; i++) {
|
||||
QModelIndex index = model->index(i, 0);
|
||||
originals[i] = index.data(Qt::UserRole).value<App::PropertyLinkSubList::SubSet>();
|
||||
}
|
||||
|
||||
pipe->Sections.setSubListValues(originals);
|
||||
recomputeFeature();
|
||||
updateUI(ui->stackedWidget->currentIndex());
|
||||
}
|
||||
|
||||
void TaskPipeScaling::clearButtons(const selectionModes notThis)
|
||||
{
|
||||
// TODO: Clear buttons in the other pipe taskboxes as well
|
||||
|
||||
@@ -145,6 +145,7 @@ private Q_SLOTS:
|
||||
void onButtonRefRemove(bool checked);
|
||||
void updateUI(int idx);
|
||||
void onDeleteSection();
|
||||
void indexesMoved();
|
||||
|
||||
protected:
|
||||
enum selectionModes { none, refAdd, refRemove };
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>353</width>
|
||||
<height>407</height>
|
||||
<width>262</width>
|
||||
<height>270</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -97,7 +97,14 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidgetReferences"/>
|
||||
<widget class="QListWidget" name="listWidgetReferences">
|
||||
<property name="toolTip">
|
||||
<string>List can be reordered by dragging</string>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user