mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Доделал списки подпроцедур
This commit is contained in:
@@ -34,17 +34,20 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
treeWidget->setObjectName("treeWidget_AMMforTrainee");
|
||||
ui->horizontalLayout_Tree->addWidget(treeWidget);
|
||||
|
||||
//connect(treeWidget, &QTreeWidget::currentItemChanged, this, &AMMtasksWidget::on_treeWidgetItemClicked);
|
||||
connect(treeWidget, &QTreeWidget::itemClicked, this, &AMMtasksWidget::on_treeWidgetItemClicked);
|
||||
connect(treeWidget, &QTreeWidget::itemDoubleClicked, this, &AMMtasksWidget::on_treeWidgetDoubleClicked);
|
||||
|
||||
preparationTreeWidget();
|
||||
|
||||
threadPreparation = new QThread();
|
||||
taskTreePreparation = new TaskAMMFIMTreePreparation(type, treeWidget);
|
||||
//taskTreePreparation->moveToThread(threadPreparation);
|
||||
threadPreparation->start();
|
||||
threadPreparation->setPriority(QThread::HighestPriority);
|
||||
if(type == TypeListTreeAMMFIM::listCommon)
|
||||
{
|
||||
threadPreparation = new QThread();
|
||||
taskTreePreparation->moveToThread(threadPreparation);
|
||||
threadPreparation->start();
|
||||
threadPreparation->setPriority(QThread::HighestPriority);
|
||||
}
|
||||
|
||||
connect(this, &AMMtasksWidget::signal_prepareAMMListItems, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_prepareAMMListItems);
|
||||
connect(this, &AMMtasksWidget::signal_prepareAMMListItemsForTrainee, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee);
|
||||
connect(taskTreePreparation, &TaskAMMFIMTreePreparation::signal_listAMMItemsReady, this, &AMMtasksWidget::slot_AMMlistItemsReady);
|
||||
@@ -89,10 +92,14 @@ AMMtasksWidget::~AMMtasksWidget()
|
||||
waitAnimationWidget->hideWithStop();
|
||||
emit signal_stopParserPreparation();
|
||||
|
||||
threadPreparation->quit();
|
||||
threadPreparation->wait();
|
||||
|
||||
delete threadPreparation;
|
||||
if(type == TypeListTreeAMMFIM::listCommon)
|
||||
{
|
||||
threadPreparation->quit();
|
||||
threadPreparation->wait();
|
||||
|
||||
delete threadPreparation;
|
||||
}
|
||||
|
||||
delete taskTreePreparation;
|
||||
delete waitAnimationWidget;
|
||||
@@ -266,7 +273,6 @@ void AMMtasksWidget::loadTasksAMM(bool flRequestFirst)
|
||||
|
||||
QByteArray arrayAMM;
|
||||
|
||||
//if(flRequestFirst)
|
||||
arrayAMM = connectorToServer->getListTaskAmmArray();
|
||||
|
||||
emit signal_prepareAMMListItems(arrayAMM, flOnlyActive, flRequestFirst);
|
||||
|
||||
@@ -104,10 +104,6 @@ private:
|
||||
int lastCurrentID;
|
||||
|
||||
TaskAmmFim lastSelectedTask;
|
||||
|
||||
CustomDelegate* delegate;
|
||||
|
||||
QStyle* style;
|
||||
};
|
||||
|
||||
#endif // AMMTASKSWIDGET_H
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#include "customdelegate.h"
|
||||
|
||||
CustomDelegate::CustomDelegate(QObject *parent):
|
||||
QItemDelegate(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CustomDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
bool mergeCell = index.data(UserRole_MergeCell).toBool();
|
||||
|
||||
if (mergeCell && index.column() == 0)
|
||||
{
|
||||
QModelIndex nextColumnIndex = index.siblingAtColumn(index.column() + 1);
|
||||
if (!nextColumnIndex.isValid())
|
||||
{
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
return;
|
||||
}
|
||||
|
||||
QRect mergedRect(option.rect.x(),
|
||||
option.rect.y(),
|
||||
option.rect.width() * 2,
|
||||
option.rect.height());
|
||||
|
||||
painter->save();
|
||||
painter->setClipRect(mergedRect);
|
||||
drawBackground(painter, option, index);
|
||||
drawDisplay(painter, option, mergedRect, index.data(Qt::DisplayRole).toString());
|
||||
|
||||
painter->restore();
|
||||
} else {
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
}
|
||||
|
||||
QSize CustomDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
return QItemDelegate::sizeHint(option, index);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef CUSTOMDELEGATE_H
|
||||
#define CUSTOMDELEGATE_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QPainter>
|
||||
#include <QStyle>
|
||||
#include <QItemDelegate>
|
||||
|
||||
enum UserRoles {
|
||||
UserRole_MergeCell = Qt::UserRole + 1 // Пользовательская роль для хранения признака объединения
|
||||
};
|
||||
|
||||
class CustomDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
//using QStyledItemDelegate::QStyledItemDelegate;
|
||||
|
||||
CustomDelegate(QObject *parent = nullptr);
|
||||
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
};
|
||||
|
||||
#endif // CUSTOMDELEGATE_H
|
||||
@@ -499,12 +499,8 @@ void TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee(QList<TaskAmm
|
||||
|
||||
item = new QTreeWidgetItem(treeWidget);
|
||||
|
||||
//item->setData(0, UserRole_MergeCell, false);
|
||||
|
||||
treeWidget->addTopLevelItem(item);
|
||||
|
||||
//treeWidget->setFirstItemColumnSpanned(item, true);
|
||||
|
||||
item->setIcon(0, QIcon(":/resources/icons/procedure.png"));
|
||||
|
||||
item->setText(ColumnsTreeAMM::clmnAMM_PMorDM, text);
|
||||
@@ -545,13 +541,12 @@ void TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee(QList<TaskAmm
|
||||
|
||||
SubProcItemWidget* itemWidget = new SubProcItemWidget();
|
||||
itemWidget->setListSubProc(task.listSubProc);
|
||||
//itemWidget->setAutoFillBackground(true);
|
||||
|
||||
//itemSubProc->setData(0, UserRole_MergeCell, true);
|
||||
itemWidget->setAutoFillBackground(true);
|
||||
|
||||
item->addChild(itemSubProc);
|
||||
treeWidget->setItemWidget(itemSubProc, 0, itemWidget);
|
||||
|
||||
//Объединение всех ячеек
|
||||
itemSubProc->setFirstColumnSpanned(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user