qtqq 2/28 (ppa完成)
- phoenixlzx
- 帖子: 2245
- 注册时间: 2009-07-29 20:11
- 系统: Arch Linux
- 来自: Gensokyo
- 联系:
- phoenixlzx
- 帖子: 2245
- 注册时间: 2009-07-29 20:11
- 系统: Arch Linux
- 来自: Gensokyo
- 联系:
-
- 帖子: 312
- 注册时间: 2010-02-01 19:24
-
- 帖子: 306
- 注册时间: 2010-04-02 21:17
Re: qtqq~
diff oldqq/zhanlangsir-Qtqq-c3c187c/mainpanel.h zhanlangsir-Qtqq-c3c187c/mainpanel.h
代码: 全选
8a9,10
> #include<QSystemTrayIcon>
> #include<QMenu>
50a53
> void iconActivated(QSystemTrayIcon::ActivationReason reason);
60a64,66
> void createTrayIcon();
> void createActions();
>
79a86,90
> QSystemTrayIcon *trayIcon;
> QAction *minimizeAction;
> QAction *restoreAction;
> QAction *quitAction;
> QMenu *trayIconMenu;
代码: 全选
46a47,51
> createActions();
> createTrayIcon();
> connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
> this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
>
429a435,474
> }
> void QQMainPanel::createActions()
> {
> minimizeAction = new QAction(tr("Mi&nimize"), this);
> connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
>
> restoreAction = new QAction(tr("&Restore"), this);
> connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));
>
> quitAction = new QAction(tr("&Quit"), this);
> connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
> }
> void QQMainPanel::createTrayIcon()
> {
> trayIconMenu = new QMenu(this);
> trayIconMenu->addAction(minimizeAction);
> trayIconMenu->addAction(restoreAction);
> trayIconMenu->addSeparator();
> trayIconMenu->addAction(quitAction);
>
> QIcon icon(":/new/common/images/WebQQ.ico");
> trayIcon = new QSystemTrayIcon(this);
> trayIcon->setContextMenu(trayIconMenu);
> trayIcon->setIcon(icon);
> setWindowIcon(icon);
> trayIcon->show();
>
> }
> void QQMainPanel::iconActivated(QSystemTrayIcon::ActivationReason reason)
> {
> switch (reason) {
> case QSystemTrayIcon::Trigger:
> if(this->isVisible())
> hide();
> else
> showNormal();
> break;
> default:
> ;
> }
代码: 全选
21c21,24
< <qresource prefix="/new/common"/>
---
> <qresource prefix="/new/common">
> <file>images/WebQQ.ico</file>
> </qresource>
> <qresource prefix="/"/>
- 附件
-
- mainpanel.cpp
- (14.78 KiB) 已下载 95 次
-
- mainpanel.h
- (2.17 KiB) 已下载 83 次
上次由 Mazenvoy 在 2012-03-28 10:49,总共编辑 3 次。