Files
GUI/src/mainwindow.cpp

77 lines
3.8 KiB
C++
Raw Normal View History

2021-10-09 16:38:34 +08:00
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <qtabwidget.h>
#include <QSizePolicy>
#include <QHBoxLayout>
#include "tabformwidget.h"
#include "SelectFormWidget.h"
#include "ScanFormWidget.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
const QString style = "*{background-color:#3c3c3c; font-family:Microsoft YaHei; color:white;margin:0;font-size:16px;}"
"QTabBar::tab {\n"
"height:60px;"
"width:300px;"
"font-size: 25px;"
"background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\"\n"
"stop: 0 #333333, stop: 1.0 #555555);"
"border: 2px solid #505050;\n"
// "border-bottom-color: #323232; /* same as the pane color */\n"
"border-bottom-left-radius: 50%;\n"
"border-bottom-right-radius: 50%;\n"
"min-width: 8ex;\n"
"padding: 2px;\n"
"}"
"QTabBar::tab:selected, QTabBar::tab:hover {"
"border-top:5px solid #4a88c7;\n"
"background: #505050;}"
"QTabWidget::pane{margin:0}"
"QLineEdit{min-height:36px;max-height:36px; border:1px solid silver}"
"QTextEdit{border:1px solid silver}"
"QComboBox{text-align:center;min-height:36px;max-height:36px; border:1px solid silver}"
"QComboBox::drop-down{width:20px}"
"QComboBox QAbstractItemView{min-width:120px;}"
"QComboBox QAbstractItemView::item {min-height:60px;max-height:60px; border:1px solid white;}"
"QScrollBar:vertical {min-width: 50px;}"
"QLabel{color:white; font-weight:bold; font-size:16px;}\n"
"QWidget#topbarWidget{min-height:36px;max-height:36px;}\n"
"QWidget#contentWidget{border-top:1px solid #515151;}\n"
"QWidget#commandWidget{min-height:123px;max-height:123px;border-top:1px solid #323232; border-bottom:1px solid #323232;}\n"
"QLabel#logo{min-width:30px;max-width:30px}\n"
"QLabel#company{min-width:150px;max-width:150px}\n"
"QWidget QWidget#statusBarWidget{min-width:300px;max-width:300px}\n"
"QWidget QToolButton{border:none;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;}\n"
"QWidget QToolButton:hover{background:#505050;}\n"
"QWidget QToolButton:checked{border:5px solid darkorange;padding:0px;}"
"QWidget#editcmdWidget{min-height:83px;max-height:83px;}"
"QWidget#verSpaceLine{ border-right:1px solid #0078d8;}";
this->setStyleSheet(style);
ui->setupUi(this);
QTabWidget *tab = new QTabWidget(this);
tab->setTabPosition(QTabWidget::South);
tab->setContentsMargins(0,0,0,0);
// tab->layout()->setMargin(0);
SelectFormWidget* select_form= new SelectFormWidget(this);
tab->addTab(select_form, "Select");
ScanFormWidget* scan_form= new ScanFormWidget(this);
tab->addTab(scan_form, "Scan");
TabFormWidget* verify_form= new TabFormWidget(this);
tab->addTab(verify_form, "Verify");
tab->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
QHBoxLayout * layout = new QHBoxLayout();
layout->setMargin(0);
layout->addWidget(tab);
ui->centralWidget->setLayout(layout);
this->setWindowFlags (Qt::Window);
this->showFullScreen ();
}
MainWindow::~MainWindow()
{
delete ui;
}