From ef1fff7a22e0407925fd3af2ee0c3a5446f8bfd9 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Fri, 13 Nov 2015 12:31:10 +0200 Subject: [PATCH] Resolved Issue #329. Add button to 'Scroll Up/Scroll Down' in Detail mode --HG-- branch : feature --- .../vtools/dialogs/tools/dialogdetail.cpp | 29 +++++++ src/libs/vtools/dialogs/tools/dialogdetail.h | 2 + src/libs/vtools/dialogs/tools/dialogdetail.ui | 75 ++++++++++++++++--- 3 files changed, 97 insertions(+), 9 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index cbf4d159c..4b774e535 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -78,6 +78,8 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged); connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem); + connect(ui.toolButtonUp, &QToolButton::clicked, this, &DialogDetail::ScrollUp); + connect(ui.toolButtonDown, &QToolButton::clicked, this, &DialogDetail::ScrollDown); } //--------------------------------------------------------------------------------------------------------------------- @@ -170,6 +172,8 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t qDebug()<<"Got wrong tools. Ignore."; return; } + ui.toolButtonUp->setEnabled(ui.checkBoxSeams->isChecked() && not ui.checkBoxClosed->isChecked()); + ui.toolButtonDown->setEnabled(ui.checkBoxSeams->isChecked() && not ui.checkBoxClosed->isChecked()); bool canAddNewPoint = false; @@ -338,6 +342,9 @@ void DialogDetail::ClickedSeams(bool checked) ui.checkBoxClosed->setEnabled(checked); ui.doubleSpinBoxSeams->setEnabled(checked); + ui.toolButtonUp->setEnabled(checked && not ui.checkBoxClosed->isChecked()); + ui.toolButtonDown->setEnabled(checked && not ui.checkBoxClosed->isChecked()); + if (checked && ui.doubleSpinBoxSeams->value() <= 0) { flagWidth = false; @@ -359,6 +366,8 @@ void DialogDetail::ClickedSeams(bool checked) void DialogDetail::ClickedClosed(bool checked) { closed = checked; + ui.toolButtonUp->setEnabled(not checked); + ui.toolButtonDown->setEnabled(not checked); } //--------------------------------------------------------------------------------------------------------------------- @@ -415,6 +424,26 @@ void DialogDetail::DeleteItem() ValidObjects(DetailIsValid()); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogDetail::ScrollUp() +{ + if (ui.listWidget->count() > 1) + { + QListWidgetItem *item = ui.listWidget->takeItem(ui.listWidget->count()-1); + ui.listWidget->insertItem(0, item); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogDetail::ScrollDown() +{ + if (ui.listWidget->count() > 1) + { + QListWidgetItem *item = ui.listWidget->takeItem(0); + ui.listWidget->addItem(item); + } +} + //--------------------------------------------------------------------------------------------------------------------- bool DialogDetail::DetailIsValid() const { diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.h b/src/libs/vtools/dialogs/tools/dialogdetail.h index dac43f320..9a8ec4314 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.h +++ b/src/libs/vtools/dialogs/tools/dialogdetail.h @@ -54,6 +54,8 @@ public slots: void ClickedReverse(bool checked); void ObjectChanged(int row); void DeleteItem(); + void ScrollUp(); + void ScrollDown(); protected: /** * @brief SaveData Put dialog data in local variables diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.ui b/src/libs/vtools/dialogs/tools/dialogdetail.ui index 808fcc799..e21c0bdf6 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.ui +++ b/src/libs/vtools/dialogs/tools/dialogdetail.ui @@ -6,8 +6,8 @@ 0 0 - 565 - 382 + 522 + 368 @@ -313,14 +313,72 @@ - - - false + + + QLayout::SetFixedSize - - Delete + + 10 - + + 10 + + + 10 + + + 10 + + + + + false + + + Delete + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Scroll down + + + ... + + + + + + + + + + Scroll up + + + ... + + + + + + + @@ -352,7 +410,6 @@ checkBoxSeams doubleSpinBoxSeams checkBoxClosed - toolButtonDelete buttonBox