55 RendererStyleFlags2 ,
66 RendererType2
77} from '@angular/core' ;
8- import { QWidget , QLabel , FlexLayout } from '@nodegui/nodegui' ;
8+ import { QWidget , QPushButton , QLabel , FlexLayout } from '@nodegui/nodegui' ;
99import { QWindowService } from './window' ;
1010
1111@Injectable ( )
@@ -32,12 +32,13 @@ export class NodeguiRenderer implements Renderer2 {
3232 constructor ( private window : QWindowService ) { }
3333
3434 createElement ( name : string , namespace ?: string | null ) : any {
35- const centralWidget = new QWidget ( ) ;
36- return centralWidget . setObjectName ( 'myroot' ) ;
35+ const button = new QPushButton ( ) ;
36+ button . setObjectName ( 'button' ) ;
37+ return button ;
3738 }
3839
3940 createText ( value : string ) : any {
40- const label = new QLabel ( ) ;
41+ const label = new QLabel ( ) ; // may be use Qwidget? need for set button to text
4142 label . setText ( value ) ;
4243 label . setInlineStyle ( `
4344 color: red;
@@ -53,15 +54,21 @@ export class NodeguiRenderer implements Renderer2 {
5354
5455 appendChild ( parent : FlexLayout , newChild : any ) : void {
5556 if ( newChild ) {
56- parent . addWidget ( newChild ) ;
57+ if ( parent instanceof QPushButton && newChild instanceof QLabel ) {
58+ parent . setText ( newChild . text ) ;
59+ } else {
60+ parent . addWidget ( newChild ) ;
61+ }
5762 }
5863 }
5964
6065 createComment ( value : string ) : any { }
6166
6267 destroy ( ) : void { }
6368
64- insertBefore ( parent : any , newChild : any , refChild : any ) : void { }
69+ insertBefore ( parent : any , newChild : any , refChild : any ) : void {
70+ console . log ( 'insertBefore' ) ;
71+ }
6572
6673 listen (
6774 target : any ,
@@ -71,7 +78,9 @@ export class NodeguiRenderer implements Renderer2 {
7178 return ( ) => { } ;
7279 }
7380
74- nextSibling ( node : any ) : any { }
81+ nextSibling ( node : any ) : any {
82+ console . log ( 'nextSibling' ) ;
83+ }
7584
7685 parentNode ( node : any ) : any { }
7786
@@ -110,6 +119,7 @@ export class NodeguiRenderer implements Renderer2 {
110119 }
111120
112121 setValue ( node : any , value : string ) : void {
122+ // use new values may be button not set text, may be use widget for text?
113123 node . setText ( value ) ;
114124 }
115125}
0 commit comments