Additional controls to cover issue with Internal move. ref #824.
--HG-- branch : develop
This commit is contained in:
parent
2cb7c4c603
commit
3d8cdb6630
|
@ -717,6 +717,62 @@ void DialogTool::InitNodeAngles(QComboBox *box)
|
|||
box->addItem(tr("by second edge right angle"), static_cast<unsigned char>(PieceNodeAngle::BySecondEdgeRightAngle));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::MoveListRowTop(QListWidget *list)
|
||||
{
|
||||
SCASSERT(list != nullptr)
|
||||
const int currentIndex = list->currentRow();
|
||||
if (QListWidgetItem *currentItem = list->takeItem(currentIndex))
|
||||
{
|
||||
list->insertItem(0, currentItem);
|
||||
list->setCurrentRow(0);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::MoveListRowUp(QListWidget *list)
|
||||
{
|
||||
SCASSERT(list != nullptr)
|
||||
int currentIndex = list->currentRow();
|
||||
if (QListWidgetItem *currentItem = list->takeItem(currentIndex--))
|
||||
{
|
||||
if (currentIndex < 0)
|
||||
{
|
||||
currentIndex = 0;
|
||||
}
|
||||
list->insertItem(currentIndex, currentItem);
|
||||
list->setCurrentRow(currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::MoveListRowDown(QListWidget *list)
|
||||
{
|
||||
SCASSERT(list != nullptr)
|
||||
int currentIndex = list->currentRow();
|
||||
if (QListWidgetItem *currentItem = list->takeItem(currentIndex++))
|
||||
{
|
||||
if (currentIndex > list->count())
|
||||
{
|
||||
currentIndex = list->count();
|
||||
}
|
||||
list->insertItem(currentIndex, currentItem);
|
||||
list->setCurrentRow(currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::MoveListRowBottom(QListWidget *list)
|
||||
{
|
||||
SCASSERT(list != nullptr)
|
||||
const int currentIndex = list->currentRow();
|
||||
if (QListWidgetItem *currentItem = list->takeItem(currentIndex))
|
||||
{
|
||||
list->insertItem(list->count(), currentItem);
|
||||
list->setCurrentRow(list->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogTool::IsSplinePath(const QSharedPointer<VGObject> &obj) const
|
||||
{
|
||||
|
|
|
@ -282,6 +282,11 @@ protected:
|
|||
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);
|
||||
|
||||
void InitNodeAngles(QComboBox *box);
|
||||
|
||||
void MoveListRowTop(QListWidget *list);
|
||||
void MoveListRowUp(QListWidget *list);
|
||||
void MoveListRowDown(QListWidget *list);
|
||||
void MoveListRowBottom(QListWidget *list);
|
||||
private:
|
||||
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;
|
||||
|
||||
|
|
|
@ -346,6 +346,7 @@ void DialogPiecePath::ListChanged()
|
|||
|
||||
InitPassmarksList();
|
||||
InitNodesList();
|
||||
SetMoveControls();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -833,6 +834,36 @@ void DialogPiecePath::DeployVisibleFormulaTextEdit()
|
|||
DeployFormula(ui->plainTextEditFormulaVisible, ui->pushButtonGrowVisible, m_formulaBaseVisible);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::SetMoveControls()
|
||||
{
|
||||
ui->toolButtonTop->setEnabled(false);
|
||||
ui->toolButtonUp->setEnabled(false);
|
||||
ui->toolButtonDown->setEnabled(false);
|
||||
ui->toolButtonBottom->setEnabled(false);
|
||||
|
||||
if (ui->listWidget->count() >= 2)
|
||||
{
|
||||
if (ui->listWidget->currentRow() == 0)
|
||||
{
|
||||
ui->toolButtonDown->setEnabled(true);
|
||||
ui->toolButtonBottom->setEnabled(true);
|
||||
}
|
||||
else if (ui->listWidget->currentRow() == ui->listWidget->count()-1)
|
||||
{
|
||||
ui->toolButtonTop->setEnabled(true);
|
||||
ui->toolButtonUp->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->toolButtonTop->setEnabled(true);
|
||||
ui->toolButtonUp->setEnabled(true);
|
||||
ui->toolButtonDown->setEnabled(true);
|
||||
ui->toolButtonBottom->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::InitPathTab()
|
||||
{
|
||||
|
@ -853,6 +884,13 @@ void DialogPiecePath::InitPathTab()
|
|||
|
||||
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogPiecePath::ShowContextMenu);
|
||||
connect(ui->listWidget->model(), &QAbstractItemModel::rowsMoved, this, &DialogPiecePath::ListChanged);
|
||||
connect(ui->listWidget, &QListWidget::itemSelectionChanged, this, &DialogPiecePath::SetMoveControls);
|
||||
|
||||
connect(ui->toolButtonTop, &QToolButton::clicked, this, [this](){MoveListRowTop(ui->listWidget);});
|
||||
connect(ui->toolButtonUp, &QToolButton::clicked, this, [this](){MoveListRowUp(ui->listWidget);});
|
||||
connect(ui->toolButtonDown, &QToolButton::clicked, this, [this](){MoveListRowDown(ui->listWidget);});
|
||||
connect(ui->toolButtonBottom, &QToolButton::clicked, this, [this](){MoveListRowBottom(ui->listWidget);});
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -97,6 +97,8 @@ private slots:
|
|||
void DeployWidthAfterFormulaTextEdit();
|
||||
void DeployVisibleFormulaTextEdit();
|
||||
|
||||
void SetMoveControls();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPiecePath)
|
||||
Ui::DialogPiecePath *ui;
|
||||
|
|
|
@ -102,6 +102,91 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonTop">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move on top</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-top">
|
||||
<normaloff>../../../../../app/tape</normaloff>../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonUp">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-up">
|
||||
<normaloff>../../../../../app/tape</normaloff>../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonDown">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move down</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down">
|
||||
<normaloff>../../../../../app/tape</normaloff>../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonBottom">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move on bottom</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-bottom">
|
||||
<normaloff>../../../../../app/tape</normaloff>../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5000</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxCut">
|
||||
<property name="toolTip">
|
||||
|
|
|
@ -906,6 +906,7 @@ void DialogSeamAllowance::ListChanged()
|
|||
InitNodesList();
|
||||
InitPassmarksList();
|
||||
CustomSAChanged(uiTabPaths->listWidgetCustomSA->currentRow());
|
||||
SetMoveControls();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2681,6 +2682,17 @@ void DialogSeamAllowance::InitMainPathTab()
|
|||
&DialogSeamAllowance::ShowMainPathContextMenu);
|
||||
connect(uiTabPaths->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this,
|
||||
&DialogSeamAllowance::ListChanged);
|
||||
connect(uiTabPaths->listWidgetMainPath, &QListWidget::itemSelectionChanged, this,
|
||||
&DialogSeamAllowance::SetMoveControls);
|
||||
|
||||
connect(uiTabPaths->toolButtonTop, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowTop(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonUp, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowUp(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonDown, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowDown(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonBottom, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowBottom(uiTabPaths->listWidgetMainPath);});
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -3301,3 +3313,33 @@ QString DialogSeamAllowance::GetDefaultPieceName() const
|
|||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetMoveControls()
|
||||
{
|
||||
uiTabPaths->toolButtonTop->setEnabled(false);
|
||||
uiTabPaths->toolButtonUp->setEnabled(false);
|
||||
uiTabPaths->toolButtonDown->setEnabled(false);
|
||||
uiTabPaths->toolButtonBottom->setEnabled(false);
|
||||
|
||||
if (uiTabPaths->listWidgetMainPath->count() >= 2)
|
||||
{
|
||||
if (uiTabPaths->listWidgetMainPath->currentRow() == 0)
|
||||
{
|
||||
uiTabPaths->toolButtonDown->setEnabled(true);
|
||||
uiTabPaths->toolButtonBottom->setEnabled(true);
|
||||
}
|
||||
else if (uiTabPaths->listWidgetMainPath->currentRow() == uiTabPaths->listWidgetMainPath->count()-1)
|
||||
{
|
||||
uiTabPaths->toolButtonTop->setEnabled(true);
|
||||
uiTabPaths->toolButtonUp->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiTabPaths->toolButtonTop->setEnabled(true);
|
||||
uiTabPaths->toolButtonUp->setEnabled(true);
|
||||
uiTabPaths->toolButtonDown->setEnabled(true);
|
||||
uiTabPaths->toolButtonBottom->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ private slots:
|
|||
void PatternPinPointChanged();
|
||||
|
||||
void EditLabel();
|
||||
void SetMoveControls();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSeamAllowance)
|
||||
|
|
|
@ -134,6 +134,91 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="toolButtonTop">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move on top</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-top">
|
||||
<normaloff>../../../../../../app/tape</normaloff>../../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="toolButtonUp">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-up">
|
||||
<normaloff>../../../../../../app/tape</normaloff>../../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="toolButtonDown">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move down</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down">
|
||||
<normaloff>../../../../../../app/tape</normaloff>../../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="toolButtonBottom">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Move on bottom</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-bottom">
|
||||
<normaloff>../../../../../../app/tape</normaloff>../../../../../../app/tape</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5000</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="helpLabel">
|
||||
<property name="text">
|
||||
|
@ -947,11 +1032,7 @@
|
|||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidgetInternalPaths">
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="listWidgetInternalPaths"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -19,11 +19,7 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidgetPins">
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="listWidgetPins"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -15,11 +15,7 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidgetPlaceLabels">
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="listWidgetPlaceLabels"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue
Block a user