qtrs 0.3.0

qtrs - A type-safe, builder-pattern-driven Qt6 GUI library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
// src/ffi.rs — cxx bridge declarations for qtrs
//
// All C++ functions are free functions (not member functions), so we use
// raw `*mut T` parameters instead of `self: &T`.

#[cxx::bridge]
pub mod ffi_inner {

    // ========================================================================
    // Qt Core
    // ========================================================================

    unsafe extern "C++" {
        include!("src/cpp/qt_widget.h");

        // --- Qt opaque types ---
        type QApplication;
        type QWidget;
        type QPushButton;
        type QLabel;
        type QLineEdit;
        type QCheckBox;
        type QComboBox;
        type QTextEdit;
        type QSlider;
        type QProgressBar;
        type QTimer;
        type QVBoxLayout;
        type QHBoxLayout;
        type QGridLayout;
        type QLayout;
        type QRadioButton;
        type QGroupBox;
        type QTabWidget;
        type QSpinBox;
        type QMenu;
        type QMenuBar;
        type QIcon;
        type QPoint;
        type QListWidget;
        type QAction;
        type QMainWindow;
        type QToolBar;
        type QStatusBar;
        type QMessageBox;
        type QProgressDialog;
        type QTableWidget;
        type QTreeWidget;
        type QScrollArea;
        type QStackedWidget;
        type QSplitter;

        // --- QObject (base class for signal-slot connections) ---
        type QObject;

        // --- Generic signal-slot connection ---
        unsafe fn QObject_connect(
            sender: *mut QObject,
            sig: &CxxString,
            receiver: *mut QObject,
            slt: &CxxString,
            conn_type: i32,
        ) -> bool;

        unsafe fn QObject_disconnect(
            sender: *mut QObject,
            sig: &CxxString,
            receiver: *mut QObject,
            slt: &CxxString,
        ) -> bool;

        // --- Thread safety ---
        unsafe fn QObject_isInGuiThread() -> bool;

        // --- Trampolines ---
        unsafe fn qtrs_setVoidTrampoline(trampoline: unsafe extern "C" fn(u64));
        unsafe fn qtrs_setBoolTrampoline(trampoline: unsafe extern "C" fn(u64, bool));
        unsafe fn qtrs_setIntTrampoline(trampoline: unsafe extern "C" fn(u64, i32));
        unsafe fn qtrs_setStringTrampoline(trampoline: unsafe extern "C" fn(u64, String));

        // --- QApplication ---
        unsafe fn QApplication_new() -> *mut QApplication;
        unsafe fn QApplication_exec(app: *mut QApplication) -> i32;
        unsafe fn QApplication_setWindowIcon(app: *mut QApplication, icon_path: &CxxString);
        unsafe fn QApplication_setDesktopFileName(app: *mut QApplication, name: &CxxString);

        // --- QWidget ---
        unsafe fn QWidget_new(parent: *mut QWidget) -> *mut QWidget;
        unsafe fn QWidget_show(widget: *mut QWidget);
        unsafe fn QWidget_hide(widget: *mut QWidget);
        unsafe fn QWidget_setWindowTitle(widget: *mut QWidget, title: &CxxString);
        unsafe fn QWidget_resize(widget: *mut QWidget, width: i32, height: i32);
        unsafe fn QWidget_delete(widget: *mut QWidget);
        unsafe fn QWidget_setLayout(widget: *mut QWidget, layout: *mut QLayout);
        unsafe fn QWidget_setWindowIcon(widget: *mut QWidget, icon_path: &CxxString);
        unsafe fn QWidget_move(widget: *mut QWidget, x: i32, y: i32);
        unsafe fn QWidget_moveToPoint(widget: *mut QWidget, point: *mut QPoint);

        // --- Common QWidget properties ---
        unsafe fn QWidget_setEnabled(widget: *mut QWidget, enabled: bool);
        unsafe fn QWidget_setVisible(widget: *mut QWidget, visible: bool);
        unsafe fn QWidget_setToolTip(widget: *mut QWidget, tip: &CxxString);
        unsafe fn QWidget_setMinimumSize(widget: *mut QWidget, width: i32, height: i32);
        unsafe fn QWidget_setMaximumSize(widget: *mut QWidget, width: i32, height: i32);
        unsafe fn QWidget_setFixedSize(widget: *mut QWidget, width: i32, height: i32);
        unsafe fn QWidget_setStyleSheet(widget: *mut QWidget, css: &CxxString);
        unsafe fn QWidget_disconnectAll(widget: *mut QWidget);

        // --- toQWidget upcasts ---
        unsafe fn toQWidget_QWidget(w: *mut QWidget) -> *mut QWidget;
        unsafe fn toQWidget_QPushButton(btn: *mut QPushButton) -> *mut QWidget;
        unsafe fn toQWidget_QLabel(label: *mut QLabel) -> *mut QWidget;
        unsafe fn toQWidget_QLineEdit(edit: *mut QLineEdit) -> *mut QWidget;
        unsafe fn toQWidget_QCheckBox(cb: *mut QCheckBox) -> *mut QWidget;
        unsafe fn toQWidget_QComboBox(cb: *mut QComboBox) -> *mut QWidget;
        unsafe fn toQWidget_QTextEdit(edit: *mut QTextEdit) -> *mut QWidget;
        unsafe fn toQWidget_QSlider(s: *mut QSlider) -> *mut QWidget;
        unsafe fn toQWidget_QProgressBar(bar: *mut QProgressBar) -> *mut QWidget;
        unsafe fn toQWidget_QRadioButton(rb: *mut QRadioButton) -> *mut QWidget;
        unsafe fn toQWidget_QGroupBox(gb: *mut QGroupBox) -> *mut QWidget;
        unsafe fn toQWidget_QTabWidget(tw: *mut QTabWidget) -> *mut QWidget;
        unsafe fn toQWidget_QSpinBox(sb: *mut QSpinBox) -> *mut QWidget;
        unsafe fn toQWidget_QMenu(menu: *mut QMenu) -> *mut QWidget;
        unsafe fn toQWidget_QMenuBar(mb: *mut QMenuBar) -> *mut QWidget;

        // --- QPushButton ---
        unsafe fn QPushButton_new(text: &CxxString, parent: *mut QWidget) -> *mut QPushButton;
        unsafe fn QPushButton_show(btn: *mut QPushButton);
        unsafe fn QPushButton_setText(btn: *mut QPushButton, text: &CxxString);
        unsafe fn QPushButton_delete(btn: *mut QPushButton);
        unsafe fn QPushButton_onClicked(btn: *mut QPushButton, ctx: u64);

        // --- QLabel ---
        unsafe fn QLabel_new(text: &CxxString, parent: *mut QWidget) -> *mut QLabel;
        unsafe fn QLabel_setText(label: *mut QLabel, text: &CxxString);
        unsafe fn QLabel_delete(label: *mut QLabel);

        // --- QLineEdit ---
        unsafe fn QLineEdit_new(text: &CxxString, parent: *mut QWidget) -> *mut QLineEdit;
        unsafe fn QLineEdit_text(edit: *mut QLineEdit) -> String;
        unsafe fn QLineEdit_setText(edit: *mut QLineEdit, text: &CxxString);
        unsafe fn QLineEdit_delete(edit: *mut QLineEdit);
        unsafe fn QLineEdit_onReturnPressed(edit: *mut QLineEdit, ctx: u64);

        // --- QCheckBox ---
        unsafe fn QCheckBox_new(text: &CxxString, parent: *mut QWidget) -> *mut QCheckBox;
        unsafe fn QCheckBox_isChecked(cb: *mut QCheckBox) -> bool;
        unsafe fn QCheckBox_setChecked(cb: *mut QCheckBox, checked: bool);
        unsafe fn QCheckBox_delete(cb: *mut QCheckBox);
        unsafe fn QCheckBox_onToggled(cb: *mut QCheckBox, ctx: u64);

        // --- QComboBox ---
        unsafe fn QComboBox_new(parent: *mut QWidget) -> *mut QComboBox;
        unsafe fn QComboBox_addItem(cb: *mut QComboBox, text: &CxxString);
        unsafe fn QComboBox_currentText(cb: *mut QComboBox) -> String;
        unsafe fn QComboBox_setCurrentIndex(cb: *mut QComboBox, index: i32);
        unsafe fn QComboBox_delete(cb: *mut QComboBox);
        unsafe fn QComboBox_onCurrentTextChanged(cb: *mut QComboBox, ctx: u64);
        unsafe fn QComboBox_onCurrentIndexChanged(cb: *mut QComboBox, ctx: u64);

        // --- QTextEdit ---
        unsafe fn QTextEdit_new(parent: *mut QWidget) -> *mut QTextEdit;
        unsafe fn QTextEdit_toPlainText(edit: *mut QTextEdit) -> String;
        unsafe fn QTextEdit_setPlainText(edit: *mut QTextEdit, text: &CxxString);
        unsafe fn QTextEdit_setPlaceholderText(edit: *mut QTextEdit, text: &CxxString);
        unsafe fn QTextEdit_delete(edit: *mut QTextEdit);
        unsafe fn QTextEdit_onTextChanged(edit: *mut QTextEdit, ctx: u64);

        // --- QSlider ---
        unsafe fn QSlider_new(orientation: i32, parent: *mut QWidget) -> *mut QSlider;
        unsafe fn QSlider_value(s: *mut QSlider) -> i32;
        unsafe fn QSlider_setValue(s: *mut QSlider, value: i32);
        unsafe fn QSlider_setRange(s: *mut QSlider, min: i32, max: i32);
        unsafe fn QSlider_delete(s: *mut QSlider);
        unsafe fn QSlider_onValueChanged(s: *mut QSlider, ctx: u64);

        // --- QProgressBar ---
        unsafe fn QProgressBar_new(parent: *mut QWidget) -> *mut QProgressBar;
        unsafe fn QProgressBar_setValue(bar: *mut QProgressBar, value: i32);
        unsafe fn QProgressBar_value(bar: *mut QProgressBar) -> i32;
        unsafe fn QProgressBar_setRange(bar: *mut QProgressBar, min: i32, max: i32);
        unsafe fn QProgressBar_setMinimum(bar: *mut QProgressBar, min: i32);
        unsafe fn QProgressBar_setMaximum(bar: *mut QProgressBar, max: i32);
        unsafe fn QProgressBar_setFormat(bar: *mut QProgressBar, format: &CxxString);
        unsafe fn QProgressBar_delete(bar: *mut QProgressBar);

        // --- QVBoxLayout ---
        unsafe fn QVBoxLayout_new(parent: *mut QWidget) -> *mut QVBoxLayout;
        unsafe fn QVBoxLayout_addWidget(layout: *mut QVBoxLayout, widget: *mut QWidget);
        unsafe fn QVBoxLayout_delete(layout: *mut QVBoxLayout);
        unsafe fn QVBoxLayout_setSpacing(layout: *mut QVBoxLayout, spacing: i32);
        unsafe fn QVBoxLayout_setContentsMargins(
            layout: *mut QVBoxLayout,
            left: i32,
            top: i32,
            right: i32,
            bottom: i32,
        );

        // --- QHBoxLayout ---
        unsafe fn QHBoxLayout_new(parent: *mut QWidget) -> *mut QHBoxLayout;
        unsafe fn QHBoxLayout_addWidget(layout: *mut QHBoxLayout, widget: *mut QWidget);
        unsafe fn QHBoxLayout_delete(layout: *mut QHBoxLayout);
        unsafe fn QHBoxLayout_setSpacing(layout: *mut QHBoxLayout, spacing: i32);
        unsafe fn QHBoxLayout_setContentsMargins(
            layout: *mut QHBoxLayout,
            left: i32,
            top: i32,
            right: i32,
            bottom: i32,
        );

        // --- QGridLayout ---
        unsafe fn QGridLayout_new(parent: *mut QWidget) -> *mut QGridLayout;
        unsafe fn QGridLayout_addWidget(
            layout: *mut QGridLayout,
            widget: *mut QWidget,
            row: i32,
            col: i32,
            rowSpan: i32,
            colSpan: i32,
        );
        unsafe fn QGridLayout_delete(layout: *mut QGridLayout);

        // --- findChild helpers (for widgets loaded from .ui files) ---
        unsafe fn QWidget_findWidget(parent: *mut QWidget, name: &CxxString) -> *mut QWidget;
        unsafe fn QWidget_findPushButton(parent: *mut QWidget, name: &CxxString) -> *mut QPushButton;
        unsafe fn QWidget_findLineEdit(parent: *mut QWidget, name: &CxxString) -> *mut QLineEdit;
        unsafe fn QWidget_findCheckBox(parent: *mut QWidget, name: &CxxString) -> *mut QCheckBox;
        unsafe fn QWidget_findLabel(parent: *mut QWidget, name: &CxxString) -> *mut QLabel;
        unsafe fn QWidget_findComboBox(parent: *mut QWidget, name: &CxxString) -> *mut QComboBox;
        unsafe fn QWidget_findSlider(parent: *mut QWidget, name: &CxxString) -> *mut QSlider;
        unsafe fn QWidget_findTextEdit(parent: *mut QWidget, name: &CxxString) -> *mut QTextEdit;
        unsafe fn QWidget_findProgressBar(parent: *mut QWidget, name: &CxxString) -> *mut QProgressBar;
        unsafe fn QWidget_findRadioButton(parent: *mut QWidget, name: &CxxString) -> *mut QRadioButton;
        unsafe fn QWidget_findGroupBox(parent: *mut QWidget, name: &CxxString) -> *mut QGroupBox;
        unsafe fn QWidget_findTabWidget(parent: *mut QWidget, name: &CxxString) -> *mut QTabWidget;
        unsafe fn QWidget_findSpinBox(parent: *mut QWidget, name: &CxxString) -> *mut QSpinBox;
        unsafe fn QWidget_findListWidget(parent: *mut QWidget, name: &CxxString) -> *mut QListWidget;
        unsafe fn QWidget_findProgressDialog(parent: *mut QWidget, name: &CxxString) -> *mut QProgressDialog;
        unsafe fn QWidget_findScrollArea(parent: *mut QWidget, name: &CxxString) -> *mut QScrollArea;
        unsafe fn QWidget_findTableWidget(parent: *mut QWidget, name: &CxxString) -> *mut QTableWidget;
        unsafe fn QWidget_findTreeWidget(parent: *mut QWidget, name: &CxxString) -> *mut QTreeWidget;
        unsafe fn QWidget_findStackedWidget(parent: *mut QWidget, name: &CxxString) -> *mut QStackedWidget;
        unsafe fn QWidget_findSplitter(parent: *mut QWidget, name: &CxxString) -> *mut QSplitter;

        // --- QTimer ---
        unsafe fn QTimer_new() -> *mut QTimer;
        unsafe fn QTimer_start(timer: *mut QTimer, interval_ms: i32);
        unsafe fn QTimer_stop(timer: *mut QTimer);
        unsafe fn QTimer_isActive(timer: *mut QTimer) -> bool;
        unsafe fn QTimer_delete(timer: *mut QTimer);
        unsafe fn QTimer_onTimeout(timer: *mut QTimer, ctx: u64);
        unsafe fn QTimer_singleShot(interval_ms: i32, ctx: u64);

        // --- QMessageBox ---
        unsafe fn QMessageBox_information(
            parent: *mut QWidget,
            title: &CxxString,
            text: &CxxString,
        );
        unsafe fn QMessageBox_warning(
            parent: *mut QWidget,
            title: &CxxString,
            text: &CxxString,
        );
        unsafe fn QMessageBox_critical(
            parent: *mut QWidget,
            title: &CxxString,
            text: &CxxString,
        );
        unsafe fn QMessageBox_question(
            parent: *mut QWidget,
            title: &CxxString,
            text: &CxxString,
        ) -> i32;

        // --- QRadioButton ---
        unsafe fn QRadioButton_new(text: &CxxString, parent: *mut QWidget) -> *mut QRadioButton;
        unsafe fn QRadioButton_isChecked(rb: *mut QRadioButton) -> bool;
        unsafe fn QRadioButton_setChecked(rb: *mut QRadioButton, checked: bool);
        unsafe fn QRadioButton_delete(rb: *mut QRadioButton);
        unsafe fn QRadioButton_onToggled(rb: *mut QRadioButton, ctx: u64);

        // --- QGroupBox ---
        unsafe fn QGroupBox_new(title: &CxxString, parent: *mut QWidget) -> *mut QGroupBox;
        unsafe fn QGroupBox_setTitle(gb: *mut QGroupBox, title: &CxxString);
        unsafe fn QGroupBox_delete(gb: *mut QGroupBox);

        // --- QTabWidget ---
        unsafe fn QTabWidget_new(parent: *mut QWidget) -> *mut QTabWidget;
        unsafe fn QTabWidget_addTab(tw: *mut QTabWidget, page: *mut QWidget, label: &CxxString);
        unsafe fn QTabWidget_currentIndex(tw: *mut QTabWidget) -> i32;
        unsafe fn QTabWidget_setCurrentIndex(tw: *mut QTabWidget, index: i32);
        unsafe fn QTabWidget_delete(tw: *mut QTabWidget);
        unsafe fn QTabWidget_onCurrentChanged(tw: *mut QTabWidget, ctx: u64);

        // --- QSpinBox ---
        unsafe fn QSpinBox_new(parent: *mut QWidget) -> *mut QSpinBox;
        unsafe fn QSpinBox_setValue(sb: *mut QSpinBox, value: i32);
        unsafe fn QSpinBox_value(sb: *mut QSpinBox) -> i32;
        unsafe fn QSpinBox_setRange(sb: *mut QSpinBox, min: i32, max: i32);
        unsafe fn QSpinBox_setSuffix(sb: *mut QSpinBox, suffix: &CxxString);
        unsafe fn QSpinBox_delete(sb: *mut QSpinBox);
        unsafe fn QSpinBox_onValueChanged(sb: *mut QSpinBox, ctx: u64);

        // --- QMenu ---
        unsafe fn QMenu_new(title: &CxxString, parent: *mut QWidget) -> *mut QMenu;
        unsafe fn QMenu_addAction(menu: *mut QMenu, text: &CxxString, ctx: u64);
        unsafe fn QMenu_delete(menu: *mut QMenu);

        // --- QMenuBar ---
        unsafe fn QMenuBar_new(parent: *mut QWidget) -> *mut QMenuBar;
        unsafe fn QMenuBar_addMenu(mb: *mut QMenuBar, menu: *mut QMenu);
        unsafe fn QMenuBar_delete(mb: *mut QMenuBar);

        // --- QFileDialog ---
        unsafe fn QFileDialog_getOpenFileName(
            parent: *mut QWidget,
            caption: &CxxString,
            dir: &CxxString,
            filter: &CxxString,
        ) -> String;

        unsafe fn QFileDialog_getOpenFileNames(
            parent: *mut QWidget,
            caption: &CxxString,
            dir: &CxxString,
            filter: &CxxString,
        ) -> Vec<String>;

        unsafe fn QFileDialog_getSaveFileName(
            parent: *mut QWidget,
            caption: &CxxString,
            dir: &CxxString,
            filter: &CxxString,
        ) -> String;

        unsafe fn QFileDialog_getExistingDirectory(
            parent: *mut QWidget,
            caption: &CxxString,
            dir: &CxxString,
        ) -> String;

        // --- QPoint ---
        unsafe fn QPoint_new(x: i32, y: i32) -> *mut QPoint;
        unsafe fn QPoint_delete(point: *mut QPoint);

        // ============================================================
        // ListWidget
        // ============================================================
        

        unsafe fn QListWidget_new(parent: *mut QWidget) -> *mut QListWidget;
        unsafe fn QListWidget_delete(w: *mut QListWidget);
        unsafe fn QListWidget_addItem(w: *mut QListWidget, text: &CxxString);
        unsafe fn QListWidget_addItems(w: *mut QListWidget, items: &CxxVector<CxxString>);
        unsafe fn QListWidget_insertItem(w: *mut QListWidget, row: i32, text: &CxxString);
        unsafe fn QListWidget_clear(w: *mut QListWidget);
        unsafe fn QListWidget_removeItem(w: *mut QListWidget, row: i32);
        unsafe fn QListWidget_count(w: *mut QListWidget) -> i32;
        unsafe fn QListWidget_itemText(w: *mut QListWidget, row: i32) -> String;
        unsafe fn QListWidget_currentRow(w: *mut QListWidget) -> i32;
        unsafe fn QListWidget_currentText(w: *mut QListWidget) -> String;
        unsafe fn QListWidget_setCurrentRow(w: *mut QListWidget, row: i32);
        unsafe fn QListWidget_setSelectionMode(w: *mut QListWidget, mode: i32);
        unsafe fn QListWidget_onItemClicked(w: *mut QListWidget, ctx: u64);
        unsafe fn QListWidget_onItemDoubleClicked(w: *mut QListWidget, ctx: u64);
        unsafe fn QListWidget_onCurrentItemChanged(w: *mut QListWidget, ctx: u64);
        unsafe fn toQWidget_QListWidget(w: *mut QListWidget) -> *mut QWidget;
        unsafe fn toQWidget_QMainWindow(w: *mut QMainWindow) -> *mut QWidget;
        unsafe fn toQWidget_QToolBar(toolbar: *mut QToolBar) -> *mut QWidget;
        unsafe fn toQWidget_QStatusBar(bar: *mut QStatusBar) -> *mut QWidget;
        unsafe fn toQWidget_QMessageBox(w: *mut QMessageBox) -> *mut QWidget;
        unsafe fn toQWidget_QProgressDialog(w: *mut QProgressDialog) -> *mut QWidget;
        unsafe fn toQWidget_QTableWidget(w: *mut QTableWidget) -> *mut QWidget;
        unsafe fn toQWidget_QTreeWidget(w: *mut QTreeWidget) -> *mut QWidget;
        unsafe fn toQWidget_QScrollArea(w: *mut QScrollArea) -> *mut QWidget;
        unsafe fn toQWidget_QStackedWidget(w: *mut QStackedWidget) -> *mut QWidget;
        unsafe fn toQWidget_QSplitter(w: *mut QSplitter) -> *mut QWidget;

        // --- QAction ---
        unsafe fn QAction_new(text: &CxxString, parent: *mut QWidget) -> *mut QAction;
        unsafe fn QAction_delete(action: *mut QAction);
        unsafe fn QAction_setText(action: *mut QAction, text: &CxxString);
        unsafe fn QAction_setIcon(action: *mut QAction, icon_path: &CxxString);
        unsafe fn QAction_setCheckable(action: *mut QAction, checkable: bool);
        unsafe fn QAction_setChecked(action: *mut QAction, checked: bool);
        unsafe fn QAction_setShortcut(action: *mut QAction, key: &CxxString);
        unsafe fn QAction_setEnabled(action: *mut QAction, enabled: bool);
        unsafe fn QAction_setToolTip(action: *mut QAction, tip: &CxxString);
        unsafe fn QAction_text(action: *mut QAction) -> String;
        unsafe fn QAction_isChecked(action: *mut QAction) -> bool;
        unsafe fn QAction_isEnabled(action: *mut QAction) -> bool;
        unsafe fn QAction_onTriggered(action: *mut QAction, ctx: u64);
        unsafe fn QAction_onToggled(action: *mut QAction, ctx: u64);

        // --- QMainWindow ---
        unsafe fn QMainWindow_new(parent: *mut QWidget) -> *mut QMainWindow;
        unsafe fn QMainWindow_delete(w: *mut QMainWindow);
        unsafe fn QMainWindow_setMenuBar(w: *mut QMainWindow, menuBar: *mut QMenuBar);
        unsafe fn QMainWindow_setCentralWidget(w: *mut QMainWindow, central: *mut QWidget);
        unsafe fn QMainWindow_setStatusBar(w: *mut QMainWindow, statusBar: *mut QStatusBar);
        unsafe fn QMainWindow_addToolBar(w: *mut QMainWindow, title: &CxxString) -> *mut QToolBar;
        unsafe fn QMainWindow_addToolBarBreak(w: *mut QMainWindow);
        unsafe fn QMainWindow_setWindowTitle(w: *mut QMainWindow, title: &CxxString);
        unsafe fn QMainWindow_resize(w: *mut QMainWindow, width: i32, height: i32);
        unsafe fn QMainWindow_show(w: *mut QMainWindow);
        unsafe fn QMainWindow_hide(w: *mut QMainWindow);
        unsafe fn QMainWindow_setDockOptions(w: *mut QMainWindow, options: i32);
        unsafe fn QMainWindow_setTabPosition(w: *mut QMainWindow, areas: i32, tabPos: i32);

        // --- QToolBar ---
        unsafe fn QToolBar_new(title: &CxxString, parent: *mut QWidget) -> *mut QToolBar;
        unsafe fn QToolBar_delete(toolbar: *mut QToolBar);
        unsafe fn QToolBar_addAction(toolbar: *mut QToolBar, text: &CxxString, ctx: u64);
        unsafe fn QToolBar_addSeparator(toolbar: *mut QToolBar);
        unsafe fn QToolBar_addWidget(toolbar: *mut QToolBar, widget: *mut QWidget);
        unsafe fn QToolBar_setMovable(toolbar: *mut QToolBar, movable: bool);
        unsafe fn QToolBar_setFloatable(toolbar: *mut QToolBar, floatable: bool);
        unsafe fn QToolBar_setIconSize(toolbar: *mut QToolBar, w: i32, h: i32);
        unsafe fn QToolBar_setAllowedAreas(toolbar: *mut QToolBar, areas: i32);
        unsafe fn QToolBar_setToolButtonStyle(toolbar: *mut QToolBar, style: i32);
        unsafe fn QToolBar_clear(toolbar: *mut QToolBar);

        // --- QStatusBar ---
        unsafe fn QStatusBar_new(parent: *mut QWidget) -> *mut QStatusBar;
        unsafe fn QStatusBar_delete(bar: *mut QStatusBar);
        unsafe fn QStatusBar_showMessage(bar: *mut QStatusBar, text: &CxxString, timeout_ms: i32);
        unsafe fn QStatusBar_clearMessage(bar: *mut QStatusBar);
        unsafe fn QStatusBar_addWidget(bar: *mut QStatusBar, widget: *mut QWidget);
        unsafe fn QStatusBar_addPermanentWidget(bar: *mut QStatusBar, widget: *mut QWidget);
        unsafe fn QStatusBar_removeWidget(bar: *mut QStatusBar, widget: *mut QWidget);
        unsafe fn QStatusBar_setSizeGripEnabled(bar: *mut QStatusBar, enabled: bool);

        // --- QMessageBox (object-based) ---
        unsafe fn QMessageBox_new(parent: *mut QWidget) -> *mut QMessageBox;
        unsafe fn QMessageBox_delete(w: *mut QMessageBox);
        unsafe fn QMessageBox_setIcon(w: *mut QMessageBox, icon: i32);
        unsafe fn QMessageBox_setText(w: *mut QMessageBox, text: &CxxString);
        unsafe fn QMessageBox_setInformativeText(w: *mut QMessageBox, text: &CxxString);
        unsafe fn QMessageBox_setWindowTitle(w: *mut QMessageBox, title: &CxxString);
        unsafe fn QMessageBox_setStandardButtons(w: *mut QMessageBox, buttons: i32);
        unsafe fn QMessageBox_setDefaultButton(w: *mut QMessageBox, button: i32);
        unsafe fn QMessageBox_setDetailedText(w: *mut QMessageBox, text: &CxxString);
        unsafe fn QMessageBox_exec(w: *mut QMessageBox) -> i32;
        unsafe fn QMessageBox_about(parent: *mut QWidget, title: &CxxString, text: &CxxString);

        // --- QInputDialog ---
        unsafe fn QInputDialog_getText(
            parent: *mut QWidget,
            title: &CxxString,
            label: &CxxString,
            text: &CxxString,
        ) -> String;
        unsafe fn QInputDialog_getInt(
            parent: *mut QWidget,
            title: &CxxString,
            label: &CxxString,
            value: i32,
            min: i32,
            max: i32,
            step: i32,
        ) -> i32;
        unsafe fn QInputDialog_getDouble(
            parent: *mut QWidget,
            title: &CxxString,
            label: &CxxString,
            value: f64,
            min: f64,
            max: f64,
            decimals: i32,
        ) -> f64;
        unsafe fn QInputDialog_getItem(
            parent: *mut QWidget,
            title: &CxxString,
            label: &CxxString,
            items: Vec<String>,
            current: i32,
            editable: bool,
        ) -> String;

        // --- QProgressDialog ---
        unsafe fn QProgressDialog_new(
            label: &CxxString,
            cancelText: &CxxString,
            min: i32,
            max: i32,
            parent: *mut QWidget,
        ) -> *mut QProgressDialog;
        unsafe fn QProgressDialog_delete(w: *mut QProgressDialog);
        unsafe fn QProgressDialog_setMinimum(w: *mut QProgressDialog, min: i32);
        unsafe fn QProgressDialog_setMaximum(w: *mut QProgressDialog, max: i32);
        unsafe fn QProgressDialog_setRange(w: *mut QProgressDialog, min: i32, max: i32);
        unsafe fn QProgressDialog_setValue(w: *mut QProgressDialog, value: i32);
        unsafe fn QProgressDialog_value(w: *mut QProgressDialog) -> i32;
        unsafe fn QProgressDialog_setLabelText(w: *mut QProgressDialog, text: &CxxString);
        unsafe fn QProgressDialog_setCancelButtonText(w: *mut QProgressDialog, text: &CxxString);
        unsafe fn QProgressDialog_wasCanceled(w: *mut QProgressDialog) -> bool;
        unsafe fn QProgressDialog_setMinimumDuration(w: *mut QProgressDialog, ms: i32);
        unsafe fn QProgressDialog_setAutoClose(w: *mut QProgressDialog, close: bool);
        unsafe fn QProgressDialog_setAutoReset(w: *mut QProgressDialog, reset: bool);
        unsafe fn QProgressDialog_show(w: *mut QProgressDialog);
        unsafe fn QProgressDialog_hide(w: *mut QProgressDialog);
        unsafe fn QProgressDialog_close(w: *mut QProgressDialog);

        // --- QTableWidget ---
        unsafe fn QTableWidget_new(rows: i32, cols: i32, parent: *mut QWidget) -> *mut QTableWidget;
        unsafe fn QTableWidget_delete(w: *mut QTableWidget);
        unsafe fn QTableWidget_setRowCount(w: *mut QTableWidget, rows: i32);
        unsafe fn QTableWidget_setColumnCount(w: *mut QTableWidget, cols: i32);
        unsafe fn QTableWidget_setItem(w: *mut QTableWidget, row: i32, col: i32, text: &CxxString);
        unsafe fn QTableWidget_itemText(w: *mut QTableWidget, row: i32, col: i32) -> String;
        unsafe fn QTableWidget_setHorizontalHeaderLabels(w: *mut QTableWidget, labels: Vec<String>);
        unsafe fn QTableWidget_setVerticalHeaderLabels(w: *mut QTableWidget, labels: Vec<String>);
        unsafe fn QTableWidget_setCurrentCell(w: *mut QTableWidget, row: i32, col: i32);
        unsafe fn QTableWidget_currentRow(w: *mut QTableWidget) -> i32;
        unsafe fn QTableWidget_currentColumn(w: *mut QTableWidget) -> i32;
        unsafe fn QTableWidget_selectedRows(w: *mut QTableWidget) -> Vec<i32>;
        unsafe fn QTableWidget_clear(w: *mut QTableWidget);
        unsafe fn QTableWidget_clearContents(w: *mut QTableWidget);
        unsafe fn QTableWidget_setSelectionMode(w: *mut QTableWidget, mode: i32);
        unsafe fn QTableWidget_setSelectionBehavior(w: *mut QTableWidget, behavior: i32);
        unsafe fn QTableWidget_removeRow(w: *mut QTableWidget, row: i32);
        unsafe fn QTableWidget_insertRow(w: *mut QTableWidget, row: i32);
        unsafe fn QTableWidget_setColumnWidth(w: *mut QTableWidget, col: i32, width: i32);
        unsafe fn QTableWidget_setRowHeight(w: *mut QTableWidget, row: i32, height: i32);
        unsafe fn QTableWidget_onCellClicked(w: *mut QTableWidget, ctx: u64);
        unsafe fn QTableWidget_onCellDoubleClicked(w: *mut QTableWidget, ctx: u64);
        unsafe fn QTableWidget_onCurrentCellChanged(w: *mut QTableWidget, ctx: u64);

        // --- QTreeWidget ---
        unsafe fn QTreeWidget_new(parent: *mut QWidget) -> *mut QTreeWidget;
        unsafe fn QTreeWidget_delete(w: *mut QTreeWidget);
        unsafe fn QTreeWidget_addTopLevelItem(w: *mut QTreeWidget, text: &CxxString);
        unsafe fn QTreeWidget_clear(w: *mut QTreeWidget);
        unsafe fn QTreeWidget_currentItemText(w: *mut QTreeWidget) -> String;
        unsafe fn QTreeWidget_setHeaderLabel(w: *mut QTreeWidget, text: &CxxString);
        unsafe fn QTreeWidget_setHeaderLabels(w: *mut QTreeWidget, labels: Vec<String>);
        unsafe fn QTreeWidget_expandAll(w: *mut QTreeWidget);
        unsafe fn QTreeWidget_collapseAll(w: *mut QTreeWidget);
        unsafe fn QTreeWidget_expandItem(w: *mut QTreeWidget, text: &CxxString);
        unsafe fn QTreeWidget_setCurrentItem(w: *mut QTreeWidget, text: &CxxString);
        unsafe fn QTreeWidget_topLevelItemCount(w: *mut QTreeWidget) -> i32;
        unsafe fn QTreeWidget_onItemClicked(w: *mut QTreeWidget, ctx: u64);
        unsafe fn QTreeWidget_onItemDoubleClicked(w: *mut QTreeWidget, ctx: u64);
        unsafe fn QTreeWidget_onItemExpanded(w: *mut QTreeWidget, ctx: u64);
        unsafe fn QTreeWidget_onItemCollapsed(w: *mut QTreeWidget, ctx: u64);
        unsafe fn QTreeWidget_onCurrentItemChanged(w: *mut QTreeWidget, ctx: u64);

        // --- QScrollArea ---
        unsafe fn QScrollArea_new(parent: *mut QWidget) -> *mut QScrollArea;
        unsafe fn QScrollArea_delete(w: *mut QScrollArea);
        unsafe fn QScrollArea_setWidget(w: *mut QScrollArea, widget: *mut QWidget);
        unsafe fn QScrollArea_takeWidget(w: *mut QScrollArea) -> *mut QWidget;
        unsafe fn QScrollArea_setWidgetResizable(w: *mut QScrollArea, resizable: bool);
        unsafe fn QScrollArea_setHorizontalScrollBarPolicy(w: *mut QScrollArea, policy: i32);
        unsafe fn QScrollArea_setVerticalScrollBarPolicy(w: *mut QScrollArea, policy: i32);
        unsafe fn QScrollArea_ensureVisible(w: *mut QScrollArea, x: i32, y: i32);
        unsafe fn QScrollArea_ensureWidgetVisible(w: *mut QScrollArea, widget: *mut QWidget);

        // --- QStackedWidget ---
        unsafe fn QStackedWidget_new(parent: *mut QWidget) -> *mut QStackedWidget;
        unsafe fn QStackedWidget_delete(w: *mut QStackedWidget);
        unsafe fn QStackedWidget_addWidget(w: *mut QStackedWidget, page: *mut QWidget) -> i32;
        unsafe fn QStackedWidget_insertWidget(w: *mut QStackedWidget, index: i32, page: *mut QWidget) -> i32;
        unsafe fn QStackedWidget_removeWidget(w: *mut QStackedWidget, page: *mut QWidget);
        unsafe fn QStackedWidget_setCurrentIndex(w: *mut QStackedWidget, index: i32);
        unsafe fn QStackedWidget_currentIndex(w: *mut QStackedWidget) -> i32;
        unsafe fn QStackedWidget_count(w: *mut QStackedWidget) -> i32;
        unsafe fn QStackedWidget_widget(w: *mut QStackedWidget, index: i32) -> *mut QWidget;
        unsafe fn QStackedWidget_onCurrentChanged(w: *mut QStackedWidget, ctx: u64);

        // --- QSplitter ---
        unsafe fn QSplitter_new(orientation: i32, parent: *mut QWidget) -> *mut QSplitter;
        unsafe fn QSplitter_delete(w: *mut QSplitter);
        unsafe fn QSplitter_addWidget(w: *mut QSplitter, widget: *mut QWidget);
        unsafe fn QSplitter_insertWidget(w: *mut QSplitter, index: i32, widget: *mut QWidget);
        unsafe fn QSplitter_setStretchFactor(w: *mut QSplitter, index: i32, stretch: i32);
        unsafe fn QSplitter_setSizes(w: *mut QSplitter, sizes: Vec<i32>);
        unsafe fn QSplitter_sizes(w: *mut QSplitter) -> Vec<i32>;
        unsafe fn QSplitter_setOrientation(w: *mut QSplitter, orientation: i32);
        unsafe fn QSplitter_count(w: *mut QSplitter) -> i32;
        unsafe fn QSplitter_setHandleWidth(w: *mut QSplitter, width: i32);
        unsafe fn QSplitter_setChildrenCollapsible(w: *mut QSplitter, collapsible: bool);

    }

    unsafe extern "C++" {
        include!("src/cpp/uiloader.h");

        type QUiLoader;
        unsafe fn QUiLoader_new() -> *mut QUiLoader;
        unsafe fn QUiLoader_load(
            loader: *mut QUiLoader,
            ui_path: &CxxString,
            parent: *mut QWidget,
        ) -> *mut QWidget;
        unsafe fn QUiLoader_delete(loader: *mut QUiLoader);
    }
}

pub use ffi_inner::*;