1 line
5.7 KiB
JavaScript
1 line
5.7 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{161:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return u}));var a=n(0),r=n.n(a),o=r.a.createContext({}),i=function(e){var t=r.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):Object.assign({},t,e)),n},c=function(e){var t=i(e.components);return r.a.createElement(o.Provider,{value:t},e.children)};var l="mdxType",b={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},s=Object(a.forwardRef)((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&-1===t.indexOf(a)&&(n[a]=e[a]);return n}(e,["components","mdxType","originalType","parentName"]),s=i(n),u=a,p=s[c+"."+u]||s[u]||b[u]||o;return n?r.a.createElement(p,Object.assign({},{ref:t},l,{components:n})):r.a.createElement(p,Object.assign({},{ref:t},l))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=s;var c={};for(var b in t)hasOwnProperty.call(t,b)&&(c[b]=t[b]);c.originalType=e,c[l]="string"==typeof e?e:a,i[1]=c;for(var u=2;u<o;u++)i[u]=n[u];return r.a.createElement.apply(null,i)}return r.a.createElement.apply(null,n)}s.displayName="MDXCreateElement"},89:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return i})),n.d(t,"rightToc",(function(){return c})),n.d(t,"default",(function(){return s}));n(0);var a=n(161);function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i={sidebar_label:"QPushButton",title:"QPushButton"},c=[{value:"Example",id:"example",children:[]},{value:"new QPushButton(parent?)",id:"new-qpushbuttonparent",children:[]},{value:"Static Methods",id:"static-methods",children:[]},{value:"Instance Properties",id:"instance-properties",children:[]},{value:"Instance Methods",id:"instance-methods",children:[{value:"button.setText(text)",id:"buttonsettexttext",children:[]},{value:"button.setFlat(isFlat)",id:"buttonsetflatisflat",children:[]},{value:"button.setIcon(icon)",id:"buttonseticonicon",children:[]}]}],l={rightToc:c},b="wrapper";function s(e){var t=e.components,n=o(e,["components"]);return Object(a.b)(b,r({},l,n,{components:t,mdxType:"MDXLayout"}),Object(a.b)("blockquote",null,Object(a.b)("p",{parentName:"blockquote"},"Create and control buttons.")),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"This class is a JS wrapper around Qt's ",Object(a.b)("a",r({parentName:"strong"},{href:"https://doc.qt.io/qt-5/qpushbutton.html"}),"QPushButton class"))),Object(a.b)("p",null,"A ",Object(a.b)("inlineCode",{parentName:"p"},"QPushButton")," provides ability to add and manipulate native button widgets."),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"QPushButton inherits from ",Object(a.b)("a",r({parentName:"strong"},{href:"/docs/api/NodeWidget"}),"NodeWidget"))),Object(a.b)("h3",{id:"example"},"Example"),Object(a.b)("pre",null,Object(a.b)("code",r({parentName:"pre"},{className:"language-javascript"}),'const { QPushButton } = require("@nodegui/nodegui");\n\nconst button = new QPushButton();\nbutton.setText("Hello");\n')),Object(a.b)("h3",{id:"new-qpushbuttonparent"},Object(a.b)("inlineCode",{parentName:"h3"},"new QPushButton(parent?)")),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},Object(a.b)("inlineCode",{parentName:"li"},"parent")," NodeWidget (",Object(a.b)("em",{parentName:"li"},"optional"),"). Any widget inheriting from NodeWidget can be passed as a parent. This will make this widget, the child of the parent widget.")),Object(a.b)("h2",{id:"static-methods"},"Static Methods"),Object(a.b)("p",null,"QPushButton can access all the static methods defined in ",Object(a.b)("a",r({parentName:"p"},{href:"/docs/api/NodeWidget"}),"NodeWidget")),Object(a.b)("h2",{id:"instance-properties"},"Instance Properties"),Object(a.b)("p",null,"QPushButton can access all the instance properties defined in ",Object(a.b)("a",r({parentName:"p"},{href:"/docs/api/NodeWidget"}),"NodeWidget")),Object(a.b)("h2",{id:"instance-methods"},"Instance Methods"),Object(a.b)("p",null,"QPushButton can access all the instance methods defined in ",Object(a.b)("a",r({parentName:"p"},{href:"/docs/api/NodeWidget"}),"NodeWidget")),Object(a.b)("p",null,"Additionally it also has the following instance methods:"),Object(a.b)("h3",{id:"buttonsettexttext"},Object(a.b)("inlineCode",{parentName:"h3"},"button.setText(text)")),Object(a.b)("p",null,"Sets the given text to the button."),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},Object(a.b)("inlineCode",{parentName:"li"},"text")," string")),Object(a.b)("h3",{id:"buttonsetflatisflat"},Object(a.b)("inlineCode",{parentName:"h3"},"button.setFlat(isFlat)")),Object(a.b)("p",null,"Sets whether the button border is raised."),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},Object(a.b)("inlineCode",{parentName:"li"},"isFlat")," boolean")),Object(a.b)("h3",{id:"buttonseticonicon"},Object(a.b)("inlineCode",{parentName:"h3"},"button.setIcon(icon)")),Object(a.b)("p",null,"Sets an icon in the button."),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},Object(a.b)("inlineCode",{parentName:"li"},"icon")," QIcon")))}s.isMDXComponent=!0}}]); |