Resolved Issue #329. Add button to 'Scroll Up/Scroll Down' in Detail mode

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2015-11-13 12:31:10 +02:00
parent 148f9cab44
commit ef1fff7a22
3 changed files with 97 additions and 9 deletions

View File

@ -78,6 +78,8 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged); connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged);
connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem); 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."; qDebug()<<"Got wrong tools. Ignore.";
return; return;
} }
ui.toolButtonUp->setEnabled(ui.checkBoxSeams->isChecked() && not ui.checkBoxClosed->isChecked());
ui.toolButtonDown->setEnabled(ui.checkBoxSeams->isChecked() && not ui.checkBoxClosed->isChecked());
bool canAddNewPoint = false; bool canAddNewPoint = false;
@ -338,6 +342,9 @@ void DialogDetail::ClickedSeams(bool checked)
ui.checkBoxClosed->setEnabled(checked); ui.checkBoxClosed->setEnabled(checked);
ui.doubleSpinBoxSeams->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) if (checked && ui.doubleSpinBoxSeams->value() <= 0)
{ {
flagWidth = false; flagWidth = false;
@ -359,6 +366,8 @@ void DialogDetail::ClickedSeams(bool checked)
void DialogDetail::ClickedClosed(bool checked) void DialogDetail::ClickedClosed(bool checked)
{ {
closed = checked; closed = checked;
ui.toolButtonUp->setEnabled(not checked);
ui.toolButtonDown->setEnabled(not checked);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -415,6 +424,26 @@ void DialogDetail::DeleteItem()
ValidObjects(DetailIsValid()); 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 bool DialogDetail::DetailIsValid() const
{ {

View File

@ -54,6 +54,8 @@ public slots:
void ClickedReverse(bool checked); void ClickedReverse(bool checked);
void ObjectChanged(int row); void ObjectChanged(int row);
void DeleteItem(); void DeleteItem();
void ScrollUp();
void ScrollDown();
protected: protected:
/** /**
* @brief SaveData Put dialog data in local variables * @brief SaveData Put dialog data in local variables

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>565</width> <width>522</width>
<height>382</height> <height>368</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -312,6 +312,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item> <item>
<widget class="QToolButton" name="toolButtonDelete"> <widget class="QToolButton" name="toolButtonDelete">
<property name="enabled"> <property name="enabled">
@ -322,6 +339,47 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonDown">
<property name="toolTip">
<string>Scroll down</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonUp">
<property name="toolTip">
<string>Scroll up</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-up"/>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -352,7 +410,6 @@
<tabstop>checkBoxSeams</tabstop> <tabstop>checkBoxSeams</tabstop>
<tabstop>doubleSpinBoxSeams</tabstop> <tabstop>doubleSpinBoxSeams</tabstop>
<tabstop>checkBoxClosed</tabstop> <tabstop>checkBoxClosed</tabstop>
<tabstop>toolButtonDelete</tabstop>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
</tabstops> </tabstops>
<resources> <resources>