⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trayicon_kde.cpp

📁 张勇的linQ学习P2P及IM软件的极佳素材代码
💻 CPP
字号:
#include "trayicon.h"
#include <qtooltip.h>
#include <qapplication.h>
#include <ksystemtray.h>


class TrayIcon::TrayIconPrivate : public KSystemTray {
public:
	TrayIconPrivate(TrayIcon *icon, QWidget *parent = 0, const char *name = 0)
		: KSystemTray(parent, name), iconObject(icon) {}

private:
	virtual bool event(QEvent *e) {
		QEvent::Type type = e->type();
		if (type == QEvent::MouseButtonPress ||
			type == QEvent::MouseButtonRelease ||
			type == QEvent::MouseButtonDblClick ||
			type == QEvent::MouseMove)
			return QApplication::sendEvent(iconObject, e);

		return KSystemTray::event(e);
	}

	TrayIcon *iconObject;
};


void TrayIcon::sysInstall()
{
	if (!d)
		d = new TrayIconPrivate(this);
	d->setPixmap(pm);
	d->show();
}

void TrayIcon::sysRemove()
{
	if (d) {
		delete d;
		d = 0;
	}
}

void TrayIcon::sysUpdateIcon()
{
	if (d)
		d->setPixmap(pm);
}

void TrayIcon::sysUpdateToolTip()
{
	QToolTip::remove(d);
	QToolTip::add(d, tip);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -