#include "SysTray.h"
#include <QApplication>

SysTray::SysTray(QObject *parent) :
    QSystemTrayIcon(parent)
{
    _CreatMenu();

    setIcon(QIcon(":images/fm.ico"));
}

void SysTray::_CreatMenu()
{
    m_menu = new QMenu();
    m_menu->setObjectName("trayMenu");
    QAction *acQuit = new QAction("退出", m_menu);
    connect(acQuit, &QAction::triggered, this, &SysTray::onActionQuitTriggered);

    m_menu->addAction(acQuit);
    setContextMenu(m_menu);
}

void SysTray::onActionQuitTriggered()
{
    qApp->exit();
}
