{"id":1228,"date":"2012-06-19T15:16:32","date_gmt":"2012-06-19T11:16:32","guid":{"rendered":"http:\/\/nayarweb.com\/blog\/?p=1228"},"modified":"2013-04-15T23:55:31","modified_gmt":"2013-04-15T19:55:31","slug":"my-first-qt-app-ft-linux-notifications","status":"publish","type":"post","link":"https:\/\/nayarweb.com\/blog\/2012\/my-first-qt-app-ft-linux-notifications\/","title":{"rendered":"My First Qt App ft. Linux Notifications"},"content":{"rendered":"<p>This is more than just a &#8220;Hello World&#8221; app. It uses the linux notification API to send global notifications.<\/p>\n<p><a href=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/06\/snapshot283.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1229\" title=\"snapshot283\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/06\/snapshot283-300x208.png\" alt=\"\" width=\"300\" height=\"208\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/06\/snapshot283-300x208.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2012\/06\/snapshot283.png 1010w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It is very easy to do this. It&#8217;s like working in Visual Basics.<br \/>\n&#8211; Create a button in the ui editor.<br \/>\n&#8211; Right-click on it then select &#8220;Go to slot&#8221;<br \/>\n&#8211; Select signal &#8220;clicked()&#8221;<\/p>\n<p>For following code will be created in mainwindow.cpp<\/p>\n<p><code>void MainWindow::on_pushButton_clicked()<br \/>\n{<br \/>\n}<\/code><\/p>\n<p>Now you can add the notify function between the curly brackets<\/p>\n<p><code>system(\"kdialog --title '*le Nayar testing' --passivepopup \\\"Hahaha, i still don't know how to fetch the text above :P\\\"\");<\/code><\/p>\n<p>You can alternatively use libnotify instead of kdialog. libnotify works in both GNOME and KDE.<\/p>\n<p><code>system(\"notify-send '*le Nayar testing' \\\"Hahaha, i still don't know how to fetch the text above :P\\\"\");<\/code><\/p>\n<p>Now i need to put some variables instead of hardcoding texts and play with the options provided by kdialog and libnotify \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is more than just a &#8220;Hello World&#8221; app. It uses the linux notification API to send global notifications. It is very easy to do this. It&#8217;s like working in Visual Basics. &#8211; Create a button in the ui editor. &#8211; Right-click on it then select &#8220;Go to slot&#8221; &#8211; Select signal &#8220;clicked()&#8221; For following &hellip; <a href=\"https:\/\/nayarweb.com\/blog\/2012\/my-first-qt-app-ft-linux-notifications\/\" class=\"continue-reading\">Continue reading <span class=\"screen-reader-text\">My First Qt App ft. Linux Notifications<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14,152,143,55,61],"class_list":["post-1228","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-c","tag-coding","tag-gnome","tag-kde","tag-linux"],"_links":{"self":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/1228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/comments?post=1228"}],"version-history":[{"count":5,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/1228\/revisions"}],"predecessor-version":[{"id":1652,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/1228\/revisions\/1652"}],"wp:attachment":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/media?parent=1228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/categories?post=1228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/tags?post=1228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}