使用Qt显示ubuntu(Linux)通知 [英] Show ubuntu (linux) notifications with Qt

查看:275
本文介绍了使用Qt显示ubuntu(Linux)通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Qt上使用Phonon多媒体框架,它会弹出一条消息(如音量更改消息会在音量改变时弹出),因为我的音频设备未完全配置,是否可以启动我自己的通知来自Qt?

I was working with Phonon multimedia framework in Qt, and it popups a message (like the volume notification message that popups when one changes the volume), because my audio device is not fully configurated, is it possible to launch my own notification from Qt?

请参见上图.

非常感谢您.

推荐答案

使用libnotify的AFAIK是可行的方法,如果您不想使用这种方法,我会在网上进行一些挖掘后发现:

AFAIK using libnotify is the way to go, if you dont want to use this method I found after some digging around on the net:

system("notify-send 'The Message Title' 'Your Message Text' '-t' 5000");

-t参数用于通知超时.

the -t parameter is for the notification timeout.

您可以在此处阅读有关通知发送的信息:

you can read up on notify-send here:

ubuntu论坛操作方法:使用通知发送

一个很好的示例,说明如何使用KDE和GNOME中的Qt

感谢发布教程的好心人:)特别是第二篇;非常聪明.

Thanks to the kind persons who posted the tutorials :) especially the second one; very smart.

这篇关于使用Qt显示ubuntu(Linux)通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆