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:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.11.1, 2024-11-27T17:52:53. -->
|
||||
<!-- Written by QtCreator 4.11.1, 2024-11-29T16:40:15. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "commonview.h"
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
CommonView::CommonView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent):
|
||||
@@ -13,11 +15,35 @@ CommonView::CommonView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *pare
|
||||
{
|
||||
treeWidget = new QTreeWidget();
|
||||
|
||||
//QString name = treeWidget->objectName();
|
||||
//treeWidget->setObjectName("onlyView");
|
||||
//treeWidget->setAccessibleName("onlyView");
|
||||
|
||||
//treeWidget->header()->setStyleSheet(QStringLiteral("font-size: 10pt;"));
|
||||
treeWidget->setStyleSheet(QStringLiteral("font-size: 10pt;"
|
||||
"font-family: Tahoma;"));
|
||||
//treeWidget->setStyleSheet(QStringLiteral("font-size: 10pt;"
|
||||
// "font-family: Tahoma;"));
|
||||
|
||||
treeWidget->setIconSize(QSize(20, 20));
|
||||
treeWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
|
||||
/*
|
||||
treeWidget->setStyleSheet("QTreeWidget {font-size: 10pt; font-family: Tahoma;}"
|
||||
"QTreeWidget::item:selected {"
|
||||
"background-color: #ddffdd; "
|
||||
"border-style: solid solid solid solid; "
|
||||
"color: #000000;}"
|
||||
"QTreeWidgetItem::item:selected {"
|
||||
"background-color: #ddaadd; "
|
||||
"border-style: solid solid solid solid; "
|
||||
"color: #000000;}");
|
||||
|
||||
treeWidget->setStyleSheet("QTreeWidget {font-size: 10pt; font-family: Tahoma;}"
|
||||
"QTreeWidget::item:selected {"
|
||||
"background-color: #ddffdd; "
|
||||
"border-style: solid solid solid solid; "
|
||||
"color: #000000;}");*/
|
||||
|
||||
updateMyStyleSheet();
|
||||
}
|
||||
|
||||
void CommonView::setItemColorArchive(QTreeWidgetItem *item)
|
||||
@@ -37,3 +63,32 @@ void CommonView::setItemColor(QTreeWidgetItem *item, QColor color)
|
||||
for (int i = 0; i < item->columnCount(); i++)
|
||||
item->setBackground(i, color);
|
||||
}
|
||||
|
||||
void CommonView::updateMyStyleSheet()
|
||||
{
|
||||
QString styleSheet = loadStyleSheet();
|
||||
styleSheet = styleSheet.replace("\n", "");
|
||||
treeWidget->setStyleSheet(styleSheet);
|
||||
|
||||
QString style = treeWidget->styleSheet();
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
QString CommonView::loadStyleSheet()
|
||||
{
|
||||
QString fileName = "./styleSheetTreeWidget.css";
|
||||
QFile styleSheetTreeWidgetFile(fileName);
|
||||
if (!styleSheetTreeWidgetFile.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Attention!"), tr("The file could not be opened ") + fileName);
|
||||
return QStringLiteral("");
|
||||
}
|
||||
else
|
||||
{
|
||||
QByteArray byteArray = styleSheetTreeWidgetFile.readAll();
|
||||
styleSheetTreeWidgetFile.close();
|
||||
|
||||
QString style = byteArray;
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ protected:
|
||||
|
||||
void setItemColor(QTreeWidgetItem* item, QColor color);
|
||||
|
||||
public:
|
||||
void updateMyStyleSheet();
|
||||
|
||||
private:
|
||||
QString loadStyleSheet();
|
||||
|
||||
protected:
|
||||
InterfaceDataBaseLMS* dbLMS;
|
||||
QTreeWidget* treeWidget;
|
||||
|
||||
@@ -68,7 +68,7 @@ void InstructorsView::preparationTreeWidget(/*QTreeWidget* tree*/)
|
||||
else
|
||||
archiveVisible = false;
|
||||
|
||||
notLoggedInVisible = true;
|
||||
notLoggedInVisible = true;
|
||||
}
|
||||
else
|
||||
{//control
|
||||
|
||||
@@ -11,6 +11,8 @@ ViewerInstructors::ViewerInstructors(InterfaceDataBaseLMS* db, QWidget *parent)
|
||||
|
||||
ui->horizontalLayout_1->addWidget(treeWidget);
|
||||
|
||||
treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
|
||||
preparationTreeWidget(/*ui->treeWidget*/);
|
||||
setNotLoggedInVisible(true);
|
||||
}
|
||||
|
||||
@@ -430,3 +430,9 @@ void InstructorsAndTraineesWidget::on_btnDocTasks_clicked()
|
||||
dialog->setMinimumSize(1200, 800);
|
||||
dialog->exec();
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_toolButton_clicked()
|
||||
{
|
||||
viewerTrainees->updateMyStyleSheet();
|
||||
viewerInstructors->updateMyStyleSheet();
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ private Q_SLOTS:
|
||||
|
||||
void on_btnDocTasks_clicked();
|
||||
|
||||
void on_toolButton_clicked();
|
||||
|
||||
private:
|
||||
void updateLabelLoggedInInstructor();
|
||||
|
||||
|
||||
@@ -223,6 +223,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>58</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update StyleSheet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -117,6 +117,7 @@ void TraineesView::loadTraineesFromDB()
|
||||
for(Group group : listGroups)
|
||||
{
|
||||
//Группа
|
||||
int cntChildsNotArchived = 0;
|
||||
QTreeWidgetItem *ItemGroup = new QTreeWidgetItem(treeWidget);
|
||||
ItemGroup->setText(ColumnsTreeTrainees::clmn_ID, QString::number(group.getID()));
|
||||
ItemGroup->setText(ColumnsTreeTrainees::clmn_Trainee, group.getName());
|
||||
@@ -155,6 +156,7 @@ void TraineesView::loadTraineesFromDB()
|
||||
ItemTrainee->setText(ColumnsTreeTrainees::clmn_Archived, tr("no"));
|
||||
ItemTrainee->setIcon(ColumnsTreeTrainees::clmn_Trainee, QIcon(QStringLiteral(":/icons/trainee.png")));
|
||||
setItemColorNoArchive(ItemTrainee);
|
||||
cntChildsNotArchived++;
|
||||
}
|
||||
|
||||
if(trainee.getLoggedIn())
|
||||
@@ -187,6 +189,9 @@ void TraineesView::loadTraineesFromDB()
|
||||
if(! notLoggedInVisible)
|
||||
ItemTrainee->setHidden(true);
|
||||
}
|
||||
|
||||
if(! archiveVisible && cntChildsNotArchived == 0)
|
||||
delete ItemGroup;
|
||||
}
|
||||
|
||||
treeWidget->expandAll();
|
||||
|
||||
Reference in New Issue
Block a user