Add TopBarWidget
This commit is contained in:
60
src/TopBarWidget.cpp
Normal file
60
src/TopBarWidget.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// Created by Krad on 2021/12/16.
|
||||
//
|
||||
|
||||
#include "TopBarWidget.h"
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <src/components/RollingMessageWidget.h>
|
||||
#include <QDateTime>
|
||||
|
||||
TopBarWidget::TopBarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) {
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
QLabel * logo = new QLabel(this);
|
||||
logo->setObjectName("logo");
|
||||
layout->addWidget(logo);
|
||||
QLabel * company = new QLabel(this);
|
||||
company->setObjectName("company");
|
||||
layout->addWidget(company);
|
||||
QLabel * lbl_msglogo = new QLabel(this);
|
||||
lbl_msglogo->setObjectName("lbl_msglogo");
|
||||
layout->addWidget(lbl_msglogo);
|
||||
QWidget* statusBarWidget = new QWidget(this);
|
||||
layout->addWidget(statusBarWidget);
|
||||
QLabel* hosp = new QLabel(this);
|
||||
hosp->setText(tr("浙江大学医学院附属第二医院"));
|
||||
QLabel* nowDate = new QLabel(this);
|
||||
nowDate->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
QLabel* linkIcon = new QLabel(this);
|
||||
linkIcon->setPixmap(QPixmap(":/icons/link_g.png").scaledToHeight(22, Qt::SmoothTransformation));
|
||||
QLabel* readyIcon = new QLabel(this);
|
||||
readyIcon->setPixmap(QPixmap(":/icons/ready.png").scaledToHeight(22, Qt::SmoothTransformation));
|
||||
QLabel* lockIcon = new QLabel(this);
|
||||
lockIcon->setText("");
|
||||
// lockIcon->setPixmap(QPixmap(":/icons/lock.png").scaledToHeight(22,Qt::SmoothTransformation));
|
||||
QHBoxLayout* status_layout = new QHBoxLayout(statusBarWidget);
|
||||
status_layout->setMargin(0);
|
||||
status_layout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding));
|
||||
status_layout->addWidget(hosp);
|
||||
status_layout->addWidget(nowDate);
|
||||
QWidget* spacerLine = new QWidget(this);
|
||||
spacerLine->setFixedWidth(2);
|
||||
spacerLine->setObjectName("spacer_2");
|
||||
|
||||
layout->addWidget(spacerLine);
|
||||
layout->addWidget(linkIcon);
|
||||
layout->addWidget(readyIcon);
|
||||
layout->addWidget(lockIcon);
|
||||
QWidget* widgetMsg = new QWidget(this);
|
||||
layout->addWidget(widgetMsg);
|
||||
QVBoxLayout* l = new QVBoxLayout(widgetMsg);
|
||||
widgetMsg->setObjectName("need_border");
|
||||
l->setMargin(0);
|
||||
auto w = new RollingMessageWidget(this);
|
||||
QStringList msgs;
|
||||
msgs<<"message 1!"<<"message 2!"<<"message 3!"<<"message 4!"<<"message 5!";
|
||||
QList<bool> visibleValues = {true,true,true,true,true};
|
||||
w->setMessageList(msgs, visibleValues);
|
||||
w->setObjectName("need_border");
|
||||
l->addWidget(w);
|
||||
}
|
||||
16
src/TopBarWidget.h
Normal file
16
src/TopBarWidget.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Krad on 2021/12/16.
|
||||
//
|
||||
|
||||
#ifndef GUI_TOPBARWIDGET_H
|
||||
#define GUI_TOPBARWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
class TopBarWidget :public QWidget{
|
||||
public :
|
||||
explicit TopBarWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //GUI_TOPBARWIDGET_H
|
||||
Reference in New Issue
Block a user