Resolved issue #376. Add buttons in Tape.exe to move measurement to top or
bottom of list. --HG-- branch : develop
This commit is contained in:
parent
c2e563a65c
commit
3b4c4e8261
|
@ -731,6 +731,24 @@ void TMainWindow::Remove()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::MoveTop()
|
||||
{
|
||||
const int row = ui->tableWidget->currentRow();
|
||||
|
||||
if (row == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
|
||||
m->MoveTop(nameField->data(Qt::UserRole).toString());
|
||||
MeasurementsWasSaved(false);
|
||||
RefreshData();
|
||||
search->RefreshList(ui->lineEditFind->text());
|
||||
ui->tableWidget->selectRow(0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::MoveUp()
|
||||
{
|
||||
|
@ -767,6 +785,24 @@ void TMainWindow::MoveDown()
|
|||
ui->tableWidget->selectRow(row+1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::MoveBottom()
|
||||
{
|
||||
const int row = ui->tableWidget->currentRow();
|
||||
|
||||
if (row == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName);
|
||||
m->MoveBottom(nameField->data(Qt::UserRole).toString());
|
||||
MeasurementsWasSaved(false);
|
||||
RefreshData();
|
||||
search->RefreshList(ui->lineEditFind->text());
|
||||
ui->tableWidget->selectRow(ui->tableWidget->rowCount()-1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::Fx()
|
||||
{
|
||||
|
@ -1712,8 +1748,10 @@ void TMainWindow::InitWindow()
|
|||
#endif
|
||||
|
||||
connect(ui->toolButtonRemove, &QToolButton::clicked, this, &TMainWindow::Remove);
|
||||
connect(ui->toolButtonTop, &QToolButton::clicked, this, &TMainWindow::MoveTop);
|
||||
connect(ui->toolButtonUp, &QToolButton::clicked, this, &TMainWindow::MoveUp);
|
||||
connect(ui->toolButtonDown, &QToolButton::clicked, this, &TMainWindow::MoveDown);
|
||||
connect(ui->toolButtonBottom, &QToolButton::clicked, this, &TMainWindow::MoveBottom);
|
||||
|
||||
connect(ui->lineEditName, &QLineEdit::editingFinished, this, &TMainWindow::SaveMName);
|
||||
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
|
||||
|
@ -2020,8 +2058,10 @@ void TMainWindow::Controls()
|
|||
if (m->ReadOnly())
|
||||
{
|
||||
ui->toolButtonRemove->setEnabled(false);
|
||||
ui->toolButtonTop->setEnabled(false);
|
||||
ui->toolButtonUp->setEnabled(false);
|
||||
ui->toolButtonDown->setEnabled(false);
|
||||
ui->toolButtonBottom->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2038,24 +2078,32 @@ void TMainWindow::Controls()
|
|||
{
|
||||
if (ui->tableWidget->currentRow() == 0)
|
||||
{
|
||||
ui->toolButtonTop->setEnabled(false);
|
||||
ui->toolButtonUp->setEnabled(false);
|
||||
ui->toolButtonDown->setEnabled(true);
|
||||
ui->toolButtonBottom->setEnabled(true);
|
||||
}
|
||||
else if (ui->tableWidget->currentRow() == ui->tableWidget->rowCount()-1)
|
||||
{
|
||||
ui->toolButtonTop->setEnabled(true);
|
||||
ui->toolButtonUp->setEnabled(true);
|
||||
ui->toolButtonDown->setEnabled(false);
|
||||
ui->toolButtonBottom->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->toolButtonTop->setEnabled(true);
|
||||
ui->toolButtonUp->setEnabled(true);
|
||||
ui->toolButtonDown->setEnabled(true);
|
||||
ui->toolButtonBottom->setEnabled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->toolButtonTop->setEnabled(false);
|
||||
ui->toolButtonUp->setEnabled(false);
|
||||
ui->toolButtonDown->setEnabled(false);
|
||||
ui->toolButtonBottom->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,8 +89,10 @@ private slots:
|
|||
void ReadOnly(bool ro);
|
||||
|
||||
void Remove();
|
||||
void MoveTop();
|
||||
void MoveUp();
|
||||
void MoveDown();
|
||||
void MoveBottom();
|
||||
void Fx();
|
||||
|
||||
void AddCustom();
|
||||
|
|
|
@ -326,6 +326,19 @@
|
|||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonTop">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-top"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="toolButtonUp">
|
||||
<property name="enabled">
|
||||
|
@ -362,6 +375,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonBottom">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-bottom"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
|
|
@ -137,6 +137,25 @@ void VMeasurements::Remove(const QString &name)
|
|||
list.at(0).removeChild(FindM(name));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::MoveTop(const QString &name)
|
||||
{
|
||||
const QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
const QDomNodeList mList = elementsByTagName(TagMeasurement);
|
||||
if (mList.size() >= 2)
|
||||
{
|
||||
const QDomNode top = mList.at(0);
|
||||
if (not top.isNull())
|
||||
{
|
||||
const QDomNodeList list = elementsByTagName(TagBodyMeasurements);
|
||||
list.at(0).insertBefore(node, top);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::MoveUp(const QString &name)
|
||||
{
|
||||
|
@ -167,6 +186,25 @@ void VMeasurements::MoveDown(const QString &name)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::MoveBottom(const QString &name)
|
||||
{
|
||||
const QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
const QDomNodeList mList = elementsByTagName(TagMeasurement);
|
||||
if (mList.size() >= 2)
|
||||
{
|
||||
const QDomNode bottom = mList.at(mList.size()-1);
|
||||
if (not bottom.isNull())
|
||||
{
|
||||
const QDomNodeList list = elementsByTagName(TagBodyMeasurements);
|
||||
list.at(0).insertAfter(node, bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::ReadMeasurements() const
|
||||
{
|
||||
|
|
|
@ -48,8 +48,10 @@ public:
|
|||
void AddEmpty(const QString &name, const QString &formula = QString());
|
||||
void AddEmptyAfter(const QString &after, const QString &name, const QString &formula = QString());
|
||||
void Remove(const QString &name);
|
||||
void MoveTop(const QString &name);
|
||||
void MoveUp(const QString &name);
|
||||
void MoveDown(const QString &name);
|
||||
void MoveBottom(const QString &name);
|
||||
|
||||
void ReadMeasurements() const;
|
||||
|
||||
|
|
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-bottom.png
Executable file
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-bottom.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 804 B |
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-top.png
Executable file
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-top.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 777 B |
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-bottom.png
Executable file
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-bottom.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-top.png
Executable file
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-top.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-bottom.png
Executable file
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-bottom.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-top.png
Executable file
BIN
src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-top.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -71,5 +71,11 @@
|
|||
<file>icons/win.icon.theme/16x16/actions/go-up.png</file>
|
||||
<file>icons/win.icon.theme/24x24/actions/go-up.png</file>
|
||||
<file>icons/win.icon.theme/32x32/actions/go-up.png</file>
|
||||
<file>icons/win.icon.theme/16x16/actions/go-top.png</file>
|
||||
<file>icons/win.icon.theme/24x24/actions/go-top.png</file>
|
||||
<file>icons/win.icon.theme/32x32/actions/go-top.png</file>
|
||||
<file>icons/win.icon.theme/16x16/actions/go-bottom.png</file>
|
||||
<file>icons/win.icon.theme/24x24/actions/go-bottom.png</file>
|
||||
<file>icons/win.icon.theme/32x32/actions/go-bottom.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in New Issue
Block a user