Git Product home page Git Product logo

qt-notification-manager-v2's Introduction

Qt通知控件

仿Windows通知,多个通知显示,定时消失,支持出现/消失动画

和之前版本相比,使用了另一套控件:InteractiveButton,提高交互操作

允许两种使用方式:

  • 局部通知,通过信号槽和 Lambda 直接获取通知的操作方式
  • 全部通知,触发信号给其他控件使用

另外支持卡片本身、附加三个按钮的点击事件

picture

部署

开发环境:Qt13.1(理论上相近版本亦可)

用法

头文件

需要在工程pro文件中包含头文件

#include "tipbox.h"

初始化

tip_box = new TipBox(this);
connect(tip_box, &TipBox::signalCardClicked, [=](NotificationEntry* n){
    qDebug() << n->toString();
});
connect(tip_box, &TipBox::signalBtnClicked, [=](NotificationEntry* n){
    qDebug() << n->toString();
});

添加通知

在窗口右下角添加一个通知卡片,5秒钟后定时消失

NotificationEntry* noti = new NotificationEntry("key", "title", "content1");
noti->setBtn(1, "btn1", "cmd1"); // 全局信号可接收
noti->setBtn(2, "btn2", "cmd2");
tip_box->createTipCard(noti);

connect()

自动调整大小

在修改窗口大小的时候,固定通知Box在右下角

void MainWindow::resizeEvent(QResizeEvent*)
{
    tip_box->adjustPosition();
}

qt-notification-manager-v2's People

Contributors

iwxyi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.