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
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
// This file is auto-generated by rute_gen. DO NOT EDIT.
use std::cell::Cell;
use std::rc::Rc;

#[allow(unused_imports)]
use std::marker::PhantomData;

#[allow(unused_imports)]
use std::os::raw::c_void;

#[allow(unused_imports)]
use std::mem::transmute;

#[allow(unused_imports)]
use std::ffi::{CStr, CString};

use rute_ffi_base::*;

#[allow(unused_imports)]
use auto::*;

/// **Notice these docs are heavy WIP and not very relevent yet**
///
/// QGuiApplication contains the main event loop, where all events from the window
/// system and other sources are processed and dispatched. It also handles the
/// application's initialization and finalization, and provides session management.
/// In addition, QGuiApplication handles most of the system-wide and application-wide
/// settings.
///
/// For any GUI application using Qt, there is precisely **one** QGuiApplication
/// object no matter whether the application has 0, 1, 2 or more windows at
/// any given time. For non-GUI Qt applications, use QCoreApplication instead,
/// as it does not depend on the Qt GUI module. For QWidget based Qt applications,
/// use QApplication instead, as it provides some functionality needed for creating
/// QWidget instances.
///
/// The QGuiApplication object is accessible through the instance() function, which
/// returns a pointer equivalent to the global [qApp](qApp)
/// pointer.
///
/// QGuiApplication's main areas of responsibility are:
/// * It initializes the application with the user's desktop settings, such as palette(), font() and styleHints(). It keeps track of these properties in case the user changes the desktop globally, for example, through some kind of control panel.
/// * It performs event handling, meaning that it receives events from the underlying window system and dispatches them to the relevant widgets. You can send your own events to windows by using sendEvent() and postEvent().
/// * It parses common command line arguments and sets its internal state accordingly. See the [constructor documentation](QGuiApplication::QGuiApplication())
/// below for more details.
/// * It provides localization of strings that are visible to the user via translate().
/// * It provides some magical objects like the clipboard().
/// * It knows about the application's windows. You can ask which window is at a certain position using topLevelAt(), get a list of topLevelWindows(), etc.
/// * It manages the application's mouse cursor handling, see setOverrideCursor()
/// * It provides support for sophisticated [session management](Session%20Management)
/// . This makes it possible for applications to terminate gracefully when the user logs out, to cancel a shutdown process if termination isn't possible and even to preserve the entire application's state for a future session. See isSessionRestored(), sessionId() and commitDataRequest() and saveStateRequest() for details.
///
/// Since the QGuiApplication object does so much initialization, it *must* be
/// created before any other objects related to the user interface are created.
/// QGuiApplication also deals with common command line arguments. Hence, it is
/// usually a good idea to create it *before* any interpretation or
/// modification of `argv` is done in the application itself.
///
/// * {2,1} Groups of functions
///
/// * System settings
/// * desktopSettingsAware(), setDesktopSettingsAware(), styleHints(), palette(), setPalette(), font(), setFont().
///
/// * Event handling
/// * exec(), processEvents(), exit(), quit(). sendEvent(), postEvent(), sendPostedEvents(), removePostedEvents(), hasPendingEvents(), notify().
///
/// * Windows
/// * allWindows(), topLevelWindows(), focusWindow(), clipboard(), topLevelAt().
///
/// * Advanced cursor handling
/// * overrideCursor(), setOverrideCursor(), restoreOverrideCursor().
///
/// * Session management
/// * isSessionRestored(), sessionId(), commitDataRequest(), saveStateRequest().
///
/// * Miscellaneous
/// * startingUp(), closingDown().
///
/// **See also:** [`CoreApplication`]
/// [`AbstractEventDispatcher`]
/// [`EventLoop`]
/// # Licence
///
/// The documentation is an adoption of the original [Qt Documentation](http://doc.qt.io/) and provided herein is licensed under the terms of the [GNU Free Documentation License version 1.3](http://www.gnu.org/licenses/fdl.html) as published by the Free Software Foundation.
#[derive(Clone)]
pub struct GuiApplication<'a> {
    #[doc(hidden)]
    pub data: Rc<Cell<Option<*const RUBase>>>,
    #[doc(hidden)]
    pub all_funcs: *const RUGuiApplicationAllFuncs,
    #[doc(hidden)]
    pub owned: bool,
    #[doc(hidden)]
    pub _marker: PhantomData<::std::cell::Cell<&'a ()>>,
}

impl<'a> GuiApplication<'a> {
    #[allow(dead_code)]
    pub(crate) fn new_from_rc(ffi_data: RUGuiApplication) -> GuiApplication<'a> {
        GuiApplication {
            data: unsafe { Rc::from_raw(ffi_data.host_data as *const Cell<Option<*const RUBase>>) },
            all_funcs: ffi_data.all_funcs,
            owned: false,
            _marker: PhantomData,
        }
    }

    #[allow(dead_code)]
    pub(crate) fn new_from_owned(ffi_data: RUGuiApplication) -> GuiApplication<'a> {
        GuiApplication {
            data: Rc::new(Cell::new(Some(ffi_data.qt_data as *const RUBase))),
            all_funcs: ffi_data.all_funcs,
            owned: true,
            _marker: PhantomData,
        }
    }

    #[allow(dead_code)]
    pub(crate) fn new_from_temporary(ffi_data: RUGuiApplication) -> GuiApplication<'a> {
        GuiApplication {
            data: Rc::new(Cell::new(Some(ffi_data.qt_data as *const RUBase))),
            all_funcs: ffi_data.all_funcs,
            owned: false,
            _marker: PhantomData,
        }
    }
    pub fn set_application_display_name(name: &str) {
        let str_in_name_1 = CString::new(name).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_application_display_name)(obj_data, str_in_name_1.as_ptr());
        }
    }
    ///
    /// This name is shown to the user, for instance in window titles.
    /// It can be translated, if necessary.
    ///
    /// If not set, the application display name defaults to the application name.
    ///
    /// **See also:** applicationName
    pub fn application_display_name() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).application_display_name)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    pub fn set_desktop_file_name(name: &str) {
        let str_in_name_1 = CString::new(name).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_desktop_file_name)(obj_data, str_in_name_1.as_ptr());
        }
    }
    ///
    /// This is the file name, without the full path, of the desktop entry
    /// that represents this application according to the freedesktop desktop
    /// entry specification.
    ///
    /// This property gives a precise indication of what desktop entry represents
    /// the application and it is needed by the windowing system to retrieve
    /// such information without resorting to imprecise heuristics.
    ///
    /// The latest version of the freedesktop desktop entry specification can be obtained
    /// [here](http://standards.freedesktop.org/desktop-entry-spec/latest/)
    ///
    pub fn desktop_file_name() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).desktop_file_name)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    ///
    /// Returns the top level window at the given position *pos,* if any.
    pub fn top_level_at<P: PointTrait<'a>>(pos: &P) -> Option<Window<'a>> {
        let (obj_pos_1, _funcs) = pos.get_point_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).top_level_at)(obj_data, obj_pos_1);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Window::new_from_rc(t);
            } else {
                ret_val = Window::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    pub fn set_window_icon<I: IconTrait<'a>>(icon: &I) {
        let (obj_icon_1, _funcs) = icon.get_icon_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_window_icon)(obj_data, obj_icon_1);
        }
    }
    ///
    /// **See also:** [`Window::set_icon`]
    /// {Setting the Application Icon}
    pub fn window_icon() -> Icon<'a> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).window_icon)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Icon::new_from_rc(t);
            } else {
                ret_val = Icon::new_from_owned(t);
            }
            ret_val
        }
    }
    ///
    /// The QPA platform plugins are located in `qtbase\src\plugins\platforms` .
    /// At the time of writing, the following platform plugin names are supported:
    ///
    /// * `android`
    /// * `cocoa` is a platform plugin for MacOS .
    /// * `directfb`
    /// * `eglfs` is a platform plugin for running Qt5 applications on top of EGL and OpenGL ES 2.0 without an actual windowing system (like X11 or Wayland). For more information, see [EGLFS](EGLFS)
    ///
    /// * `ios` (also used for tvOS)
    /// * `kms` is an experimental platform plugin using kernel modesetting and [DRM](http://dri.freedesktop.org/wiki/DRM)
    /// (Direct Rendering Manager).
    /// * `linuxfb` writes directly to the framebuffer. For more information, see [LinuxFB](LinuxFB)
    ///
    /// * `minimal` is provided as an examples for developers who want to write their own platform plugins. However, you can use the plugin to run GUI applications in environments without a GUI, such as servers.
    /// * `minimalegl` is an example plugin.
    /// * `offscreen`
    /// * `openwfd`
    /// * `qnx`
    /// * `windows`
    /// * `wayland` is a platform plugin for modern Linux desktops and some embedded systems.
    /// * `xcb` is the X11 plugin used on regular desktop Linux platforms.
    ///
    /// For more information about the platform plugins for embedded Linux devices,
    /// see [Qt for Embedded Linux](Qt%20for%20Embedded%20Linux)
    ///
    pub fn platform_name() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).platform_name)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    ///
    /// Returns the most recently shown modal window. If no modal windows are
    /// visible, this function returns zero.
    ///
    /// A modal window is a window which has its
    /// [modality](QWindow::modality)
    /// property set to Qt::WindowModal
    /// or Qt::ApplicationModal. A modal window must be closed before the user can
    /// continue with other parts of the program.
    ///
    /// Modal window are organized in a stack. This function returns the modal
    /// window at the top of the stack.
    ///
    /// **See also:** [`t::window_modality()`]
    /// [`Window::set_modality`]
    pub fn modal_window() -> Option<Window<'a>> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).modal_window)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Window::new_from_rc(t);
            } else {
                ret_val = Window::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// Returns the QWindow that receives events tied to focus,
    /// such as key events.
    ///
    /// This signal is emitted when the focused window changes.
    /// *focusWindow* is the new focused window.
    ///
    /// **See also:** [`focus_window()`]
    pub fn focus_window() -> Option<Window<'a>> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).focus_window)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Window::new_from_rc(t);
            } else {
                ret_val = Window::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// This signal is emitted when final receiver of events tied to focus is changed.
    /// *focusObject* is the new receiver.
    ///
    /// **See also:** [`focus_object()`]
    ///
    /// Returns the QObject in currently active window that will be final receiver of events
    /// tied to focus, such as key events.
    pub fn focus_object() -> Option<Object<'a>> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).focus_object)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Object::new_from_rc(t);
            } else {
                ret_val = Object::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// This will be the screen where QWindows are initially shown, unless otherwise specified.
    ///
    /// The primaryScreenChanged signal was introduced in Qt 5.6.
    ///
    /// **See also:** [`screens()`]
    pub fn primary_screen() -> Option<Screen<'a>> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).primary_screen)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Screen::new_from_rc(t);
            } else {
                ret_val = Screen::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// Returns a list of all the screens associated with the
    /// windowing system the application is connected to.
    ///
    /// Returns the screen at *point,* or `nullptr` if outside of any screen.
    ///
    /// The *point* is in relation to the virtualGeometry() of each set of virtual
    /// siblings. If the point maps to more than one set of virtual siblings the first
    /// match is returned.
    ///
    pub fn screen_at<P: PointTrait<'a>>(point: &P) -> Option<Screen<'a>> {
        let (obj_point_1, _funcs) = point.get_point_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).screen_at)(obj_data, obj_point_1);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Screen::new_from_rc(t);
            } else {
                ret_val = Screen::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// Returns the highest screen device pixel ratio found on
    /// the system. This is the ratio between physical pixels and
    /// device-independent pixels.
    ///
    /// Use this function only when you don't know which window you are targeting.
    /// If you do know the target window, use QWindow::devicePixelRatio() instead.
    ///
    /// **See also:** [`Window::device_pixel_ratio`]
    pub fn device_pixel_ratio(&self) -> f32 {
        let (obj_data, funcs) = self.get_gui_application_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).device_pixel_ratio)(obj_data);
            ret_val
        }
    }
    ///
    /// Returns the active application override cursor.
    ///
    /// This function returns 0 if no application cursor has been defined (i.e. the
    /// internal cursor stack is empty).
    ///
    /// **See also:** [`set_override_cursor()`]
    /// [`restore_override_cursor()`]
    pub fn override_cursor() -> Option<Cursor<'a>> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).override_cursor)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Cursor::new_from_rc(t);
            } else {
                ret_val = Cursor::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// Sets the application override cursor to *cursor.*
    ///
    /// Application override cursors are intended for showing the user that the
    /// application is in a special state, for example during an operation that
    /// might take some time.
    ///
    /// This cursor will be displayed in all the application's widgets until
    /// restoreOverrideCursor() or another setOverrideCursor() is called.
    ///
    /// Application cursors are stored on an internal stack. setOverrideCursor()
    /// pushes the cursor onto the stack, and restoreOverrideCursor() pops the
    /// active cursor off the stack. changeOverrideCursor() changes the curently
    /// active application override cursor.
    ///
    /// Every setOverrideCursor() must eventually be followed by a corresponding
    /// restoreOverrideCursor(), otherwise the stack will never be emptied.
    ///
    /// Example:
    ///
    /// **See also:** [`override_cursor()`]
    /// [`restore_override_cursor()`]
    /// [`change_override_cursor()`]
    /// [`Widget::set_cursor`]
    pub fn set_override_cursor<C: CursorTrait<'a>>(arg0: &C) {
        let (obj_arg0_1, _funcs) = arg0.get_cursor_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_override_cursor)(obj_data, obj_arg0_1);
        }
    }
    ///
    /// Changes the currently active application override cursor to *cursor.*
    ///
    /// This function has no effect if setOverrideCursor() was not called.
    ///
    /// **See also:** [`set_override_cursor()`]
    /// [`override_cursor()`]
    /// [`restore_override_cursor()`]
    /// [`Widget::set_cursor`]
    pub fn change_override_cursor<C: CursorTrait<'a>>(arg0: &C) {
        let (obj_arg0_1, _funcs) = arg0.get_cursor_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).change_override_cursor)(obj_data, obj_arg0_1);
        }
    }
    ///
    /// Undoes the last setOverrideCursor().
    ///
    /// If setOverrideCursor() has been called twice, calling
    /// restoreOverrideCursor() will activate the first cursor set. Calling this
    /// function a second time restores the original widgets' cursors.
    ///
    /// **See also:** [`set_override_cursor()`]
    /// [`override_cursor()`]
    pub fn restore_override_cursor() {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).restore_override_cursor)(obj_data);
        }
    }
    ///
    /// This signal is emitted when the *font* of the application changes.
    ///
    /// **See also:** [`font()`]
    ///
    /// Returns the default application font.
    ///
    /// **See also:** [`set_font()`]
    ///
    /// This signal is emitted when application fonts are loaded or removed.
    ///
    /// **See also:** [`FontDatabase::add_application_font`]
    /// [`FontDatabase::add_application_font_from_data`]
    /// [`FontDatabase::remove_all_application_fonts`]
    /// [`FontDatabase::remove_application_font`]
    pub fn font() -> Font<'a> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).font)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Font::new_from_rc(t);
            } else {
                ret_val = Font::new_from_owned(t);
            }
            ret_val
        }
    }
    ///
    /// Changes the default application font to *font.*
    ///
    /// **See also:** [`font()`]
    pub fn set_font<F: FontTrait<'a>>(arg0: &F) {
        let (obj_arg0_1, _funcs) = arg0.get_font_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_font)(obj_data, obj_arg0_1);
        }
    }
    ///
    /// Returns the object for interacting with the clipboard.
    pub fn clipboard() -> Option<Clipboard<'a>> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).clipboard)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Clipboard::new_from_rc(t);
            } else {
                ret_val = Clipboard::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// This signal is emitted when the *palette* of the application changes.
    ///
    /// **See also:** [`palette()`]
    ///
    /// Returns the default application palette.
    ///
    /// **See also:** [`set_palette()`]
    pub fn palette() -> Palette<'a> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).palette)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Palette::new_from_rc(t);
            } else {
                ret_val = Palette::new_from_owned(t);
            }
            ret_val
        }
    }
    ///
    /// Changes the default application palette to *pal.*
    ///
    /// **See also:** [`palette()`]
    pub fn set_palette<P: PaletteTrait<'a>>(pal: &P) {
        let (obj_pal_1, _funcs) = pal.get_palette_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_palette)(obj_data, obj_pal_1);
        }
    }
    ///
    /// Returns the current state of the modifier keys on the keyboard. The current
    /// state is updated sychronously as the event queue is emptied of events that
    /// will spontaneously change the keyboard state (QEvent::KeyPress and
    /// QEvent::KeyRelease events).
    ///
    /// It should be noted this may not reflect the actual keys held on the input
    /// device at the time of calling but rather the modifiers as last reported in
    /// one of the above events. If no keys are being held Qt::NoModifier is
    /// returned.
    ///
    /// **See also:** [`mouse_buttons()`]
    /// [`query_keyboard_modifiers()`]
    pub fn keyboard_modifiers() -> KeyboardModifiers {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).keyboard_modifiers)(obj_data);
            let ret_val = KeyboardModifiers::from_bits_truncate(ret_val);
            ret_val
        }
    }
    ///
    /// Queries and returns the state of the modifier keys on the keyboard.
    /// Unlike keyboardModifiers, this method returns the actual keys held
    /// on the input device at the time of calling the method.
    ///
    /// It does not rely on the keypress events having been received by this
    /// process, which makes it possible to check the modifiers while moving
    /// a window, for instance. Note that in most cases, you should use
    /// keyboardModifiers(), which is faster and more accurate since it contains
    /// the state of the modifiers as they were when the currently processed
    /// event was received.
    ///
    /// **See also:** [`keyboard_modifiers()`]
    pub fn query_keyboard_modifiers() -> KeyboardModifiers {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).query_keyboard_modifiers)(obj_data);
            let ret_val = KeyboardModifiers::from_bits_truncate(ret_val);
            ret_val
        }
    }
    ///
    /// Returns the current state of the buttons on the mouse. The current state is
    /// updated syncronously as the event queue is emptied of events that will
    /// spontaneously change the mouse state (QEvent::MouseButtonPress and
    /// QEvent::MouseButtonRelease events).
    ///
    /// It should be noted this may not reflect the actual buttons held on the
    /// input device at the time of calling but rather the mouse buttons as last
    /// reported in one of the above events. If no mouse buttons are being held
    /// Qt::NoButton is returned.
    ///
    /// **See also:** [`keyboard_modifiers()`]
    pub fn mouse_buttons() -> MouseButtons {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).mouse_buttons)(obj_data);
            let ret_val = MouseButtons::from_bits_truncate(ret_val);
            ret_val
        }
    }
    pub fn set_layout_direction(direction: LayoutDirection) {
        let enum_direction_1 = direction as u32;

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_layout_direction)(obj_data, enum_direction_1);
        }
    }
    ///
    /// On system start-up, the default layout direction depends on the
    /// application's language.
    ///
    /// The notifier signal was introduced in Qt 5.4.
    ///
    /// **See also:** [`Widget::layout_direction()`]
    /// [`is_left_to_right()`]
    /// [`is_right_to_left()`]
    pub fn layout_direction() -> LayoutDirection {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).layout_direction)(obj_data);
            let ret_val = { transmute::<u32, LayoutDirection>(ret_val) };
            ret_val
        }
    }
    ///
    /// Returns `true` if the application's layout direction is
    /// Qt::RightToLeft; otherwise returns `false.`
    ///
    /// **See also:** [`layout_direction()`]
    /// [`is_left_to_right()`]
    pub fn is_right_to_left() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).is_right_to_left)(obj_data);
            ret_val
        }
    }
    ///
    /// Returns `true` if the application's layout direction is
    /// Qt::LeftToRight; otherwise returns `false.`
    ///
    /// **See also:** [`layout_direction()`]
    /// [`is_right_to_left()`]
    pub fn is_left_to_right() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).is_left_to_right)(obj_data);
            ret_val
        }
    }
    ///
    /// Sets whether Qt should use the system's standard colors, fonts, etc., to
    /// *on.* By default, this is `true.`
    ///
    /// This function must be called before creating the QGuiApplication object, like
    /// this:
    ///
    /// **See also:** [`desktop_settings_aware()`]
    pub fn set_desktop_settings_aware(on: bool) {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_desktop_settings_aware)(obj_data, on);
        }
    }
    ///
    /// Returns `true` if Qt is set to use the system's standard colors, fonts, etc.;
    /// otherwise returns `false.` The default is `true.`
    ///
    /// **See also:** [`set_desktop_settings_aware()`]
    pub fn desktop_settings_aware() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).desktop_settings_aware)(obj_data);
            ret_val
        }
    }
    pub fn set_quit_on_last_window_closed(quit: bool) {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_quit_on_last_window_closed)(obj_data, quit);
        }
    }
    ///
    /// The default is `true.`
    ///
    /// If this property is `true,` the applications quits when the last visible
    /// primary window (i.e. window with no parent) is closed.
    ///
    /// **See also:** [`quit()`]
    /// [`Window::close`]
    pub fn quit_on_last_window_closed() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).quit_on_last_window_closed)(obj_data);
            ret_val
        }
    }
    ///
    /// Returns the current state of the application.
    ///
    /// You can react to application state changes to perform actions such as
    /// stopping/resuming CPU-intensive tasks, freeing/loading resources or
    /// saving/restoring application data.
    ///
    /// This signal is emitted when the *state* of the application changes.
    ///
    /// **See also:** [`application_state()`]
    pub fn application_state() -> ApplicationState {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).application_state)(obj_data);
            let ret_val = ApplicationState::from_bits_truncate(ret_val);
            ret_val
        }
    }
    ///
    /// Enters the main event loop and waits until exit() is called, and then
    /// returns the value that was set to exit() (which is 0 if exit() is called
    /// via quit()).
    ///
    /// It is necessary to call this function to start event handling. The main
    /// event loop receives events from the window system and dispatches these to
    /// the application widgets.
    ///
    /// Generally, no user interaction can take place before calling exec().
    ///
    /// To make your application perform idle processing, e.g., executing a special
    /// function whenever there are no pending events, use a QTimer with 0 timeout.
    /// More advanced idle processing schemes can be achieved using processEvents().
    ///
    /// We recommend that you connect clean-up code to the
    /// [aboutToQuit()](QCoreApplication::)
    /// signal, instead of putting it in your
    /// application's `main()` function. This is because, on some platforms, the
    /// QApplication::exec() call may not return.
    ///
    /// **See also:** quitOnLastWindowClosed
    /// [`quit()`]
    /// [`exit()`]
    /// [`process_events()`]
    /// [`CoreApplication::exec`]
    pub fn exec() -> i32 {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).exec)(obj_data);
            ret_val
        }
    }
    ///
    ///
    /// Returns `true` if the application has been restored from an earlier
    /// [session](Session%20Management)
    /// ; otherwise returns `false.`
    ///
    /// **See also:** [`session_id()`]
    /// [`commit_data_request()`]
    /// [`save_state_request()`]
    pub fn is_session_restored(&self) -> bool {
        let (obj_data, funcs) = self.get_gui_application_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_session_restored)(obj_data);
            ret_val
        }
    }
    ///
    /// Returns the current [session's](Session%20Management)
    /// identifier.
    ///
    /// If the application has been restored from an earlier session, this
    /// identifier is the same as it was in that previous session. The session
    /// identifier is guaranteed to be unique both for different applications
    /// and for different instances of the same application.
    ///
    /// **See also:** [`is_session_restored()`]
    /// [`session_key()`]
    /// [`commit_data_request()`]
    /// [`save_state_request()`]
    pub fn session_id(&self) -> String {
        let (obj_data, funcs) = self.get_gui_application_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).session_id)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    ///
    /// Returns the session key in the current [session](Session%20Management)
    ///
    ///
    /// If the application has been restored from an earlier session, this key is
    /// the same as it was when the previous session ended.
    ///
    /// The session key changes every time the session is saved. If the shutdown process
    /// is cancelled, another session key will be used when shutting down again.
    ///
    /// **See also:** [`is_session_restored()`]
    /// [`session_id()`]
    /// [`commit_data_request()`]
    /// [`save_state_request()`]
    pub fn session_key(&self) -> String {
        let (obj_data, funcs) = self.get_gui_application_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).session_key)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    ///
    /// Returns `true` if the application is currently saving the
    /// [session](Session%20Management)
    /// ; otherwise returns `false.`
    ///
    /// This is `true` when commitDataRequest() and saveStateRequest() are emitted,
    /// but also when the windows are closed afterwards by session management.
    ///
    /// **See also:** [`session_id()`]
    /// [`commit_data_request()`]
    /// [`save_state_request()`]
    pub fn is_saving_session(&self) -> bool {
        let (obj_data, funcs) = self.get_gui_application_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_saving_session)(obj_data);
            ret_val
        }
    }
    ///
    /// Returns whether QGuiApplication will use fallback session management.
    ///
    /// The default is `true.`
    ///
    /// If this is `true` and the session manager allows user interaction,
    /// QGuiApplication will try to close toplevel windows after
    /// commitDataRequest() has been emitted. If a window cannot be closed, session
    /// shutdown will be canceled and the application will keep running.
    ///
    /// Fallback session management only benefits applications that have an
    /// feature or other logic that
    /// prevents closing a toplevel window depending on certain conditions, and
    /// that do nothing to explicitly implement session management. In applications
    /// that *do* implement session management using the proper session management
    /// API, fallback session management interferes and may break session
    /// management logic.
    ///
    /// **Warning**: If all windows *are* closed due to fallback session management
    /// and quitOnLastWindowClosed() is `true,` the application will quit before
    /// it is explicitly instructed to quit through the platform's session
    /// management protocol. That violation of protocol may prevent the platform
    /// session manager from saving application state.
    ///
    /// **See also:** [`set_fallback_session_management_enabled()`]
    /// [`SessionManager::allows_interaction`]
    /// [`save_state_request()`]
    /// [`commit_data_request()`]
    /// {Session Management}
    pub fn is_fallback_session_management_enabled() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).is_fallback_session_management_enabled)(obj_data);
            ret_val
        }
    }
    ///
    /// Sets whether QGuiApplication will use fallback session management to
    /// *enabled.*
    ///
    /// **See also:** [`is_fallback_session_management_enabled()`]
    pub fn set_fallback_session_management_enabled(arg0: bool) {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_fallback_session_management_enabled)(obj_data, arg0);
        }
    }
    ///
    /// Function that can be used to sync Qt state with the Window Systems state.
    ///
    /// This function will first empty Qts events by calling QCoreApplication::processEvents(),
    /// then the platform plugin will sync up with the windowsystem, and finally Qts events
    /// will be delived by another call to QCoreApplication::processEvents();
    ///
    /// This function is timeconsuming and its use is discouraged.
    pub fn sync() {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_gui_application)(::std::ptr::null()).all_funcs)
                    .gui_application_funcs,
            )
        };
        unsafe {
            ((*funcs).sync)(obj_data);
        }
    }
    #[doc(hidden)]
    pub fn set_organization_domain(org_domain: &str) {
        let str_in_org_domain_1 = CString::new(org_domain).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_organization_domain)(obj_data, str_in_org_domain_1.as_ptr());
        }
    }
    #[doc(hidden)]
    pub fn organization_domain() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).organization_domain)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_organization_name(org_name: &str) {
        let str_in_org_name_1 = CString::new(org_name).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_organization_name)(obj_data, str_in_org_name_1.as_ptr());
        }
    }
    #[doc(hidden)]
    pub fn organization_name() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).organization_name)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_application_name(application: &str) {
        let str_in_application_1 = CString::new(application).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_application_name)(obj_data, str_in_application_1.as_ptr());
        }
    }
    #[doc(hidden)]
    pub fn application_name() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).application_name)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_application_version(version: &str) {
        let str_in_version_1 = CString::new(version).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_application_version)(obj_data, str_in_version_1.as_ptr());
        }
    }
    #[doc(hidden)]
    pub fn application_version() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).application_version)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_setuid_allowed(allow: bool) {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_setuid_allowed)(obj_data, allow);
        }
    }
    #[doc(hidden)]
    pub fn is_setuid_allowed() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).is_setuid_allowed)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn instance() -> Option<CoreApplication<'a>> {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).instance)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = CoreApplication::new_from_rc(t);
            } else {
                ret_val = CoreApplication::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn exit(retcode: i32) {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).exit)(obj_data, retcode);
        }
    }
    #[doc(hidden)]
    pub fn send_event<E: EventTrait<'a>, O: ObjectTrait<'a>>(receiver: &O, event: &E) -> bool {
        let (obj_receiver_1, _funcs) = receiver.get_object_obj_funcs();
        let (obj_event_2, _funcs) = event.get_event_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).send_event)(obj_data, obj_receiver_1, obj_event_2);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn post_event<E: EventTrait<'a>, O: ObjectTrait<'a>>(
        receiver: &O,
        event: &E,
        priority: i32,
    ) {
        let (obj_receiver_1, _funcs) = receiver.get_object_obj_funcs();
        let (obj_event_2, _funcs) = event.get_event_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).post_event)(obj_data, obj_receiver_1, obj_event_2, priority);
        }
    }
    #[doc(hidden)]
    pub fn send_posted_events<O: ObjectTrait<'a>>(receiver: &O, event_type: i32) {
        let (obj_receiver_1, _funcs) = receiver.get_object_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).send_posted_events)(obj_data, obj_receiver_1, event_type);
        }
    }
    #[doc(hidden)]
    pub fn remove_posted_events<O: ObjectTrait<'a>>(receiver: &O, event_type: i32) {
        let (obj_receiver_1, _funcs) = receiver.get_object_obj_funcs();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).remove_posted_events)(obj_data, obj_receiver_1, event_type);
        }
    }
    #[doc(hidden)]
    pub fn has_pending_events() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).has_pending_events)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn starting_up() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).starting_up)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn closing_down() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).closing_down)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn application_dir_path() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).application_dir_path)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn application_file_path() -> String {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).application_file_path)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn application_pid() -> i64 {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).application_pid)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn add_library_path(arg0: &str) {
        let str_in_arg0_1 = CString::new(arg0).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).add_library_path)(obj_data, str_in_arg0_1.as_ptr());
        }
    }
    #[doc(hidden)]
    pub fn remove_library_path(arg0: &str) {
        let str_in_arg0_1 = CString::new(arg0).unwrap();

        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).remove_library_path)(obj_data, str_in_arg0_1.as_ptr());
        }
    }
    #[doc(hidden)]
    pub fn flush() {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).flush)(obj_data);
        }
    }
    #[doc(hidden)]
    pub fn is_quit_lock_enabled() -> bool {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            let ret_val = ((*funcs).is_quit_lock_enabled)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_quit_lock_enabled(enabled: bool) {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).set_quit_lock_enabled)(obj_data, enabled);
        }
    }
    #[doc(hidden)]
    pub fn quit() {
        let (obj_data, funcs) = unsafe {
            (
                ::std::ptr::null(),
                (*((*rute_ffi_get()).get_core_application)(::std::ptr::null()).all_funcs)
                    .core_application_funcs,
            )
        };
        unsafe {
            ((*funcs).quit)(obj_data);
        }
    }
    #[doc(hidden)]
    pub fn set_about_to_quit_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_core_application_obj_funcs();

        let f: Box<Box<Fn(&T) + 'a>> = Box::new(Box::new(func));
        let user_data = data as *const _ as *const c_void;

        unsafe {
            ((*funcs).set_about_to_quit_event)(
                obj_data,
                user_data,
                Box::into_raw(f) as *const _,
                transmute(core_application_about_to_quit_trampoline_ud::<T> as usize),
            );
        }

        self
    }

    pub fn set_about_to_quit_event<F>(&self, func: F) -> &Self
    where
        F: Fn() + 'a,
    {
        let (obj_data, funcs) = self.get_core_application_obj_funcs();
        let f: Box<Box<Fn() + 'a>> = Box::new(Box::new(func));

        unsafe {
            ((*funcs).set_about_to_quit_event)(
                obj_data,
                ::std::ptr::null(),
                Box::into_raw(f) as *const _,
                transmute(core_application_about_to_quit_trampoline as usize),
            );
        }

        self
    }
    #[doc(hidden)]
    pub fn object_name(&self) -> String {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).object_name)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_object_name(&self, name: &str) -> &Self {
        let str_in_name_1 = CString::new(name).unwrap();

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).set_object_name)(obj_data, str_in_name_1.as_ptr());
        }
        self
    }
    #[doc(hidden)]
    pub fn is_widget_type(&self) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_widget_type)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn is_window_type(&self) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_window_type)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn signals_blocked(&self) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).signals_blocked)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn block_signals(&self, b: bool) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).block_signals)(obj_data, b);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn start_timer(&self, interval: i32, timer_type: TimerType) -> i32 {
        let enum_timer_type_2 = timer_type as u32;

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).start_timer)(obj_data, interval, enum_timer_type_2);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn start_timer_2(&self, time: u32, timer_type: TimerType) -> i32 {
        let enum_timer_type_2 = timer_type as u32;

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).start_timer_2)(obj_data, time, enum_timer_type_2);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn kill_timer(&self, id: i32) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).kill_timer)(obj_data, id);
        }
        self
    }
    #[doc(hidden)]
    pub fn set_parent<O: ObjectTrait<'a>>(&self, parent: &O) -> &Self {
        let (obj_parent_1, _funcs) = parent.get_object_obj_funcs();

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).set_parent)(obj_data, obj_parent_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn install_event_filter<O: ObjectTrait<'a>>(&self, filter_obj: &O) -> &Self {
        let (obj_filter_obj_1, _funcs) = filter_obj.get_object_obj_funcs();

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).install_event_filter)(obj_data, obj_filter_obj_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_tree(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_tree)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_info(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_info)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_tree_2(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_tree_2)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_info_2(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_info_2)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn parent(&self) -> Option<Object> {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).parent)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Object::new_from_rc(t);
            } else {
                ret_val = Object::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn delete_later(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).delete_later)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn set_custom_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, &Event) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_object_obj_funcs();

        let f: Box<Box<Fn(&T, &Event) + 'a>> = Box::new(Box::new(func));
        let user_data = data as *const _ as *const c_void;

        unsafe {
            ((*funcs).set_custom_event)(
                obj_data,
                user_data,
                Box::into_raw(f) as *const _,
                transmute(object_custom_trampoline_ud::<T> as usize),
            );
        }

        self
    }

    pub fn set_custom_event<F>(&self, func: F) -> &Self
    where
        F: Fn(&Event) + 'a,
    {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        let f: Box<Box<Fn(&Event) + 'a>> = Box::new(Box::new(func));

        unsafe {
            ((*funcs).set_custom_event)(
                obj_data,
                ::std::ptr::null(),
                Box::into_raw(f) as *const _,
                transmute(object_custom_trampoline as usize),
            );
        }

        self
    }

    pub fn build(&self) -> Self {
        self.clone()
    }
}
pub trait GuiApplicationTrait<'a> {
    #[inline]
    #[doc(hidden)]
    fn get_gui_application_obj_funcs(&self) -> (*const RUBase, *const RUGuiApplicationFuncs);
}

impl<'a> ObjectTrait<'a> for GuiApplication<'a> {
    #[doc(hidden)]
    fn get_object_obj_funcs(&self) -> (*const RUBase, *const RUObjectFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).object_funcs) }
    }
}

impl<'a> CoreApplicationTrait<'a> for GuiApplication<'a> {
    #[doc(hidden)]
    fn get_core_application_obj_funcs(&self) -> (*const RUBase, *const RUCoreApplicationFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).core_application_funcs) }
    }
}

impl<'a> GuiApplicationTrait<'a> for GuiApplication<'a> {
    #[doc(hidden)]
    fn get_gui_application_obj_funcs(&self) -> (*const RUBase, *const RUGuiApplicationFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).gui_application_funcs) }
    }
}