hai 6 months ago
parent e148f78679
commit 1bcd6643eb

@ -0,0 +1,24 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 7
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 5
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
/usr/include/c++/7 \
/usr/include/x86_64-linux-gnu/c++/7 \
/usr/include/c++/7/backward \
/usr/lib/gcc/x86_64-linux-gnu/7/include \
/usr/local/include \
/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed \
/usr/include/x86_64-linux-gnu \
/usr/include
QMAKE_CXX.LIBDIRS = \
/usr/lib/gcc/x86_64-linux-gnu/7 \
/usr/lib/x86_64-linux-gnu \
/usr/lib \
/lib/x86_64-linux-gnu \
/lib

@ -0,0 +1,115 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia multimediawidgets network sql positioning quickcontrols2
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
TARGET_ARCH = $${QT_ARCH}
contains(TARGET_ARCH, arm) {
CONFIG += link_pkgconfig
PKGCONFIG += opencv4
INCLUDEPATH += /opt/st/stm32mp1/3.1-snapshot/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/usr/include
} else: win32 {
# Windows平台的库文件路径和头文件路径
LIBS += -LF:/coderead/OpenCV-MinGW-Build/x64/mingw/lib \
-lopencv_core452 \
-lopencv_highgui452 \
-lopencv_imgproc452 \
-lopencv_videoio452 \
-lopencv_imgcodecs452
INCLUDEPATH += F:/coderead/OpenCV-MinGW-Build/include
} else {
# 非Windows, 非ARM平台如Linux
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_videoio \
-lopencv_imgcodecs
INCLUDEPATH += /usr/local/include # 注意应该是include而不是lib/include
}
SOURCES += \
album/album.cpp \
cam/CAM.cpp \
cam/camera.cpp \
cam/mylabel.cpp \
class_table/class_table.cpp \
comnet.cpp \
desktop.cpp \
desktop2.cpp \
flyme/flyme.cpp \
main.cpp \
assistant.cpp\
music/music.cpp \
set/mydevice.cpp \
set/set.cpp \
set/wireless/wirelessmodel.cpp \
slidepage/slidepage.cpp \
timer/alarm.cpp \
timer/numberpicker.cpp \
timer/switchbutton.cpp \
timer/tt.cpp \
weather/climate.cpp \
weather/weather.cpp
HEADERS += \
album/album.h \
assistant.h \
cam/CAM.h \
cam/camera.h \
cam/mylabel.h \
class_table/class_table.h \
comnet.h \
desktop.h \
desktop2.h \
flyme/flyme.h \
music/music.h \
set/mydevice.h \
set/set.h \
set/wireless/wirelessmodel.h \
slidepage/slidepage.h \
timer/alarm.h \
timer/numberpicker.h \
timer/switchbutton.h \
timer/tt.h \
weather/climate.h \
weather/weather.h
FORMS += \
album/album.ui \
assistant.ui \
cam/CAM.ui \
class_table/class_table.ui \
desktop2.ui \
flyme/flyme.ui \
music/music.ui \
set/mydevice.ui \
set/set.ui \
timer/tt.ui \
weather/climate.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
src.qrc

@ -0,0 +1,113 @@
#include "album.h"
#include "ui_album.h"
#include <QPixmap>
album::album(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::album)
{
ui->setupUi(this);
this->installEventFilter(this);
// showapp = new QLabel(this);
// showapp->setMaximumSize(800, 480);
// showapp->setMinimumSize(800, 480);
// showapp->setGeometry(0,0,800,480);
// showapp->setPixmap(QPixmap(":/album/images/8.jpg"));
floatingbutton= new FloatingButton (this);
// 将悬浮球的pressed()信号连接到槽函数onButtonPressed()上
connect(floatingbutton, &FloatingButton::pressed, this, &album::onButtonPressed);
}
album::~album()
{
delete ui;
}
void album::onButtonPressed()
{
emit album_close(false);
qDebug() << "悬浮球被按下了!";
}
void album::album_init()
{
}
bool album::eventFilter(QObject *watch, QEvent *evn)
{
// static int press_x;
// static int press_y;
// static int relea_x;
// static int relea_y;
// QMouseEvent *event = static_cast<QMouseEvent *>(evn);
// if(event->type()==QEvent::MouseButtonPress)
// {
// press_x = event->globalX();
// press_y = event->globalY();
// }
// if(event->type()==QEvent::MouseButtonRelease)
// {
// relea_x = event->globalX();
// relea_y = event->globalY();
// }
// //判断滑动方向(右滑)
// if((relea_x - press_x)>20 && event->type()==QEvent::MouseButtonRelease && qAbs(relea_y-press_y)<50)
// {
// int current_page = ui->stackedWidget->currentIndex();
// if(current_page<=2)
// {
// ui->label->setPixmap(ui->stackedWidget->currentWidget()->grab());
// QPropertyAnimation *animation1 = new QPropertyAnimation(ui->label,"geometry");
// animation1->setDuration(1000);
// animation1->setStartValue(QRect(0,0,this->width(),this->height()));
// animation1->setEndValue(QRect(this->width()*2,0,this->width(),this->height()));
// //animation1->start();
// ui->stackedWidget->setCurrentIndex(current_page+1);
// QPropertyAnimation *animation2 = new QPropertyAnimation(ui->stackedWidget->currentWidget(),"geometry");
// animation2->setDuration(1000);
// animation2->setStartValue(QRect(-this->width()*2,0,this->width(),this->height()));
// animation2->setEndValue(QRect(0,0,this->width(),this->height()));
// QParallelAnimationGroup *group = new QParallelAnimationGroup;
// group->addAnimation(animation1);
// group->addAnimation(animation2);
// group->start();
// }
// }
// //判断滑动方向(左滑)
// if((press_x - relea_x)>20 && event->type()==QEvent::MouseButtonRelease && qAbs(relea_y-press_y)<50)
// {
// int current_page = ui->stackedWidget->currentIndex();
// if(current_page>=0)
// {
// ui->label->setPixmap(ui->stackedWidget->currentWidget()->grab());
// QPropertyAnimation *animation1 = new QPropertyAnimation(ui->label,"geometry");
// animation1->setDuration(1000);
// animation1->setStartValue(QRect(0,0,this->width(),this->height()));
// animation1->setEndValue(QRect(-this->width(),0,this->width(),this->height()));
// //animation1->start();
// ui->stackedWidget->setCurrentIndex(current_page-1);
// QPropertyAnimation *animation2 = new QPropertyAnimation(ui->stackedWidget->currentWidget(),"geometry");
// animation2->setDuration(1000);
// animation2->setStartValue(QRect(this->width()*2,0,this->width(),this->height()));
// animation2->setEndValue(QRect(0,0,this->width(),this->height()));
// QParallelAnimationGroup *group = new QParallelAnimationGroup;
// group->addAnimation(animation1);
// group->addAnimation(animation2);
// group->start();
// }
// }
// return QWidget::eventFilter(watch,evn);
}

@ -0,0 +1,45 @@
#ifndef ALBUM_H
#define ALBUM_H
#include <QMainWindow>
#include <QPropertyAnimation>
#include <QParallelAnimationGroup>
#include <QDebug>
#include <QMouseEvent>
#include <QString>
#include "flyme/flyme.h"
#include <QLabel>
QT_BEGIN_NAMESPACE
namespace Ui { class album; }
QT_END_NAMESPACE
class FloatingButton;
class album : public QMainWindow
{
Q_OBJECT
public:
album(QWidget *parent = nullptr);
~album();
bool eventFilter(QObject *watch, QEvent *evn); //事件监听函数
QLabel *showapp;
private:
Ui::album *ui;
/*图片的标号*/
int image_num;
/*图片的路劲*/
QString image_path;
FloatingButton *floatingbutton;
int image_max=10;
int i;
void album_init();
private slots:
/*悬浮球 */
void onButtonPressed();
signals:
void album_close(bool t);
};
#endif // ALBUM_H

@ -0,0 +1,34 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
album.cpp
HEADERS += \
album.h
FORMS += \
album.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
src.qrc

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>album</class>
<widget class="QMainWindow" name="album">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>album</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>801</width>
<height>481</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/album/images/8.jpg);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

@ -0,0 +1,11 @@
#include "album.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
album w;
w.show();
return a.exec();
}

@ -0,0 +1,16 @@
<RCC>
<qresource prefix="/">
<file>images/1.jpg</file>
<file>images/2.jpg</file>
<file>images/3.jpg</file>
<file>images/4.jpg</file>
<file>images/5.jpg</file>
<file>images/6.jpg</file>
<file>images/7.jpg</file>
<file>images/8.jpg</file>
<file>images/9.jpg</file>
<file>images/10.jpg</file>
<file>images/11.jpg</file>
<file>images/此文件夹是相册图片.txt</file>
</qresource>
</RCC>

@ -0,0 +1,39 @@
#include "assistant.h"
#include "ui_assistant.h"
#include<QDebug>
#include<QTime>
assistant::assistant(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::assistant)
{
ui->setupUi(this);
QTime time = QTime::currentTime();
ui->label->setText(time.toString("hh:mm"));
QDate date = QDate::currentDate();
ui->label_2->setText(date.toString("yyyy年MM月dd日 dddd"));
}
assistant::~assistant()
{
delete ui;
}
void assistant::on_pushButton_clicked()
{
emit climate_ready(true);
qDebug()<<"天气";
}
//课程表
void assistant::on_pushButton_3_clicked()
{
emit class_ready(true);
qDebug()<<"课程表";
}
//闹钟
void assistant::on_pushButton_2_clicked()
{
emit alarm_ready(true);
qDebug()<<"闹钟";
}

@ -0,0 +1,31 @@
#ifndef ASSISTANT_H
#define ASSISTANT_H
#include <QMainWindow>
QT_BEGIN_NAMESPACE
namespace Ui { class assistant; }
QT_END_NAMESPACE
class assistant : public QMainWindow
{
Q_OBJECT
public:
assistant(QWidget *parent = nullptr);
~assistant();
private slots:
void on_pushButton_clicked();
void on_pushButton_3_clicked();
void on_pushButton_2_clicked();
private:
Ui::assistant *ui;
signals:
void climate_ready(bool t);
void class_ready(bool t);
void alarm_ready(bool t);
};
#endif // ASSISTANT_H

@ -0,0 +1,394 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>assistant</class>
<widget class="QMainWindow" name="assistant">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>480</height>
</size>
</property>
<property name="font">
<font>
<underline>false</underline>
</font>
</property>
<property name="windowTitle">
<string>assistant</string>
</property>
<property name="styleSheet">
<string notr="true">QWidget#centralwidget{
border-image: url(:/icon/abc.png);
}
</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>200</x>
<y>120</y>
<width>421</width>
<height>211</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 57 105pt &quot;Ubuntu&quot;;
color: rgb(117, 80, 123);</string>
</property>
<property name="text">
<string>13:00</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>400</x>
<y>340</y>
<width>391</width>
<height>131</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>17</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QComboBox#comboBox{ border: 0px; padding: 0px; background: white; border-image: url(:/icon/abc.png);border-radius:10px;}
QComboBox::drop-down { width: 0px; }
QComboBox::down-arrow { image: none; }
</string>
</property>
<item>
<property name="text">
<string>08:00 ~ 09:35 电机拖动 电子楼402</string>
</property>
</item>
<item>
<property name="text">
<string>10:55 ~11:30 PLC技术 旭日楼503</string>
</property>
</item>
<item>
<property name="text">
<string>14:30 ~16:05 自动控制 田家炳402</string>
</property>
</item>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>781</width>
<height>42</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>60</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">color: rgb(238, 238, 236);
font: 57 20pt &quot;Ubuntu&quot;;</string>
</property>
<property name="text">
<string>2022年11月06日 星期三</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/notice.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/alarm.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/Internet.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/wifi.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/battery.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>371</width>
<height>81</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>距离</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<pointsize>27</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>期末考试</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>还有</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<pointsize>27</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(138, 226, 52);</string>
</property>
<property name="text">
<string>125</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>天</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>340</y>
<width>371</width>
<height>131</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="5,1">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="pushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724562_2.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>天气</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="5,1">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724519_2.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_15">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>课程表</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="5,1">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724469_2.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>时钟</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,93 @@
#include "CAM.h"
#include "ui_CAM.h"
#include <QGuiApplication>
#include <QScreen>
#include <QFile>
#include <QPixmap>
#include <QBuffer>
#include "camera.h"
CAM::CAM(QWidget *parent)
: QWidget(parent)
, ui(new Ui::CAM)
{
ui->setupUi(this);
/* 摄像头 */
camera = new Camera(this);
showapp = new album(this);
scanCameraDevice();
/* 信号连接槽 */
connect(camera, SIGNAL(readyImage(QImage)),
this, SLOT(showImage(QImage)));
connect(ui->cam_traBut,SIGNAL(clicked(bool)),
camera, SLOT(cameraProcess(bool)));//开启摄像头
connect(ui->cam_playBut, SIGNAL(clicked()),
this, SLOT(saveImageToLocal()));
floatingbutton= new FloatingButton (this);
// 将悬浮球的pressed()信号连接到槽函数onButtonPressed()上
connect(floatingbutton, &FloatingButton::pressed, this, &CAM::onButtonPressed);
}
CAM::~CAM()
{
delete ui;
}
void CAM::onButtonPressed()
{
emit cam_close(false);
qDebug() << "悬浮球被按下了!";
}
void CAM::scanCameraDevice()
{
/* QFile文件指向/dev/video1 */
QFile file("/dev/video1");
file.setFileName("/dev/video1");
if (file.exists())
{
qDebug()<<"camera success" ;
camera->selectCameraDevice(1);//video1
}
else
{
qDebug()<<"camera cannot finded" ;
}
}
void CAM::showImage(const QImage &image)
{
/* 显示图像 */
ui->displayLabel->setPixmap(QPixmap::fromImage(image));
saveImage = image;
/* 判断图像是否为空,空则设置拍照按钮不可用 */
if (!saveImage.isNull())
ui->cam_playBut->setEnabled(true);
else
ui->cam_playBut->setEnabled(false);
}
void CAM::saveImageToLocal()
{
/* 判断图像是否为空 */
if (!saveImage.isNull()) {
QString fileName =
QCoreApplication::applicationDirPath() + "/test.png";
qDebug()<<"正在保存"<<fileName<<"图片,请稍候..."<<endl;
/* save(arg1arg2arg3)重载函数arg1代表路径文件名
* arg2arg3 */
saveImage.save(fileName, "PNG", 1);
/* 设置拍照的图像为显示在photoLabel上 */
ui->cam_albumBut->setPixmap(QPixmap::fromImage(QImage(fileName)));
//showapp->showapp->setPixmap(QPixmap::fromImage(QImage(fileName)));
qDebug()<<"保存完成!"<<endl;
}
}

@ -0,0 +1,55 @@
#ifndef CAM_H
#define CAM_H
#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QComboBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QLabel>
#include <QScrollArea>
#include <QDebug>
#include "flyme/flyme.h"
#include "album/album.h"
QT_BEGIN_NAMESPACE
namespace Ui { class CAM; }
QT_END_NAMESPACE
class Camera;
class FloatingButton;
class album;
class CAM : public QWidget
{
Q_OBJECT
public:
CAM(QWidget *parent = nullptr);
~CAM();
private:
Ui::CAM *ui;
/* 扫描是否存在摄像头 */
void scanCameraDevice();
/* 摄像头设备 */
Camera *camera;
/* 拍照保存的照片 */
QImage saveImage;
FloatingButton *floatingbutton;
album *showapp;
private slots:
/* 显示图像 */
void showImage(const QImage&);
/* 保存照片到本地 */
void saveImageToLocal();
/*悬浮球 */
void onButtonPressed();
signals:
void cam_close(bool t);
};
#endif // CAM_H

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CAM</class>
<widget class="QWidget" name="CAM">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>CAM</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
<widget class="QLabel" name="displayLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>150</x>
<y>0</y>
<width>480</width>
<height>480</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>320</width>
<height>480</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(238, 238, 236);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="cam_traBut">
<property name="geometry">
<rect>
<x>680</x>
<y>60</y>
<width>70</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/cam/images/camera_play.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="cam_playBut">
<property name="geometry">
<rect>
<x>670</x>
<y>200</y>
<width>80</width>
<height>80</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QPushButton#cam_playBut {
border-image: url(:/cam/images/canera_off.png);}
QPushButton#cam_playBut:checked:hover {
border-image: url(:/cam/images/camera_playon.png);}
QPushButton#cam_playBut :hpver{
border-image: url(:/cam/images/canera_off.png);}</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>50</x>
<y>20</y>
<width>61</width>
<height>431</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>80</number>
</property>
<item>
<widget class="QPushButton" name="cam_flashBut">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">
QPushButton#cam_flashBut {
border-image: url(:/cam/images/camera_flash.png);}
QPushButton#cam_flashBut:checked {
border-image: url(:/cam/images/camera_flashon.png);}
</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cam_hdrBut">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/cam/images/camera_hdr.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cam_vidBut">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/cam/images/camera_video.png);
</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cam_setBut">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/cam/images/camera_set.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="cam_albumBut">
<property name="geometry">
<rect>
<x>680</x>
<y>350</y>
<width>70</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/cam/images/camera_album.png);</string>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,120 @@
/******************************************************************
Copyright © Deng Zhimao Co., Ltd. 1990-2021. All rights reserved.
* @projectName 05_opencv_camera
* @brief camera.cpp
* @author Deng Zhimao
* @email 1252699831@qq.com
* @net www.openedv.com
* @date 2021-03-17
*******************************************************************/
#include "camera.h"
/* opencv4 */
#if __arm__
#include "opencv4/opencv2/core/core.hpp"
#include "opencv4/opencv2/highgui/highgui.hpp"
/* CV_CAP_PROP_FRAME_WIDTH这样的宏在此头文件里 */
#include "opencv4/opencv2/videoio/legacy/constants_c.h"
#elif defined(_WIN32)
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/videoio.hpp>
#else
/* Ubuntu18上使用的opencv3头文件路径 */
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#endif
#include <QImage>
#include <QDebug>
Camera::Camera(QObject *parent) :
QObject(parent)
{
/* 实例化 */
capture = new cv::VideoCapture();
timer = new QTimer(this);
/* 信号槽连接 */
connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeOut()));
}
Camera::~Camera()
{
delete capture;
capture = NULL;
}
//opencv4X
void Camera::selectCameraDevice(int index)
{
/* 如果有其他摄像头打开了,先释放 */
if (capture->isOpened()) {
capture->release();
}
/* 打开摄像头设备 */
capture->open(index);
/* 设置采集摄像头的分辨率的宽度 */
capture ->set(cv::CAP_PROP_FRAME_WIDTH, 640);
/* 设置采集摄像头的分辨率的高度 */
capture ->set(cv::CAP_PROP_FRAME_HEIGHT, 480);
/* 设置亮度 */
capture ->set(cv::CAP_PROP_BRIGHTNESS, 1);
/* 设置曝光 */
capture ->set(cv::CAP_PROP_EXPOSURE, -7);
/* 设置对比度 */
capture ->set(cv::CAP_PROP_CONTRAST, 60);
}
bool Camera::cameraProcess(bool bl)
{
if (bl) {
/* 为什么是331000/33约等于30帧也就是一秒最多显示30帧 */
timer->start(33);
} else {
timer->stop();
}
/* 返回摄像头的状态 */
return capture->isOpened();
}
void Camera::timerTimeOut()
{
/* 如果摄像头没有打开,停止定时器,返回 */
if (!capture->isOpened()) {
timer->stop();
return;
}
static cv::Mat frame;
*capture >> frame;
if (frame.cols)
/* 发送图片信号 */
emit readyImage(matToQImage(frame));
}
QImage Camera::matToQImage(const cv::Mat &img)
{
/* USB摄像头和OV5640等都是RGB三通道不考虑单/四通道摄像头 */
if(img.type() == CV_8UC3) {
/* 得到图像的的首地址 */
const uchar *pimg = (const uchar*)img.data;
/* 以img构造图片 */
QImage qImage(pimg, img.cols, img.rows, img.step,
QImage::Format_RGB888);
/* 在不改变实际图像数据的条件下,交换红蓝通道 */
return qImage.rgbSwapped();
}
/* 返回QImage */
return QImage();
}

@ -0,0 +1,46 @@
#ifndef CAMERA_H
#define CAMERA_H
#include <QImage>
#include <QTimer>
/* 使用命名空间cv下的VideoCapture与Mat类 */
namespace cv {
class VideoCapture;
class Mat;
}
class Camera : public QObject
{
Q_OBJECT
public:
explicit Camera(QObject *parent = nullptr);
~Camera();
signals:
/* 声明信号,用于传递有图片信号时显示图像 */
void readyImage(const QImage&);
public slots:
/* 用于开启定时器 */
bool cameraProcess(bool);
/* 选择摄像头 */
void selectCameraDevice(int);
private slots:
/* 定时器时间到处理函数,发送图像数据信号 */
void timerTimeOut();
private:
/* 声明OpenCV的cv命名空间下的VideoCapture对象 */
cv::VideoCapture * capture;
/* 定时器,定时处理获取图像 */
QTimer * timer;
/* 图像转换处理函数 */
QImage matToQImage(const cv::Mat&);
};
#endif // CAMERA_H

@ -0,0 +1,54 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
TARGET_ARCH = $${QT_ARCH}
contains(TARGET_ARCH, arm){
CONFIG += link_pkgconfig
PKGCONFIG += opencv4
INCLUDEPATH += /opt/st/stm32mp1/3.1-snapshot/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/usr/include
} else {
#库文件路径
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_videoio \
-lopencv_imgcodecs
#头文件路径
INCLUDEPATH += /usr/local/lib/include
}
SOURCES += \
camera.cpp \
main.cpp \
mylabel.cpp \
CAM.cpp\
HEADERS += \
camera.h \
mylabel.h \
CAM.h
FORMS += \
CAM.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
src.qrc

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -0,0 +1,11 @@
#include "CAM.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
CAM w;
w.show();
return a.exec();
}

@ -0,0 +1,17 @@
#include "mylabel.h"
#include <QMouseEvent>
MyLabel::MyLabel(QWidget *parent) :
QLabel(parent)
{
}
void MyLabel::mouseReleaseEvent(QMouseEvent *ev)
{
if (ev->button() == Qt::LeftButton)
{
Q_UNUSED(ev);
emit Clicked();
}
}

@ -0,0 +1,22 @@
#ifndef MYLABEL_H
#define MYLABEL_H
#include <QLabel>
class MyLabel : public QLabel
{
Q_OBJECT
public:
explicit MyLabel(QWidget *parent = 0);
void mouseReleaseEvent(QMouseEvent *ev);
signals:
void Clicked();
private:
};
#endif // MYLABEL_H

@ -0,0 +1,14 @@
<RCC>
<qresource prefix="/image">
<file>images/camera_play.png</file>
<file>images/camera_album.png</file>
<file>images/camera_flash.png</file>
<file>images/camera_flashon.png</file>
<file>images/camera_hdr.png</file>
<file>images/camera_playon.png</file>
<file>images/camera_round.png</file>
<file>images/camera_set.png</file>
<file>images/camera_video.png</file>
<file>images/canera_off.png</file>
</qresource>
</RCC>

@ -0,0 +1,108 @@
#include "class_table.h"
#include "ui_class_table.h"
#include <QDebug>
#include <QHeaderView>
#include <QSqlError>
#include <QApplication>
#include <QSqlRecord>
#include <QDateTime>
class_table::class_table(QWidget *parent) :
QWidget(parent),
ui(new Ui::class_table)
{
ui->setupUi(this);
sqlQueryModel = new QSqlQueryModel(this);
/* 数据库初始化 */
sqldata_init();
model = new QSqlTableModel(this, sqlDatabase);
/* 模型设置表的名字,需要与数据库的表的名字相同 */
model->setTable("employee");
/* 数据修改后立马保存到数据库 */
model->setEditStrategy(QSqlTableModel::OnFieldChange);
model->select();//执行上面语句
if (model->lastError().isValid())
{
qDebug()<<"选择数据失败!"<<endl;
}
model->setHeaderData(0, Qt::Horizontal, "星期一");
model->setHeaderData(1, Qt::Horizontal, "星期二");
model->setHeaderData(2, Qt::Horizontal, "星期三");
model->setHeaderData(3, Qt::Horizontal, "星期四");
model->setHeaderData(4, Qt::Horizontal, "星期五");
model->setHeaderData(5, Qt::Horizontal, "星期六");
model->setHeaderData(6, Qt::Horizontal, "星期日");
ui->tableView->setModel(model);//加载模型显示
/*tableView布局*/
// ui->tableView->setColumnHidden(0,125);
//ui->tableView->setColumnWidth(1, 125);
//ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);//自动调整列宽
//ui->tableView->setWordWrap(true);
ui->tableView->verticalHeader()->setDefaultSectionSize(100);
ui->tableView->horizontalHeader()->setDefaultSectionSize(103);
/*显示时间*/
QDateTime dateTime;
dateTime = QDateTime::currentDateTime();
//qDebug() << dateTime.toString("yyyy-MM-dd hh:mm:ss dddd");
ui->label_7->setText(dateTime.toString("yyyy-MM-dd dddd"));
floatingbutton= new FloatingButton (this);
// 将悬浮球的pressed()信号连接到槽函数onButtonPressed()上
connect(floatingbutton, &FloatingButton::pressed, this, &class_table::onButtonPressed);
}
class_table::~class_table()
{
sqlDatabase.close();
delete ui;
delete model;
delete dataWidgetMapper;
delete itemSelectionModel;
delete floatingbutton;
}
void class_table::onButtonPressed()
{
emit class_close(false);
qDebug() << "悬浮球被按下了!";
}
void class_table::sqldata_init()
{
/* 查看本机可用的数据库驱动 */
QStringList drivers = QSqlDatabase::drivers();
foreach(QString driver, drivers) {
qDebug()<<driver;
}
/* 以QSQLITE驱动方式打开或者创建数据库 */
sqlDatabase = QSqlDatabase::addDatabase("QSQLITE");
sqlDatabase.setDatabaseName("employee.db");
/* 以open的方式打开class.db数据库则会创建一个class.db */
if (!sqlDatabase.open())
qDebug()<<"连接数据库错误"<<sqlDatabase.lastError()<<endl;
else
qDebug()<<"连接数据库成功"<<endl;
QSqlQuery query(sqlDatabase);
/* 使用指令式创建表 */
query.exec("create table employee (Monday vchar(10), Tuesday vchar(10), Wednesday vchar(10),Thursday vchar(10),"
"Friday vchar(10),Saturday vchar(10),Sunday vchar(10))");
/* 以指令的方式插入数据,如果数据已经存在则不会成功不能插入 */
// query.exec(tr("insert into employee values('没课','自动控制系统-电子楼501','电气设备及plc技术-旭日楼519','没课','没课','没课','没课')"));
// query.exec(tr("insert into employee values('电气设备及plc技术-电子楼308','无课','机器视觉工业应用-电子楼501','自动控制系统-电子楼405','没课','机器视觉工业应用-电子楼405','没课')"));
// query.exec(tr("insert into employee values('没课','没课','没课','没课','没课','没课','没课')"));
// query.exec(tr("insert into employee values('没课','没课','没课','没课','没课','没课','没课')"));
// query.exec(tr("insert into employee values('没课','没课','没课','没课','没课','没课','没课')"));
// query.exec(tr("insert into employee values('没课','没课','没课','没课','没课','没课','没课')"));
}
void class_table::sqldata_delate(int row)
{
model->removeRow(row);
model->submit();//提交当前行的修改到数据库
model->submitAll();
model->select();
}

@ -0,0 +1,67 @@
#ifndef CLASS_TABLE_H
#define CLASS_TABLE_H
#include <QWidget>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QMainWindow>
#include <QLabel>
#include <QSqlTableModel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QTableView>
#include <QComboBox>
#include <QLineEdit>
#include <QDataWidgetMapper>
#include <QSqlQueryModel>
#include <QItemSelectionModel>
#include <QSpinBox>
#include <QStandardItemModel>
#include "flyme/flyme.h"
namespace Ui {
class class_table;
}
class FloatingButton;
class class_table : public QWidget
{
Q_OBJECT
public:
explicit class_table(QWidget *parent = nullptr);
~class_table();
private:
Ui::class_table *ui;
/* 数据库连接类 */
QSqlDatabase sqlDatabase;
/* 用于查询数据 */
QSqlQueryModel *sqlQueryModel;
/* 数据库操作模型 */
QSqlTableModel *model;
/* 数据映射 */
QDataWidgetMapper *dataWidgetMapper;
/* 选择模型 */
QItemSelectionModel * itemSelectionModel;
FloatingButton *floatingbutton;
/* 数据库初始化 */
void sqldata_init();
/* 数据库删除 */
void sqldata_delate(int row);
/*悬浮球 */
void onButtonPressed();
signals:
void class_close(bool t);
};
#endif // CLASS_TABLE_H

@ -0,0 +1,34 @@
QT += core gui sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
class_table.cpp \
main.cpp
HEADERS += \
class_table.h
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
src.qrc
FORMS += \
class_table.ui

@ -0,0 +1,323 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>class_table</class>
<widget class="QWidget" name="class_table">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>0</x>
<y>420</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>18:00</string>
</property>
</widget>
<widget class="Line" name="line_3">
<property name="geometry">
<rect>
<x>0</x>
<y>160</y>
<width>41</width>
<height>31</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>0</x>
<y>60</y>
<width>41</width>
<height>31</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>0</x>
<y>180</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>9:55</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>0</x>
<y>380</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>16:25</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QTableView" name="tableView">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>761</width>
<height>441</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QHeaderView::section {
font: 20px &quot;微软雅黑&quot;;
font-weight:bold;
color: rgb(24, 100, 249);
padding-left: 4px;
border: 1px solid #e2e2e2;
background-color:#cddffe;
}
QTableView{
border:none;
color: rgb(119, 119, 119);
gridline-color:#e2e2e2;
}
QTableView::item::selected{
background-color:#cddffe;
color:rgb(51, 51, 51);
}
/*QTableView 左上角样式*/
QTableView QTableCornerButton::section {
background-color:#cddffe;
border: 1px solid #e2e2e2;
}
</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>0</x>
<y>120</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>9:35</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_14">
<property name="geometry">
<rect>
<x>680</x>
<y>0</y>
<width>41</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/class_table/photos/rest.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>60</x>
<y>10</y>
<width>191</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>2022-2023学年第二学期</string>
</property>
</widget>
<widget class="Line" name="line_4">
<property name="geometry">
<rect>
<x>0</x>
<y>260</y>
<width>41</width>
<height>31</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>0</x>
<y>80</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>8:00</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>20</width>
<height>441</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>0</x>
<y>220</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>11:30</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>280</x>
<y>0</y>
<width>201</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>25</pointsize>
</font>
</property>
<property name="text">
<string>第五周</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>0</x>
<y>290</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>14:30</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>41</width>
<height>61</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/class_table/photos/attend.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>750</x>
<y>0</y>
<width>41</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/class_table/photos/class1.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>480</x>
<y>10</y>
<width>171</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>2023-3-25 星期五</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>0</x>
<y>330</y>
<width>40</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>16:05</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,12 @@
#include "class_table.h"
#include "ui_class_table.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
class_table w;
w.show();
return a.exec();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/">
<file>icons/addalarm1.png</file>
<file>style.qss</file>
<file>icons/addalarm2.png</file>
</qresource>
</RCC>

@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/">
<file>photos/attend.png</file>
<file>photos/class.png</file>
<file>photos/class1.png</file>
<file>photos/rest.png</file>
<file>photos/啊棠.jpg</file>
<file>photos/啊万.jpg</file>
</qresource>
</RCC>

@ -0,0 +1,11 @@
//#include "comnet.h"
//Comnet::Comnet(QObject *parent) : QObject(parent)
//{
// connect(this, SIGNAL(getclue()), this, SLOT(on_pushButton_2_clicked()));
//}
//void Comnet::on_pushButton_2_clicked()
//{
// emit wificloed();
// qDebug()<<"get value";
//}

@ -0,0 +1,27 @@
#ifndef COMNET_H
#define COMNET_H
//#include <QObject>
//#include <QDebug>
//class Comnet : public QObject
//{
// Q_OBJECT
//public:
// explicit Comnet(QObject *parent = nullptr);
// Q_INVOKABLE void getValFromQml(int v) {
// qDebug() << "value from qml is :" << v;
// emit getclue();
// }
//private slots:
// void on_pushButton_2_clicked();
//signals:
// void valueFromCpp(int val);
// void wificloed();
// void getclue();
//};
#endif // COMNET_H

@ -0,0 +1,204 @@
#include "desktop.h"
#include <QDebug>
#include <QThread>
desktop::desktop()
{
this->setGeometry(0, 0, 800, 480);
this->setMinimumSize(800, 480);
/*背景初始化*/
bgWidget=new QWidget(this);
bgWidget->setStyleSheet("border-image: url(:/icon/abc.png);");
/*app初始化*/
musicplay= new music();
climateapp=new climate();
classtable= new class_table();
alarmnotice = new Alarm();
cameraapp = new CAM();
setapp = new set();
albumapp = new album();
/*桌面初始化*/
mySlidePage = new SlidePage(this);
mySlidePage->resize(this->size());
desktop1= new assistant();
mySlidePage->addPage(desktop1);
desk2= new desktop2();
mySlidePage->addPage(desk2);
// music
connect(desk2, SIGNAL(music_ready(bool)),this, SLOT(music_handle(bool)));
connect(musicplay, SIGNAL(music_close(bool)),this, SLOT(music_handle(bool)));
// camera
connect(desk2, SIGNAL(cam_ready(bool)),this, SLOT(cam_handle(bool)));
connect(cameraapp, SIGNAL(cam_close(bool)),this, SLOT(cam_handle(bool)));
// set
connect(desk2, SIGNAL(set_ready(bool)),this, SLOT(set_handle(bool)));
connect(setapp, SIGNAL(set_close(bool)),this, SLOT(set_handle(bool)));
// ablum
connect(desk2, SIGNAL(album_ready(bool)),this, SLOT(album_handle(bool)));
connect(albumapp, SIGNAL(album_close(bool)),this, SLOT(album_handle(bool)));
// climate
connect(desktop1, SIGNAL(climate_ready(bool)),this, SLOT(climate_handle(bool)));
connect(climateapp, SIGNAL(climate_close(bool)),this, SLOT(climate_handle(bool)));
// classtable
connect(desktop1, SIGNAL(class_ready(bool)),this, SLOT(class_handle(bool)));
connect(classtable, SIGNAL(class_close(bool)),this, SLOT(class_handle(bool)));
// alarm
connect(desktop1, SIGNAL(alarm_ready(bool)),this, SLOT(alarm_handle(bool)));
connect(alarmnotice, SIGNAL(alarm_close(bool)),this, SLOT(alarm_handle(bool)));
}
desktop::~desktop()
{
delete bgWidget;
delete mySlidePage;
delete desktop1;
delete desk2;
delete musicplay;
delete classtable;
delete alarmnotice;
delete climateapp;
delete cameraapp;
delete setapp;
}
void desktop::onButtonPressed()
{
qDebug() << "悬浮球被按下了!";
}
void desktop::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event)
mySlidePage->resize(this->size());
bgWidget->resize(this->size());
}
/*music handle*/
void desktop::music_handle(bool t)
{
if(t)
{
mySlidePage->close();
musicplay->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
musicplay->close();
qDebug() << "close success";
}
}
/*climate handle*/
void desktop::climate_handle(bool t)
{
if(t)
{
mySlidePage->close();
climateapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
climateapp->close();
qDebug() << "close success";
}
}
/*class handle*/
void desktop::class_handle(bool t)
{
if(t)
{
mySlidePage->close();
classtable->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
classtable->close();
qDebug() << "close success";
}
}
/*alarm handle*/
void desktop::alarm_handle(bool t)
{
qDebug()<<t;
if(t)
{
mySlidePage->close();
alarmnotice->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
alarmnotice->close();
qDebug() << "close success";
}
}
/*cam handle*/
void desktop::cam_handle(bool t)
{
qDebug()<<t;
if(t)
{
mySlidePage->close();
cameraapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
cameraapp->close();
qDebug() << "close success";
}
}
/*set handle*/
void desktop::set_handle(bool t)
{
qDebug()<<t;
if(t)
{
mySlidePage->close();
setapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
setapp->close();
qDebug() << "close success";
}
}
/*set handle*/
void desktop::album_handle(bool t)
{
if(t)
{
mySlidePage->close();
albumapp->show();
qDebug() << "open success";
}
else
{
mySlidePage->show();
albumapp->close();
qDebug() << "close success";
}
}

@ -0,0 +1,71 @@
#ifndef DESKTOP_H
#define DESKTOP_H
#include <QWidget>
#include "assistant.h"
#include "slidepage/slidepage.h"
#include "desktop2.h"
#include "slidepage/slidepage.h"
#include "music/music.h"
#include "weather/climate.h"
#include "class_table/class_table.h"
#include "timer/alarm.h"
#include "cam/CAM.h"
#include "set/set.h"
#include "album/album.h"
class assistant;
class assistant;
class SlidePage;
class desktop2;
class music;
class climate;
class class_table;
class Alarm;
class CAM;
class set;
class album;
class desktop : public QWidget
{
Q_OBJECT
public:
desktop();
~desktop();
private:
/*第一页*/
assistant *desktop1;
/*第二页*/
desktop2 *desk2;
/* 滑动页面管理对象*/
SlidePage *mySlidePage;
QWidget *bgWidget;
/*app*/
music *musicplay;
class_table *classtable;
Alarm *alarmnotice;
climate *climateapp;
CAM *cameraapp;
set *setapp;
album *albumapp;
/* 重设大小 */
void resizeEvent(QResizeEvent *event);
private slots:
void onButtonPressed();
void music_handle(bool t);
void climate_handle(bool t);
void class_handle(bool t);
void alarm_handle(bool t);
void cam_handle(bool t);
void set_handle(bool t);
void album_handle(bool t);
};
#endif // DESKTOP_H

@ -0,0 +1,43 @@
#include "desktop2.h"
#include "ui_desktop2.h"
#include <QDebug>
#include <QDate>
#include "music/music.h"
desktop2::desktop2(QWidget *parent) :
QWidget(parent),
ui(new Ui::desktop2)
{
ui->setupUi(this);
QDate date = QDate::currentDate();
ui->label_16->setText(date.toString("yyyy年MM月dd日 dddd"));
}
desktop2::~desktop2()
{
delete ui;
}
/*music*/
void desktop2::on_pushButton_6_clicked()
{
emit music_ready(true);
qDebug()<<"music";
}
/*相机*/
void desktop2::on_pushButton_4_clicked()
{
emit cam_ready(true);
qDebug()<<"camera";
}
void desktop2::on_pushButton_5_clicked()
{
emit set_ready(true);
qDebug()<<"set";
}
void desktop2::on_pushButton_8_clicked()
{
emit album_ready(true);
qDebug()<<"album";
}

@ -0,0 +1,38 @@
#ifndef DESKTOP2_H
#define DESKTOP2_H
#include <QWidget>
namespace Ui {
class desktop2;
}
class desktop2 : public QWidget
{
Q_OBJECT
public:
explicit desktop2(QWidget *parent = nullptr);
~desktop2();
private slots:
void on_pushButton_6_clicked();
void on_pushButton_4_clicked();
void on_pushButton_5_clicked();
void on_pushButton_8_clicked();
private:
Ui::desktop2 *ui;
signals:
void music_ready(bool t);
void cam_ready(bool t);
void set_ready(bool t);
void album_ready(bool t);
};
#endif // DESKTOP2_H

@ -0,0 +1,459 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>desktop2</class>
<widget class="QWidget" name="desktop2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>480</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">QWidget#desktop2{
border-image: url(:/icon/abc.png);
}</string>
</property>
<widget class="QWidget" name="layoutWidget_3">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>781</width>
<height>42</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>60</number>
</property>
<item>
<widget class="QLabel" name="label_16">
<property name="styleSheet">
<string notr="true">color: rgb(238, 238, 236);
background-image: none;
font: 57 20pt &quot;Ubuntu&quot;;
</string>
</property>
<property name="text">
<string>2022年11月06日 星期三</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QLabel" name="label_17">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/notice.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_18">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/alarm.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/Internet.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_20">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/wifi.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_21">
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/battery.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>30</x>
<y>70</y>
<width>741</width>
<height>391</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="spacing">
<number>37</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>40</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724462_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_22">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>相机</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724531_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_23">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>设置</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724514_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_24">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>音乐</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724497_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_25">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>信息</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>40</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724488_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_26">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>相片</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724506_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_27">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>语音助手</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724563_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_28">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>视频</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="5,1">
<item>
<widget class="QPushButton" name="pushButton_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/icon/4724541_2.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_29">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>智能家庭</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,49 @@
#include "flyme/flyme.h"
#include "ui_flyme.h"
#include <QDesktopWidget>
#include <QDebug>
FloatingButton::FloatingButton(QWidget *parent )
: QPushButton(parent)
{
FloatingButton_init();
}
FloatingButton::~FloatingButton()
{
}
void FloatingButton::FloatingButton_init()
{
// 设置悬浮球按钮的大小和位置
setGeometry(QRect(725, 200, 80, 80));
setIcon(QIcon(":/icon/flow_set.png"));
setIconSize(QSize(80, 80));
// 设置不透明度
setWindowOpacity(0.95);
// 隐藏边框
setFlat(true);
// 设置窗口标志为窗口置顶
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
// // 将悬浮球放置在屏幕的中心位置
// QRect screenGeometry = QApplication::desktop()->screenGeometry();
// int x = (screenGeometry.width() - width())-50;
// int y = (screenGeometry.height() - height()) / 2-25;
// move(x, y);
}
void FloatingButton::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)//表示鼠标左键的值
{
// 当悬浮球被按下时发射pressed()信号
emit pressed();
}
}

@ -0,0 +1,31 @@
#ifndef FLYME_H
#define FLYME_H
#include <QApplication>
#include <QMainWindow>
#include <QMenu>
#include <QContextMenuEvent>
#include <QPoint>
#include <QPushButton>
#include <QIcon>
class FloatingButton : public QPushButton
{
Q_OBJECT
public:
FloatingButton(QWidget *parent = nullptr);
~FloatingButton();
protected:
void FloatingButton_init();
void mousePressEvent(QMouseEvent *event) override;
signals:
void pressed();
};
#endif // FLYME_H

@ -0,0 +1,31 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
flyme.cpp
HEADERS += \
flyme.h
FORMS += \
flyme.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>flyme</class>
<widget class="QMainWindow" name="flyme">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>flyme</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar"/>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,14 @@
#include "flyme.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// 创建悬浮球按钮并显示
FloatingButton button;
button.show();
return a.exec();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save