My First Qt App ft. Linux Notifications

This is more than just a “Hello World” app. It uses the linux notification API to send global notifications.

It is very easy to do this. It’s like working in Visual Basics.
– Create a button in the ui editor.
– Right-click on it then select “Go to slot”
– Select signal “clicked()”

For following code will be created in mainwindow.cpp

void MainWindow::on_pushButton_clicked()
{
}

Now you can add the notify function between the curly brackets

system("kdialog --title '*le Nayar testing' --passivepopup \"Hahaha, i still don't know how to fetch the text above :P\"");

You can alternatively use libnotify instead of kdialog. libnotify works in both GNOME and KDE.

system("notify-send '*le Nayar testing' \"Hahaha, i still don't know how to fetch the text above :P\"");

Now i need to put some variables instead of hardcoding texts and play with the options provided by kdialog and libnotify 😉

3 thoughts on “My First Qt App ft. Linux Notifications

Leave a Reply

Your email address will not be published. Required fields are marked *