R
R
Robotex2011-02-04 13:36:11
Qt
Robotex, 2011-02-04 13:36:11

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

4 answer(s)
A
Alexey Skobkin, 2011-02-04
@skobkin

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.

W
wholeman, 2011-02-04
@wholeman

Qt::WA_TransparentForMouseEvents window attribute doesn't help?

R
Robotex, 2011-02-04
@Robotex

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();
    }
}

But there is some way. How do monitors draw on top of all windows when you press the settings button?

D
demogorgorn, 2011-04-02
@demogorgorn

slow-tone.blogspot.com/2011/04/qt-pretty-osd.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question