本文主要是介绍QLocalServer/QLocalSocket 实现保证程序只有一个实例,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、单实例封装类:
头文件:
/*LANShare - LAN file transfer.Copyright (C) 2016 Abdul Aris R. <abdularisrahmanudin10@gmail.com>This program is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.
*/#ifndef SINGLEINSTANCE_H
#define SINGLEINSTANCE_H#include <QObject>
#include <QtNetwork/QLocalServer>/** SingleInstance, di
这篇关于QLocalServer/QLocalSocket 实现保证程序只有一个实例的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!