Additional controls for Label template editor. ref #824.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-09 10:20:38 +03:00
parent 64029c249a
commit 0281b5508c
3 changed files with 123 additions and 5 deletions

View File

@ -36,6 +36,7 @@
#include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/vpiece.h"
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../tools/dialogtool.h"
#include <QDir>
#include <QMessageBox>
@ -70,6 +71,12 @@ DialogEditLabel::DialogEditLabel(VAbstractPattern *doc, QWidget *parent)
connect(ui->toolButtonImportLabel, &QToolButton::clicked, this, &DialogEditLabel::ImportTemplate);
connect(ui->spinBoxFontSize, QOverload<int>::of(&QSpinBox::valueChanged), this,
&DialogEditLabel::SaveAdditionalFontSize);
connect(ui->toolButtonTop, &QToolButton::clicked, this, [this](){DialogTool::MoveListRowTop(ui->listWidgetEdit);});
connect(ui->toolButtonUp, &QToolButton::clicked, this, [this](){DialogTool::MoveListRowUp(ui->listWidgetEdit);});
connect(ui->toolButtonDown, &QToolButton::clicked, this,
[this](){DialogTool::MoveListRowDown(ui->listWidgetEdit);});
connect(ui->toolButtonBottom, &QToolButton::clicked, this,
[this](){DialogTool::MoveListRowBottom(ui->listWidgetEdit);});
InitPlaceholders();
InitPlaceholdersMenu();
@ -433,6 +440,32 @@ void DialogEditLabel::SetupControls()
ui->toolButtonExportLabel->setEnabled(enabled);
ui->lineEditLine->setEnabled(enabled);
ui->spinBoxFontSize->setEnabled(enabled);
ui->toolButtonTop->setEnabled(false);
ui->toolButtonUp->setEnabled(false);
ui->toolButtonDown->setEnabled(false);
ui->toolButtonBottom->setEnabled(false);
if (ui->listWidgetEdit->count() >= 2)
{
if (ui->listWidgetEdit->currentRow() == 0)
{
ui->toolButtonDown->setEnabled(true);
ui->toolButtonBottom->setEnabled(true);
}
else if (ui->listWidgetEdit->currentRow() == ui->listWidgetEdit->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);
}
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -130,6 +130,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>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="1">

View File

@ -91,6 +91,11 @@ public:
void SetToolId(const quint32 &value);
QString getPointName() const;
static void MoveListRowTop(QListWidget *list);
static void MoveListRowUp(QListWidget *list);
static void MoveListRowDown(QListWidget *list);
static void MoveListRowBottom(QListWidget *list);
signals:
/**
* @brief DialogClosed signal dialog closed
@ -282,11 +287,6 @@ 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;