Merged in vorzelmir/valentina (pull request #14)
make details hidden or visible depend on its layout status --HG-- branch : develop
This commit is contained in:
commit
4df7c1dc93
|
@ -28,10 +28,12 @@
|
||||||
|
|
||||||
#include "vwidgetdetails.h"
|
#include "vwidgetdetails.h"
|
||||||
#include "ui_vwidgetdetails.h"
|
#include "ui_vwidgetdetails.h"
|
||||||
|
#include "vwidgetdetails.h"
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vtools/undocommands/togglepiecestate.h"
|
#include "../vtools/undocommands/togglepiecestate.h"
|
||||||
|
#include "../vtools/tools/vtoolseamallowance.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
@ -45,6 +47,8 @@ VWidgetDetails::VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->checkBoxHideNotInLayout->setChecked(false);
|
||||||
|
|
||||||
FillTable(m_data->DataPieces());
|
FillTable(m_data->DataPieces());
|
||||||
|
|
||||||
ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
@ -201,6 +205,8 @@ void VWidgetDetails::ToggleSectionDetails(bool select)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
|
@ -279,3 +285,41 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
qApp->getUndoStack()->endMacro();
|
qApp->getUndoStack()->endMacro();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* enable "in layout" details visible or "not in layout" hidden
|
||||||
|
*/
|
||||||
|
void VWidgetDetails::on_checkBoxHideNotInLayout_stateChanged()
|
||||||
|
{
|
||||||
|
//all details that were created and now they are in DocWidget
|
||||||
|
const QHash<quint32, VPiece> *allDetails = m_data->DataPieces();
|
||||||
|
//enable slot if shedule of details is not empty
|
||||||
|
if (not allDetails->isEmpty())
|
||||||
|
{//search the checked in layout items and make its visible or are not in layout make hidden once
|
||||||
|
for (int i = 0; i < ui->tableWidget->rowCount(); ++i)
|
||||||
|
{
|
||||||
|
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
|
||||||
|
const quint32 id = item->data(Qt::UserRole).toUInt();
|
||||||
|
if (item != nullptr)
|
||||||
|
{
|
||||||
|
VToolSeamAllowance *tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(id));
|
||||||
|
if (tool != nullptr)
|
||||||
|
{
|
||||||
|
if (ui->checkBoxHideNotInLayout->isChecked())
|
||||||
|
{
|
||||||
|
(allDetails->value(id).IsInLayout())? tool->setVisible(true)
|
||||||
|
: tool->setVisible(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tool->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
class VAbstractPattern;
|
class VAbstractPattern;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
class VPiece;
|
class VPiece;
|
||||||
|
class VWidgetGroups;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -60,6 +61,8 @@ private slots:
|
||||||
void InLayoutStateChanged(int row, int column);
|
void InLayoutStateChanged(int row, int column);
|
||||||
void ShowContextMenu(const QPoint &pos);
|
void ShowContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
|
void on_checkBoxHideNotInLayout_stateChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VWidgetDetails)
|
Q_DISABLE_COPY(VWidgetDetails)
|
||||||
Ui::VWidgetDetails *ui;
|
Ui::VWidgetDetails *ui;
|
||||||
|
|
|
@ -14,6 +14,19 @@
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxHideNotInLayout">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string extracomment="hide details that are not in layout"/>
|
||||||
|
</property>
|
||||||
|
<property name="toolTipDuration">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hide not in layout</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableWidget" name="tableWidget">
|
<widget class="QTableWidget" name="tableWidget">
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user