Answer the question
In order to leave comments, you need to log in
OSD messages using Qt4?
There is a wonderful XOSD project ( ignavus.net/software.html ). Easy to use, simple, non-resource-intensive and generally would be ideal, if not for one thing - it only works under Linux. For me, this is not a problem, but a lot of the target audience uses other operating systems. How to do exactly the same using Qt4? I need absolutely the same thing, but cross-platform.
Answer the question
In order to leave comments, you need to log in
Once I saw something in Windows that does not intercept the mouse. However, by and large, all implementations of notifications that I have seen anywhere under Windows catch it.
As an option, use selectively different types of notifications depending on the platform. So many do.
Here's what I wrote, suits everything, except that the mouse is intercepted:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QKeyEvent>
#include <QGraphicsDropShadowEffect>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setWindowFlags(Qt::Window
| Qt::WindowStaysOnTopHint
| Qt::X11BypassWindowManagerHint
| Qt::FramelessWindowHint);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_TransparentForMouseEvents, true);
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
effect->setBlurRadius(0);
effect->setColor(QColor("#000000"));
effect->setOffset(1,1);
ui->label->setGraphicsEffect(effect);
QString fonttemplate = tr("<font color='%1'>%2</font>");
ui->label->setText(fonttemplate.arg("#00FF00", "OSD Message"));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape) {
qApp->quit();
}
}
void MainWindow::mousePressEvent ( QMouseEvent * event )
{
if( event->button())
{
qApp->quit();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question