ComputerManager.zip

  • 李四华
    了解作者
  • C/C++
    开发工具
  • 117KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2021-04-23 14:49
    上传日期
QT5,Windows托盘应用,仿腾讯安全管家
ComputerManager.zip
  • image
  • switch
  • switch_off.png
    1.1KB
  • switch_hover.png
    829B
  • switch_on.png
    1.5KB
  • mainMenu
  • open.png
    2.9KB
  • home.png
    2.8KB
  • about.png
    2.9KB
  • quit.png
    3KB
  • setting.png
    3KB
  • help.png
    3KB
  • update.png
    3.2KB
  • css
  • blue.css
    3.2KB
  • 4.png
    8.2KB
  • icon.png
    5.3KB
  • 3.png
    14.8KB
  • 5.png
    14.3KB
  • 1.png
    8.6KB
  • 2.png
    6.2KB
  • qt_zh_CN.ts
    4KB
  • 6.png
    14KB
  • topicon.png.png
    2.9KB
  • system_tray.png
    3.7KB
  • qt_zh_CN.qm
    1.1KB
  • ComputerManager.pro
    546B
  • computermanager.cpp
    8.4KB
  • widget.ui
    441B
  • image.qrc
    925B
  • ComputerManager.pro.user
    21.7KB
  • computermanager.h
    2.6KB
  • main.cpp
    524B
  • widget.cpp
    501B
  • widget.h
    393B
  • myswitchbutton.cpp
    975B
  • myswitchbutton.h
    596B
内容介绍
#include "computermanager.h" #include <QPushButton> #include <QToolButton> #include <QWidget> #include <QSystemTrayIcon> #include <QMenu> #include <QAction> #include <QApplication> #include <QWidgetAction> #include <QLabel> #include <QHBoxLayout> #include <QGridLayout> #include <QPainter> #include "myswitchbutton.h" ComputerManager::ComputerManager(QObject *parent) : QSystemTrayIcon(parent) { this->initAction(); this->initTopAction(); this->initMidAction(); this->initBottomAction(); this->addActions(); this->initConnect(); this->translateActions(); } void ComputerManager::translateActions() { m_tbnOpenSteward->setText(tr("Open")); m_tbnHome->setText(tr("check")); m_tbnAntiVirus->setText(tr("AntiVi")); m_tbnCleanRubbish->setText(tr("Clean")); m_tbnComputerSpeed->setText(tr("Comput")); m_tbnComputerClinic->setText(tr("Clinic")); } bool ComputerManager::eventFilter(QObject *obj, QEvent *event) { if (obj == m_topWidget && event->type() == QEvent::Paint) { QPainter painter(m_topWidget); painter.setPen(Qt::NoPen); painter.setBrush(QColor(42,120,192)); painter.drawRect(m_topWidget->rect()); } return QSystemTrayIcon::eventFilter(obj,event); } void ComputerManager::initTopAction() { //顶层菜单项初始化 m_topWidget = new QWidget(); m_topWidgetAction = new QWidgetAction(m_trayMenu); m_topLabelIcon = new QLabel(); m_topLabelIcon->setPixmap(QPixmap(":/image/topicon.png")); m_topLabelIcon->setFixedSize(30,30); m_topLabel = new QLabel(tr("Comuter Manager now protected you!")); m_topLabel->setObjectName(QString("WhiteLabel")); m_topLabel->setFont(QFont("Times", 11)); QHBoxLayout* m_topLayout = new QHBoxLayout(); m_topLayout->addWidget(m_topLabelIcon); m_topLayout->addWidget(m_topLabel,1,Qt::AlignHCenter | Qt::AlignVCenter); m_topLayout->setContentsMargins(0,0,0,0); m_topWidget->setLayout(m_topLayout); m_topWidget->setMinimumHeight(70); m_topWidget->installEventFilter(this); m_topWidgetAction->setDefaultWidget(m_topWidget); m_topQQWidget = new QWidget(); m_topQQWidgetAction = new QWidgetAction(m_trayMenu); m_QQInfoBtn = new QLabel(tr("qq infor safety\n")+ tr("reinforce more secure")); m_QQInfoBtn->setCursor(Qt::PointingHandCursor); m_labelIcon = new QLabel(); m_labelIcon->setPixmap(QPixmap(":/image/icon.png")); m_labelIcon->setFixedSize(50,50); QHBoxLayout* m_topQQLayout = new QHBoxLayout(); m_topQQLayout->addWidget(m_labelIcon); m_topQQLayout->addWidget(m_QQInfoBtn); m_topQQLayout->setContentsMargins(0,0,0,0); m_topQQWidget->setLayout(m_topQQLayout); m_topQQWidget->setMinimumHeight(70); m_topQQWidget->installEventFilter(this); m_topQQWidgetAction->setDefaultWidget(m_topQQWidget); m_topTbnWidget = new QWidget(); m_topTbnWidgetAction = new QWidgetAction(m_trayMenu); m_tbnOpenSteward = new QToolButton(); m_tbnOpenSteward->setIcon(QIcon(":/image/1.png")); m_tbnOpenSteward->setIconSize(QSize(50,50)); m_tbnOpenSteward->setAutoRaise(true); m_tbnOpenSteward->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_tbnHome = new QToolButton(); m_tbnHome->setIcon(QIcon(":/image/2.png")); m_tbnHome->setIconSize(QSize(50,50)); m_tbnHome->setAutoRaise(true); m_tbnHome->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_tbnAntiVirus = new QToolButton(); m_tbnAntiVirus->setIcon(QIcon(":/image/3.png")); m_tbnAntiVirus->setIconSize(QSize(50,50)); m_tbnAntiVirus->setAutoRaise(true); m_tbnAntiVirus->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_tbnCleanRubbish = new QToolButton(); m_tbnCleanRubbish->setIcon(QIcon(":/image/4.png")); m_tbnCleanRubbish->setIconSize(QSize(50,50)); m_tbnCleanRubbish->setAutoRaise(true); m_tbnCleanRubbish->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_tbnComputerSpeed = new QToolButton(); m_tbnComputerSpeed->setIcon(QIcon(":/image/5.png")); m_tbnComputerSpeed->setIconSize(QSize(50,50)); m_tbnComputerSpeed->setAutoRaise(true); m_tbnComputerSpeed->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_tbnComputerClinic = new QToolButton(); m_tbnComputerClinic->setIcon(QIcon(":/image/6.png")); m_tbnComputerClinic->setIconSize(QSize(50,50)); m_tbnComputerClinic->setAutoRaise(true); m_tbnComputerClinic->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QHBoxLayout *layout1 = new QHBoxLayout(); layout1->addWidget(m_tbnOpenSteward); layout1->addWidget(m_tbnHome); layout1->setContentsMargins(0,0,0,0); QHBoxLayout *layout2 = new QHBoxLayout(); layout2->addWidget(m_tbnAntiVirus); layout2->addWidget(m_tbnCleanRubbish); layout2->setContentsMargins(0,0,0,0); QHBoxLayout *layout3 = new QHBoxLayout(); layout3->addWidget(m_tbnComputerSpeed); layout3->addWidget(m_tbnComputerClinic); layout3->setContentsMargins(0,0,0,0); QVBoxLayout *mainLout = new QVBoxLayout(); mainLout->addLayout(layout1); mainLout->addLayout(layout2); mainLout->addLayout(layout3); mainLout->setContentsMargins(0,0,0,0); m_topTbnWidget->setLayout(mainLout); m_topTbnWidgetAction->setDefaultWidget(m_topTbnWidget); } void ComputerManager::initMidAction() { m_midWidget = new QWidget(); m_midWidgetAction = new QWidgetAction(m_trayMenu); m_speedLabel = new QLabel(tr("Auto backup")); m_SpeedBtn = new mySwitchButton(); m_SpeedBtn->setFixedSize(60,25); m_SpeedBtn->setObjectName(QString("TrayButtonAuto")); m_SpeedBtn->SetCheck(true); QHBoxLayout *m_midUpLayout = new QHBoxLayout(); m_midUpLayout->addWidget(m_speedLabel); m_midUpLayout->addWidget(m_SpeedBtn); m_troubleLabel = new QLabel(tr("Auto Start")); m_troubleLabel->setToolTip(tr("computer now ")); m_TroubleBtn = new mySwitchButton(); m_TroubleBtn->setFixedSize(60,25); m_TroubleBtn->setObjectName(QString("TrayButtonAuto")); m_TroubleBtn->SetCheck(true); QHBoxLayout *m_midBottomLayout = new QHBoxLayout(); m_midBottomLayout->addWidget(m_troubleLabel); m_midBottomLayout->addWidget(m_TroubleBtn); QVBoxLayout *m_midMainLayout = new QVBoxLayout(); m_midMainLayout->addLayout(m_midUpLayout); m_midMainLayout->addLayout(m_midBottomLayout); m_midWidget->setLayout(m_midMainLayout); m_midWidgetAction->setDefaultWidget(m_midWidget); } void ComputerManager::initBottomAction() { m_bottomWidget = new QWidget(); m_bottomWidgetAction = new QWidgetAction(m_trayMenu); m_ReportBtn = new QPushButton(QIcon(":/image/mainMenu/update.png"), tr("Update")); m_ReportBtn->setObjectName(QString("TrayButton")); m_ReportBtn->setFixedSize(60, 25); m_InformBtn = new QPushButton(QIcon(":/image/mainMenu/about.png"), tr("About")); m_InformBtn->setObjectName(QString("TrayButton")); m_InformBtn->setFixedSize(60, 25); m_exitBtn = new QPushButton(QIcon(":/image/mainMenu/quit.png"), tr("Exit")); m_exitBtn->setObjectName(QString("TrayButton")); m_exitBtn->setFixedSize(60, 25); QHBoxLayout* m_bottomLayout = new QHBoxLayout(); m_bottomLayout->addWidget(m_ReportBtn, 0, Qt::AlignCenter); m_bottomLayout->addWidget(m_InformBtn, 0, Qt::AlignCenter); m_bottomLayout->addWidget(m_exitBtn, 0, Qt::AlignCenter); m_bottomLayout->setSpacing(5); m_bottomLayout->setContentsMargins(5,5,5,5); m_bottomWidget->setLayout(m_bottomLayout); m_bottomWidgetAction->setDefaultWidget(m_bottomWidget); } void ComputerManager::initAction() { this->setToolTip(tr("Computer Manager")); this->setIcon(QIcon(":/image/system_tray.png")); m_trayMenu = new QM
评论
    相关推荐
    • Qt学习笔记.zip
      学习qt做的笔记,虽然不是很全面,但是囊括了常用知识点。希望多初学者有用。
    • QT5 编程入门.zip
      Qt [1] 是一个1991年由Qt Company开发的跨平台C++图形用户界面应用程序开发框架。它既可以开发GUI程序,也可用于开发非GUI程序,比如控制台工具和服务器。Qt是面向对象的框架,使用特殊的代码生成扩展(称为元对象...
    • QT线程示例
      QT线程示例,QT线程示例,QT线程示例,QT线程示例
    • 基于QT的地图web端界面
      基于QT的电子地图工具,基于百度离线地图
    • Qt5.7开发的树形控件
      Qt5.7开发的树形控件,支持批量勾选、取消勾选
    • QT界面窗口调用
      QT中窗口调用,适合qt初学者,简单但是实用。
    • Qt4 编程
      使用QT进行跨平台开发。QT支持GUI,网络等的开发
    • qt 嵌入式
      QT QT linux qt 嵌入式
    • Qt面试题.zip
      Qt面试基础题,Qt 是一个1991年由Qt Company开发的跨平台C++图形用户界面应用程序开发框架。它既可以开发GUI程序,也可用于开发非GUI程序,比如控制台工具和服务器。Qt是面向对象的框架,使用特殊的代码生成扩展...
    • qt库.rar
      qt在windows平台的运行链接库,如不安装Qt的win平台,运行qt程序很麻烦,这些链接库打 包到一起了,拷出来就能用。