实现主页面基本控件的
This commit is contained in:
parent
2bcefa52d4
commit
2200e0e22f
Binary file not shown.
@ -66,7 +66,7 @@ void CurChatWidget::paintEvent(QPaintEvent *)
|
||||
|
||||
// 设置画笔的颜色和样式
|
||||
painter.setPen(Qt::black);
|
||||
painteXY(painter);
|
||||
painteXY(painter);
|
||||
|
||||
|
||||
|
||||
|
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 <QTextCodec>
|
||||
#include "logger.h"
|
||||
|
||||
#include "hospitalinfo.h"
|
||||
#include "framebtn.h"
|
||||
#include "mainbtn.h"
|
||||
void LoadStyleFile(QString strStyle)
|
||||
{
|
||||
QFile qss(strStyle);
|
||||
@ -27,6 +29,8 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
#if 0
|
||||
// QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
//qInstallMessageHandler(MessageHandler);
|
||||
QTextCodec *codec = QTextCodec::codecForName("GBK");
|
||||
@ -36,9 +40,13 @@ int main(int argc, char *argv[])
|
||||
//window->resize(300, 400);
|
||||
// window->showMaximized();
|
||||
mainw->showMaximized();
|
||||
QFont globalFont;
|
||||
globalFont.setFamily("黑体");
|
||||
QFont globalFont;
|
||||
globalFont.setFamily("黑体");
|
||||
QApplication::setFont(globalFont);
|
||||
LoadStyleFile(QApplication::applicationDirPath()+"/defaultstyle.qss");
|
||||
return a.exec();
|
||||
#endif
|
||||
MainBtn ll;
|
||||
ll.setTxt("系统设置","EGG acquisition","");
|
||||
ll.show();
|
||||
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 \
|
||||
devconwidget.cpp \
|
||||
eggwidget.cpp \
|
||||
framebtn.cpp \
|
||||
framelesswindow.cpp \
|
||||
framewindow.cpp \
|
||||
hospitalinfo.cpp \
|
||||
@ -43,6 +44,7 @@ SOURCES += \
|
||||
logger.cpp \
|
||||
loginwidget.cpp \
|
||||
main.cpp \
|
||||
mainbtn.cpp \
|
||||
mainwindow.cpp \
|
||||
medicalrecordmanager.cpp \
|
||||
medicalrecordwidget.cpp \
|
||||
@ -65,12 +67,14 @@ HEADERS += \
|
||||
dataprocesswidget.h \
|
||||
devconwidget.h \
|
||||
eggwidget.h \
|
||||
framebtn.h \
|
||||
framelesswindow.h \
|
||||
framewindow.h \
|
||||
hospitalinfo.h \
|
||||
leadscheme.h \
|
||||
logger.h \
|
||||
loginwidget.h \
|
||||
mainbtn.h \
|
||||
mainwindow.h \
|
||||
medicalrecordmanager.h \
|
||||
medicalrecordwidget.h \
|
||||
@ -83,6 +87,7 @@ HEADERS += \
|
||||
widget.h
|
||||
|
||||
FORMS += \
|
||||
framebtn.ui \
|
||||
widget.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
|
Loading…
x
Reference in New Issue
Block a user