{"id":6100,"date":"2012-12-03T06:11:01","date_gmt":"2012-12-03T06:11:01","guid":{"rendered":"http:\/\/www.notmart.org\/index.php\/Software\/New_QML_components:_Know_thy_dia"},"modified":"2012-12-03T06:11:01","modified_gmt":"2012-12-03T06:11:01","slug":"new_qml_components_know_thy_dia","status":"publish","type":"post","link":"https:\/\/notmart.org\/blog\/2012\/12\/new_qml_components_know_thy_dia\/","title":{"rendered":"New QML components: Know thy dialogs"},"content":{"rendered":"<p>Today part of &#8220;what to expect in 4.10 in QML components&#8221;: <strong>Dialog<\/strong>. The Dialog components have been introduced in plasma since sone time, and are documented in the <a href=\"http:\/\/api.kde.org\/4.x-api\/plasma-qml-apidocs\/\">usual page<\/a>. The components that may be used to create a dialog are:<\/p>\n<ul>\n<li><strong>Dialog<\/strong>: unsurprising name: it creates a Plasma themed window with space for a title, a content and buttons. You have to create all of them, you&#8217;re on your own, but provides the window management and methods such as open(), close(), accepted() and rejected(). You usually don&#8217;t want to use this, unless you want some strange custom things in the titlebar area or in the buttons area.<\/li>\n<li><strong>CommonDialog<\/strong>: is a Dialog, but provides a titlebar and the buttons, you want to use this in the 90% of the cases when you want to display custom content in a dialog.<\/li>\n<li><strong>SelectionDialog<\/strong>: presents the user a list of items to chose from, useful to create menus when you want to modally ask &#8220;what of those items do you want?&#8221;<\/li>\n<li><strong>QueryDialog<\/strong>: probably the most useful: is a simple dialog with text and two buttons. Used for things like confirmation dialogs like &#8220;are you sure you want to delete this item?&#8221;. It displays a text and two buttons, that default as &#8220;Ok&#8221; and &#8220;Cancel&#8221;, but their text is customizable.<\/li>\n<\/ul>\n<p>It&#8217;s a while this API exists, but in 4.10 there was an important change in its look and feel in 4.10: Now if it&#8217;s possible the dialogs looks &#8220;inline&#8221;. It will be done on the same window as the plasmoid (i.e. on the &#8220;desktop&#8221;) and if provided with a <em>visualParent<\/em> property, it will have a comic balloon tip pointing to it. As usual, an image is worth a thousand words:<\/p>\n<p><img decoding=\"async\" style=\"clear:both;float:none;\" src=\"http:\/\/www.notmart.org\/images\/dialog-410-desktop.png\" alt=\"Dialogs on desktop\"\/><\/p>\n<p>But what about if there isn&#8217;t enough space? For instance the dialog may be displayed from a Panel, where is impossible to have an inline dialog. Fear not, in this case the dialog will become a separate window, still working everywhere:<\/p>\n<p><img decoding=\"async\" style=\"clear:both;float:none;\" src=\"http:\/\/www.notmart.org\/images\/dialog-410-panel.png\" alt=\"Dialogs on panel\"\/><\/p>\n<p>An &#8220;inline&#8221; behavior for dialogs is preferred because in this way questions are semantically and visually grouped with the object they belong to, and most important the desktop layer must not &#8220;interrupt&#8221; the user, it&#8217;s just background information.<\/p>\n<p>The switch between an inline behavior and an external window is completely automatic, as usual, something that the plasmoid should never have to worry about.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today part of &#8220;what to expect in 4.10 in QML components&#8221;: Dialog. The Dialog components have been introduced in plasma since sone time, and are documented in the usual page. The components that may be used to create a dialog are: Dialog: unsurprising name: it creates a Plasma themed window with space for a title, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[17,2,10,7,18],"class_list":["post-6100","post","type-post","status-publish","format-standard","hentry","category-software","tag-components","tag-kde","tag-kde4","tag-plasma","tag-qml"],"_links":{"self":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/posts\/6100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/comments?post=6100"}],"version-history":[{"count":0,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/posts\/6100\/revisions"}],"wp:attachment":[{"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/media?parent=6100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/categories?post=6100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notmart.org\/blog\/wp-json\/wp\/v2\/tags?post=6100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}