Merged in ValentinaZhuravska/valentina/feature (pull request #75)

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

--HG--
branch : develop
This commit is contained in:
Roman Telezhinskyi 2015-11-13 15:27:23 +02:00
commit 4ca6e23870
3 changed files with 105 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.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem);
connect(ui.toolButtonUp, &QToolButton::clicked, this, &DialogDetail::ScrollUp);
connect(ui.toolButtonDown, &QToolButton::clicked, this, &DialogDetail::ScrollDown);
}
//---------------------------------------------------------------------------------------------------------------------
@ -176,6 +178,8 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
if(ui.listWidget->count() == 0)
{
canAddNewPoint = true;
ui.toolButtonUp->setEnabled(false);
ui.toolButtonDown->setEnabled(false);
}
else
{
@ -184,6 +188,8 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
{
canAddNewPoint = true;
}
ui.toolButtonUp->setEnabled(true);
ui.toolButtonDown->setEnabled(true);
}
if(canAddNewPoint)
@ -413,6 +419,37 @@ void DialogDetail::DeleteItem()
delete ui.listWidget->item(ui.listWidget->currentRow());
ValidObjects(DetailIsValid());
if(ui.listWidget->count() < 2)
{
ui.toolButtonUp->setEnabled(false);
ui.toolButtonDown->setEnabled(false);
}
else
{
ui.toolButtonUp->setEnabled(true);
ui.toolButtonDown->setEnabled(true);
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ScrollUp()
{
if (ui.listWidget->count() > 1)
{
QListWidgetItem *item = ui.listWidget->takeItem(0);
ui.listWidget->addItem(item);
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ScrollDown()
{
if (ui.listWidget->count() > 1)
{
QListWidgetItem *item = ui.listWidget->takeItem(ui.listWidget->count()-1);
ui.listWidget->insertItem(0, item);
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -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

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>565</width>
<height>382</height>
<width>522</width>
<height>368</height>
</rect>
</property>
<property name="windowTitle">
@ -313,14 +313,72 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonDelete">
<property name="enabled">
<bool>false</bool>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="text">
<string>Delete</string>
<property name="leftMargin">
<number>10</number>
</property>
</widget>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QToolButton" name="toolButtonDelete">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</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 the list</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 the list</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-up"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
@ -352,7 +410,6 @@
<tabstop>checkBoxSeams</tabstop>
<tabstop>doubleSpinBoxSeams</tabstop>
<tabstop>checkBoxClosed</tabstop>
<tabstop>toolButtonDelete</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>