实现主页面基本控件的
This commit is contained in:
parent
2bcefa52d4
commit
2200e0e22f
Binary file not shown.
23
xyylMCWEACSystem/framebtn.cpp
Normal file
23
xyylMCWEACSystem/framebtn.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include "framebtn.h"
|
||||||
|
#include "ui_framebtn.h"
|
||||||
|
|
||||||
|
FrameBtn::FrameBtn(QWidget *parent) :
|
||||||
|
QFrame(parent),
|
||||||
|
ui(new Ui::FrameBtn)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->label->setStyleSheet("{padding-top: 2px;\
|
||||||
|
background-repeat: no-repeat;\
|
||||||
|
background-color: #60C171;\
|
||||||
|
text-align: bottom;\
|
||||||
|
padding-bottom: 2px;\
|
||||||
|
font-size: 12px;\
|
||||||
|
color: #FFFFFF;}");
|
||||||
|
ui->label_2->setStyleSheet("");
|
||||||
|
ui->label_3->setStyleSheet("");
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameBtn::~FrameBtn()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
22
xyylMCWEACSystem/framebtn.h
Normal file
22
xyylMCWEACSystem/framebtn.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef FRAMEBTN_H
|
||||||
|
#define FRAMEBTN_H
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class FrameBtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
class FrameBtn : public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit FrameBtn(QWidget *parent = nullptr);
|
||||||
|
~FrameBtn();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::FrameBtn *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FRAMEBTN_H
|
98
xyylMCWEACSystem/framebtn.ui
Normal file
98
xyylMCWEACSystem/framebtn.ui
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>FrameBtn</class>
|
||||||
|
<widget class="QFrame" name="FrameBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>450</width>
|
||||||
|
<height>500</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Frame</string>
|
||||||
|
</property>
|
||||||
|
<property name="inputMethodHints">
|
||||||
|
<set>Qt::ImhNone</set>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>45</x>
|
||||||
|
<y>52</y>
|
||||||
|
<width>240</width>
|
||||||
|
<height>87</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>30</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>脑电采集</string>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>44</x>
|
||||||
|
<y>138</y>
|
||||||
|
<width>278</width>
|
||||||
|
<height>47</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Source Code Pro</family>
|
||||||
|
<pointsize>40</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>290</y>
|
||||||
|
<width>72</width>
|
||||||
|
<height>15</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="gridLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>160</x>
|
||||||
|
<y>270</y>
|
||||||
|
<width>160</width>
|
||||||
|
<height>80</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout"/>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -15,7 +15,9 @@
|
|||||||
#include "framelesswindow.h"
|
#include "framelesswindow.h"
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
#include "hospitalinfo.h"
|
||||||
|
#include "framebtn.h"
|
||||||
|
#include "mainbtn.h"
|
||||||
void LoadStyleFile(QString strStyle)
|
void LoadStyleFile(QString strStyle)
|
||||||
{
|
{
|
||||||
QFile qss(strStyle);
|
QFile qss(strStyle);
|
||||||
@ -27,6 +29,8 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
// QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
//qInstallMessageHandler(MessageHandler);
|
//qInstallMessageHandler(MessageHandler);
|
||||||
QTextCodec *codec = QTextCodec::codecForName("GBK");
|
QTextCodec *codec = QTextCodec::codecForName("GBK");
|
||||||
@ -40,5 +44,9 @@ int main(int argc, char *argv[])
|
|||||||
globalFont.setFamily("黑体");
|
globalFont.setFamily("黑体");
|
||||||
QApplication::setFont(globalFont);
|
QApplication::setFont(globalFont);
|
||||||
LoadStyleFile(QApplication::applicationDirPath()+"/defaultstyle.qss");
|
LoadStyleFile(QApplication::applicationDirPath()+"/defaultstyle.qss");
|
||||||
|
#endif
|
||||||
|
MainBtn ll;
|
||||||
|
ll.setTxt("系统设置","EGG acquisition","");
|
||||||
|
ll.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
52
xyylMCWEACSystem/mainbtn.cpp
Normal file
52
xyylMCWEACSystem/mainbtn.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include "mainbtn.h"
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
void MainBtn::setTxt(QString str,QString str2,QString str3)
|
||||||
|
{
|
||||||
|
m_labTxt.setText(str);
|
||||||
|
m_labEgTxt.setText(str2) ;
|
||||||
|
m_labImage.setText(str3);
|
||||||
|
setObjectName("MinBtn");
|
||||||
|
this->setStyleSheet("QFrame#MinBtn{border-image:url(:/image/index_bg_data.png);border-radius: 40px;} ");
|
||||||
|
m_labTxt.setStyleSheet("font-size: 60px;font-weight: 500;color:white;");
|
||||||
|
m_labEgTxt.setStyleSheet("font-size: 60px;font-weight:normal;color:white;");
|
||||||
|
}
|
||||||
|
MainBtn::MainBtn(QWidget * parent )
|
||||||
|
{
|
||||||
|
setWindowFlags(Qt::FramelessWindowHint); // 去掉边框
|
||||||
|
setAttribute(Qt::WA_TranslucentBackground); // 背景透明
|
||||||
|
m_labTxt.setFixedSize(QSize(240,87));
|
||||||
|
//m_labEgTxt.setFixedSize(QSize(302,58));
|
||||||
|
m_labImage.setFixedSize(QSize(129,117));
|
||||||
|
|
||||||
|
|
||||||
|
QHBoxLayout * hlay = new QHBoxLayout;
|
||||||
|
QHBoxLayout * hlay2 = new QHBoxLayout;
|
||||||
|
QHBoxLayout * hlay3 = new QHBoxLayout;
|
||||||
|
hlay->addWidget(&m_labTxt);
|
||||||
|
hlay->addStretch();
|
||||||
|
hlay2->addWidget(&m_labEgTxt);
|
||||||
|
hlay2->addStretch();
|
||||||
|
hlay3->addStretch();
|
||||||
|
hlay3->addWidget(&m_labImage);
|
||||||
|
|
||||||
|
|
||||||
|
QVBoxLayout * vlay = new QVBoxLayout;
|
||||||
|
vlay->addLayout(hlay);
|
||||||
|
vlay->addLayout(hlay2);
|
||||||
|
vlay->addSpacing(143);
|
||||||
|
vlay->addLayout(hlay3);
|
||||||
|
vlay->setSpacing(0);
|
||||||
|
vlay->setContentsMargins(45,45,45,45);
|
||||||
|
//setFixedSize(QSize(450,500));
|
||||||
|
setLayout(vlay);
|
||||||
|
}
|
||||||
|
MainBtn::~MainBtn()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainBtn::mouseReleaseEvent(QMouseEvent * ev)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
32
xyylMCWEACSystem/mainbtn.h
Normal file
32
xyylMCWEACSystem/mainbtn.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef MAINBTN_H
|
||||||
|
#define MAINBTN_H
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QStyleOption>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
class MainBtn:public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MainBtn(QWidget * parent =NULL);
|
||||||
|
~MainBtn();
|
||||||
|
void setTxt(QString str,QString str2,QString str3);
|
||||||
|
void paintEvent(QPaintEvent* event)
|
||||||
|
{
|
||||||
|
QStyleOption opt;
|
||||||
|
opt.init(this);
|
||||||
|
QPainter p(this);
|
||||||
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
}
|
||||||
|
signals:
|
||||||
|
void clicked();
|
||||||
|
protected:
|
||||||
|
virtual void mouseReleaseEvent(QMouseEvent * ev);
|
||||||
|
private:
|
||||||
|
QLabel m_labTxt;
|
||||||
|
QLabel m_labEgTxt;
|
||||||
|
QLabel m_labImage;
|
||||||
|
};
|
||||||
|
#endif // MAINBTN_H
|
@ -36,6 +36,7 @@ SOURCES += \
|
|||||||
dataprocesswidget.cpp \
|
dataprocesswidget.cpp \
|
||||||
devconwidget.cpp \
|
devconwidget.cpp \
|
||||||
eggwidget.cpp \
|
eggwidget.cpp \
|
||||||
|
framebtn.cpp \
|
||||||
framelesswindow.cpp \
|
framelesswindow.cpp \
|
||||||
framewindow.cpp \
|
framewindow.cpp \
|
||||||
hospitalinfo.cpp \
|
hospitalinfo.cpp \
|
||||||
@ -43,6 +44,7 @@ SOURCES += \
|
|||||||
logger.cpp \
|
logger.cpp \
|
||||||
loginwidget.cpp \
|
loginwidget.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
|
mainbtn.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
medicalrecordmanager.cpp \
|
medicalrecordmanager.cpp \
|
||||||
medicalrecordwidget.cpp \
|
medicalrecordwidget.cpp \
|
||||||
@ -65,12 +67,14 @@ HEADERS += \
|
|||||||
dataprocesswidget.h \
|
dataprocesswidget.h \
|
||||||
devconwidget.h \
|
devconwidget.h \
|
||||||
eggwidget.h \
|
eggwidget.h \
|
||||||
|
framebtn.h \
|
||||||
framelesswindow.h \
|
framelesswindow.h \
|
||||||
framewindow.h \
|
framewindow.h \
|
||||||
hospitalinfo.h \
|
hospitalinfo.h \
|
||||||
leadscheme.h \
|
leadscheme.h \
|
||||||
logger.h \
|
logger.h \
|
||||||
loginwidget.h \
|
loginwidget.h \
|
||||||
|
mainbtn.h \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
medicalrecordmanager.h \
|
medicalrecordmanager.h \
|
||||||
medicalrecordwidget.h \
|
medicalrecordwidget.h \
|
||||||
@ -83,6 +87,7 @@ HEADERS += \
|
|||||||
widget.h
|
widget.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
framebtn.ui \
|
||||||
widget.ui
|
widget.ui
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user