AdminSettingForm , a frame layout form for Admin setting

This commit is contained in:
Krad
2021-11-23 09:21:07 +08:00
parent 516f3659a5
commit 5c4e3453dd
2 changed files with 78 additions and 0 deletions

60
src/AdminSettingForm.cpp Normal file
View File

@@ -0,0 +1,60 @@
//
// Created by Krad on 2021/11/22.
//
#include "AdminSettingForm.h"
#include <QHBoxLayout>
#include <QStackedWidget>
#include <QStringListModel>
#include <QListWidget>
#include "tabformwidget.h"
#include <QListWidgetItem>
#include "ui_tabformwidget.h"
#include <QLabel>
AdminSettingForm::AdminSettingForm(QWidget *parent, Qt::WindowFlags f) : TabFormWidget(parent) {
QHBoxLayout* layout = new QHBoxLayout(this);
this->ui->contentWidget->setLayout(layout);
QListWidget* widget = new QListWidget(this);
widget->setFixedWidth(250);
QStringList menus;
menus<<tr("Account Manage")<<tr("System Setting")<<"System Information"<<tr("About");
widget->addItems(menus);
widget->setSpacing(3);
for (int i = 0; i < menus.count(); ++i) {
widget->item(i)->setTextAlignment(Qt::AlignCenter);
}
layout->addWidget(widget);
QStackedWidget* stackedWidget = new QStackedWidget(this);
QWidget* spacerLine2= new QWidget(this);
spacerLine2->setFixedWidth(2);
spacerLine2->setObjectName("verSpaceLine");
layout->addWidget(spacerLine2);
layout->addWidget(stackedWidget);
this->ui->commandWidget->hide();
QLabel* acc = new QLabel(this);
acc->setText("Account Manage");
stackedWidget->addWidget(acc);
QLabel* systemSetting = new QLabel(this);
systemSetting->setText("systemSetting");
stackedWidget->addWidget(systemSetting);
QLabel* Info = new QLabel(this);
Info->setText("info");
stackedWidget->addWidget(Info);
QLabel* about = new QLabel(this);
about->setText("About");
stackedWidget->addWidget(about);
widget->setCurrentRow(0);
connect(widget,&QListWidget::currentRowChanged,[=](int rowindex){
stackedWidget->setCurrentIndex(rowindex);
});
}
AdminSettingForm::~AdminSettingForm() {
}

18
src/AdminSettingForm.h Normal file
View File

@@ -0,0 +1,18 @@
//
// Created by Krad on 2021/11/22.
//
#ifndef GUI_ADMINSETTINGFORM_H
#define GUI_ADMINSETTINGFORM_H
#include "TabFormWidget.h"
class AdminSettingForm:public TabFormWidget {
Q_OBJECT
public:
explicit AdminSettingForm(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~AdminSettingForm() ;
};
#endif //GUI_ADMINSETTINGFORM_H