Fix runtime errors in examples: arity mismatches, define placement, let vs let*
ober
6608874b819e350e0937b23be293ea3a086b5b75
--- a/examples/autocomplete.ss +++ b/examples/autocomplete.ss @@ -64,7 +64,7 @@ (qt-frame-set-frame-shadow! search-frame QT_FRAME_RAISED) ;; Attach completer - (qt-completer-set-case-sensitivity! completer #f) + (qt-completer-set-case-sensitivity! completer QT_CASE_INSENSITIVE) (qt-completer-set-filter-mode! completer QT_MATCH_CONTAINS) (qt-completer-set-max-visible-items! completer 10) (qt-line-edit-set-completer! search-edit completer) --- a/examples/diagram.ss +++ b/examples/diagram.ss @@ -9,7 +9,7 @@ (view (qt-graphics-view-create scene)) (canvas (qt-paint-widget-create)) (status (qt-label-create "Drag shapes in the scene, canvas paints live"))) - (qt-graphics-view-set-render-hint! view QT_RENDER_ANTIALIASING) + (qt-graphics-view-set-render-hint! view QT_RENDER_ANTIALIASING #t) (qt-graphics-view-set-drag-mode! view QT_DRAG_RUBBER_BAND) (qt-graphics-scene-set-background! scene 245 245 245) (let ((box1 (qt-graphics-scene-add-rect! scene 20 30 120 80))) @@ -39,7 +39,7 @@ (w (qt-paint-widget-width canvas)) (h (qt-paint-widget-height canvas))) (when painter - (qt-painter-fill-rect! painter 0 0 w h 30 30 50) + (qt-painter-fill-rect! painter 0 0 w h 30 30 50 255) (qt-painter-set-antialiasing! painter #t) (let loop ((i 0)) (when (< i 8) --- a/examples/dialogs.ss +++ b/examples/dialogs.ss @@ -43,13 +43,12 @@ (btn-color (qt-push-button-create "Color Dialog")) (btn-progress (qt-push-button-create "Progress Dialog"))) - (qt-plain-text-edit-set-read-only! log-area #t) - (qt-plain-text-edit-set-max-block-count! log-area 200) - - ;; Helper (define (log! msg) (qt-plain-text-edit-append! log-area msg)) + (qt-plain-text-edit-set-read-only! log-area #t) + (qt-plain-text-edit-set-max-block-count! log-area 200) + ;; === Input Dialogs === (qt-on-clicked! btn-text (lambda () --- a/examples/filemanager.ss +++ b/examples/filemanager.ss @@ -68,7 +68,7 @@ ;; Splitter (qt-splitter-add-widget! splitter tree) (qt-splitter-add-widget! splitter detail-widget) - (qt-splitter-set-sizes! splitter (list 500 300)) + (qt-splitter-set-sizes! splitter 500 300) (qt-splitter-set-stretch-factor! splitter 0 1) (qt-splitter-set-stretch-factor! splitter 1 0) --- a/examples/mdi.ss +++ b/examples/mdi.ss @@ -65,8 +65,8 @@ ;; create initial document (new-document!) ;; layout - (let ((central (qt-widget-create)) - (vlayout (qt-vbox-layout-create central))) + (let* ((central (qt-widget-create)) + (vlayout (qt-vbox-layout-create central))) (qt-layout-add-widget! vlayout mdi) (qt-layout-add-widget! vlayout status) (qt-main-window-set-central-widget! win central)) --- a/examples/painter.ss +++ b/examples/painter.ss @@ -19,7 +19,7 @@ (status-label (qt-label-create "QPainter Demo"))) ;; Fill background - (qt-pixmap-fill! canvas 30 30 30) + (qt-pixmap-fill! canvas 30 30 30 255) ;; Enable antialiasing (qt-painter-set-antialiasing! p #t) @@ -37,9 +37,9 @@ (loop (+ y 20)))) ;; Draw filled rectangles - (qt-painter-fill-rect! p 20 20 80 60 200 50 50) ;; Red - (qt-painter-fill-rect! p 120 20 80 60 50 200 50) ;; Green - (qt-painter-fill-rect! p 220 20 80 60 50 50 200) ;; Blue + (qt-painter-fill-rect! p 20 20 80 60 200 50 50 255) ;; Red + (qt-painter-fill-rect! p 120 20 80 60 50 200 50 255) ;; Green + (qt-painter-fill-rect! p 220 20 80 60 50 50 200 255) ;; Blue ;; Draw outlined rectangle with thick pen (qt-painter-set-pen-color! p 255 255 0) --- a/examples/styled.ss +++ b/examples/styled.ss @@ -55,7 +55,7 @@ ;; Set up splitter (qt-splitter-add-widget! splitter scroll) (qt-splitter-add-widget! splitter right-panel) - (qt-splitter-set-sizes! splitter (list 300 500)) + (qt-splitter-set-sizes! splitter 300 500) (qt-splitter-set-handle-width! splitter 4) ;; Key handler --- a/examples/terminal.ss +++ b/examples/terminal.ss @@ -18,29 +18,6 @@ ;; Active process (proc #f)) - ;; Configure output area - (qt-plain-text-edit-set-read-only! output #t) - (qt-plain-text-edit-set-max-block-count! output 10000) - - ;; Configure input - (qt-line-edit-set-placeholder! input "Enter command...") - - ;; Set monospace font - (let ((mono (qt-font-create "Monospace" 10))) - (qt-widget-set-font! output mono) - (qt-widget-set-font! input mono) - (qt-widget-set-font! prompt-label mono) - (qt-font-destroy! mono)) - - ;; Build input row - (qt-layout-add-widget! input-layout prompt-label) - (qt-layout-add-widget! input-layout input) - (qt-layout-add-widget! input-layout run-btn) - - ;; Build main layout - (qt-layout-add-widget! layout output) - (qt-layout-add-widget! layout input-box) - ;; Append text to output (define (append-output text) (qt-plain-text-edit-append! output text)) @@ -78,6 +55,29 @@ ;; Start via sh -c (qt-process-start! proc "/bin/sh" (list "-c" cmd))))) + ;; Configure output area + (qt-plain-text-edit-set-read-only! output #t) + (qt-plain-text-edit-set-max-block-count! output 10000) + + ;; Configure input + (qt-line-edit-set-placeholder! input "Enter command...") + + ;; Set monospace font + (let ((mono (qt-font-create "Monospace" 10))) + (qt-widget-set-font! output mono) + (qt-widget-set-font! input mono) + (qt-widget-set-font! prompt-label mono) + (qt-font-destroy! mono)) + + ;; Build input row + (qt-layout-add-widget! input-layout prompt-label) + (qt-layout-add-widget! input-layout input) + (qt-layout-add-widget! input-layout run-btn) + + ;; Build main layout + (qt-layout-add-widget! layout output) + (qt-layout-add-widget! layout input-box) + ;; Connect signals (qt-on-clicked! run-btn (lambda () (run-command))) (qt-on-return-pressed! input (lambda () (run-command)))