rute/auto/
widget.rs

1// This file is auto-generated by rute_gen. DO NOT EDIT.
2use std::cell::Cell;
3use std::rc::Rc;
4
5#[allow(unused_imports)]
6use std::marker::PhantomData;
7
8#[allow(unused_imports)]
9use std::os::raw::c_void;
10
11#[allow(unused_imports)]
12use std::mem::transmute;
13
14#[allow(unused_imports)]
15use std::ffi::{CStr, CString};
16
17use rute_ffi_base::*;
18
19#[allow(unused_imports)]
20use auto::*;
21
22pub(crate) unsafe extern "C" fn widget_window_title_changed_trampoline_ud<T>(
23    self_c: *const c_void,
24    func: *const c_void,
25    title: *const ::std::os::raw::c_char,
26) {
27    let f: &&(Fn(&T, &str) + 'static) = transmute(func);
28    let str_in_title_0 = CStr::from_ptr(title);
29
30    let data = self_c as *const T;
31    f(&*data, str_in_title_0.to_str().unwrap());
32}
33
34#[allow(unused_variables)]
35pub(crate) unsafe extern "C" fn widget_window_title_changed_trampoline(
36    self_c: *const c_void,
37    func: *const c_void,
38    title: *const ::std::os::raw::c_char,
39) {
40    let f: &&(Fn(&str) + 'static) = transmute(func);
41    let str_in_title_0 = CStr::from_ptr(title);
42
43    f(str_in_title_0.to_str().unwrap());
44}
45
46pub(crate) unsafe extern "C" fn widget_window_icon_changed_trampoline_ud<T>(
47    self_c: *const c_void,
48    func: *const c_void,
49    icon: *const RUBase,
50) {
51    let f: &&(Fn(&T, &Icon) + 'static) = transmute(func);
52    let obj_icon_0 = Icon::new_from_temporary(*(icon as *const RUIcon));
53    let data = self_c as *const T;
54    f(&*data, &obj_icon_0);
55}
56
57#[allow(unused_variables)]
58pub(crate) unsafe extern "C" fn widget_window_icon_changed_trampoline(
59    self_c: *const c_void,
60    func: *const c_void,
61    icon: *const RUBase,
62) {
63    let f: &&(Fn(&Icon) + 'static) = transmute(func);
64    let obj_icon_0 = Icon::new_from_temporary(*(icon as *const RUIcon));
65    f(&obj_icon_0);
66}
67
68pub(crate) unsafe extern "C" fn widget_window_icon_text_changed_trampoline_ud<T>(
69    self_c: *const c_void,
70    func: *const c_void,
71    icon_text: *const ::std::os::raw::c_char,
72) {
73    let f: &&(Fn(&T, &str) + 'static) = transmute(func);
74    let str_in_icon_text_0 = CStr::from_ptr(icon_text);
75
76    let data = self_c as *const T;
77    f(&*data, str_in_icon_text_0.to_str().unwrap());
78}
79
80#[allow(unused_variables)]
81pub(crate) unsafe extern "C" fn widget_window_icon_text_changed_trampoline(
82    self_c: *const c_void,
83    func: *const c_void,
84    icon_text: *const ::std::os::raw::c_char,
85) {
86    let f: &&(Fn(&str) + 'static) = transmute(func);
87    let str_in_icon_text_0 = CStr::from_ptr(icon_text);
88
89    f(str_in_icon_text_0.to_str().unwrap());
90}
91
92pub(crate) unsafe extern "C" fn widget_custom_context_menu_requested_trampoline_ud<T>(
93    self_c: *const c_void,
94    func: *const c_void,
95    pos: *const RUBase,
96) {
97    let f: &&(Fn(&T, &Point) + 'static) = transmute(func);
98    let obj_pos_0 = Point::new_from_temporary(*(pos as *const RUPoint));
99    let data = self_c as *const T;
100    f(&*data, &obj_pos_0);
101}
102
103#[allow(unused_variables)]
104pub(crate) unsafe extern "C" fn widget_custom_context_menu_requested_trampoline(
105    self_c: *const c_void,
106    func: *const c_void,
107    pos: *const RUBase,
108) {
109    let f: &&(Fn(&Point) + 'static) = transmute(func);
110    let obj_pos_0 = Point::new_from_temporary(*(pos as *const RUPoint));
111    f(&obj_pos_0);
112}
113
114pub(crate) unsafe extern "C" fn widget_mouse_press_trampoline_ud<T>(
115    self_c: *const c_void,
116    func: *const c_void,
117    event: *const RUBase,
118) {
119    let f: &&(Fn(&T, &MouseEvent) + 'static) = transmute(func);
120    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
121    let data = self_c as *const T;
122    f(&*data, &obj_event_0);
123}
124
125#[allow(unused_variables)]
126pub(crate) unsafe extern "C" fn widget_mouse_press_trampoline(
127    self_c: *const c_void,
128    func: *const c_void,
129    event: *const RUBase,
130) {
131    let f: &&(Fn(&MouseEvent) + 'static) = transmute(func);
132    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
133    f(&obj_event_0);
134}
135
136pub(crate) unsafe extern "C" fn widget_mouse_release_trampoline_ud<T>(
137    self_c: *const c_void,
138    func: *const c_void,
139    event: *const RUBase,
140) {
141    let f: &&(Fn(&T, &MouseEvent) + 'static) = transmute(func);
142    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
143    let data = self_c as *const T;
144    f(&*data, &obj_event_0);
145}
146
147#[allow(unused_variables)]
148pub(crate) unsafe extern "C" fn widget_mouse_release_trampoline(
149    self_c: *const c_void,
150    func: *const c_void,
151    event: *const RUBase,
152) {
153    let f: &&(Fn(&MouseEvent) + 'static) = transmute(func);
154    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
155    f(&obj_event_0);
156}
157
158pub(crate) unsafe extern "C" fn widget_mouse_double_click_trampoline_ud<T>(
159    self_c: *const c_void,
160    func: *const c_void,
161    event: *const RUBase,
162) {
163    let f: &&(Fn(&T, &MouseEvent) + 'static) = transmute(func);
164    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
165    let data = self_c as *const T;
166    f(&*data, &obj_event_0);
167}
168
169#[allow(unused_variables)]
170pub(crate) unsafe extern "C" fn widget_mouse_double_click_trampoline(
171    self_c: *const c_void,
172    func: *const c_void,
173    event: *const RUBase,
174) {
175    let f: &&(Fn(&MouseEvent) + 'static) = transmute(func);
176    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
177    f(&obj_event_0);
178}
179
180pub(crate) unsafe extern "C" fn widget_mouse_move_trampoline_ud<T>(
181    self_c: *const c_void,
182    func: *const c_void,
183    event: *const RUBase,
184) {
185    let f: &&(Fn(&T, &MouseEvent) + 'static) = transmute(func);
186    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
187    let data = self_c as *const T;
188    f(&*data, &obj_event_0);
189}
190
191#[allow(unused_variables)]
192pub(crate) unsafe extern "C" fn widget_mouse_move_trampoline(
193    self_c: *const c_void,
194    func: *const c_void,
195    event: *const RUBase,
196) {
197    let f: &&(Fn(&MouseEvent) + 'static) = transmute(func);
198    let obj_event_0 = MouseEvent::new_from_temporary(*(event as *const RUMouseEvent));
199    f(&obj_event_0);
200}
201
202pub(crate) unsafe extern "C" fn widget_wheel_trampoline_ud<T>(
203    self_c: *const c_void,
204    func: *const c_void,
205    event: *const RUBase,
206) {
207    let f: &&(Fn(&T, &WheelEvent) + 'static) = transmute(func);
208    let obj_event_0 = WheelEvent::new_from_temporary(*(event as *const RUWheelEvent));
209    let data = self_c as *const T;
210    f(&*data, &obj_event_0);
211}
212
213#[allow(unused_variables)]
214pub(crate) unsafe extern "C" fn widget_wheel_trampoline(
215    self_c: *const c_void,
216    func: *const c_void,
217    event: *const RUBase,
218) {
219    let f: &&(Fn(&WheelEvent) + 'static) = transmute(func);
220    let obj_event_0 = WheelEvent::new_from_temporary(*(event as *const RUWheelEvent));
221    f(&obj_event_0);
222}
223
224pub(crate) unsafe extern "C" fn widget_key_press_trampoline_ud<T>(
225    self_c: *const c_void,
226    func: *const c_void,
227    event: *const RUBase,
228) {
229    let f: &&(Fn(&T, &KeyEvent) + 'static) = transmute(func);
230    let obj_event_0 = KeyEvent::new_from_temporary(*(event as *const RUKeyEvent));
231    let data = self_c as *const T;
232    f(&*data, &obj_event_0);
233}
234
235#[allow(unused_variables)]
236pub(crate) unsafe extern "C" fn widget_key_press_trampoline(
237    self_c: *const c_void,
238    func: *const c_void,
239    event: *const RUBase,
240) {
241    let f: &&(Fn(&KeyEvent) + 'static) = transmute(func);
242    let obj_event_0 = KeyEvent::new_from_temporary(*(event as *const RUKeyEvent));
243    f(&obj_event_0);
244}
245
246pub(crate) unsafe extern "C" fn widget_key_release_trampoline_ud<T>(
247    self_c: *const c_void,
248    func: *const c_void,
249    event: *const RUBase,
250) {
251    let f: &&(Fn(&T, &KeyEvent) + 'static) = transmute(func);
252    let obj_event_0 = KeyEvent::new_from_temporary(*(event as *const RUKeyEvent));
253    let data = self_c as *const T;
254    f(&*data, &obj_event_0);
255}
256
257#[allow(unused_variables)]
258pub(crate) unsafe extern "C" fn widget_key_release_trampoline(
259    self_c: *const c_void,
260    func: *const c_void,
261    event: *const RUBase,
262) {
263    let f: &&(Fn(&KeyEvent) + 'static) = transmute(func);
264    let obj_event_0 = KeyEvent::new_from_temporary(*(event as *const RUKeyEvent));
265    f(&obj_event_0);
266}
267
268pub(crate) unsafe extern "C" fn widget_focus_in_trampoline_ud<T>(
269    self_c: *const c_void,
270    func: *const c_void,
271    event: *const RUBase,
272) {
273    let f: &&(Fn(&T, &FocusEvent) + 'static) = transmute(func);
274    let obj_event_0 = FocusEvent::new_from_temporary(*(event as *const RUFocusEvent));
275    let data = self_c as *const T;
276    f(&*data, &obj_event_0);
277}
278
279#[allow(unused_variables)]
280pub(crate) unsafe extern "C" fn widget_focus_in_trampoline(
281    self_c: *const c_void,
282    func: *const c_void,
283    event: *const RUBase,
284) {
285    let f: &&(Fn(&FocusEvent) + 'static) = transmute(func);
286    let obj_event_0 = FocusEvent::new_from_temporary(*(event as *const RUFocusEvent));
287    f(&obj_event_0);
288}
289
290pub(crate) unsafe extern "C" fn widget_focus_out_trampoline_ud<T>(
291    self_c: *const c_void,
292    func: *const c_void,
293    event: *const RUBase,
294) {
295    let f: &&(Fn(&T, &FocusEvent) + 'static) = transmute(func);
296    let obj_event_0 = FocusEvent::new_from_temporary(*(event as *const RUFocusEvent));
297    let data = self_c as *const T;
298    f(&*data, &obj_event_0);
299}
300
301#[allow(unused_variables)]
302pub(crate) unsafe extern "C" fn widget_focus_out_trampoline(
303    self_c: *const c_void,
304    func: *const c_void,
305    event: *const RUBase,
306) {
307    let f: &&(Fn(&FocusEvent) + 'static) = transmute(func);
308    let obj_event_0 = FocusEvent::new_from_temporary(*(event as *const RUFocusEvent));
309    f(&obj_event_0);
310}
311
312pub(crate) unsafe extern "C" fn widget_enter_trampoline_ud<T>(
313    self_c: *const c_void,
314    func: *const c_void,
315    event: *const RUBase,
316) {
317    let f: &&(Fn(&T, &Event) + 'static) = transmute(func);
318    let obj_event_0 = Event::new_from_temporary(*(event as *const RUEvent));
319    let data = self_c as *const T;
320    f(&*data, &obj_event_0);
321}
322
323#[allow(unused_variables)]
324pub(crate) unsafe extern "C" fn widget_enter_trampoline(
325    self_c: *const c_void,
326    func: *const c_void,
327    event: *const RUBase,
328) {
329    let f: &&(Fn(&Event) + 'static) = transmute(func);
330    let obj_event_0 = Event::new_from_temporary(*(event as *const RUEvent));
331    f(&obj_event_0);
332}
333
334pub(crate) unsafe extern "C" fn widget_leave_trampoline_ud<T>(
335    self_c: *const c_void,
336    func: *const c_void,
337    event: *const RUBase,
338) {
339    let f: &&(Fn(&T, &Event) + 'static) = transmute(func);
340    let obj_event_0 = Event::new_from_temporary(*(event as *const RUEvent));
341    let data = self_c as *const T;
342    f(&*data, &obj_event_0);
343}
344
345#[allow(unused_variables)]
346pub(crate) unsafe extern "C" fn widget_leave_trampoline(
347    self_c: *const c_void,
348    func: *const c_void,
349    event: *const RUBase,
350) {
351    let f: &&(Fn(&Event) + 'static) = transmute(func);
352    let obj_event_0 = Event::new_from_temporary(*(event as *const RUEvent));
353    f(&obj_event_0);
354}
355
356pub(crate) unsafe extern "C" fn widget_paint_trampoline_ud<T>(
357    self_c: *const c_void,
358    func: *const c_void,
359    event: *const RUBase,
360) {
361    let f: &&(Fn(&T, &PaintEvent) + 'static) = transmute(func);
362    let obj_event_0 = PaintEvent::new_from_temporary(*(event as *const RUPaintEvent));
363    let data = self_c as *const T;
364    f(&*data, &obj_event_0);
365}
366
367#[allow(unused_variables)]
368pub(crate) unsafe extern "C" fn widget_paint_trampoline(
369    self_c: *const c_void,
370    func: *const c_void,
371    event: *const RUBase,
372) {
373    let f: &&(Fn(&PaintEvent) + 'static) = transmute(func);
374    let obj_event_0 = PaintEvent::new_from_temporary(*(event as *const RUPaintEvent));
375    f(&obj_event_0);
376}
377
378pub(crate) unsafe extern "C" fn widget_move_trampoline_ud<T>(
379    self_c: *const c_void,
380    func: *const c_void,
381    event: *const RUBase,
382) {
383    let f: &&(Fn(&T, &MoveEvent) + 'static) = transmute(func);
384    let obj_event_0 = MoveEvent::new_from_temporary(*(event as *const RUMoveEvent));
385    let data = self_c as *const T;
386    f(&*data, &obj_event_0);
387}
388
389#[allow(unused_variables)]
390pub(crate) unsafe extern "C" fn widget_move_trampoline(
391    self_c: *const c_void,
392    func: *const c_void,
393    event: *const RUBase,
394) {
395    let f: &&(Fn(&MoveEvent) + 'static) = transmute(func);
396    let obj_event_0 = MoveEvent::new_from_temporary(*(event as *const RUMoveEvent));
397    f(&obj_event_0);
398}
399
400pub(crate) unsafe extern "C" fn widget_resize_trampoline_ud<T>(
401    self_c: *const c_void,
402    func: *const c_void,
403    event: *const RUBase,
404) {
405    let f: &&(Fn(&T, &ResizeEvent) + 'static) = transmute(func);
406    let obj_event_0 = ResizeEvent::new_from_temporary(*(event as *const RUResizeEvent));
407    let data = self_c as *const T;
408    f(&*data, &obj_event_0);
409}
410
411#[allow(unused_variables)]
412pub(crate) unsafe extern "C" fn widget_resize_trampoline(
413    self_c: *const c_void,
414    func: *const c_void,
415    event: *const RUBase,
416) {
417    let f: &&(Fn(&ResizeEvent) + 'static) = transmute(func);
418    let obj_event_0 = ResizeEvent::new_from_temporary(*(event as *const RUResizeEvent));
419    f(&obj_event_0);
420}
421
422pub(crate) unsafe extern "C" fn widget_close_trampoline_ud<T>(
423    self_c: *const c_void,
424    func: *const c_void,
425    event: *const RUBase,
426) {
427    let f: &&(Fn(&T, &CloseEvent) + 'static) = transmute(func);
428    let obj_event_0 = CloseEvent::new_from_temporary(*(event as *const RUCloseEvent));
429    let data = self_c as *const T;
430    f(&*data, &obj_event_0);
431}
432
433#[allow(unused_variables)]
434pub(crate) unsafe extern "C" fn widget_close_trampoline(
435    self_c: *const c_void,
436    func: *const c_void,
437    event: *const RUBase,
438) {
439    let f: &&(Fn(&CloseEvent) + 'static) = transmute(func);
440    let obj_event_0 = CloseEvent::new_from_temporary(*(event as *const RUCloseEvent));
441    f(&obj_event_0);
442}
443
444pub(crate) unsafe extern "C" fn widget_context_menu_trampoline_ud<T>(
445    self_c: *const c_void,
446    func: *const c_void,
447    event: *const RUBase,
448) {
449    let f: &&(Fn(&T, &ContextMenuEvent) + 'static) = transmute(func);
450    let obj_event_0 = ContextMenuEvent::new_from_temporary(*(event as *const RUContextMenuEvent));
451    let data = self_c as *const T;
452    f(&*data, &obj_event_0);
453}
454
455#[allow(unused_variables)]
456pub(crate) unsafe extern "C" fn widget_context_menu_trampoline(
457    self_c: *const c_void,
458    func: *const c_void,
459    event: *const RUBase,
460) {
461    let f: &&(Fn(&ContextMenuEvent) + 'static) = transmute(func);
462    let obj_event_0 = ContextMenuEvent::new_from_temporary(*(event as *const RUContextMenuEvent));
463    f(&obj_event_0);
464}
465
466pub(crate) unsafe extern "C" fn widget_tablet_trampoline_ud<T>(
467    self_c: *const c_void,
468    func: *const c_void,
469    event: *const RUBase,
470) {
471    let f: &&(Fn(&T, &TabletEvent) + 'static) = transmute(func);
472    let obj_event_0 = TabletEvent::new_from_temporary(*(event as *const RUTabletEvent));
473    let data = self_c as *const T;
474    f(&*data, &obj_event_0);
475}
476
477#[allow(unused_variables)]
478pub(crate) unsafe extern "C" fn widget_tablet_trampoline(
479    self_c: *const c_void,
480    func: *const c_void,
481    event: *const RUBase,
482) {
483    let f: &&(Fn(&TabletEvent) + 'static) = transmute(func);
484    let obj_event_0 = TabletEvent::new_from_temporary(*(event as *const RUTabletEvent));
485    f(&obj_event_0);
486}
487
488pub(crate) unsafe extern "C" fn widget_drag_enter_trampoline_ud<T>(
489    self_c: *const c_void,
490    func: *const c_void,
491    event: *const RUBase,
492) {
493    let f: &&(Fn(&T, &DragEnterEvent) + 'static) = transmute(func);
494    let obj_event_0 = DragEnterEvent::new_from_temporary(*(event as *const RUDragEnterEvent));
495    let data = self_c as *const T;
496    f(&*data, &obj_event_0);
497}
498
499#[allow(unused_variables)]
500pub(crate) unsafe extern "C" fn widget_drag_enter_trampoline(
501    self_c: *const c_void,
502    func: *const c_void,
503    event: *const RUBase,
504) {
505    let f: &&(Fn(&DragEnterEvent) + 'static) = transmute(func);
506    let obj_event_0 = DragEnterEvent::new_from_temporary(*(event as *const RUDragEnterEvent));
507    f(&obj_event_0);
508}
509
510pub(crate) unsafe extern "C" fn widget_drag_move_trampoline_ud<T>(
511    self_c: *const c_void,
512    func: *const c_void,
513    event: *const RUBase,
514) {
515    let f: &&(Fn(&T, &DragMoveEvent) + 'static) = transmute(func);
516    let obj_event_0 = DragMoveEvent::new_from_temporary(*(event as *const RUDragMoveEvent));
517    let data = self_c as *const T;
518    f(&*data, &obj_event_0);
519}
520
521#[allow(unused_variables)]
522pub(crate) unsafe extern "C" fn widget_drag_move_trampoline(
523    self_c: *const c_void,
524    func: *const c_void,
525    event: *const RUBase,
526) {
527    let f: &&(Fn(&DragMoveEvent) + 'static) = transmute(func);
528    let obj_event_0 = DragMoveEvent::new_from_temporary(*(event as *const RUDragMoveEvent));
529    f(&obj_event_0);
530}
531
532pub(crate) unsafe extern "C" fn widget_drag_leave_trampoline_ud<T>(
533    self_c: *const c_void,
534    func: *const c_void,
535    event: *const RUBase,
536) {
537    let f: &&(Fn(&T, &DragLeaveEvent) + 'static) = transmute(func);
538    let obj_event_0 = DragLeaveEvent::new_from_temporary(*(event as *const RUDragLeaveEvent));
539    let data = self_c as *const T;
540    f(&*data, &obj_event_0);
541}
542
543#[allow(unused_variables)]
544pub(crate) unsafe extern "C" fn widget_drag_leave_trampoline(
545    self_c: *const c_void,
546    func: *const c_void,
547    event: *const RUBase,
548) {
549    let f: &&(Fn(&DragLeaveEvent) + 'static) = transmute(func);
550    let obj_event_0 = DragLeaveEvent::new_from_temporary(*(event as *const RUDragLeaveEvent));
551    f(&obj_event_0);
552}
553
554pub(crate) unsafe extern "C" fn widget_drop_trampoline_ud<T>(
555    self_c: *const c_void,
556    func: *const c_void,
557    event: *const RUBase,
558) {
559    let f: &&(Fn(&T, &DropEvent) + 'static) = transmute(func);
560    let obj_event_0 = DropEvent::new_from_temporary(*(event as *const RUDropEvent));
561    let data = self_c as *const T;
562    f(&*data, &obj_event_0);
563}
564
565#[allow(unused_variables)]
566pub(crate) unsafe extern "C" fn widget_drop_trampoline(
567    self_c: *const c_void,
568    func: *const c_void,
569    event: *const RUBase,
570) {
571    let f: &&(Fn(&DropEvent) + 'static) = transmute(func);
572    let obj_event_0 = DropEvent::new_from_temporary(*(event as *const RUDropEvent));
573    f(&obj_event_0);
574}
575
576pub(crate) unsafe extern "C" fn widget_show_trampoline_ud<T>(
577    self_c: *const c_void,
578    func: *const c_void,
579    event: *const RUBase,
580) {
581    let f: &&(Fn(&T, &ShowEvent) + 'static) = transmute(func);
582    let obj_event_0 = ShowEvent::new_from_temporary(*(event as *const RUShowEvent));
583    let data = self_c as *const T;
584    f(&*data, &obj_event_0);
585}
586
587#[allow(unused_variables)]
588pub(crate) unsafe extern "C" fn widget_show_trampoline(
589    self_c: *const c_void,
590    func: *const c_void,
591    event: *const RUBase,
592) {
593    let f: &&(Fn(&ShowEvent) + 'static) = transmute(func);
594    let obj_event_0 = ShowEvent::new_from_temporary(*(event as *const RUShowEvent));
595    f(&obj_event_0);
596}
597
598pub(crate) unsafe extern "C" fn widget_hide_trampoline_ud<T>(
599    self_c: *const c_void,
600    func: *const c_void,
601    event: *const RUBase,
602) {
603    let f: &&(Fn(&T, &HideEvent) + 'static) = transmute(func);
604    let obj_event_0 = HideEvent::new_from_temporary(*(event as *const RUHideEvent));
605    let data = self_c as *const T;
606    f(&*data, &obj_event_0);
607}
608
609#[allow(unused_variables)]
610pub(crate) unsafe extern "C" fn widget_hide_trampoline(
611    self_c: *const c_void,
612    func: *const c_void,
613    event: *const RUBase,
614) {
615    let f: &&(Fn(&HideEvent) + 'static) = transmute(func);
616    let obj_event_0 = HideEvent::new_from_temporary(*(event as *const RUHideEvent));
617    f(&obj_event_0);
618}
619
620pub(crate) unsafe extern "C" fn widget_change_trampoline_ud<T>(
621    self_c: *const c_void,
622    func: *const c_void,
623    arg0: *const RUBase,
624) {
625    let f: &&(Fn(&T, &Event) + 'static) = transmute(func);
626    let obj_arg0_0 = Event::new_from_temporary(*(arg0 as *const RUEvent));
627    let data = self_c as *const T;
628    f(&*data, &obj_arg0_0);
629}
630
631#[allow(unused_variables)]
632pub(crate) unsafe extern "C" fn widget_change_trampoline(
633    self_c: *const c_void,
634    func: *const c_void,
635    arg0: *const RUBase,
636) {
637    let f: &&(Fn(&Event) + 'static) = transmute(func);
638    let obj_arg0_0 = Event::new_from_temporary(*(arg0 as *const RUEvent));
639    f(&obj_arg0_0);
640}
641
642/// **Notice these docs are heavy WIP and not very relevent yet**
643///
644/// The widget is the atom of the user interface: it receives mouse, keyboard
645/// and other events from the window system, and paints a representation of
646/// itself on the screen. Every widget is rectangular, and they are sorted in a
647/// Z-order. A widget is clipped by its parent and by the widgets in front of
648/// it.
649///
650/// A widget that is not embedded in a parent widget is called a window.
651/// Usually, windows have a frame and a title bar, although it is also possible
652/// to create windows without such decoration using suitable
653/// [window flags](Qt::WindowFlags)
654/// ). In Qt, QMainWindow and the various
655/// subclasses of QDialog are the most common window types.
656///
657/// Every widget's constructor accepts one or two standard arguments:
658///
659/// * `QWidget *parent = 0` is the parent of the new widget. If it is 0 (the default), the new widget will be a window. If not, it will be a child of *parent,* and be constrained by *parent's* geometry (unless you specify Qt::Window as window flag).
660/// * `Qt::WindowFlags f = 0` (where available) sets the window flags; the default is suitable for almost all widgets, but to get, for example, a window without a window system frame, you must use special flags.
661///
662/// QWidget has many member functions, but some of them have little direct
663/// functionality; for example, QWidget has a font property, but never uses
664/// this itself. There are many subclasses which provide real functionality,
665/// such as QLabel, QPushButton, QListWidget, and QTabWidget.
666///
667/// # Top-Level and Child Widgets
668///
669/// A widget without a parent widget is always an independent window (top-level
670/// widget). For these widgets, setWindowTitle() and setWindowIcon() set the
671/// title bar and icon respectively.
672///
673/// Non-window widgets are child widgets, displayed within their parent
674/// widgets. Most widgets in Qt are mainly useful as child widgets. For
675/// example, it is possible to display a button as a top-level window, but most
676/// people prefer to put their buttons inside other widgets, such as QDialog.
677///
678/// ![A parent widget containing various child widgets.](parent-child-widgets.png)
679///
680/// The diagram above shows a QGroupBox widget being used to hold various child
681/// widgets in a layout provided by QGridLayout. The QLabel child widgets have
682/// been outlined to indicate their full sizes.
683///
684/// If you want to use a QWidget to hold child widgets you will usually want to
685/// add a layout to the parent QWidget. See [Layout Management](Layout%20Management)
686/// for more
687/// information.
688///
689/// # Composite Widgets
690///
691/// When a widget is used as a container to group a number of child widgets, it
692/// is known as a composite widget. These can be created by constructing a
693/// widget with the required visual properties - a QFrame, for example - and
694/// adding child widgets to it, usually managed by a layout. The above diagram
695/// shows such a composite widget that was created using Qt Designer.
696///
697/// Composite widgets can also be created by subclassing a standard widget,
698/// such as QWidget or QFrame, and adding the necessary layout and child
699/// widgets in the constructor of the subclass. Many of the [examples provided with Qt](Qt%20Widgets%20Examples)
700/// use this approach, and it is also covered in
701/// the Qt [Tutorials](Tutorials)
702///
703///
704/// # Custom Widgets and Painting
705///
706/// Since QWidget is a subclass of QPaintDevice, subclasses can be used to
707/// display custom content that is composed using a series of painting
708/// operations with an instance of the QPainter class. This approach contrasts
709/// with the canvas-style approach used by the [Graphics View Framework](Graphics%20View)
710/// where items are added to a scene by the
711/// application and are rendered by the framework itself.
712///
713/// Each widget performs all painting operations from within its paintEvent()
714/// function. This is called whenever the widget needs to be redrawn, either
715/// as a result of some external change or when requested by the application.
716///
717/// The [Analog Clock example](widgets/analogclock)
718/// shows how a simple widget
719/// can handle paint events.
720///
721/// # Size Hints and Size Policies
722///
723/// When implementing a new widget, it is almost always useful to reimplement
724/// sizeHint() to provide a reasonable default size for the widget and to set
725/// the correct size policy with setSizePolicy().
726///
727/// By default, composite widgets which do not provide a size hint will be
728/// sized according to the space requirements of their child widgets.
729///
730/// The size policy lets you supply good default behavior for the layout
731/// management system, so that other widgets can contain and manage yours
732/// easily. The default size policy indicates that the size hint represents
733/// the preferred size of the widget, and this is often good enough for many
734/// widgets.
735///
736/// **Note**: The size of top-level widgets are constrained to 2/3 of the desktop's
737/// height and width. You can resize() the widget manually if these bounds are
738/// inadequate.
739///
740/// # Events
741///
742/// Widgets respond to events that are typically caused by user actions. Qt
743/// delivers events to widgets by calling specific event handler functions with
744/// instances of QEvent subclasses containing information about each event.
745///
746/// If your widget only contains child widgets, you probably do not need to
747/// implement any event handlers. If you want to detect a mouse click in a
748/// child widget call the child's underMouse() function inside the widget's
749/// mousePressEvent().
750///
751/// The [Scribble example](widgets/scribble)
752/// implements a wider set of
753/// events to handle mouse movement, button presses, and window resizing.
754///
755/// You will need to supply the behavior and content for your own widgets, but
756/// here is a brief overview of the events that are relevant to QWidget,
757/// starting with the most common ones:
758///
759/// * paintEvent() is called whenever the widget needs to be repainted. Every widget displaying custom content must implement it. Painting using a QPainter can only take place in a paintEvent() or a function called by a paintEvent().
760/// * resizeEvent() is called when the widget has been resized.
761/// * mousePressEvent() is called when a mouse button is pressed while the mouse cursor is inside the widget, or when the widget has grabbed the mouse using grabMouse(). Pressing the mouse without releasing it is effectively the same as calling grabMouse().
762/// * mouseReleaseEvent() is called when a mouse button is released. A widget receives mouse release events when it has received the corresponding mouse press event. This means that if the user presses the mouse inside *your* widget, then drags the mouse somewhere else before releasing the mouse button, *your* widget receives the release event. There is one exception: if a popup menu appears while the mouse button is held down, this popup immediately steals the mouse events.
763/// * mouseDoubleClickEvent() is called when the user double-clicks in the widget. If the user double-clicks, the widget receives a mouse press event, a mouse release event, (a mouse click event,) a second mouse press, this event and finally a second mouse release event. (Some mouse move events may also be received if the mouse is not held steady during this operation.) It is *not possible* to distinguish a click from a double-click until the second click arrives. (This is one reason why most GUI books recommend that double-clicks be an extension of single-clicks, rather than trigger a different action.)
764///
765/// Widgets that accept keyboard input need to reimplement a few more event
766/// handlers:
767///
768/// * keyPressEvent() is called whenever a key is pressed, and again when a key has been held down long enough for it to auto-repeat. The **Tab** and **Shift+Tab** keys are only passed to the widget if they are not used by the focus-change mechanisms. To force those keys to be processed by your widget, you must reimplement QWidget::event().
769/// * focusInEvent() is called when the widget gains keyboard focus (assuming you have called setFocusPolicy()). Well-behaved widgets indicate that they own the keyboard focus in a clear but discreet way.
770/// * focusOutEvent() is called when the widget loses keyboard focus.
771///
772/// You may be required to also reimplement some of the less common event
773/// handlers:
774///
775/// * mouseMoveEvent() is called whenever the mouse moves while a mouse button is held down. This can be useful during drag and drop operations. If you call [setMouseTracking](setMouseTracking())
776/// (true), you get mouse move events even when no buttons are held down. (See also the [Drag and Drop](Drag%20and%20Drop)
777/// guide.)
778/// * keyReleaseEvent() is called whenever a key is released and while it is held down (if the key is auto-repeating). In that case, the widget will receive a pair of key release and key press event for every repeat. The **Tab** and **Shift+Tab** keys are only passed to the widget if they are not used by the focus-change mechanisms. To force those keys to be processed by your widget, you must reimplement QWidget::event().
779/// * wheelEvent() is called whenever the user turns the mouse wheel while the widget has the focus.
780/// * enterEvent() is called when the mouse enters the widget's screen space. (This excludes screen space owned by any of the widget's children.)
781/// * leaveEvent() is called when the mouse leaves the widget's screen space. If the mouse enters a child widget it will not cause a leaveEvent().
782/// * moveEvent() is called when the widget has been moved relative to its parent.
783/// * closeEvent() is called when the user closes the widget (or when close() is called).
784///
785/// There are also some rather obscure events described in the documentation
786/// for QEvent::Type. To handle these events, you need to reimplement event()
787/// directly.
788///
789/// The default implementation of event() handles **Tab** and **Shift+Tab**
790/// (to move the keyboard focus), and passes on most of the other events to
791/// one of the more specialized handlers above.
792///
793/// Events and the mechanism used to deliver them are covered in
794/// [The Event System](The%20Event%20System)
795///
796///
797/// # Groups of Functions and Properties
798///
799/// * Context
800/// * Functions and Properties
801/// * Window functions
802/// * show(), hide(), raise(), lower(), close().
803/// * Top-level windows
804/// * [windowModified,](windowModified,)
805/// [windowTitle,](windowTitle,)
806/// [windowIcon,](windowIcon,)
807/// [isActiveWindow,](isActiveWindow,)
808/// activateWindow(), [minimized,](minimized,)
809/// showMinimized(), [maximized,](maximized,)
810/// showMaximized(), [fullScreen,](fullScreen,)
811/// showFullScreen(), showNormal().
812/// * Window contents
813/// * update(), repaint(), scroll().
814/// * Geometry
815/// * [pos,](pos,)
816/// x(), y(), [rect,](rect,)
817/// [size,](size,)
818/// width(), height(), move(), resize(), [sizePolicy,](sizePolicy,)
819/// sizeHint(), minimumSizeHint(), updateGeometry(), layout(), [frameGeometry,](frameGeometry,)
820/// [geometry,](geometry,)
821/// [childrenRect,](childrenRect,)
822/// [childrenRegion,](childrenRegion,)
823/// adjustSize(), mapFromGlobal(), mapToGlobal(), mapFromParent(), mapToParent(), [maximumSize,](maximumSize,)
824/// [minimumSize,](minimumSize,)
825/// [sizeIncrement,](sizeIncrement,)
826/// [baseSize,](baseSize,)
827/// setFixedSize()
828/// * Mode
829/// * [visible,](visible,)
830/// isVisibleTo(), [enabled,](enabled,)
831/// isEnabledTo(), [modal,](modal,)
832/// isWindow(), [mouseTracking,](mouseTracking,)
833/// [updatesEnabled,](updatesEnabled,)
834/// visibleRegion().
835/// * Look and feel
836/// * style(), setStyle(), [styleSheet,](styleSheet,)
837/// [cursor,](cursor,)
838/// [font,](font,)
839/// [palette,](palette,)
840/// backgroundRole(), setBackgroundRole(), fontInfo(), fontMetrics().
841/// * Keyboard focus functions
842/// * [focus,](focus,)
843/// [focusPolicy,](focusPolicy,)
844/// setFocus(), clearFocus(), setTabOrder(), setFocusProxy(), focusNextChild(), focusPreviousChild().
845/// * Mouse and keyboard grabbing
846/// * grabMouse(), releaseMouse(), grabKeyboard(), releaseKeyboard(), mouseGrabber(), keyboardGrabber().
847/// * Event handlers
848/// * event(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), keyPressEvent(), keyReleaseEvent(), focusInEvent(), focusOutEvent(), wheelEvent(), enterEvent(), leaveEvent(), paintEvent(), moveEvent(), resizeEvent(), closeEvent(), dragEnterEvent(), dragMoveEvent(), dragLeaveEvent(), dropEvent(), childEvent(), showEvent(), hideEvent(), customEvent(). changeEvent(),
849/// * System functions
850/// * parentWidget(), window(), setParent(), winId(), find(), metric().
851/// * Context menu
852/// * contextMenuPolicy, contextMenuEvent(), customContextMenuRequested(), actions()
853/// * Interactive help
854/// * setToolTip(), setWhatsThis()
855///
856/// # Widget Style Sheets
857///
858/// In addition to the standard widget styles for each platform, widgets can
859/// also be styled according to rules specified in a [style sheet](styleSheet)
860/// . This feature enables you to customize the appearance of
861/// specific widgets to provide visual cues to users about their purpose. For
862/// example, a button could be styled in a particular way to indicate that it
863/// performs a destructive action.
864///
865/// The use of widget style sheets is described in more detail in the
866/// [Qt Style Sheets](Qt%20Style%20Sheets)
867/// document.
868///
869/// # Transparency and Double Buffering
870///
871/// Since Qt 4.0, QWidget automatically double-buffers its painting, so there
872/// is no need to write double-buffering code in paintEvent() to avoid
873/// flicker.
874///
875/// Since Qt 4.1, the Qt::WA_ContentsPropagated widget attribute has been
876/// deprecated. Instead, the contents of parent widgets are propagated by
877/// default to each of their children as long as Qt::WA_PaintOnScreen is not
878/// set. Custom widgets can be written to take advantage of this feature by
879/// updating irregular regions (to create non-rectangular child widgets), or
880/// painting with colors that have less than full alpha component. The
881/// following diagram shows how attributes and properties of a custom widget
882/// can be fine-tuned to achieve different effects.
883///
884/// ![propagation-custom.png](propagation-custom.png)
885///
886/// In the above diagram, a semi-transparent rectangular child widget with an
887/// area removed is constructed and added to a parent widget (a QLabel showing
888/// a pixmap). Then, different properties and widget attributes are set to
889/// achieve different effects:
890///
891/// * The left widget has no additional properties or widget attributes set. This default state suits most custom widgets using transparency, are irregularly-shaped, or do not paint over their entire area with an opaque brush.
892/// * The center widget has the [autoFillBackground](autoFillBackground)
893/// property set. This property is used with custom widgets that rely on the widget to supply a default background, and do not paint over their entire area with an opaque brush.
894/// * The right widget has the Qt::WA_OpaquePaintEvent widget attribute set. This indicates that the widget will paint over its entire area with opaque colors. The widget's area will initially be *uninitialized* , represented in the diagram with a red diagonal grid pattern that shines through the overpainted area. The Qt::WA_OpaquePaintArea attribute is useful for widgets that need to paint their own specialized contents quickly and do not need a default filled background.
895///
896/// To rapidly update custom widgets with simple background colors, such as
897/// real-time plotting or graphing widgets, it is better to define a suitable
898/// background color (using setBackgroundRole() with the
899/// QPalette::Window role), set the [autoFillBackground](autoFillBackground)
900/// property, and only
901/// implement the necessary drawing functionality in the widget's paintEvent().
902///
903/// To rapidly update custom widgets that constantly paint over their entire
904/// areas with opaque content, e.g., video streaming widgets, it is better to
905/// set the widget's Qt::WA_OpaquePaintEvent, avoiding any unnecessary overhead
906/// associated with repainting the widget's background.
907///
908/// If a widget has both the Qt::WA_OpaquePaintEvent widget attribute *and*
909/// the [autoFillBackground](autoFillBackground)
910/// property set, the Qt::WA_OpaquePaintEvent
911/// attribute takes precedence. Depending on your requirements, you should
912/// choose either one of them.
913///
914/// Since Qt 4.1, the contents of parent widgets are also propagated to
915/// standard Qt widgets. This can lead to some unexpected results if the
916/// parent widget is decorated in a non-standard way, as shown in the diagram
917/// below.
918///
919/// ![propagation-standard.png](propagation-standard.png)
920///
921/// The scope for customizing the painting behavior of standard Qt widgets,
922/// without resorting to subclassing, is slightly less than that possible for
923/// custom widgets. Usually, the desired appearance of a standard widget can be
924/// achieved by setting its [autoFillBackground](autoFillBackground)
925/// property.
926///
927/// # Creating Translucent Windows
928///
929/// Since Qt 4.5, it has been possible to create windows with translucent regions
930/// on window systems that support compositing.
931///
932/// To enable this feature in a top-level widget, set its Qt::WA_TranslucentBackground
933/// attribute with setAttribute() and ensure that its background is painted with
934/// non-opaque colors in the regions you want to be partially transparent.
935///
936/// Platform notes:
937///
938/// * X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager.
939/// * Windows: The widget needs to have the Qt::FramelessWindowHint window flag set for the translucency to work.
940///
941/// # Native Widgets vs Alien Widgets
942///
943/// Introduced in Qt 4.4, alien widgets are widgets unknown to the windowing
944/// system. They do not have a native window handle associated with them. This
945/// feature significantly speeds up widget painting, resizing, and removes flicker.
946///
947/// Should you require the old behavior with native windows, you can choose
948/// one of the following options:
949///
950/// * Use the `QT_USE_NATIVE_WINDOWS=1` in your environment.
951/// * Set the Qt::AA_NativeWindows attribute on your application. All widgets will be native widgets.
952/// * Set the Qt::WA_NativeWindow attribute on widgets: The widget itself and all of its ancestors will become native (unless Qt::WA_DontCreateNativeAncestors is set).
953/// * Call QWidget::winId to enforce a native window (this implies 3).
954/// * Set the Qt::WA_PaintOnScreen attribute to enforce a native window (this implies 3).
955///
956/// **See also:** [`Event`]
957/// [`Painter`]
958/// [`GridLayout`]
959/// [`BoxLayout`]
960///
961/// # Licence
962///
963/// 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.
964#[derive(Clone)]
965pub struct Widget<'a> {
966    #[doc(hidden)]
967    pub data: Rc<Cell<Option<*const RUBase>>>,
968    #[doc(hidden)]
969    pub all_funcs: *const RUWidgetAllFuncs,
970    #[doc(hidden)]
971    pub owned: bool,
972    #[doc(hidden)]
973    pub _marker: PhantomData<::std::cell::Cell<&'a ()>>,
974}
975
976impl<'a> Widget<'a> {
977    pub fn new() -> Widget<'a> {
978        let data = Rc::new(Cell::new(None));
979
980        let ffi_data = unsafe {
981            ((*rute_ffi_get()).create_widget)(
982                ::std::ptr::null(),
983                transmute(rute_object_delete_callback as usize),
984                Rc::into_raw(data.clone()) as *const c_void,
985            )
986        };
987
988        data.set(Some(ffi_data.qt_data));
989
990        Widget {
991            data,
992            all_funcs: ffi_data.all_funcs,
993            owned: true,
994            _marker: PhantomData,
995        }
996    }
997    #[allow(dead_code)]
998    pub(crate) fn new_from_rc(ffi_data: RUWidget) -> Widget<'a> {
999        Widget {
1000            data: unsafe { Rc::from_raw(ffi_data.host_data as *const Cell<Option<*const RUBase>>) },
1001            all_funcs: ffi_data.all_funcs,
1002            owned: false,
1003            _marker: PhantomData,
1004        }
1005    }
1006
1007    #[allow(dead_code)]
1008    pub(crate) fn new_from_owned(ffi_data: RUWidget) -> Widget<'a> {
1009        Widget {
1010            data: Rc::new(Cell::new(Some(ffi_data.qt_data as *const RUBase))),
1011            all_funcs: ffi_data.all_funcs,
1012            owned: true,
1013            _marker: PhantomData,
1014        }
1015    }
1016
1017    #[allow(dead_code)]
1018    pub(crate) fn new_from_temporary(ffi_data: RUWidget) -> Widget<'a> {
1019        Widget {
1020            data: Rc::new(Cell::new(Some(ffi_data.qt_data as *const RUBase))),
1021            all_funcs: ffi_data.all_funcs,
1022            owned: false,
1023            _marker: PhantomData,
1024        }
1025    }
1026    ///
1027    /// Returns the window system identifier of the widget.
1028    ///
1029    /// Portable in principle, but if you use it you are probably about to
1030    /// do something non-portable. Be careful.
1031    ///
1032    /// If a widget is non-native (alien) and winId() is invoked on it, that widget
1033    /// will be provided a native handle.
1034    ///
1035    /// This value may change at run-time. An event with type QEvent::WinIdChange
1036    /// will be sent to the widget following a change in window system identifier.
1037    ///
1038    /// **See also:** [`find()`]
1039    pub fn win_id(&self) -> u64 {
1040        let (obj_data, funcs) = self.get_widget_obj_funcs();
1041        unsafe {
1042            let ret_val = ((*funcs).win_id)(obj_data);
1043            ret_val
1044        }
1045    }
1046    pub fn create_win_id(&self) -> &Self {
1047        let (obj_data, funcs) = self.get_widget_obj_funcs();
1048        unsafe {
1049            ((*funcs).create_win_id)(obj_data);
1050        }
1051        self
1052    }
1053    pub fn internal_win_id(&self) -> u64 {
1054        let (obj_data, funcs) = self.get_widget_obj_funcs();
1055        unsafe {
1056            let ret_val = ((*funcs).internal_win_id)(obj_data);
1057            ret_val
1058        }
1059    }
1060    ///
1061    /// Returns the effective window system identifier of the widget, i.e. the
1062    /// native parent's window system identifier.
1063    ///
1064    /// If the widget is native, this function returns the native widget ID.
1065    /// Otherwise, the window ID of the first native parent widget, i.e., the
1066    /// top-level widget that contains this widget, is returned.
1067    ///
1068    /// **Note**: We recommend that you do not store this value as it is likely to
1069    /// change at run-time.
1070    ///
1071    /// **See also:** [`native_parent_widget()`]
1072    pub fn effective_win_id(&self) -> u64 {
1073        let (obj_data, funcs) = self.get_widget_obj_funcs();
1074        unsafe {
1075            let ret_val = ((*funcs).effective_win_id)(obj_data);
1076            ret_val
1077        }
1078    }
1079    ///
1080    /// The style sheet contains a textual description of customizations to the
1081    /// widget's style, as described in the [Qt Style Sheets](Qt%20Style%20Sheets)
1082    /// document.
1083    ///
1084    /// Since Qt 4.5, Qt style sheets fully supports MacOS .
1085    ///
1086    /// **Warning**: Qt style sheets are currently not supported for custom QStyle
1087    /// subclasses. We plan to address this in some future release.
1088    ///
1089    /// **See also:** [`set_style()`]
1090    /// [`Application::style_sheet()`]
1091    /// {Qt Style Sheets}
1092    ///
1093    /// **See also:** [`Widget::set_style`]
1094    /// [`Application::set_style`]
1095    /// [`Application::style`]
1096    pub fn style(&self) -> Option<Style> {
1097        let (obj_data, funcs) = self.get_widget_obj_funcs();
1098        unsafe {
1099            let ret_val = ((*funcs).style)(obj_data);
1100            if ret_val.qt_data == ::std::ptr::null() {
1101                return None;
1102            }
1103            let t = ret_val;
1104            let ret_val;
1105            if t.host_data != ::std::ptr::null() {
1106                ret_val = Style::new_from_rc(t);
1107            } else {
1108                ret_val = Style::new_from_owned(t);
1109            }
1110            Some(ret_val)
1111        }
1112    }
1113    ///
1114    /// Sets the widget's GUI style to *style.* The ownership of the style
1115    /// object is not transferred.
1116    ///
1117    /// If no style is set, the widget uses the application's style,
1118    /// QApplication::style() instead.
1119    ///
1120    /// Setting a widget's style has no effect on existing or future child
1121    /// widgets.
1122    ///
1123    /// **Warning**: This function is particularly useful for demonstration
1124    /// purposes, where you want to show Qt's styling capabilities. Real
1125    /// applications should avoid it and use one consistent GUI style
1126    /// instead.
1127    ///
1128    /// **Warning**: Qt style sheets are currently not supported for custom QStyle
1129    /// subclasses. We plan to address this in some future release.
1130    ///
1131    /// **See also:** [`style()`]
1132    /// [`Style`]
1133    /// [`Application::style`]
1134    /// [`Application::set_style`]
1135    pub fn set_style<S: StyleTrait<'a>>(&self, arg0: &S) -> &Self {
1136        let (obj_arg0_1, _funcs) = arg0.get_style_obj_funcs();
1137
1138        let (obj_data, funcs) = self.get_widget_obj_funcs();
1139        unsafe {
1140            ((*funcs).set_style)(obj_data, obj_arg0_1);
1141        }
1142        self
1143    }
1144    ///
1145    /// Use isWindow() instead.
1146    pub fn is_top_level(&self) -> bool {
1147        let (obj_data, funcs) = self.get_widget_obj_funcs();
1148        unsafe {
1149            let ret_val = ((*funcs).is_top_level)(obj_data);
1150            ret_val
1151        }
1152    }
1153    ///
1154    /// Returns `true` if the widget is an independent window, otherwise
1155    /// returns `false.`
1156    ///
1157    /// A window is a widget that isn't visually the child of any other
1158    /// widget and that usually has a frame and a
1159    /// [window title](QWidget::setWindowTitle())
1160    ///
1161    ///
1162    /// A window can have a [parent widget](QWidget::parentWidget())
1163    ///
1164    /// It will then be grouped with its parent and deleted when the
1165    /// parent is deleted, minimized when the parent is minimized etc. If
1166    /// supported by the window manager, it will also have a common
1167    /// taskbar entry with its parent.
1168    ///
1169    /// QDialog and QMainWindow widgets are by default windows, even if a
1170    /// parent widget is specified in the constructor. This behavior is
1171    /// specified by the Qt::Window flag.
1172    ///
1173    /// **See also:** [`window()`]
1174    /// [`is_modal()`]
1175    /// [`parent_widget()`]
1176    pub fn is_window(&self) -> bool {
1177        let (obj_data, funcs) = self.get_widget_obj_funcs();
1178        unsafe {
1179            let ret_val = ((*funcs).is_window)(obj_data);
1180            ret_val
1181        }
1182    }
1183    pub fn is_modal(&self) -> bool {
1184        let (obj_data, funcs) = self.get_widget_obj_funcs();
1185        unsafe {
1186            let ret_val = ((*funcs).is_modal)(obj_data);
1187            ret_val
1188        }
1189    }
1190    ///
1191    /// This property only makes sense for windows. A modal widget
1192    /// prevents widgets in other windows from getting input. The value of
1193    /// this property controls which windows are blocked when the widget
1194    /// is visible. Changing this property while the window is visible has
1195    /// no effect; you must hide() the widget first, then show() it again.
1196    ///
1197    /// By default, this property is Qt::NonModal.
1198    ///
1199    /// **See also:** [`is_window()`]
1200    /// [`Widget::modal()`]
1201    /// [`Dialog`]
1202    pub fn window_modality(&self) -> WindowModality {
1203        let (obj_data, funcs) = self.get_widget_obj_funcs();
1204        unsafe {
1205            let ret_val = ((*funcs).window_modality)(obj_data);
1206            let ret_val = { transmute::<u32, WindowModality>(ret_val) };
1207            ret_val
1208        }
1209    }
1210    pub fn set_window_modality(&self, window_modality: WindowModality) -> &Self {
1211        let enum_window_modality_1 = window_modality as u32;
1212
1213        let (obj_data, funcs) = self.get_widget_obj_funcs();
1214        unsafe {
1215            ((*funcs).set_window_modality)(obj_data, enum_window_modality_1);
1216        }
1217        self
1218    }
1219    ///
1220    /// Returns `true` if this widget would become enabled if *ancestor* is
1221    /// enabled; otherwise returns `false.`
1222    ///
1223    /// This is the case if neither the widget itself nor every parent up
1224    /// to but excluding *ancestor* has been explicitly disabled.
1225    ///
1226    /// isEnabledTo(0) returns false if this widget or any if its ancestors
1227    /// was explicitly disabled.
1228    ///
1229    /// The word ancestor here means a parent widget within the same window.
1230    ///
1231    /// Therefore isEnabledTo(0) stops at this widget's window, unlike
1232    /// isEnabled() which also takes parent windows into considerations.
1233    ///
1234    /// **See also:** [`set_enabled()`]
1235    /// enabled
1236    ///
1237    /// This function is deprecated. It is equivalent to isEnabled()
1238    pub fn is_enabled(&self) -> bool {
1239        let (obj_data, funcs) = self.get_widget_obj_funcs();
1240        unsafe {
1241            let ret_val = ((*funcs).is_enabled)(obj_data);
1242            ret_val
1243        }
1244    }
1245    ///
1246    /// Returns `true` if this widget would become enabled if *ancestor* is
1247    /// enabled; otherwise returns `false.`
1248    ///
1249    /// This is the case if neither the widget itself nor every parent up
1250    /// to but excluding *ancestor* has been explicitly disabled.
1251    ///
1252    /// isEnabledTo(0) returns false if this widget or any if its ancestors
1253    /// was explicitly disabled.
1254    ///
1255    /// The word ancestor here means a parent widget within the same window.
1256    ///
1257    /// Therefore isEnabledTo(0) stops at this widget's window, unlike
1258    /// isEnabled() which also takes parent windows into considerations.
1259    ///
1260    /// **See also:** [`set_enabled()`]
1261    /// enabled
1262    ///
1263    /// This function is deprecated. It is equivalent to isEnabled()
1264    pub fn is_enabled_to<W: WidgetTrait<'a>>(&self, arg0: &W) -> bool {
1265        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
1266
1267        let (obj_data, funcs) = self.get_widget_obj_funcs();
1268        unsafe {
1269            let ret_val = ((*funcs).is_enabled_to)(obj_data, obj_arg0_1);
1270            ret_val
1271        }
1272    }
1273    ///
1274    pub fn set_enabled(&self, arg0: bool) -> &Self {
1275        let (obj_data, funcs) = self.get_widget_obj_funcs();
1276        unsafe {
1277            ((*funcs).set_enabled)(obj_data, arg0);
1278        }
1279        self
1280    }
1281    ///
1282    /// Disables widget input events if *disable* is true; otherwise
1283    /// enables input events.
1284    ///
1285    /// See the [enabled](enabled)
1286    /// documentation for more information.
1287    ///
1288    /// **See also:** [`is_enabled_to()`]
1289    /// [`KeyEvent`]
1290    /// [`MouseEvent`]
1291    /// [`change_event()`]
1292    pub fn set_disabled(&self, arg0: bool) -> &Self {
1293        let (obj_data, funcs) = self.get_widget_obj_funcs();
1294        unsafe {
1295            ((*funcs).set_disabled)(obj_data, arg0);
1296        }
1297        self
1298    }
1299    pub fn set_window_modified(&self, arg0: bool) -> &Self {
1300        let (obj_data, funcs) = self.get_widget_obj_funcs();
1301        unsafe {
1302            ((*funcs).set_window_modified)(obj_data, arg0);
1303        }
1304        self
1305    }
1306    ///
1307    /// See the [Window Geometry](Window%20Geometry)
1308    /// documentation for an overview of geometry
1309    /// issues with windows.
1310    ///
1311    /// By default, this property has a value of 0.
1312    ///
1313    /// **See also:** frameGeometry
1314    ///
1315    /// pos
1316    pub fn x(&self) -> i32 {
1317        let (obj_data, funcs) = self.get_widget_obj_funcs();
1318        unsafe {
1319            let ret_val = ((*funcs).x)(obj_data);
1320            ret_val
1321        }
1322    }
1323    ///
1324    /// See the [Window Geometry](Window%20Geometry)
1325    /// documentation for an overview of geometry
1326    /// issues with windows.
1327    ///
1328    /// By default, this property has a value of 0.
1329    ///
1330    /// **See also:** frameGeometry
1331    ///
1332    /// pos
1333    pub fn y(&self) -> i32 {
1334        let (obj_data, funcs) = self.get_widget_obj_funcs();
1335        unsafe {
1336            let ret_val = ((*funcs).y)(obj_data);
1337            ret_val
1338        }
1339    }
1340    ///
1341    /// If the widget is a window, the position is that of the widget on
1342    /// the desktop, including its frame.
1343    ///
1344    /// When changing the position, the widget, if visible, receives a
1345    /// move event (moveEvent()) immediately. If the widget is not
1346    /// currently visible, it is guaranteed to receive an event before it
1347    /// is shown.
1348    ///
1349    /// By default, this property contains a position that refers to the
1350    /// origin.
1351    ///
1352    /// **Warning**: Calling move() or setGeometry() inside moveEvent() can
1353    /// lead to infinite recursion.
1354    ///
1355    /// See the [Window Geometry](Window%20Geometry)
1356    /// documentation for an overview of geometry
1357    /// issues with windows.
1358    ///
1359    /// **See also:** frameGeometry
1360    /// size
1361    /// [`x()`]
1362    /// [`y()`]
1363    pub fn pos(&self) -> Point {
1364        let (obj_data, funcs) = self.get_widget_obj_funcs();
1365        unsafe {
1366            let ret_val = ((*funcs).pos)(obj_data);
1367            let t = ret_val;
1368            let ret_val;
1369            if t.host_data != ::std::ptr::null() {
1370                ret_val = Point::new_from_rc(t);
1371            } else {
1372                ret_val = Point::new_from_owned(t);
1373            }
1374            ret_val
1375        }
1376    }
1377    ///
1378    /// By default, this property contains a value that depends on the user's
1379    /// platform and screen geometry.
1380    pub fn frame_size(&self) -> Size {
1381        let (obj_data, funcs) = self.get_widget_obj_funcs();
1382        unsafe {
1383            let ret_val = ((*funcs).frame_size)(obj_data);
1384            let t = ret_val;
1385            let ret_val;
1386            if t.host_data != ::std::ptr::null() {
1387                ret_val = Size::new_from_rc(t);
1388            } else {
1389                ret_val = Size::new_from_owned(t);
1390            }
1391            ret_val
1392        }
1393    }
1394    ///
1395    /// If the widget is visible when it is being resized, it receives a resize event
1396    /// (resizeEvent()) immediately. If the widget is not currently
1397    /// visible, it is guaranteed to receive an event before it is shown.
1398    ///
1399    /// The size is adjusted if it lies outside the range defined by
1400    /// minimumSize() and maximumSize().
1401    ///
1402    /// By default, this property contains a value that depends on the user's
1403    /// platform and screen geometry.
1404    ///
1405    /// **Warning**: Calling resize() or setGeometry() inside resizeEvent() can
1406    /// lead to infinite recursion.
1407    ///
1408    /// **Note**: Setting the size to `QSize(0, 0)` will cause the widget to not
1409    /// appear on screen. This also applies to windows.
1410    ///
1411    /// **See also:** pos
1412    /// geometry
1413    /// minimumSize
1414    /// maximumSize
1415    /// [`resize_event()`]
1416    /// [`adjust_size()`]
1417    ///
1418    /// When the user resizes the window, the size will move in steps of
1419    /// sizeIncrement().width() pixels horizontally and
1420    /// sizeIncrement.height() pixels vertically, with baseSize() as the
1421    /// basis. Preferred widget sizes are for non-negative integers *i*
1422    /// and *j:*
1423    ///
1424    /// Note that while you can set the size increment for all widgets, it
1425    /// only affects windows.
1426    ///
1427    /// By default, this property contains a size with zero width and height.
1428    ///
1429    /// **Warning**: The size increment has no effect under Windows, and may
1430    /// be disregarded by the window manager on X11.
1431    ///
1432    /// **See also:** size
1433    /// minimumSize
1434    /// maximumSize
1435    ///
1436    /// If the value of this property is an invalid size, no size is
1437    /// recommended.
1438    ///
1439    /// The default implementation of sizeHint() returns an invalid size
1440    /// if there is no layout for this widget, and returns the layout's
1441    /// preferred size otherwise.
1442    ///
1443    /// **See also:** [`Size::is_valid`]
1444    /// [`minimum_size_hint()`]
1445    /// [`size_policy()`]
1446    /// [`set_minimum_size()`]
1447    /// [`update_geometry()`]
1448    ///
1449    /// If there is a QLayout that manages this widget's children, the
1450    /// size policy specified by that layout is used. If there is no such
1451    /// QLayout, the result of this function is used.
1452    ///
1453    /// The default policy is Preferred/Preferred, which means that the
1454    /// widget can be freely resized, but prefers to be the size
1455    /// sizeHint() returns. Button-like widgets set the size policy to
1456    /// specify that they may stretch horizontally, but are fixed
1457    /// vertically. The same applies to lineedit controls (such as
1458    /// QLineEdit, QSpinBox or an editable QComboBox) and other
1459    /// horizontally orientated widgets (such as QProgressBar).
1460    /// QToolButton's are normally square, so they allow growth in both
1461    /// directions. Widgets that support different directions (such as
1462    /// QSlider, QScrollBar or QHeader) specify stretching in the
1463    /// respective direction only. Widgets that can provide scroll bars
1464    /// (usually subclasses of QScrollArea) tend to specify that they can
1465    /// use additional space, and that they can make do with less than
1466    /// sizeHint().
1467    ///
1468    /// **See also:** [`size_hint()`]
1469    /// [`Layout`]
1470    /// [`SizePolicy`]
1471    /// [`update_geometry()`]
1472    pub fn size(&self) -> Size {
1473        let (obj_data, funcs) = self.get_widget_obj_funcs();
1474        unsafe {
1475            let ret_val = ((*funcs).size)(obj_data);
1476            let t = ret_val;
1477            let ret_val;
1478            if t.host_data != ::std::ptr::null() {
1479                ret_val = Size::new_from_rc(t);
1480            } else {
1481                ret_val = Size::new_from_owned(t);
1482            }
1483            ret_val
1484        }
1485    }
1486    ///
1487    /// See the [Window Geometry](Window%20Geometry)
1488    /// documentation for an overview of geometry
1489    /// issues with windows.
1490    ///
1491    /// **Note**: Do not use this function to find the width of a screen on
1492    /// a [multiple screen desktop](QDesktopWidget)
1493    /// . Read
1494    /// [this note](QDesktopWidget%23Screen%20Geometry)
1495    /// for details.
1496    ///
1497    /// By default, this property contains a value that depends on the user's
1498    /// platform and screen geometry.
1499    ///
1500    /// **See also:** geometry
1501    /// height
1502    /// size
1503    pub fn width(&self) -> i32 {
1504        let (obj_data, funcs) = self.get_widget_obj_funcs();
1505        unsafe {
1506            let ret_val = ((*funcs).width)(obj_data);
1507            ret_val
1508        }
1509    }
1510    ///
1511    /// See the [Window Geometry](Window%20Geometry)
1512    /// documentation for an overview of geometry
1513    /// issues with windows.
1514    ///
1515    /// **Note**: Do not use this function to find the height of a screen
1516    /// on a [multiple screen desktop](QDesktopWidget)
1517    /// . Read
1518    /// [this note](QDesktopWidget%23Screen%20Geometry)
1519    /// for details.
1520    ///
1521    /// By default, this property contains a value that depends on the user's
1522    /// platform and screen geometry.
1523    ///
1524    /// **See also:** geometry
1525    /// width
1526    /// size
1527    ///
1528    /// Returns the preferred height for this widget, given the width *w.*
1529    ///
1530    /// If this widget has a layout, the default implementation returns
1531    /// the layout's preferred height. if there is no layout, the default
1532    /// implementation returns -1 indicating that the preferred height
1533    /// does not depend on the width.
1534    pub fn height(&self) -> i32 {
1535        let (obj_data, funcs) = self.get_widget_obj_funcs();
1536        unsafe {
1537            let ret_val = ((*funcs).height)(obj_data);
1538            ret_val
1539        }
1540    }
1541    ///
1542    /// The rect property equals QRect(0, 0, width(), height()).
1543    ///
1544    /// See the [Window Geometry](Window%20Geometry)
1545    /// documentation for an overview of geometry
1546    /// issues with windows.
1547    ///
1548    /// By default, this property contains a value that depends on the user's
1549    /// platform and screen geometry.
1550    ///
1551    /// **See also:** size
1552    pub fn rect(&self) -> Rect {
1553        let (obj_data, funcs) = self.get_widget_obj_funcs();
1554        unsafe {
1555            let ret_val = ((*funcs).rect)(obj_data);
1556            let t = ret_val;
1557            let ret_val;
1558            if t.host_data != ::std::ptr::null() {
1559                ret_val = Rect::new_from_rc(t);
1560            } else {
1561                ret_val = Rect::new_from_owned(t);
1562            }
1563            ret_val
1564        }
1565    }
1566    ///
1567    /// Hidden children are excluded.
1568    ///
1569    /// By default, for a widget with no children, this property contains a
1570    /// rectangle with zero width and height located at the origin.
1571    ///
1572    /// **See also:** [`children_region()`]
1573    /// [`geometry()`]
1574    pub fn children_rect(&self) -> Rect {
1575        let (obj_data, funcs) = self.get_widget_obj_funcs();
1576        unsafe {
1577            let ret_val = ((*funcs).children_rect)(obj_data);
1578            let t = ret_val;
1579            let ret_val;
1580            if t.host_data != ::std::ptr::null() {
1581                ret_val = Rect::new_from_rc(t);
1582            } else {
1583                ret_val = Rect::new_from_owned(t);
1584            }
1585            ret_val
1586        }
1587    }
1588    ///
1589    /// Hidden children are excluded.
1590    ///
1591    /// By default, for a widget with no children, this property contains an
1592    /// empty region.
1593    ///
1594    /// **See also:** [`children_rect()`]
1595    /// [`geometry()`]
1596    /// [`mask()`]
1597    pub fn children_region(&self) -> Region {
1598        let (obj_data, funcs) = self.get_widget_obj_funcs();
1599        unsafe {
1600            let ret_val = ((*funcs).children_region)(obj_data);
1601            let t = ret_val;
1602            let ret_val;
1603            if t.host_data != ::std::ptr::null() {
1604                ret_val = Region::new_from_rc(t);
1605            } else {
1606                ret_val = Region::new_from_owned(t);
1607            }
1608            ret_val
1609        }
1610    }
1611    ///
1612    /// The widget cannot be resized to a smaller size than the minimum
1613    /// widget size. The widget's size is forced to the minimum size if
1614    /// the current size is smaller.
1615    ///
1616    /// The minimum size set by this function will override the minimum size
1617    /// defined by QLayout. In order to unset the minimum size, use a
1618    /// value of `QSize(0, 0)` .
1619    ///
1620    /// By default, this property contains a size with zero width and height.
1621    ///
1622    /// **See also:** minimumWidth
1623    /// minimumHeight
1624    /// maximumSize
1625    /// sizeIncrement
1626    ///
1627    /// If the value of this property is an invalid size, no minimum size
1628    /// is recommended.
1629    ///
1630    /// The default implementation of minimumSizeHint() returns an invalid
1631    /// size if there is no layout for this widget, and returns the
1632    /// layout's minimum size otherwise. Most built-in widgets reimplement
1633    /// minimumSizeHint().
1634    ///
1635    /// [QLayout](QLayout)
1636    /// will never resize a widget to a size smaller than the
1637    /// minimum size hint unless minimumSize() is set or the size policy is
1638    /// set to QSizePolicy::Ignore. If minimumSize() is set, the minimum
1639    /// size hint will be ignored.
1640    ///
1641    /// **See also:** [`Size::is_valid`]
1642    /// [`resize()`]
1643    /// [`set_minimum_size()`]
1644    /// [`size_policy()`]
1645    pub fn minimum_size(&self) -> Size {
1646        let (obj_data, funcs) = self.get_widget_obj_funcs();
1647        unsafe {
1648            let ret_val = ((*funcs).minimum_size)(obj_data);
1649            let t = ret_val;
1650            let ret_val;
1651            if t.host_data != ::std::ptr::null() {
1652                ret_val = Size::new_from_rc(t);
1653            } else {
1654                ret_val = Size::new_from_owned(t);
1655            }
1656            ret_val
1657        }
1658    }
1659    ///
1660    /// The widget cannot be resized to a larger size than the maximum
1661    /// widget size.
1662    ///
1663    /// By default, this property contains a size in which both width and height
1664    /// have values of 16777215.
1665    ///
1666    /// **Note**: The definition of the `QWIDGETSIZE_MAX` macro limits the maximum size
1667    /// of widgets.
1668    ///
1669    /// **See also:** maximumWidth
1670    /// maximumHeight
1671    /// minimumSize
1672    /// sizeIncrement
1673    pub fn maximum_size(&self) -> Size {
1674        let (obj_data, funcs) = self.get_widget_obj_funcs();
1675        unsafe {
1676            let ret_val = ((*funcs).maximum_size)(obj_data);
1677            let t = ret_val;
1678            let ret_val;
1679            if t.host_data != ::std::ptr::null() {
1680                ret_val = Size::new_from_rc(t);
1681            } else {
1682                ret_val = Size::new_from_owned(t);
1683            }
1684            ret_val
1685        }
1686    }
1687    ///
1688    /// This property corresponds to the width held by the [minimumSize](minimumSize)
1689    /// property.
1690    ///
1691    /// By default, this property has a value of 0.
1692    ///
1693    /// **See also:** minimumSize
1694    /// minimumHeight
1695    pub fn minimum_width(&self) -> i32 {
1696        let (obj_data, funcs) = self.get_widget_obj_funcs();
1697        unsafe {
1698            let ret_val = ((*funcs).minimum_width)(obj_data);
1699            ret_val
1700        }
1701    }
1702    ///
1703    /// This property corresponds to the height held by the [minimumSize](minimumSize)
1704    /// property.
1705    ///
1706    /// By default, this property has a value of 0.
1707    ///
1708    /// **See also:** minimumSize
1709    /// minimumWidth
1710    pub fn minimum_height(&self) -> i32 {
1711        let (obj_data, funcs) = self.get_widget_obj_funcs();
1712        unsafe {
1713            let ret_val = ((*funcs).minimum_height)(obj_data);
1714            ret_val
1715        }
1716    }
1717    ///
1718    /// This property corresponds to the width held by the [maximumSize](maximumSize)
1719    /// property.
1720    ///
1721    /// By default, this property contains a value of 16777215.
1722    ///
1723    /// **Note**: The definition of the `QWIDGETSIZE_MAX` macro limits the maximum size
1724    /// of widgets.
1725    ///
1726    /// **See also:** maximumSize
1727    /// maximumHeight
1728    pub fn maximum_width(&self) -> i32 {
1729        let (obj_data, funcs) = self.get_widget_obj_funcs();
1730        unsafe {
1731            let ret_val = ((*funcs).maximum_width)(obj_data);
1732            ret_val
1733        }
1734    }
1735    ///
1736    /// This property corresponds to the height held by the [maximumSize](maximumSize)
1737    /// property.
1738    ///
1739    /// By default, this property contains a value of 16777215.
1740    ///
1741    /// **Note**: The definition of the `QWIDGETSIZE_MAX` macro limits the maximum size
1742    /// of widgets.
1743    ///
1744    /// **See also:** maximumSize
1745    /// maximumWidth
1746    pub fn maximum_height(&self) -> i32 {
1747        let (obj_data, funcs) = self.get_widget_obj_funcs();
1748        unsafe {
1749            let ret_val = ((*funcs).maximum_height)(obj_data);
1750            ret_val
1751        }
1752    }
1753    ///
1754    /// **Overloads**
1755    /// This function corresponds to setMinimumSize(QSize(minw, minh)).
1756    /// Sets the minimum width to *minw* and the minimum height to *minh.*
1757    pub fn set_minimum_size<S: SizeTrait<'a>>(&self, arg0: &S) -> &Self {
1758        let (obj_arg0_1, _funcs) = arg0.get_size_obj_funcs();
1759
1760        let (obj_data, funcs) = self.get_widget_obj_funcs();
1761        unsafe {
1762            ((*funcs).set_minimum_size)(obj_data, obj_arg0_1);
1763        }
1764        self
1765    }
1766    ///
1767    /// **Overloads**
1768    /// This function corresponds to setMinimumSize(QSize(minw, minh)).
1769    /// Sets the minimum width to *minw* and the minimum height to *minh.*
1770    pub fn set_minimum_size_2(&self, minw: i32, minh: i32) -> &Self {
1771        let (obj_data, funcs) = self.get_widget_obj_funcs();
1772        unsafe {
1773            ((*funcs).set_minimum_size_2)(obj_data, minw, minh);
1774        }
1775        self
1776    }
1777    ///
1778    /// **Overloads**
1779    /// This function corresponds to setMaximumSize(QSize( *maxw,* *maxh)).* Sets the maximum width to *maxw* and the maximum height
1780    /// to *maxh.*
1781    pub fn set_maximum_size<S: SizeTrait<'a>>(&self, arg0: &S) -> &Self {
1782        let (obj_arg0_1, _funcs) = arg0.get_size_obj_funcs();
1783
1784        let (obj_data, funcs) = self.get_widget_obj_funcs();
1785        unsafe {
1786            ((*funcs).set_maximum_size)(obj_data, obj_arg0_1);
1787        }
1788        self
1789    }
1790    ///
1791    /// **Overloads**
1792    /// This function corresponds to setMaximumSize(QSize( *maxw,* *maxh)).* Sets the maximum width to *maxw* and the maximum height
1793    /// to *maxh.*
1794    pub fn set_maximum_size_2(&self, maxw: i32, maxh: i32) -> &Self {
1795        let (obj_data, funcs) = self.get_widget_obj_funcs();
1796        unsafe {
1797            ((*funcs).set_maximum_size_2)(obj_data, maxw, maxh);
1798        }
1799        self
1800    }
1801    pub fn set_minimum_width(&self, minw: i32) -> &Self {
1802        let (obj_data, funcs) = self.get_widget_obj_funcs();
1803        unsafe {
1804            ((*funcs).set_minimum_width)(obj_data, minw);
1805        }
1806        self
1807    }
1808    pub fn set_minimum_height(&self, minh: i32) -> &Self {
1809        let (obj_data, funcs) = self.get_widget_obj_funcs();
1810        unsafe {
1811            ((*funcs).set_minimum_height)(obj_data, minh);
1812        }
1813        self
1814    }
1815    pub fn set_maximum_width(&self, maxw: i32) -> &Self {
1816        let (obj_data, funcs) = self.get_widget_obj_funcs();
1817        unsafe {
1818            ((*funcs).set_maximum_width)(obj_data, maxw);
1819        }
1820        self
1821    }
1822    pub fn set_maximum_height(&self, maxh: i32) -> &Self {
1823        let (obj_data, funcs) = self.get_widget_obj_funcs();
1824        unsafe {
1825            ((*funcs).set_maximum_height)(obj_data, maxh);
1826        }
1827        self
1828    }
1829    ///
1830    /// When the user resizes the window, the size will move in steps of
1831    /// sizeIncrement().width() pixels horizontally and
1832    /// sizeIncrement.height() pixels vertically, with baseSize() as the
1833    /// basis. Preferred widget sizes are for non-negative integers *i*
1834    /// and *j:*
1835    ///
1836    /// Note that while you can set the size increment for all widgets, it
1837    /// only affects windows.
1838    ///
1839    /// By default, this property contains a size with zero width and height.
1840    ///
1841    /// **Warning**: The size increment has no effect under Windows, and may
1842    /// be disregarded by the window manager on X11.
1843    ///
1844    /// **See also:** size
1845    /// minimumSize
1846    /// maximumSize
1847    pub fn size_increment(&self) -> Size {
1848        let (obj_data, funcs) = self.get_widget_obj_funcs();
1849        unsafe {
1850            let ret_val = ((*funcs).size_increment)(obj_data);
1851            let t = ret_val;
1852            let ret_val;
1853            if t.host_data != ::std::ptr::null() {
1854                ret_val = Size::new_from_rc(t);
1855            } else {
1856                ret_val = Size::new_from_owned(t);
1857            }
1858            ret_val
1859        }
1860    }
1861    ///
1862    /// **Overloads**
1863    /// Sets the x (width) size increment to *w* and the y (height) size
1864    /// increment to *h.*
1865    pub fn set_size_increment<S: SizeTrait<'a>>(&self, arg0: &S) -> &Self {
1866        let (obj_arg0_1, _funcs) = arg0.get_size_obj_funcs();
1867
1868        let (obj_data, funcs) = self.get_widget_obj_funcs();
1869        unsafe {
1870            ((*funcs).set_size_increment)(obj_data, obj_arg0_1);
1871        }
1872        self
1873    }
1874    ///
1875    /// **Overloads**
1876    /// Sets the x (width) size increment to *w* and the y (height) size
1877    /// increment to *h.*
1878    pub fn set_size_increment_2(&self, w: i32, h: i32) -> &Self {
1879        let (obj_data, funcs) = self.get_widget_obj_funcs();
1880        unsafe {
1881            ((*funcs).set_size_increment_2)(obj_data, w, h);
1882        }
1883        self
1884    }
1885    ///
1886    /// The base size is used to calculate a proper widget size if the
1887    /// widget defines sizeIncrement().
1888    ///
1889    /// By default, for a newly-created widget, this property contains a size with
1890    /// zero width and height.
1891    ///
1892    /// **See also:** [`set_size_increment()`]
1893    pub fn base_size(&self) -> Size {
1894        let (obj_data, funcs) = self.get_widget_obj_funcs();
1895        unsafe {
1896            let ret_val = ((*funcs).base_size)(obj_data);
1897            let t = ret_val;
1898            let ret_val;
1899            if t.host_data != ::std::ptr::null() {
1900                ret_val = Size::new_from_rc(t);
1901            } else {
1902                ret_val = Size::new_from_owned(t);
1903            }
1904            ret_val
1905        }
1906    }
1907    ///
1908    /// **Overloads**
1909    /// This corresponds to setBaseSize(QSize( *basew,* *baseh)).* Sets
1910    /// the widgets base size to width *basew* and height *baseh.*
1911    pub fn set_base_size<S: SizeTrait<'a>>(&self, arg0: &S) -> &Self {
1912        let (obj_arg0_1, _funcs) = arg0.get_size_obj_funcs();
1913
1914        let (obj_data, funcs) = self.get_widget_obj_funcs();
1915        unsafe {
1916            ((*funcs).set_base_size)(obj_data, obj_arg0_1);
1917        }
1918        self
1919    }
1920    ///
1921    /// **Overloads**
1922    /// This corresponds to setBaseSize(QSize( *basew,* *baseh)).* Sets
1923    /// the widgets base size to width *basew* and height *baseh.*
1924    pub fn set_base_size_2(&self, basew: i32, baseh: i32) -> &Self {
1925        let (obj_data, funcs) = self.get_widget_obj_funcs();
1926        unsafe {
1927            ((*funcs).set_base_size_2)(obj_data, basew, baseh);
1928        }
1929        self
1930    }
1931    ///
1932    /// Sets both the minimum and maximum sizes of the widget to *s,*
1933    /// thereby preventing it from ever growing or shrinking.
1934    ///
1935    /// This will override the default size constraints set by QLayout.
1936    ///
1937    /// To remove constraints, set the size to QWIDGETSIZE_MAX.
1938    ///
1939    /// Alternatively, if you want the widget to have a
1940    /// fixed size based on its contents, you can call
1941    /// QLayout::setSizeConstraint(QLayout::SetFixedSize);
1942    ///
1943    /// **See also:** maximumSize
1944    /// minimumSize
1945    ///
1946    /// **Overloads**
1947    /// Sets the width of the widget to *w* and the height to *h.*
1948    pub fn set_fixed_size<S: SizeTrait<'a>>(&self, arg0: &S) -> &Self {
1949        let (obj_arg0_1, _funcs) = arg0.get_size_obj_funcs();
1950
1951        let (obj_data, funcs) = self.get_widget_obj_funcs();
1952        unsafe {
1953            ((*funcs).set_fixed_size)(obj_data, obj_arg0_1);
1954        }
1955        self
1956    }
1957    ///
1958    /// Sets both the minimum and maximum sizes of the widget to *s,*
1959    /// thereby preventing it from ever growing or shrinking.
1960    ///
1961    /// This will override the default size constraints set by QLayout.
1962    ///
1963    /// To remove constraints, set the size to QWIDGETSIZE_MAX.
1964    ///
1965    /// Alternatively, if you want the widget to have a
1966    /// fixed size based on its contents, you can call
1967    /// QLayout::setSizeConstraint(QLayout::SetFixedSize);
1968    ///
1969    /// **See also:** maximumSize
1970    /// minimumSize
1971    ///
1972    /// **Overloads**
1973    /// Sets the width of the widget to *w* and the height to *h.*
1974    pub fn set_fixed_size_2(&self, w: i32, h: i32) -> &Self {
1975        let (obj_data, funcs) = self.get_widget_obj_funcs();
1976        unsafe {
1977            ((*funcs).set_fixed_size_2)(obj_data, w, h);
1978        }
1979        self
1980    }
1981    ///
1982    /// Sets both the minimum and maximum width of the widget to *w*
1983    /// without changing the heights. Provided for convenience.
1984    ///
1985    /// **See also:** [`size_hint()`]
1986    /// [`minimum_size()`]
1987    /// [`maximum_size()`]
1988    /// [`set_fixed_size()`]
1989    pub fn set_fixed_width(&self, w: i32) -> &Self {
1990        let (obj_data, funcs) = self.get_widget_obj_funcs();
1991        unsafe {
1992            ((*funcs).set_fixed_width)(obj_data, w);
1993        }
1994        self
1995    }
1996    ///
1997    /// Sets both the minimum and maximum heights of the widget to *h*
1998    /// without changing the widths. Provided for convenience.
1999    ///
2000    /// **See also:** [`size_hint()`]
2001    /// [`minimum_size()`]
2002    /// [`maximum_size()`]
2003    /// [`set_fixed_size()`]
2004    pub fn set_fixed_height(&self, h: i32) -> &Self {
2005        let (obj_data, funcs) = self.get_widget_obj_funcs();
2006        unsafe {
2007            ((*funcs).set_fixed_height)(obj_data, h);
2008        }
2009        self
2010    }
2011    ///
2012    /// Translates the widget coordinate *pos* to global screen
2013    /// coordinates. For example, `mapToGlobal(QPoint(0,0))` would give
2014    /// the global coordinates of the top-left pixel of the widget.
2015    ///
2016    /// **See also:** [`map_from_global()`]
2017    /// [`map_to()`]
2018    /// [`map_to_parent()`]
2019    pub fn map_to_global<P: PointTrait<'a>>(&self, arg0: &P) -> Point {
2020        let (obj_arg0_1, _funcs) = arg0.get_point_obj_funcs();
2021
2022        let (obj_data, funcs) = self.get_widget_obj_funcs();
2023        unsafe {
2024            let ret_val = ((*funcs).map_to_global)(obj_data, obj_arg0_1);
2025            let t = ret_val;
2026            let ret_val;
2027            if t.host_data != ::std::ptr::null() {
2028                ret_val = Point::new_from_rc(t);
2029            } else {
2030                ret_val = Point::new_from_owned(t);
2031            }
2032            ret_val
2033        }
2034    }
2035    ///
2036    /// Translates the global screen coordinate *pos* to widget
2037    /// coordinates.
2038    ///
2039    /// **See also:** [`map_to_global()`]
2040    /// [`map_from()`]
2041    /// [`map_from_parent()`]
2042    pub fn map_from_global<P: PointTrait<'a>>(&self, arg0: &P) -> Point {
2043        let (obj_arg0_1, _funcs) = arg0.get_point_obj_funcs();
2044
2045        let (obj_data, funcs) = self.get_widget_obj_funcs();
2046        unsafe {
2047            let ret_val = ((*funcs).map_from_global)(obj_data, obj_arg0_1);
2048            let t = ret_val;
2049            let ret_val;
2050            if t.host_data != ::std::ptr::null() {
2051                ret_val = Point::new_from_rc(t);
2052            } else {
2053                ret_val = Point::new_from_owned(t);
2054            }
2055            ret_val
2056        }
2057    }
2058    ///
2059    /// Translates the widget coordinate *pos* to a coordinate in the
2060    /// parent widget.
2061    ///
2062    /// Same as mapToGlobal() if the widget has no parent.
2063    ///
2064    /// **See also:** [`map_from_parent()`]
2065    /// [`map_to()`]
2066    /// [`map_to_global()`]
2067    /// [`under_mouse()`]
2068    pub fn map_to_parent<P: PointTrait<'a>>(&self, arg0: &P) -> Point {
2069        let (obj_arg0_1, _funcs) = arg0.get_point_obj_funcs();
2070
2071        let (obj_data, funcs) = self.get_widget_obj_funcs();
2072        unsafe {
2073            let ret_val = ((*funcs).map_to_parent)(obj_data, obj_arg0_1);
2074            let t = ret_val;
2075            let ret_val;
2076            if t.host_data != ::std::ptr::null() {
2077                ret_val = Point::new_from_rc(t);
2078            } else {
2079                ret_val = Point::new_from_owned(t);
2080            }
2081            ret_val
2082        }
2083    }
2084    ///
2085    /// Translates the parent widget coordinate *pos* to widget
2086    /// coordinates.
2087    ///
2088    /// Same as mapFromGlobal() if the widget has no parent.
2089    ///
2090    /// **See also:** [`map_to_parent()`]
2091    /// [`map_from()`]
2092    /// [`map_from_global()`]
2093    /// [`under_mouse()`]
2094    pub fn map_from_parent<P: PointTrait<'a>>(&self, arg0: &P) -> Point {
2095        let (obj_arg0_1, _funcs) = arg0.get_point_obj_funcs();
2096
2097        let (obj_data, funcs) = self.get_widget_obj_funcs();
2098        unsafe {
2099            let ret_val = ((*funcs).map_from_parent)(obj_data, obj_arg0_1);
2100            let t = ret_val;
2101            let ret_val;
2102            if t.host_data != ::std::ptr::null() {
2103                ret_val = Point::new_from_rc(t);
2104            } else {
2105                ret_val = Point::new_from_owned(t);
2106            }
2107            ret_val
2108        }
2109    }
2110    ///
2111    /// Translates the widget coordinate *pos* to the coordinate system
2112    /// of *parent.* The *parent* must not be 0 and must be a parent
2113    /// of the calling widget.
2114    ///
2115    /// **See also:** [`map_from()`]
2116    /// [`map_to_parent()`]
2117    /// [`map_to_global()`]
2118    /// [`under_mouse()`]
2119    ///
2120    /// Translates the widget coordinate *pos* to a coordinate in the
2121    /// parent widget.
2122    ///
2123    /// Same as mapToGlobal() if the widget has no parent.
2124    ///
2125    /// **See also:** [`map_from_parent()`]
2126    /// [`map_to()`]
2127    /// [`map_to_global()`]
2128    /// [`under_mouse()`]
2129    ///
2130    /// Translates the widget coordinate *pos* to global screen
2131    /// coordinates. For example, `mapToGlobal(QPoint(0,0))` would give
2132    /// the global coordinates of the top-left pixel of the widget.
2133    ///
2134    /// **See also:** [`map_from_global()`]
2135    /// [`map_to()`]
2136    /// [`map_to_parent()`]
2137    pub fn map_to<P: PointTrait<'a>, W: WidgetTrait<'a>>(&self, arg0: &W, arg1: &P) -> Point {
2138        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
2139        let (obj_arg1_2, _funcs) = arg1.get_point_obj_funcs();
2140
2141        let (obj_data, funcs) = self.get_widget_obj_funcs();
2142        unsafe {
2143            let ret_val = ((*funcs).map_to)(obj_data, obj_arg0_1, obj_arg1_2);
2144            let t = ret_val;
2145            let ret_val;
2146            if t.host_data != ::std::ptr::null() {
2147                ret_val = Point::new_from_rc(t);
2148            } else {
2149                ret_val = Point::new_from_owned(t);
2150            }
2151            ret_val
2152        }
2153    }
2154    ///
2155    /// Translates the widget coordinate *pos* from the coordinate system
2156    /// of *parent* to this widget's coordinate system. The *parent*
2157    /// must not be 0 and must be a parent of the calling widget.
2158    ///
2159    /// **See also:** [`map_to()`]
2160    /// [`map_from_parent()`]
2161    /// [`map_from_global()`]
2162    /// [`under_mouse()`]
2163    ///
2164    /// Translates the parent widget coordinate *pos* to widget
2165    /// coordinates.
2166    ///
2167    /// Same as mapFromGlobal() if the widget has no parent.
2168    ///
2169    /// **See also:** [`map_to_parent()`]
2170    /// [`map_from()`]
2171    /// [`map_from_global()`]
2172    /// [`under_mouse()`]
2173    ///
2174    /// Translates the global screen coordinate *pos* to widget
2175    /// coordinates.
2176    ///
2177    /// **See also:** [`map_to_global()`]
2178    /// [`map_from()`]
2179    /// [`map_from_parent()`]
2180    pub fn map_from<P: PointTrait<'a>, W: WidgetTrait<'a>>(&self, arg0: &W, arg1: &P) -> Point {
2181        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
2182        let (obj_arg1_2, _funcs) = arg1.get_point_obj_funcs();
2183
2184        let (obj_data, funcs) = self.get_widget_obj_funcs();
2185        unsafe {
2186            let ret_val = ((*funcs).map_from)(obj_data, obj_arg0_1, obj_arg1_2);
2187            let t = ret_val;
2188            let ret_val;
2189            if t.host_data != ::std::ptr::null() {
2190                ret_val = Point::new_from_rc(t);
2191            } else {
2192                ret_val = Point::new_from_owned(t);
2193            }
2194            ret_val
2195        }
2196    }
2197    ///
2198    /// If this is a native widget, return the associated QWindow.
2199    /// Otherwise return null.
2200    ///
2201    /// Native widgets include toplevel widgets, QGLWidget, and child widgets
2202    /// on which winId() was called.
2203    ///
2204    /// **See also:** [`win_id()`]
2205    ///
2206    /// This property only makes sense for windows. A modal widget
2207    /// prevents widgets in other windows from getting input. The value of
2208    /// this property controls which windows are blocked when the widget
2209    /// is visible. Changing this property while the window is visible has
2210    /// no effect; you must hide() the widget first, then show() it again.
2211    ///
2212    /// By default, this property is Qt::NonModal.
2213    ///
2214    /// **See also:** [`is_window()`]
2215    /// [`Widget::modal()`]
2216    /// [`Dialog`]
2217    ///
2218    /// Returns the current window state. The window state is a OR'ed
2219    /// combination of Qt::WindowState: Qt::WindowMinimized,
2220    /// Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive.
2221    ///
2222    /// **See also:** [`t::window_state()`]
2223    /// [`set_window_state()`]
2224    ///
2225    /// Returns the window for this widget, i.e. the next ancestor widget
2226    /// that has (or could have) a window-system frame.
2227    ///
2228    /// If the widget is a window, the widget itself is returned.
2229    ///
2230    /// Typical usage is changing the window title:
2231    ///
2232    /// **See also:** [`is_window()`]
2233    ///
2234    /// This property only makes sense for top-level widgets, such as
2235    /// windows and dialogs. If no caption has been set, the title is based of the
2236    /// [windowFilePath.](windowFilePath.)
2237    /// If neither of these is set, then the title is
2238    /// an empty string.
2239    ///
2240    /// If you use the [windowModified](windowModified)
2241    /// mechanism, the window title must
2242    /// contain a placeholder, which indicates where the '*' should
2243    /// appear. Normally, it should appear right after the file name
2244    /// (e.g., ). If the [windowModified](windowModified)
2245    /// property is `false` (the default), the placeholder
2246    /// is simply removed.
2247    ///
2248    /// On some desktop platforms (including Windows and Unix), the application name
2249    /// (from QGuiApplication::applicationDisplayName) is added at the end of the
2250    /// window title, if set. This is done by the QPA plugin, so it is shown to the
2251    /// user, but isn't part of the windowTitle string.
2252    ///
2253    /// **See also:** windowIcon
2254    /// windowModified
2255    /// windowFilePath
2256    ///
2257    /// This signal is emitted when the window's icon text has changed, with the
2258    /// new *iconText* as an argument.
2259    ///
2260    /// This signal is deprecated.
2261    ///
2262    /// This signal is emitted when the window's title has changed, with the
2263    /// new *title* as an argument.
2264    ///
2265    ///
2266    /// This property only makes sense for windows. If no icon
2267    /// has been set, windowIcon() returns the application icon
2268    /// (QApplication::windowIcon()).
2269    ///
2270    /// **See also:** windowTitle
2271    ///
2272    /// This signal is emitted when the window's icon has changed, with the
2273    /// new *icon* as an argument.
2274    ///
2275    ///
2276    /// This property only makes sense for windows. If no icon
2277    /// text has been set, this accessor returns an empty string.
2278    /// It is only implemented on the X11 platform, and only certain
2279    /// window managers use this window property.
2280    ///
2281    /// This property is deprecated.
2282    ///
2283    /// **See also:** windowIcon
2284    /// windowTitle
2285    ///
2286    /// This property only makes sense for windows. It associates a file path with
2287    /// a window. If you set the file path, but have not set the window title, Qt
2288    /// sets the window title to the file name of the specified path, obtained using
2289    /// QFileInfo::fileName().
2290    ///
2291    /// If the window title is set at any point, then the window title takes precedence and
2292    /// will be shown instead of the file path string.
2293    ///
2294    /// Additionally, on MacOS , this has an added benefit that it sets the
2295    /// [proxy icon](http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html)
2296    ///
2297    /// for the window, assuming that the file path exists.
2298    ///
2299    /// If no file path is set, this property contains an empty string.
2300    ///
2301    /// By default, this property contains an empty string.
2302    ///
2303    /// **See also:** windowTitle
2304    /// windowIcon
2305    ///
2306    /// Returns the window's role, or an empty string.
2307    ///
2308    /// **See also:** windowIcon
2309    /// windowTitle
2310    ///
2311    /// Window flags are a combination of a type (e.g. Qt::Dialog) and
2312    /// zero or more hints to the window system (e.g.
2313    /// Qt::FramelessWindowHint).
2314    ///
2315    /// If the widget had type Qt::Widget or Qt::SubWindow and becomes a
2316    /// window (Qt::Window, Qt::Dialog, etc.), it is put at position (0,
2317    /// 0) on the desktop. If the widget is a window and becomes a
2318    /// Qt::Widget or Qt::SubWindow, it is put at position (0, 0)
2319    /// relative to its parent widget.
2320    ///
2321    /// **Note**: This function calls setParent() when changing the flags for
2322    /// a window, causing the widget to be hidden. You must call show() to make
2323    /// the widget visible again..
2324    ///
2325    /// **See also:** [`window_type()`]
2326    /// [`set_window_flag()`]
2327    /// {Window Flags Example}
2328    ///
2329    /// Returns the window type of this widget. This is identical to
2330    /// windowFlags() & Qt::WindowType_Mask.
2331    ///
2332    /// **See also:** windowFlags
2333    ///
2334    /// The valid range of opacity is from 1.0 (completely opaque) to
2335    /// 0.0 (completely transparent).
2336    ///
2337    /// By default the value of this property is 1.0.
2338    ///
2339    /// This feature is available on Embedded Linux, MacOS , Windows,
2340    /// and X11 platforms that support the Composite extension.
2341    ///
2342    /// **Note**: On X11 you need to have a composite manager running,
2343    /// and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be
2344    /// supported by the window manager you are using.
2345    ///
2346    /// **Warning**: Changing this property from opaque to transparent might issue a
2347    /// paint event that needs to be processed before the window is displayed
2348    /// correctly. This affects mainly the use of QPixmap::grabWindow(). Also note
2349    /// that semi-transparent windows update and resize significantly slower than
2350    /// opaque windows.
2351    ///
2352    /// **See also:** [`set_mask()`]
2353    ///
2354    /// A modified window is a window whose content has changed but has
2355    /// not been saved to disk. This flag will have different effects
2356    /// varied by the platform. On MacOS the close button will have a
2357    /// modified look; on other platforms, the window title will have an
2358    /// '*' (asterisk).
2359    ///
2360    /// The window title must contain a placeholder, which
2361    /// indicates where the '*' should appear. Normally, it should appear
2362    /// right after the file name (e.g., ). If the window isn't modified, the placeholder is simply
2363    /// removed.
2364    ///
2365    /// Note that if a widget is set as modified, all its ancestors will
2366    /// also be set as modified. However, if you call `setWindowModified(false)` on a widget, this will not propagate to
2367    /// its parent because other children of the parent might have been
2368    /// modified.
2369    ///
2370    /// **See also:** windowTitle
2371    /// {Application Example}
2372    /// {SDI Example}
2373    /// {MDI Example}
2374    pub fn window(&self) -> Option<Widget> {
2375        let (obj_data, funcs) = self.get_widget_obj_funcs();
2376        unsafe {
2377            let ret_val = ((*funcs).window)(obj_data);
2378            if ret_val.qt_data == ::std::ptr::null() {
2379                return None;
2380            }
2381            let t = ret_val;
2382            let ret_val;
2383            if t.host_data != ::std::ptr::null() {
2384                ret_val = Widget::new_from_rc(t);
2385            } else {
2386                ret_val = Widget::new_from_owned(t);
2387            }
2388            Some(ret_val)
2389        }
2390    }
2391    ///
2392    /// Returns the native parent for this widget, i.e. the next ancestor widget
2393    /// that has a system identifier, or 0 if it does not have any native parent.
2394    ///
2395    /// **See also:** [`effective_win_id()`]
2396    pub fn native_parent_widget(&self) -> Option<Widget> {
2397        let (obj_data, funcs) = self.get_widget_obj_funcs();
2398        unsafe {
2399            let ret_val = ((*funcs).native_parent_widget)(obj_data);
2400            if ret_val.qt_data == ::std::ptr::null() {
2401                return None;
2402            }
2403            let t = ret_val;
2404            let ret_val;
2405            if t.host_data != ::std::ptr::null() {
2406                ret_val = Widget::new_from_rc(t);
2407            } else {
2408                ret_val = Widget::new_from_owned(t);
2409            }
2410            Some(ret_val)
2411        }
2412    }
2413    ///
2414    /// This property describes the widget's palette. The palette is used by the
2415    /// widget's style when rendering standard components, and is available as a
2416    /// means to ensure that custom widgets can maintain consistency with the
2417    /// native platform's look and feel. It's common that different platforms, or
2418    /// different styles, have different palettes.
2419    ///
2420    /// When you assign a new palette to a widget, the color roles from this
2421    /// palette are combined with the widget's default palette to form the
2422    /// widget's final palette. The palette entry for the widget's background role
2423    /// is used to fill the widget's background (see QWidget::autoFillBackground),
2424    /// and the foreground role initializes QPainter's pen.
2425    ///
2426    /// The default depends on the system environment. QApplication maintains a
2427    /// system/theme palette which serves as a default for all widgets. There may
2428    /// also be special palette defaults for certain types of widgets (e.g., on
2429    /// Windows Vista, all classes that derive from QMenuBar have a special
2430    /// default palette). You can also define default palettes for widgets
2431    /// yourself by passing a custom palette and the name of a widget to
2432    /// QApplication::setPalette(). Finally, the style always has the option of
2433    /// polishing the palette as it's assigned (see QStyle::polish()).
2434    ///
2435    /// QWidget propagates explicit palette roles from parent to child. If you
2436    /// assign a brush or color to a specific role on a palette and assign that
2437    /// palette to a widget, that role will propagate to all the widget's
2438    /// children, overriding any system defaults for that role. Note that palettes
2439    /// by default don't propagate to windows (see isWindow()) unless the
2440    /// Qt::WA_WindowPropagation attribute is enabled.
2441    ///
2442    /// QWidget's palette propagation is similar to its font propagation.
2443    ///
2444    /// The current style, which is used to render the content of all standard Qt
2445    /// widgets, is free to choose colors and brushes from the widget palette, or
2446    /// in some cases, to ignore the palette (partially, or completely). In
2447    /// particular, certain styles like GTK style, Mac style, and Windows Vista
2448    /// style, depend on third party APIs to render the content of widgets,
2449    /// and these styles typically do not follow the palette. Because of this,
2450    /// assigning roles to a widget's palette is not guaranteed to change the
2451    /// appearance of the widget. Instead, you may choose to apply a [styleSheet.](styleSheet.)
2452    /// You can refer to our Knowledge Base article
2453    /// [here](http://qt.nokia.com/developer/knowledgebase/22)
2454    /// for more
2455    /// information.
2456    ///
2457    /// **Warning**: Do not use this function in conjunction with [Qt Style Sheets](Qt%20Style%20Sheets)
2458    ///
2459    /// When using style sheets, the palette of a widget can be customized using
2460    /// the , , ,
2461    /// and .
2462    ///
2463    /// **See also:** [`Application::palette`]
2464    /// [`Widget::font`]
2465    pub fn palette(&self) -> Option<Palette> {
2466        let (obj_data, funcs) = self.get_widget_obj_funcs();
2467        unsafe {
2468            let ret_val = ((*funcs).palette)(obj_data);
2469            if ret_val.qt_data == ::std::ptr::null() {
2470                return None;
2471            }
2472            let t = ret_val;
2473            let ret_val;
2474            if t.host_data != ::std::ptr::null() {
2475                ret_val = Palette::new_from_rc(t);
2476            } else {
2477                ret_val = Palette::new_from_owned(t);
2478            }
2479            Some(ret_val)
2480        }
2481    }
2482    pub fn set_palette<P: PaletteTrait<'a>>(&self, arg0: &P) -> &Self {
2483        let (obj_arg0_1, _funcs) = arg0.get_palette_obj_funcs();
2484
2485        let (obj_data, funcs) = self.get_widget_obj_funcs();
2486        unsafe {
2487            ((*funcs).set_palette)(obj_data, obj_arg0_1);
2488        }
2489        self
2490    }
2491    ///
2492    /// Sets the background role of the widget to *role.*
2493    ///
2494    /// The background role defines the brush from the widget's [palette](palette)
2495    /// that
2496    /// is used to render the background.
2497    ///
2498    /// If *role* is QPalette::NoRole, then the widget inherits its
2499    /// parent's background role.
2500    ///
2501    /// Note that styles are free to choose any color from the palette.
2502    /// You can modify the palette or set a style sheet if you don't
2503    /// achieve the result you want with setBackgroundRole().
2504    ///
2505    /// **See also:** [`background_role()`]
2506    /// [`foreground_role()`]
2507    pub fn set_background_role(&self, arg0: ColorRole) -> &Self {
2508        let enum_arg0_1 = arg0.bits();
2509
2510        let (obj_data, funcs) = self.get_widget_obj_funcs();
2511        unsafe {
2512            ((*funcs).set_background_role)(obj_data, enum_arg0_1);
2513        }
2514        self
2515    }
2516    ///
2517    /// Returns the background role of the widget.
2518    ///
2519    /// The background role defines the brush from the widget's [palette](palette)
2520    /// that
2521    /// is used to render the background.
2522    ///
2523    /// If no explicit background role is set, the widget inherts its parent
2524    /// widget's background role.
2525    ///
2526    /// **See also:** [`set_background_role()`]
2527    /// [`foreground_role()`]
2528    pub fn background_role(&self) -> ColorRole {
2529        let (obj_data, funcs) = self.get_widget_obj_funcs();
2530        unsafe {
2531            let ret_val = ((*funcs).background_role)(obj_data);
2532            let ret_val = ColorRole::from_bits_truncate(ret_val);
2533            ret_val
2534        }
2535    }
2536    ///
2537    /// Sets the foreground role of the widget to *role.*
2538    ///
2539    /// The foreground role defines the color from the widget's [palette](palette)
2540    /// that
2541    /// is used to draw the foreground.
2542    ///
2543    /// If *role* is QPalette::NoRole, the widget uses a foreground role
2544    /// that contrasts with the background role.
2545    ///
2546    /// Note that styles are free to choose any color from the palette.
2547    /// You can modify the palette or set a style sheet if you don't
2548    /// achieve the result you want with setForegroundRole().
2549    ///
2550    /// **See also:** [`foreground_role()`]
2551    /// [`background_role()`]
2552    pub fn set_foreground_role(&self, arg0: ColorRole) -> &Self {
2553        let enum_arg0_1 = arg0.bits();
2554
2555        let (obj_data, funcs) = self.get_widget_obj_funcs();
2556        unsafe {
2557            ((*funcs).set_foreground_role)(obj_data, enum_arg0_1);
2558        }
2559        self
2560    }
2561    ///
2562    /// Returns the foreground role.
2563    ///
2564    /// The foreground role defines the color from the widget's [palette](palette)
2565    /// that
2566    /// is used to draw the foreground.
2567    ///
2568    /// If no explicit foreground role is set, the function returns a role
2569    /// that contrasts with the background role.
2570    ///
2571    /// **See also:** [`set_foreground_role()`]
2572    /// [`background_role()`]
2573    pub fn foreground_role(&self) -> ColorRole {
2574        let (obj_data, funcs) = self.get_widget_obj_funcs();
2575        unsafe {
2576            let ret_val = ((*funcs).foreground_role)(obj_data);
2577            let ret_val = ColorRole::from_bits_truncate(ret_val);
2578            ret_val
2579        }
2580    }
2581    ///
2582    /// This property describes the widget's requested font. The font is used by
2583    /// the widget's style when rendering standard components, and is available as
2584    /// a means to ensure that custom widgets can maintain consistency with the
2585    /// native platform's look and feel. It's common that different platforms, or
2586    /// different styles, define different fonts for an application.
2587    ///
2588    /// When you assign a new font to a widget, the properties from this font are
2589    /// combined with the widget's default font to form the widget's final
2590    /// font. You can call fontInfo() to get a copy of the widget's final
2591    /// font. The final font is also used to initialize QPainter's font.
2592    ///
2593    /// The default depends on the system environment. QApplication maintains a
2594    /// system/theme font which serves as a default for all widgets. There may
2595    /// also be special font defaults for certain types of widgets. You can also
2596    /// define default fonts for widgets yourself by passing a custom font and the
2597    /// name of a widget to QApplication::setFont(). Finally, the font is matched
2598    /// against Qt's font database to find the best match.
2599    ///
2600    /// QWidget propagates explicit font properties from parent to child. If you
2601    /// change a specific property on a font and assign that font to a widget,
2602    /// that property will propagate to all the widget's children, overriding any
2603    /// system defaults for that property. Note that fonts by default don't
2604    /// propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation
2605    /// attribute is enabled.
2606    ///
2607    /// QWidget's font propagation is similar to its palette propagation.
2608    ///
2609    /// The current style, which is used to render the content of all standard Qt
2610    /// widgets, is free to choose to use the widget font, or in some cases, to
2611    /// ignore it (partially, or completely). In particular, certain styles like
2612    /// GTK style, Mac style, and Windows Vista style, apply special
2613    /// modifications to the widget font to match the platform's native look and
2614    /// feel. Because of this, assigning properties to a widget's font is not
2615    /// guaranteed to change the appearance of the widget. Instead, you may choose
2616    /// to apply a [styleSheet.](styleSheet.)
2617    ///
2618    /// **Note**: If [Qt Style Sheets](Qt%20Style%20Sheets)
2619    /// are used on the same widget as setFont(),
2620    /// style sheets will take precedence if the settings conflict.
2621    ///
2622    /// **See also:** [`font_info()`]
2623    /// [`font_metrics()`]
2624    ///
2625    /// Returns the font metrics for the widget's current font.
2626    /// Equivalent to `QFontMetrics(widget->font()).`
2627    ///
2628    /// **See also:** [`font()`]
2629    /// [`font_info()`]
2630    /// [`set_font()`]
2631    ///
2632    /// Returns the font info for the widget's current font.
2633    /// Equivalent to `QFontInfo(widget->font()).`
2634    ///
2635    /// **See also:** [`font()`]
2636    /// [`font_metrics()`]
2637    /// [`set_font()`]
2638    pub fn font(&self) -> Option<Font> {
2639        let (obj_data, funcs) = self.get_widget_obj_funcs();
2640        unsafe {
2641            let ret_val = ((*funcs).font)(obj_data);
2642            if ret_val.qt_data == ::std::ptr::null() {
2643                return None;
2644            }
2645            let t = ret_val;
2646            let ret_val;
2647            if t.host_data != ::std::ptr::null() {
2648                ret_val = Font::new_from_rc(t);
2649            } else {
2650                ret_val = Font::new_from_owned(t);
2651            }
2652            Some(ret_val)
2653        }
2654    }
2655    pub fn set_font<F: FontTrait<'a>>(&self, arg0: &F) -> &Self {
2656        let (obj_arg0_1, _funcs) = arg0.get_font_obj_funcs();
2657
2658        let (obj_data, funcs) = self.get_widget_obj_funcs();
2659        unsafe {
2660            ((*funcs).set_font)(obj_data, obj_arg0_1);
2661        }
2662        self
2663    }
2664    ///
2665    /// The mouse cursor will assume this shape when it's over this
2666    /// widget. See the [list of predefined cursor objects](Qt::CursorShape)
2667    /// for a range of useful shapes.
2668    ///
2669    /// An editor widget might use an I-beam cursor:
2670    ///
2671    /// If no cursor has been set, or after a call to unsetCursor(), the
2672    /// parent's cursor is used.
2673    ///
2674    /// By default, this property contains a cursor with the Qt::ArrowCursor
2675    /// shape.
2676    ///
2677    /// Some underlying window implementations will reset the cursor if it
2678    /// leaves a widget even if the mouse is grabbed. If you want to have
2679    /// a cursor set for all widgets, even when outside the window, consider
2680    /// QApplication::setOverrideCursor().
2681    ///
2682    /// **See also:** [`Application::set_override_cursor`]
2683    pub fn cursor(&self) -> Cursor {
2684        let (obj_data, funcs) = self.get_widget_obj_funcs();
2685        unsafe {
2686            let ret_val = ((*funcs).cursor)(obj_data);
2687            let t = ret_val;
2688            let ret_val;
2689            if t.host_data != ::std::ptr::null() {
2690                ret_val = Cursor::new_from_rc(t);
2691            } else {
2692                ret_val = Cursor::new_from_owned(t);
2693            }
2694            ret_val
2695        }
2696    }
2697    pub fn set_cursor<C: CursorTrait<'a>>(&self, arg0: &C) -> &Self {
2698        let (obj_arg0_1, _funcs) = arg0.get_cursor_obj_funcs();
2699
2700        let (obj_data, funcs) = self.get_widget_obj_funcs();
2701        unsafe {
2702            ((*funcs).set_cursor)(obj_data, obj_arg0_1);
2703        }
2704        self
2705    }
2706    pub fn unset_cursor(&self) -> &Self {
2707        let (obj_data, funcs) = self.get_widget_obj_funcs();
2708        unsafe {
2709            ((*funcs).unset_cursor)(obj_data);
2710        }
2711        self
2712    }
2713    pub fn set_mouse_tracking(&self, enable: bool) -> &Self {
2714        let (obj_data, funcs) = self.get_widget_obj_funcs();
2715        unsafe {
2716            ((*funcs).set_mouse_tracking)(obj_data, enable);
2717        }
2718        self
2719    }
2720    pub fn has_mouse_tracking(&self) -> bool {
2721        let (obj_data, funcs) = self.get_widget_obj_funcs();
2722        unsafe {
2723            let ret_val = ((*funcs).has_mouse_tracking)(obj_data);
2724            ret_val
2725        }
2726    }
2727    ///
2728    /// Returns `true` if the widget is under the mouse cursor; otherwise
2729    /// returns `false.`
2730    ///
2731    /// This value is not updated properly during drag and drop
2732    /// operations.
2733    ///
2734    /// **See also:** [`enter_event()`]
2735    /// [`leave_event()`]
2736    pub fn under_mouse(&self) -> bool {
2737        let (obj_data, funcs) = self.get_widget_obj_funcs();
2738        unsafe {
2739            let ret_val = ((*funcs).under_mouse)(obj_data);
2740            ret_val
2741        }
2742    }
2743    pub fn set_tablet_tracking(&self, enable: bool) -> &Self {
2744        let (obj_data, funcs) = self.get_widget_obj_funcs();
2745        unsafe {
2746            ((*funcs).set_tablet_tracking)(obj_data, enable);
2747        }
2748        self
2749    }
2750    pub fn has_tablet_tracking(&self) -> bool {
2751        let (obj_data, funcs) = self.get_widget_obj_funcs();
2752        unsafe {
2753            let ret_val = ((*funcs).has_tablet_tracking)(obj_data);
2754            ret_val
2755        }
2756    }
2757    ///
2758    /// **Overloads**
2759    /// Causes only the parts of the widget which overlap *region* to be
2760    /// visible. If the region includes pixels outside the rect() of the
2761    /// widget, window system controls in that area may or may not be
2762    /// visible, depending on the platform.
2763    ///
2764    /// Note that this effect can be slow if the region is particularly
2765    /// complex.
2766    ///
2767    /// **See also:** windowOpacity
2768    ///
2769    /// Causes only the pixels of the widget for which *bitmap* has a
2770    /// corresponding 1 bit to be visible. If the region includes pixels
2771    /// outside the rect() of the widget, window system controls in that
2772    /// area may or may not be visible, depending on the platform.
2773    ///
2774    /// Note that this effect can be slow if the region is particularly
2775    /// complex.
2776    ///
2777    /// The following code shows how an image with an alpha channel can be
2778    /// used to generate a mask for a widget:
2779    ///
2780    /// The label shown by this code is masked using the image it contains,
2781    /// giving the appearance that an irregularly-shaped image is being drawn
2782    /// directly onto the screen.
2783    ///
2784    /// Masked widgets receive mouse events only on their visible
2785    /// portions.
2786    ///
2787    /// **See also:** [`clear_mask()`]
2788    /// [`window_opacity()`]
2789    /// {Shaped Clock Example}
2790    pub fn set_mask<B: BitmapTrait<'a>>(&self, arg0: &B) -> &Self {
2791        let (obj_arg0_1, _funcs) = arg0.get_bitmap_obj_funcs();
2792
2793        let (obj_data, funcs) = self.get_widget_obj_funcs();
2794        unsafe {
2795            ((*funcs).set_mask)(obj_data, obj_arg0_1);
2796        }
2797        self
2798    }
2799    ///
2800    /// **Overloads**
2801    /// Causes only the parts of the widget which overlap *region* to be
2802    /// visible. If the region includes pixels outside the rect() of the
2803    /// widget, window system controls in that area may or may not be
2804    /// visible, depending on the platform.
2805    ///
2806    /// Note that this effect can be slow if the region is particularly
2807    /// complex.
2808    ///
2809    /// **See also:** windowOpacity
2810    ///
2811    /// Causes only the pixels of the widget for which *bitmap* has a
2812    /// corresponding 1 bit to be visible. If the region includes pixels
2813    /// outside the rect() of the widget, window system controls in that
2814    /// area may or may not be visible, depending on the platform.
2815    ///
2816    /// Note that this effect can be slow if the region is particularly
2817    /// complex.
2818    ///
2819    /// The following code shows how an image with an alpha channel can be
2820    /// used to generate a mask for a widget:
2821    ///
2822    /// The label shown by this code is masked using the image it contains,
2823    /// giving the appearance that an irregularly-shaped image is being drawn
2824    /// directly onto the screen.
2825    ///
2826    /// Masked widgets receive mouse events only on their visible
2827    /// portions.
2828    ///
2829    /// **See also:** [`clear_mask()`]
2830    /// [`window_opacity()`]
2831    /// {Shaped Clock Example}
2832    pub fn set_mask_2<R: RegionTrait<'a>>(&self, arg0: &R) -> &Self {
2833        let (obj_arg0_1, _funcs) = arg0.get_region_obj_funcs();
2834
2835        let (obj_data, funcs) = self.get_widget_obj_funcs();
2836        unsafe {
2837            ((*funcs).set_mask_2)(obj_data, obj_arg0_1);
2838        }
2839        self
2840    }
2841    ///
2842    /// Returns the mask currently set on a widget. If no mask is set the
2843    /// return value will be an empty region.
2844    ///
2845    /// **See also:** [`set_mask()`]
2846    /// [`clear_mask()`]
2847    /// [`Region::is_empty`]
2848    /// {Shaped Clock Example}
2849    pub fn mask(&self) -> Region {
2850        let (obj_data, funcs) = self.get_widget_obj_funcs();
2851        unsafe {
2852            let ret_val = ((*funcs).mask)(obj_data);
2853            let t = ret_val;
2854            let ret_val;
2855            if t.host_data != ::std::ptr::null() {
2856                ret_val = Region::new_from_rc(t);
2857            } else {
2858                ret_val = Region::new_from_owned(t);
2859            }
2860            ret_val
2861        }
2862    }
2863    ///
2864    /// Removes any mask set by setMask().
2865    ///
2866    /// **See also:** [`set_mask()`]
2867    pub fn clear_mask(&self) -> &Self {
2868        let (obj_data, funcs) = self.get_widget_obj_funcs();
2869        unsafe {
2870            ((*funcs).clear_mask)(obj_data);
2871        }
2872        self
2873    }
2874    ///
2875    /// Renders the *sourceRegion* of this widget into the *target*
2876    /// using *renderFlags* to determine how to render. Rendering
2877    /// starts at *targetOffset* in the *target.* For example:
2878    ///
2879    /// If *sourceRegion* is a null region, this function will use QWidget::rect() as
2880    /// the region, i.e. the entire widget.
2881    ///
2882    /// Ensure that you call QPainter::end() for the *target* device's
2883    /// active painter (if any) before rendering. For example:
2884    ///
2885    /// **Note**: To obtain the contents of a QOpenGLWidget, use QOpenGLWidget::grabFramebuffer()
2886    /// instead.
2887    ///
2888    /// **Note**: To obtain the contents of a QGLWidget (deprecated), use
2889    /// QGLWidget::grabFrameBuffer() or QGLWidget::renderPixmap() instead.
2890    ///
2891    /// **Overloads**
2892    /// Renders the widget into the *painter's* QPainter::device().
2893    ///
2894    /// Transformations and settings applied to the *painter* will be used
2895    /// when rendering.
2896    ///
2897    /// **Note**: The *painter* must be active. On MacOS the widget will be
2898    /// rendered into a QPixmap and then drawn by the *painter.*
2899    ///
2900    /// **See also:** [`Painter::device`]
2901    pub fn render<P: PaintDeviceTrait<'a>, Q: PointTrait<'a>, R: RegionTrait<'a>>(
2902        &self,
2903        target: &P,
2904        target_offset: &Q,
2905        source_region: &R,
2906        render_flags: RenderFlags,
2907    ) -> &Self {
2908        let (obj_target_1, _funcs) = target.get_paint_device_obj_funcs();
2909        let (obj_target_offset_2, _funcs) = target_offset.get_point_obj_funcs();
2910        let (obj_source_region_3, _funcs) = source_region.get_region_obj_funcs();
2911        let enum_render_flags_4 = render_flags.bits();
2912
2913        let (obj_data, funcs) = self.get_widget_obj_funcs();
2914        unsafe {
2915            ((*funcs).render)(
2916                obj_data,
2917                obj_target_1,
2918                obj_target_offset_2,
2919                obj_source_region_3,
2920                enum_render_flags_4,
2921            );
2922        }
2923        self
2924    }
2925    ///
2926    /// Renders the *sourceRegion* of this widget into the *target*
2927    /// using *renderFlags* to determine how to render. Rendering
2928    /// starts at *targetOffset* in the *target.* For example:
2929    ///
2930    /// If *sourceRegion* is a null region, this function will use QWidget::rect() as
2931    /// the region, i.e. the entire widget.
2932    ///
2933    /// Ensure that you call QPainter::end() for the *target* device's
2934    /// active painter (if any) before rendering. For example:
2935    ///
2936    /// **Note**: To obtain the contents of a QOpenGLWidget, use QOpenGLWidget::grabFramebuffer()
2937    /// instead.
2938    ///
2939    /// **Note**: To obtain the contents of a QGLWidget (deprecated), use
2940    /// QGLWidget::grabFrameBuffer() or QGLWidget::renderPixmap() instead.
2941    ///
2942    /// **Overloads**
2943    /// Renders the widget into the *painter's* QPainter::device().
2944    ///
2945    /// Transformations and settings applied to the *painter* will be used
2946    /// when rendering.
2947    ///
2948    /// **Note**: The *painter* must be active. On MacOS the widget will be
2949    /// rendered into a QPixmap and then drawn by the *painter.*
2950    ///
2951    /// **See also:** [`Painter::device`]
2952    pub fn render_2<P: PainterTrait<'a>, Q: PointTrait<'a>, R: RegionTrait<'a>>(
2953        &self,
2954        painter: &P,
2955        target_offset: &Q,
2956        source_region: &R,
2957        render_flags: RenderFlags,
2958    ) -> &Self {
2959        let (obj_painter_1, _funcs) = painter.get_painter_obj_funcs();
2960        let (obj_target_offset_2, _funcs) = target_offset.get_point_obj_funcs();
2961        let (obj_source_region_3, _funcs) = source_region.get_region_obj_funcs();
2962        let enum_render_flags_4 = render_flags.bits();
2963
2964        let (obj_data, funcs) = self.get_widget_obj_funcs();
2965        unsafe {
2966            ((*funcs).render_2)(
2967                obj_data,
2968                obj_painter_1,
2969                obj_target_offset_2,
2970                obj_source_region_3,
2971                enum_render_flags_4,
2972            );
2973        }
2974        self
2975    }
2976    ///
2977    /// Renders the widget into a pixmap restricted by the
2978    /// given *rectangle.* If the widget has any children, then
2979    /// they are also painted in the appropriate positions.
2980    ///
2981    /// If a rectangle with an invalid size is specified (the default),
2982    /// the entire widget is painted.
2983    ///
2984    /// **See also:** [`render()`]
2985    /// [`Pixmap`]
2986    ///
2987    /// Adds a shortcut to Qt's shortcut system that watches for the given
2988    /// *key* sequence in the given *context.* If the *context* is
2989    /// Qt::ApplicationShortcut, the shortcut applies to the application as a
2990    /// whole. Otherwise, it is either local to this widget, Qt::WidgetShortcut,
2991    /// or to the window itself, Qt::WindowShortcut.
2992    ///
2993    /// If the same *key* sequence has been grabbed by several widgets,
2994    /// when the *key* sequence occurs a QEvent::Shortcut event is sent
2995    /// to all the widgets to which it applies in a non-deterministic
2996    /// order, but with the ``ambiguous'' flag set to true.
2997    ///
2998    /// **Warning**: You should not normally need to use this function;
2999    /// instead create [QAction](QAction)
3000    /// s with the shortcut key sequences you
3001    /// require (if you also want equivalent menu options and toolbar
3002    /// buttons), or create [QShortcut](QShortcut)
3003    /// s if you just need key sequences.
3004    /// Both QAction and QShortcut handle all the event filtering for you,
3005    /// and provide signals which are triggered when the user triggers the
3006    /// key sequence, so are much easier to use than this low-level
3007    /// function.
3008    ///
3009    /// **See also:** [`release_shortcut()`]
3010    /// [`set_shortcut_enabled()`]
3011    ///
3012    /// Subscribes the widget to a given *gesture* with specific *flags.*
3013    ///
3014    /// **See also:** [`ungrab_gesture()`]
3015    /// [`GestureEvent`]
3016    ///
3017    /// Grabs the mouse input.
3018    ///
3019    /// This widget receives all mouse events until releaseMouse() is
3020    /// called; other widgets get no mouse events at all. Keyboard
3021    /// events are not affected. Use grabKeyboard() if you want to grab
3022    /// that.
3023    ///
3024    /// **Warning**: Bugs in mouse-grabbing applications very often lock the
3025    /// terminal. Use this function with extreme caution, and consider
3026    /// using the `-nograb` command line option while debugging.
3027    ///
3028    /// It is almost never necessary to grab the mouse when using Qt, as
3029    /// Qt grabs and releases it sensibly. In particular, Qt grabs the
3030    /// mouse when a mouse button is pressed and keeps it until the last
3031    /// button is released.
3032    ///
3033    /// **Note**: Only visible widgets can grab mouse input. If isVisible()
3034    /// returns `false` for a widget, that widget cannot call grabMouse().
3035    ///
3036    /// **Note**: On Windows, grabMouse() only works when the mouse is inside a window
3037    /// owned by the process.
3038    /// On MacOS , grabMouse() only works when the mouse is inside the frame of that widget.
3039    ///
3040    /// **See also:** [`release_mouse()`]
3041    /// [`grab_keyboard()`]
3042    /// [`release_keyboard()`]
3043    ///
3044    /// **Overloads** grabMouse()
3045    /// Grabs the mouse input and changes the cursor shape.
3046    ///
3047    /// The cursor will assume shape *cursor* (for as long as the mouse
3048    /// focus is grabbed) and this widget will be the only one to receive
3049    /// mouse events until releaseMouse() is called().
3050    ///
3051    /// **Warning**: Grabbing the mouse might lock the terminal.
3052    ///
3053    /// **Note**: See the note in QWidget::grabMouse().
3054    ///
3055    /// **See also:** [`release_mouse()`]
3056    /// [`grab_keyboard()`]
3057    /// [`release_keyboard()`]
3058    /// [`set_cursor()`]
3059    ///
3060    /// Grabs the keyboard input.
3061    ///
3062    /// This widget receives all keyboard events until releaseKeyboard()
3063    /// is called; other widgets get no keyboard events at all. Mouse
3064    /// events are not affected. Use grabMouse() if you want to grab that.
3065    ///
3066    /// The focus widget is not affected, except that it doesn't receive
3067    /// any keyboard events. setFocus() moves the focus as usual, but the
3068    /// new focus widget receives keyboard events only after
3069    /// releaseKeyboard() is called.
3070    ///
3071    /// If a different widget is currently grabbing keyboard input, that
3072    /// widget's grab is released first.
3073    ///
3074    /// **See also:** [`release_keyboard()`]
3075    /// [`grab_mouse()`]
3076    /// [`release_mouse()`]
3077    /// [`focus_widget()`]
3078    pub fn grab<R: RectTrait<'a>>(&self, rectangle: &R) -> Pixmap {
3079        let (obj_rectangle_1, _funcs) = rectangle.get_rect_obj_funcs();
3080
3081        let (obj_data, funcs) = self.get_widget_obj_funcs();
3082        unsafe {
3083            let ret_val = ((*funcs).grab)(obj_data, obj_rectangle_1);
3084            let t = ret_val;
3085            let ret_val;
3086            if t.host_data != ::std::ptr::null() {
3087                ret_val = Pixmap::new_from_rc(t);
3088            } else {
3089                ret_val = Pixmap::new_from_owned(t);
3090            }
3091            ret_val
3092        }
3093    }
3094    ///
3095    /// Subscribes the widget to a given *gesture* with specific *flags.*
3096    ///
3097    /// **See also:** [`ungrab_gesture()`]
3098    /// [`GestureEvent`]
3099    pub fn grab_gesture(&self, gtype: GestureType, flags: GestureFlags) -> &Self {
3100        let enum_gtype_1 = gtype.bits();
3101        let enum_flags_2 = flags.bits();
3102
3103        let (obj_data, funcs) = self.get_widget_obj_funcs();
3104        unsafe {
3105            ((*funcs).grab_gesture)(obj_data, enum_gtype_1, enum_flags_2);
3106        }
3107        self
3108    }
3109    ///
3110    /// Unsubscribes the widget from a given *gesture* type
3111    ///
3112    /// **See also:** [`grab_gesture()`]
3113    /// [`GestureEvent`]
3114    pub fn ungrab_gesture(&self, gtype: GestureType) -> &Self {
3115        let enum_gtype_1 = gtype.bits();
3116
3117        let (obj_data, funcs) = self.get_widget_obj_funcs();
3118        unsafe {
3119            ((*funcs).ungrab_gesture)(obj_data, enum_gtype_1);
3120        }
3121        self
3122    }
3123    pub fn set_window_title(&self, arg0: &str) -> &Self {
3124        let str_in_arg0_1 = CString::new(arg0).unwrap();
3125
3126        let (obj_data, funcs) = self.get_widget_obj_funcs();
3127        unsafe {
3128            ((*funcs).set_window_title)(obj_data, str_in_arg0_1.as_ptr());
3129        }
3130        self
3131    }
3132    pub fn set_style_sheet(&self, style_sheet: &str) -> &Self {
3133        let str_in_style_sheet_1 = CString::new(style_sheet).unwrap();
3134
3135        let (obj_data, funcs) = self.get_widget_obj_funcs();
3136        unsafe {
3137            ((*funcs).set_style_sheet)(obj_data, str_in_style_sheet_1.as_ptr());
3138        }
3139        self
3140    }
3141    ///
3142    /// The style sheet contains a textual description of customizations to the
3143    /// widget's style, as described in the [Qt Style Sheets](Qt%20Style%20Sheets)
3144    /// document.
3145    ///
3146    /// Since Qt 4.5, Qt style sheets fully supports MacOS .
3147    ///
3148    /// **Warning**: Qt style sheets are currently not supported for custom QStyle
3149    /// subclasses. We plan to address this in some future release.
3150    ///
3151    /// **See also:** [`set_style()`]
3152    /// [`Application::style_sheet()`]
3153    /// {Qt Style Sheets}
3154    pub fn style_sheet(&self) -> String {
3155        let (obj_data, funcs) = self.get_widget_obj_funcs();
3156        unsafe {
3157            let ret_val = ((*funcs).style_sheet)(obj_data);
3158            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3159            ret_val
3160        }
3161    }
3162    ///
3163    /// This property only makes sense for top-level widgets, such as
3164    /// windows and dialogs. If no caption has been set, the title is based of the
3165    /// [windowFilePath.](windowFilePath.)
3166    /// If neither of these is set, then the title is
3167    /// an empty string.
3168    ///
3169    /// If you use the [windowModified](windowModified)
3170    /// mechanism, the window title must
3171    /// contain a placeholder, which indicates where the '*' should
3172    /// appear. Normally, it should appear right after the file name
3173    /// (e.g., ). If the [windowModified](windowModified)
3174    /// property is `false` (the default), the placeholder
3175    /// is simply removed.
3176    ///
3177    /// On some desktop platforms (including Windows and Unix), the application name
3178    /// (from QGuiApplication::applicationDisplayName) is added at the end of the
3179    /// window title, if set. This is done by the QPA plugin, so it is shown to the
3180    /// user, but isn't part of the windowTitle string.
3181    ///
3182    /// **See also:** windowIcon
3183    /// windowModified
3184    /// windowFilePath
3185    ///
3186    /// This signal is emitted when the window's title has changed, with the
3187    /// new *title* as an argument.
3188    ///
3189    pub fn window_title(&self) -> String {
3190        let (obj_data, funcs) = self.get_widget_obj_funcs();
3191        unsafe {
3192            let ret_val = ((*funcs).window_title)(obj_data);
3193            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3194            ret_val
3195        }
3196    }
3197    pub fn set_window_icon<I: IconTrait<'a>>(&self, icon: &I) -> &Self {
3198        let (obj_icon_1, _funcs) = icon.get_icon_obj_funcs();
3199
3200        let (obj_data, funcs) = self.get_widget_obj_funcs();
3201        unsafe {
3202            ((*funcs).set_window_icon)(obj_data, obj_icon_1);
3203        }
3204        self
3205    }
3206    ///
3207    /// This signal is emitted when the window's icon text has changed, with the
3208    /// new *iconText* as an argument.
3209    ///
3210    /// This signal is deprecated.
3211    ///
3212    /// This property only makes sense for windows. If no icon
3213    /// has been set, windowIcon() returns the application icon
3214    /// (QApplication::windowIcon()).
3215    ///
3216    /// **See also:** windowTitle
3217    ///
3218    /// This signal is emitted when the window's icon has changed, with the
3219    /// new *icon* as an argument.
3220    ///
3221    ///
3222    /// This property only makes sense for windows. If no icon
3223    /// text has been set, this accessor returns an empty string.
3224    /// It is only implemented on the X11 platform, and only certain
3225    /// window managers use this window property.
3226    ///
3227    /// This property is deprecated.
3228    ///
3229    /// **See also:** windowIcon
3230    /// windowTitle
3231    pub fn window_icon(&self) -> Icon {
3232        let (obj_data, funcs) = self.get_widget_obj_funcs();
3233        unsafe {
3234            let ret_val = ((*funcs).window_icon)(obj_data);
3235            let t = ret_val;
3236            let ret_val;
3237            if t.host_data != ::std::ptr::null() {
3238                ret_val = Icon::new_from_rc(t);
3239            } else {
3240                ret_val = Icon::new_from_owned(t);
3241            }
3242            ret_val
3243        }
3244    }
3245    pub fn set_window_icon_text(&self, arg0: &str) -> &Self {
3246        let str_in_arg0_1 = CString::new(arg0).unwrap();
3247
3248        let (obj_data, funcs) = self.get_widget_obj_funcs();
3249        unsafe {
3250            ((*funcs).set_window_icon_text)(obj_data, str_in_arg0_1.as_ptr());
3251        }
3252        self
3253    }
3254    ///
3255    /// This signal is emitted when the window's icon text has changed, with the
3256    /// new *iconText* as an argument.
3257    ///
3258    /// This signal is deprecated.
3259    ///
3260    /// This property only makes sense for windows. If no icon
3261    /// text has been set, this accessor returns an empty string.
3262    /// It is only implemented on the X11 platform, and only certain
3263    /// window managers use this window property.
3264    ///
3265    /// This property is deprecated.
3266    ///
3267    /// **See also:** windowIcon
3268    /// windowTitle
3269    pub fn window_icon_text(&self) -> String {
3270        let (obj_data, funcs) = self.get_widget_obj_funcs();
3271        unsafe {
3272            let ret_val = ((*funcs).window_icon_text)(obj_data);
3273            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3274            ret_val
3275        }
3276    }
3277    ///
3278    /// Sets the window's role to *role.* This only makes sense for
3279    /// windows on X11.
3280    pub fn set_window_role(&self, arg0: &str) -> &Self {
3281        let str_in_arg0_1 = CString::new(arg0).unwrap();
3282
3283        let (obj_data, funcs) = self.get_widget_obj_funcs();
3284        unsafe {
3285            ((*funcs).set_window_role)(obj_data, str_in_arg0_1.as_ptr());
3286        }
3287        self
3288    }
3289    ///
3290    /// Returns the window's role, or an empty string.
3291    ///
3292    /// **See also:** windowIcon
3293    /// windowTitle
3294    pub fn window_role(&self) -> String {
3295        let (obj_data, funcs) = self.get_widget_obj_funcs();
3296        unsafe {
3297            let ret_val = ((*funcs).window_role)(obj_data);
3298            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3299            ret_val
3300        }
3301    }
3302    pub fn set_window_file_path(&self, file_path: &str) -> &Self {
3303        let str_in_file_path_1 = CString::new(file_path).unwrap();
3304
3305        let (obj_data, funcs) = self.get_widget_obj_funcs();
3306        unsafe {
3307            ((*funcs).set_window_file_path)(obj_data, str_in_file_path_1.as_ptr());
3308        }
3309        self
3310    }
3311    ///
3312    /// This property only makes sense for windows. It associates a file path with
3313    /// a window. If you set the file path, but have not set the window title, Qt
3314    /// sets the window title to the file name of the specified path, obtained using
3315    /// QFileInfo::fileName().
3316    ///
3317    /// If the window title is set at any point, then the window title takes precedence and
3318    /// will be shown instead of the file path string.
3319    ///
3320    /// Additionally, on MacOS , this has an added benefit that it sets the
3321    /// [proxy icon](http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html)
3322    ///
3323    /// for the window, assuming that the file path exists.
3324    ///
3325    /// If no file path is set, this property contains an empty string.
3326    ///
3327    /// By default, this property contains an empty string.
3328    ///
3329    /// **See also:** windowTitle
3330    /// windowIcon
3331    pub fn window_file_path(&self) -> String {
3332        let (obj_data, funcs) = self.get_widget_obj_funcs();
3333        unsafe {
3334            let ret_val = ((*funcs).window_file_path)(obj_data);
3335            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3336            ret_val
3337        }
3338    }
3339    pub fn set_window_opacity(&self, level: f32) -> &Self {
3340        let (obj_data, funcs) = self.get_widget_obj_funcs();
3341        unsafe {
3342            ((*funcs).set_window_opacity)(obj_data, level);
3343        }
3344        self
3345    }
3346    ///
3347    /// The valid range of opacity is from 1.0 (completely opaque) to
3348    /// 0.0 (completely transparent).
3349    ///
3350    /// By default the value of this property is 1.0.
3351    ///
3352    /// This feature is available on Embedded Linux, MacOS , Windows,
3353    /// and X11 platforms that support the Composite extension.
3354    ///
3355    /// **Note**: On X11 you need to have a composite manager running,
3356    /// and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be
3357    /// supported by the window manager you are using.
3358    ///
3359    /// **Warning**: Changing this property from opaque to transparent might issue a
3360    /// paint event that needs to be processed before the window is displayed
3361    /// correctly. This affects mainly the use of QPixmap::grabWindow(). Also note
3362    /// that semi-transparent windows update and resize significantly slower than
3363    /// opaque windows.
3364    ///
3365    /// **See also:** [`set_mask()`]
3366    pub fn window_opacity(&self) -> f32 {
3367        let (obj_data, funcs) = self.get_widget_obj_funcs();
3368        unsafe {
3369            let ret_val = ((*funcs).window_opacity)(obj_data);
3370            ret_val
3371        }
3372    }
3373    pub fn is_window_modified(&self) -> bool {
3374        let (obj_data, funcs) = self.get_widget_obj_funcs();
3375        unsafe {
3376            let ret_val = ((*funcs).is_window_modified)(obj_data);
3377            ret_val
3378        }
3379    }
3380    pub fn set_tool_tip(&self, arg0: &str) -> &Self {
3381        let str_in_arg0_1 = CString::new(arg0).unwrap();
3382
3383        let (obj_data, funcs) = self.get_widget_obj_funcs();
3384        unsafe {
3385            ((*funcs).set_tool_tip)(obj_data, str_in_arg0_1.as_ptr());
3386        }
3387        self
3388    }
3389    ///
3390    /// Note that by default tooltips are only shown for widgets that are
3391    /// children of the active window. You can change this behavior by
3392    /// setting the attribute Qt::WA_AlwaysShowToolTips on the *window,*
3393    /// not on the widget with the tooltip.
3394    ///
3395    /// If you want to control a tooltip's behavior, you can intercept the
3396    /// event() function and catch the QEvent::ToolTip event (e.g., if you
3397    /// want to customize the area for which the tooltip should be shown).
3398    ///
3399    /// By default, this property contains an empty string.
3400    ///
3401    /// **See also:** [`ToolTip`]
3402    /// statusTip
3403    /// whatsThis
3404    ///
3405    /// Specifies how long time the tooltip will be displayed, in milliseconds.
3406    /// If the value is -1 (default) the duration is calculated depending on the length of the tooltip.
3407    ///
3408    /// **See also:** toolTip
3409    pub fn tool_tip(&self) -> String {
3410        let (obj_data, funcs) = self.get_widget_obj_funcs();
3411        unsafe {
3412            let ret_val = ((*funcs).tool_tip)(obj_data);
3413            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3414            ret_val
3415        }
3416    }
3417    pub fn set_tool_tip_duration(&self, msec: i32) -> &Self {
3418        let (obj_data, funcs) = self.get_widget_obj_funcs();
3419        unsafe {
3420            ((*funcs).set_tool_tip_duration)(obj_data, msec);
3421        }
3422        self
3423    }
3424    ///
3425    /// Specifies how long time the tooltip will be displayed, in milliseconds.
3426    /// If the value is -1 (default) the duration is calculated depending on the length of the tooltip.
3427    ///
3428    /// **See also:** toolTip
3429    pub fn tool_tip_duration(&self) -> i32 {
3430        let (obj_data, funcs) = self.get_widget_obj_funcs();
3431        unsafe {
3432            let ret_val = ((*funcs).tool_tip_duration)(obj_data);
3433            ret_val
3434        }
3435    }
3436    pub fn set_status_tip(&self, arg0: &str) -> &Self {
3437        let str_in_arg0_1 = CString::new(arg0).unwrap();
3438
3439        let (obj_data, funcs) = self.get_widget_obj_funcs();
3440        unsafe {
3441            ((*funcs).set_status_tip)(obj_data, str_in_arg0_1.as_ptr());
3442        }
3443        self
3444    }
3445    ///
3446    /// By default, this property contains an empty string.
3447    ///
3448    /// **See also:** toolTip
3449    /// whatsThis
3450    pub fn status_tip(&self) -> String {
3451        let (obj_data, funcs) = self.get_widget_obj_funcs();
3452        unsafe {
3453            let ret_val = ((*funcs).status_tip)(obj_data);
3454            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3455            ret_val
3456        }
3457    }
3458    pub fn set_whats_this(&self, arg0: &str) -> &Self {
3459        let str_in_arg0_1 = CString::new(arg0).unwrap();
3460
3461        let (obj_data, funcs) = self.get_widget_obj_funcs();
3462        unsafe {
3463            ((*funcs).set_whats_this)(obj_data, str_in_arg0_1.as_ptr());
3464        }
3465        self
3466    }
3467    ///
3468    /// By default, this property contains an empty string.
3469    ///
3470    /// **See also:** [`WhatsThis`]
3471    /// [`Widget::tool_tip()`]
3472    /// [`Widget::status_tip()`]
3473    pub fn whats_this(&self) -> String {
3474        let (obj_data, funcs) = self.get_widget_obj_funcs();
3475        unsafe {
3476            let ret_val = ((*funcs).whats_this)(obj_data);
3477            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3478            ret_val
3479        }
3480    }
3481    ///
3482    /// This is the primary name by which assistive technology such as screen readers
3483    /// announce this widget. For most widgets setting this property is not required.
3484    /// For example for QPushButton the button's text will be used.
3485    ///
3486    /// It is important to set this property when the widget does not provide any
3487    /// text. For example a button that only contains an icon needs to set this
3488    /// property to work with screen readers.
3489    /// The name should be short and equivalent to the visual information conveyed
3490    /// by the widget.
3491    ///
3492    /// This property has to be [localized](Internationalization%20with%20Qt)
3493    ///
3494    ///
3495    /// By default, this property contains an empty string.
3496    ///
3497    /// **See also:** [`Widget::accessible_description()`]
3498    /// [`AccessibleInterface::text`]
3499    pub fn accessible_name(&self) -> String {
3500        let (obj_data, funcs) = self.get_widget_obj_funcs();
3501        unsafe {
3502            let ret_val = ((*funcs).accessible_name)(obj_data);
3503            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3504            ret_val
3505        }
3506    }
3507    pub fn set_accessible_name(&self, name: &str) -> &Self {
3508        let str_in_name_1 = CString::new(name).unwrap();
3509
3510        let (obj_data, funcs) = self.get_widget_obj_funcs();
3511        unsafe {
3512            ((*funcs).set_accessible_name)(obj_data, str_in_name_1.as_ptr());
3513        }
3514        self
3515    }
3516    ///
3517    /// The accessible description of a widget should convey what a widget does.
3518    /// While the [accessibleName](accessibleName)
3519    /// should be a short and consise string (e.g. **Save** ),
3520    /// the description should give more context, such as **Saves the current document** .
3521    ///
3522    /// This property has to be [localized](Internationalization%20with%20Qt)
3523    ///
3524    ///
3525    /// By default, this property contains an empty string and Qt falls back
3526    /// to using the tool tip to provide this information.
3527    ///
3528    /// **See also:** [`Widget::accessible_name()`]
3529    /// [`AccessibleInterface::text`]
3530    pub fn accessible_description(&self) -> String {
3531        let (obj_data, funcs) = self.get_widget_obj_funcs();
3532        unsafe {
3533            let ret_val = ((*funcs).accessible_description)(obj_data);
3534            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
3535            ret_val
3536        }
3537    }
3538    pub fn set_accessible_description(&self, description: &str) -> &Self {
3539        let str_in_description_1 = CString::new(description).unwrap();
3540
3541        let (obj_data, funcs) = self.get_widget_obj_funcs();
3542        unsafe {
3543            ((*funcs).set_accessible_description)(obj_data, str_in_description_1.as_ptr());
3544        }
3545        self
3546    }
3547    pub fn set_layout_direction(&self, direction: LayoutDirection) -> &Self {
3548        let enum_direction_1 = direction as u32;
3549
3550        let (obj_data, funcs) = self.get_widget_obj_funcs();
3551        unsafe {
3552            ((*funcs).set_layout_direction)(obj_data, enum_direction_1);
3553        }
3554        self
3555    }
3556    ///
3557    /// By default, this property is set to Qt::LeftToRight.
3558    ///
3559    /// When the layout direction is set on a widget, it will propagate to
3560    /// the widget's children, but not to a child that is a window and not
3561    /// to a child for which setLayoutDirection() has been explicitly
3562    /// called. Also, child widgets added *after* setLayoutDirection()
3563    /// has been called for the parent do not inherit the parent's layout
3564    /// direction.
3565    ///
3566    /// This method no longer affects text layout direction since Qt 4.7.
3567    ///
3568    /// **See also:** [`Application::layout_direction()`]
3569    pub fn layout_direction(&self) -> LayoutDirection {
3570        let (obj_data, funcs) = self.get_widget_obj_funcs();
3571        unsafe {
3572            let ret_val = ((*funcs).layout_direction)(obj_data);
3573            let ret_val = { transmute::<u32, LayoutDirection>(ret_val) };
3574            ret_val
3575        }
3576    }
3577    pub fn unset_layout_direction(&self) -> &Self {
3578        let (obj_data, funcs) = self.get_widget_obj_funcs();
3579        unsafe {
3580            ((*funcs).unset_layout_direction)(obj_data);
3581        }
3582        self
3583    }
3584    ///
3585    /// As long as no special locale has been set, this is either
3586    /// the parent's locale or (if this widget is a top level widget),
3587    /// the default locale.
3588    ///
3589    /// If the widget displays dates or numbers, these should be formatted
3590    /// using the widget's locale.
3591    ///
3592    /// **See also:** [`Locale`]
3593    /// [`Locale::set_default`]
3594    pub fn is_right_to_left(&self) -> bool {
3595        let (obj_data, funcs) = self.get_widget_obj_funcs();
3596        unsafe {
3597            let ret_val = ((*funcs).is_right_to_left)(obj_data);
3598            ret_val
3599        }
3600    }
3601    pub fn is_left_to_right(&self) -> bool {
3602        let (obj_data, funcs) = self.get_widget_obj_funcs();
3603        unsafe {
3604            let ret_val = ((*funcs).is_left_to_right)(obj_data);
3605            ret_val
3606        }
3607    }
3608    ///
3609    /// Sets the widget's focus proxy to widget *w.* If *w* is 0, the
3610    /// function resets this widget to have no focus proxy.
3611    ///
3612    /// Some widgets can , but create a child widget, such as
3613    /// QLineEdit, to actually handle the focus. In this case, the widget
3614    /// can set the line edit to be its focus proxy.
3615    ///
3616    /// setFocusProxy() sets the widget which will actually get focus when
3617    /// gets it. If there is a focus proxy, setFocus() and
3618    /// hasFocus() operate on the focus proxy.
3619    ///
3620    /// **See also:** [`focus_proxy()`]
3621    ///
3622    /// Gives the keyboard input focus to this widget (or its focus
3623    /// proxy) if this widget or one of its parents is the [active window](isActiveWindow())
3624    /// . The *reason* argument will
3625    /// be passed into any focus event sent from this function, it is used
3626    /// to give an explanation of what caused the widget to get focus.
3627    /// If the window is not active, the widget will be given the focus when
3628    /// the window becomes active.
3629    ///
3630    /// First, a focus about to change event is sent to the focus widget (if any) to
3631    /// tell it that it is about to lose the focus. Then focus is changed, a
3632    /// focus out event is sent to the previous focus item and a focus in event is sent
3633    /// to the new item to tell it that it just received the focus.
3634    /// (Nothing happens if the focus in and focus out widgets are the
3635    /// same.)
3636    ///
3637    /// **Note**: On embedded platforms, setFocus() will not cause an input panel
3638    /// to be opened by the input method. If you want this to happen, you
3639    /// have to send a QEvent::RequestSoftwareInputPanel event to the
3640    /// widget yourself.
3641    ///
3642    /// setFocus() gives focus to a widget regardless of its focus policy,
3643    /// but does not clear any keyboard grab (see grabKeyboard()).
3644    ///
3645    /// Be aware that if the widget is hidden, it will not accept focus
3646    /// until it is shown.
3647    ///
3648    /// **Warning**: If you call setFocus() in a function which may itself be
3649    /// called from focusOutEvent() or focusInEvent(), you may get an
3650    /// infinite recursion.
3651    ///
3652    /// **See also:** [`has_focus()`]
3653    /// [`clear_focus()`]
3654    /// [`focus_in_event()`]
3655    /// [`focus_out_event()`]
3656    /// [`set_focus_policy()`]
3657    /// [`focus_widget()`]
3658    /// [`Application::focus_widget`]
3659    /// [`grab_keyboard()`]
3660    /// [`grab_mouse()`]
3661    /// {Keyboard Focus in Widgets}
3662    /// [`Event::request_software_input_panel()`]
3663    ///
3664    /// **Overloads**
3665    /// Gives the keyboard input focus to this widget (or its focus
3666    /// proxy) if this widget or one of its parents is the
3667    /// [active window](isActiveWindow())
3668    ///
3669    pub fn set_focus(&self) -> &Self {
3670        let (obj_data, funcs) = self.get_widget_obj_funcs();
3671        unsafe {
3672            ((*funcs).set_focus)(obj_data);
3673        }
3674        self
3675    }
3676    ///
3677    /// The active window is the window that contains the widget that has
3678    /// keyboard focus (The window may still have focus if it has no
3679    /// widgets or none of its widgets accepts keyboard focus).
3680    ///
3681    /// When popup windows are visible, this property is `true` for both the
3682    /// active window *and* for the popup.
3683    ///
3684    /// By default, this property is `false.`
3685    ///
3686    /// **See also:** [`activate_window()`]
3687    /// [`Application::active_window`]
3688    pub fn is_active_window(&self) -> bool {
3689        let (obj_data, funcs) = self.get_widget_obj_funcs();
3690        unsafe {
3691            let ret_val = ((*funcs).is_active_window)(obj_data);
3692            ret_val
3693        }
3694    }
3695    ///
3696    /// Sets the top-level widget containing this widget to be the active
3697    /// window.
3698    ///
3699    /// An active window is a visible top-level window that has the
3700    /// keyboard input focus.
3701    ///
3702    /// This function performs the same operation as clicking the mouse on
3703    /// the title bar of a top-level window. On X11, the result depends on
3704    /// the Window Manager. If you want to ensure that the window is
3705    /// stacked on top as well you should also call raise(). Note that the
3706    /// window must be visible, otherwise activateWindow() has no effect.
3707    ///
3708    /// On Windows, if you are calling this when the application is not
3709    /// currently the active one then it will not make it the active
3710    /// window. It will change the color of the taskbar entry to indicate
3711    /// that the window has changed in some way. This is because Microsoft
3712    /// does not allow an application to interrupt what the user is currently
3713    /// doing in another application.
3714    ///
3715    /// **See also:** [`is_active_window()`]
3716    /// [`window()`]
3717    /// [`show()`]
3718    /// [`WindowsWindowFunctions::set_window_activation_behavior`]
3719    pub fn activate_window(&self) -> &Self {
3720        let (obj_data, funcs) = self.get_widget_obj_funcs();
3721        unsafe {
3722            ((*funcs).activate_window)(obj_data);
3723        }
3724        self
3725    }
3726    ///
3727    /// Takes keyboard input focus from the widget.
3728    ///
3729    /// If the widget has active focus, a [focus out event](focusOutEvent())
3730    /// is sent to this widget to tell it that it has
3731    /// lost the focus.
3732    ///
3733    /// This widget must enable focus setting in order to get the keyboard
3734    /// input focus, i.e. it must call setFocusPolicy().
3735    ///
3736    /// **See also:** [`has_focus()`]
3737    /// [`set_focus()`]
3738    /// [`focus_in_event()`]
3739    /// [`focus_out_event()`]
3740    /// [`set_focus_policy()`]
3741    /// [`Application::focus_widget`]
3742    pub fn clear_focus(&self) -> &Self {
3743        let (obj_data, funcs) = self.get_widget_obj_funcs();
3744        unsafe {
3745            ((*funcs).clear_focus)(obj_data);
3746        }
3747        self
3748    }
3749    ///
3750    /// Sets the widget's focus proxy to widget *w.* If *w* is 0, the
3751    /// function resets this widget to have no focus proxy.
3752    ///
3753    /// Some widgets can , but create a child widget, such as
3754    /// QLineEdit, to actually handle the focus. In this case, the widget
3755    /// can set the line edit to be its focus proxy.
3756    ///
3757    /// setFocusProxy() sets the widget which will actually get focus when
3758    /// gets it. If there is a focus proxy, setFocus() and
3759    /// hasFocus() operate on the focus proxy.
3760    ///
3761    /// **See also:** [`focus_proxy()`]
3762    ///
3763    /// Gives the keyboard input focus to this widget (or its focus
3764    /// proxy) if this widget or one of its parents is the [active window](isActiveWindow())
3765    /// . The *reason* argument will
3766    /// be passed into any focus event sent from this function, it is used
3767    /// to give an explanation of what caused the widget to get focus.
3768    /// If the window is not active, the widget will be given the focus when
3769    /// the window becomes active.
3770    ///
3771    /// First, a focus about to change event is sent to the focus widget (if any) to
3772    /// tell it that it is about to lose the focus. Then focus is changed, a
3773    /// focus out event is sent to the previous focus item and a focus in event is sent
3774    /// to the new item to tell it that it just received the focus.
3775    /// (Nothing happens if the focus in and focus out widgets are the
3776    /// same.)
3777    ///
3778    /// **Note**: On embedded platforms, setFocus() will not cause an input panel
3779    /// to be opened by the input method. If you want this to happen, you
3780    /// have to send a QEvent::RequestSoftwareInputPanel event to the
3781    /// widget yourself.
3782    ///
3783    /// setFocus() gives focus to a widget regardless of its focus policy,
3784    /// but does not clear any keyboard grab (see grabKeyboard()).
3785    ///
3786    /// Be aware that if the widget is hidden, it will not accept focus
3787    /// until it is shown.
3788    ///
3789    /// **Warning**: If you call setFocus() in a function which may itself be
3790    /// called from focusOutEvent() or focusInEvent(), you may get an
3791    /// infinite recursion.
3792    ///
3793    /// **See also:** [`has_focus()`]
3794    /// [`clear_focus()`]
3795    /// [`focus_in_event()`]
3796    /// [`focus_out_event()`]
3797    /// [`set_focus_policy()`]
3798    /// [`focus_widget()`]
3799    /// [`Application::focus_widget`]
3800    /// [`grab_keyboard()`]
3801    /// [`grab_mouse()`]
3802    /// {Keyboard Focus in Widgets}
3803    /// [`Event::request_software_input_panel()`]
3804    ///
3805    /// **Overloads**
3806    /// Gives the keyboard input focus to this widget (or its focus
3807    /// proxy) if this widget or one of its parents is the
3808    /// [active window](isActiveWindow())
3809    ///
3810    pub fn set_focus_2(&self, reason: FocusReason) -> &Self {
3811        let enum_reason_1 = reason as u32;
3812
3813        let (obj_data, funcs) = self.get_widget_obj_funcs();
3814        unsafe {
3815            ((*funcs).set_focus_2)(obj_data, enum_reason_1);
3816        }
3817        self
3818    }
3819    ///
3820    /// The policy is Qt::TabFocus if the widget accepts keyboard
3821    /// focus by tabbing, Qt::ClickFocus if the widget accepts
3822    /// focus by clicking, Qt::StrongFocus if it accepts both, and
3823    /// Qt::NoFocus (the default) if it does not accept focus at
3824    /// all.
3825    ///
3826    /// You must enable keyboard focus for a widget if it processes
3827    /// keyboard events. This is normally done from the widget's
3828    /// constructor. For instance, the QLineEdit constructor calls
3829    /// setFocusPolicy(Qt::StrongFocus).
3830    ///
3831    /// If the widget has a focus proxy, then the focus policy will
3832    /// be propagated to it.
3833    ///
3834    /// **See also:** [`focus_in_event()`]
3835    /// [`focus_out_event()`]
3836    /// [`key_press_event()`]
3837    /// [`key_release_event()`]
3838    /// enabled
3839    pub fn focus_policy(&self) -> FocusPolicy {
3840        let (obj_data, funcs) = self.get_widget_obj_funcs();
3841        unsafe {
3842            let ret_val = ((*funcs).focus_policy)(obj_data);
3843            let ret_val = { transmute::<u32, FocusPolicy>(ret_val) };
3844            ret_val
3845        }
3846    }
3847    pub fn set_focus_policy(&self, policy: FocusPolicy) -> &Self {
3848        let enum_policy_1 = policy as u32;
3849
3850        let (obj_data, funcs) = self.get_widget_obj_funcs();
3851        unsafe {
3852            ((*funcs).set_focus_policy)(obj_data, enum_policy_1);
3853        }
3854        self
3855    }
3856    pub fn has_focus(&self) -> bool {
3857        let (obj_data, funcs) = self.get_widget_obj_funcs();
3858        unsafe {
3859            let ret_val = ((*funcs).has_focus)(obj_data);
3860            ret_val
3861        }
3862    }
3863    ///
3864    /// Puts the *second* widget after the *first* widget in the focus order.
3865    ///
3866    /// It effectively removes the *second* widget from its focus chain and
3867    /// inserts it after the *first* widget.
3868    ///
3869    /// Note that since the tab order of the *second* widget is changed, you
3870    /// should order a chain like this:
3871    ///
3872    /// *not* like this:
3873    ///
3874    /// If *first* or *second* has a focus proxy, setTabOrder()
3875    /// correctly substitutes the proxy.
3876    ///
3877    /// **Note**: Since Qt 5.10: A widget that has a child as focus proxy is understood as
3878    /// a compound widget. When setting a tab order between one or two compound widgets, the
3879    /// local tab order inside each will be preserved. This means that if both widgets are
3880    /// compound widgets, the resulting tab order will be from the last child inside
3881    /// *first,* to the first child inside *second.*
3882    ///
3883    /// **See also:** [`set_focus_policy()`]
3884    /// [`set_focus_proxy()`]
3885    /// {Keyboard Focus in Widgets}
3886    pub fn set_tab_order<W: WidgetTrait<'a>>(arg0: &W, arg1: &W) {
3887        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
3888        let (obj_arg1_2, _funcs) = arg1.get_widget_obj_funcs();
3889
3890        let (obj_data, funcs) = unsafe {
3891            (
3892                ::std::ptr::null(),
3893                (*((*rute_ffi_get()).get_widget)(::std::ptr::null()).all_funcs).widget_funcs,
3894            )
3895        };
3896        unsafe {
3897            ((*funcs).set_tab_order)(obj_data, obj_arg0_1, obj_arg1_2);
3898        }
3899    }
3900    ///
3901    /// Sets the widget's focus proxy to widget *w.* If *w* is 0, the
3902    /// function resets this widget to have no focus proxy.
3903    ///
3904    /// Some widgets can , but create a child widget, such as
3905    /// QLineEdit, to actually handle the focus. In this case, the widget
3906    /// can set the line edit to be its focus proxy.
3907    ///
3908    /// setFocusProxy() sets the widget which will actually get focus when
3909    /// gets it. If there is a focus proxy, setFocus() and
3910    /// hasFocus() operate on the focus proxy.
3911    ///
3912    /// **See also:** [`focus_proxy()`]
3913    pub fn set_focus_proxy<W: WidgetTrait<'a>>(&self, arg0: &W) -> &Self {
3914        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
3915
3916        let (obj_data, funcs) = self.get_widget_obj_funcs();
3917        unsafe {
3918            ((*funcs).set_focus_proxy)(obj_data, obj_arg0_1);
3919        }
3920        self
3921    }
3922    ///
3923    /// Returns the focus proxy, or 0 if there is no focus proxy.
3924    ///
3925    /// **See also:** [`set_focus_proxy()`]
3926    pub fn focus_proxy(&self) -> Option<Widget> {
3927        let (obj_data, funcs) = self.get_widget_obj_funcs();
3928        unsafe {
3929            let ret_val = ((*funcs).focus_proxy)(obj_data);
3930            if ret_val.qt_data == ::std::ptr::null() {
3931                return None;
3932            }
3933            let t = ret_val;
3934            let ret_val;
3935            if t.host_data != ::std::ptr::null() {
3936                ret_val = Widget::new_from_rc(t);
3937            } else {
3938                ret_val = Widget::new_from_owned(t);
3939            }
3940            Some(ret_val)
3941        }
3942    }
3943    ///
3944    /// The default value of this property is Qt::DefaultContextMenu,
3945    /// which means the contextMenuEvent() handler is called. Other values
3946    /// are Qt::NoContextMenu, Qt::PreventContextMenu,
3947    /// Qt::ActionsContextMenu, and Qt::CustomContextMenu. With
3948    /// Qt::CustomContextMenu, the signal customContextMenuRequested() is
3949    /// emitted.
3950    ///
3951    /// **See also:** [`context_menu_event()`]
3952    /// [`custom_context_menu_requested()`]
3953    /// [`actions()`]
3954    pub fn context_menu_policy(&self) -> ContextMenuPolicy {
3955        let (obj_data, funcs) = self.get_widget_obj_funcs();
3956        unsafe {
3957            let ret_val = ((*funcs).context_menu_policy)(obj_data);
3958            let ret_val = { transmute::<u32, ContextMenuPolicy>(ret_val) };
3959            ret_val
3960        }
3961    }
3962    pub fn set_context_menu_policy(&self, policy: ContextMenuPolicy) -> &Self {
3963        let enum_policy_1 = policy as u32;
3964
3965        let (obj_data, funcs) = self.get_widget_obj_funcs();
3966        unsafe {
3967            ((*funcs).set_context_menu_policy)(obj_data, enum_policy_1);
3968        }
3969        self
3970    }
3971    ///
3972    /// Grabs the mouse input.
3973    ///
3974    /// This widget receives all mouse events until releaseMouse() is
3975    /// called; other widgets get no mouse events at all. Keyboard
3976    /// events are not affected. Use grabKeyboard() if you want to grab
3977    /// that.
3978    ///
3979    /// **Warning**: Bugs in mouse-grabbing applications very often lock the
3980    /// terminal. Use this function with extreme caution, and consider
3981    /// using the `-nograb` command line option while debugging.
3982    ///
3983    /// It is almost never necessary to grab the mouse when using Qt, as
3984    /// Qt grabs and releases it sensibly. In particular, Qt grabs the
3985    /// mouse when a mouse button is pressed and keeps it until the last
3986    /// button is released.
3987    ///
3988    /// **Note**: Only visible widgets can grab mouse input. If isVisible()
3989    /// returns `false` for a widget, that widget cannot call grabMouse().
3990    ///
3991    /// **Note**: On Windows, grabMouse() only works when the mouse is inside a window
3992    /// owned by the process.
3993    /// On MacOS , grabMouse() only works when the mouse is inside the frame of that widget.
3994    ///
3995    /// **See also:** [`release_mouse()`]
3996    /// [`grab_keyboard()`]
3997    /// [`release_keyboard()`]
3998    ///
3999    /// **Overloads** grabMouse()
4000    /// Grabs the mouse input and changes the cursor shape.
4001    ///
4002    /// The cursor will assume shape *cursor* (for as long as the mouse
4003    /// focus is grabbed) and this widget will be the only one to receive
4004    /// mouse events until releaseMouse() is called().
4005    ///
4006    /// **Warning**: Grabbing the mouse might lock the terminal.
4007    ///
4008    /// **Note**: See the note in QWidget::grabMouse().
4009    ///
4010    /// **See also:** [`release_mouse()`]
4011    /// [`grab_keyboard()`]
4012    /// [`release_keyboard()`]
4013    /// [`set_cursor()`]
4014    pub fn grab_mouse(&self) -> &Self {
4015        let (obj_data, funcs) = self.get_widget_obj_funcs();
4016        unsafe {
4017            ((*funcs).grab_mouse)(obj_data);
4018        }
4019        self
4020    }
4021    ///
4022    /// Grabs the mouse input.
4023    ///
4024    /// This widget receives all mouse events until releaseMouse() is
4025    /// called; other widgets get no mouse events at all. Keyboard
4026    /// events are not affected. Use grabKeyboard() if you want to grab
4027    /// that.
4028    ///
4029    /// **Warning**: Bugs in mouse-grabbing applications very often lock the
4030    /// terminal. Use this function with extreme caution, and consider
4031    /// using the `-nograb` command line option while debugging.
4032    ///
4033    /// It is almost never necessary to grab the mouse when using Qt, as
4034    /// Qt grabs and releases it sensibly. In particular, Qt grabs the
4035    /// mouse when a mouse button is pressed and keeps it until the last
4036    /// button is released.
4037    ///
4038    /// **Note**: Only visible widgets can grab mouse input. If isVisible()
4039    /// returns `false` for a widget, that widget cannot call grabMouse().
4040    ///
4041    /// **Note**: On Windows, grabMouse() only works when the mouse is inside a window
4042    /// owned by the process.
4043    /// On MacOS , grabMouse() only works when the mouse is inside the frame of that widget.
4044    ///
4045    /// **See also:** [`release_mouse()`]
4046    /// [`grab_keyboard()`]
4047    /// [`release_keyboard()`]
4048    ///
4049    /// **Overloads** grabMouse()
4050    /// Grabs the mouse input and changes the cursor shape.
4051    ///
4052    /// The cursor will assume shape *cursor* (for as long as the mouse
4053    /// focus is grabbed) and this widget will be the only one to receive
4054    /// mouse events until releaseMouse() is called().
4055    ///
4056    /// **Warning**: Grabbing the mouse might lock the terminal.
4057    ///
4058    /// **Note**: See the note in QWidget::grabMouse().
4059    ///
4060    /// **See also:** [`release_mouse()`]
4061    /// [`grab_keyboard()`]
4062    /// [`release_keyboard()`]
4063    /// [`set_cursor()`]
4064    pub fn grab_mouse_2<C: CursorTrait<'a>>(&self, arg0: &C) -> &Self {
4065        let (obj_arg0_1, _funcs) = arg0.get_cursor_obj_funcs();
4066
4067        let (obj_data, funcs) = self.get_widget_obj_funcs();
4068        unsafe {
4069            ((*funcs).grab_mouse_2)(obj_data, obj_arg0_1);
4070        }
4071        self
4072    }
4073    ///
4074    /// Releases the mouse grab.
4075    ///
4076    /// **See also:** [`grab_mouse()`]
4077    /// [`grab_keyboard()`]
4078    /// [`release_keyboard()`]
4079    pub fn release_mouse(&self) -> &Self {
4080        let (obj_data, funcs) = self.get_widget_obj_funcs();
4081        unsafe {
4082            ((*funcs).release_mouse)(obj_data);
4083        }
4084        self
4085    }
4086    ///
4087    /// Grabs the keyboard input.
4088    ///
4089    /// This widget receives all keyboard events until releaseKeyboard()
4090    /// is called; other widgets get no keyboard events at all. Mouse
4091    /// events are not affected. Use grabMouse() if you want to grab that.
4092    ///
4093    /// The focus widget is not affected, except that it doesn't receive
4094    /// any keyboard events. setFocus() moves the focus as usual, but the
4095    /// new focus widget receives keyboard events only after
4096    /// releaseKeyboard() is called.
4097    ///
4098    /// If a different widget is currently grabbing keyboard input, that
4099    /// widget's grab is released first.
4100    ///
4101    /// **See also:** [`release_keyboard()`]
4102    /// [`grab_mouse()`]
4103    /// [`release_mouse()`]
4104    /// [`focus_widget()`]
4105    pub fn grab_keyboard(&self) -> &Self {
4106        let (obj_data, funcs) = self.get_widget_obj_funcs();
4107        unsafe {
4108            ((*funcs).grab_keyboard)(obj_data);
4109        }
4110        self
4111    }
4112    ///
4113    /// Releases the keyboard grab.
4114    ///
4115    /// **See also:** [`grab_keyboard()`]
4116    /// [`grab_mouse()`]
4117    /// [`release_mouse()`]
4118    pub fn release_keyboard(&self) -> &Self {
4119        let (obj_data, funcs) = self.get_widget_obj_funcs();
4120        unsafe {
4121            ((*funcs).release_keyboard)(obj_data);
4122        }
4123        self
4124    }
4125    ///
4126    /// Adds a shortcut to Qt's shortcut system that watches for the given
4127    /// *key* sequence in the given *context.* If the *context* is
4128    /// Qt::ApplicationShortcut, the shortcut applies to the application as a
4129    /// whole. Otherwise, it is either local to this widget, Qt::WidgetShortcut,
4130    /// or to the window itself, Qt::WindowShortcut.
4131    ///
4132    /// If the same *key* sequence has been grabbed by several widgets,
4133    /// when the *key* sequence occurs a QEvent::Shortcut event is sent
4134    /// to all the widgets to which it applies in a non-deterministic
4135    /// order, but with the ``ambiguous'' flag set to true.
4136    ///
4137    /// **Warning**: You should not normally need to use this function;
4138    /// instead create [QAction](QAction)
4139    /// s with the shortcut key sequences you
4140    /// require (if you also want equivalent menu options and toolbar
4141    /// buttons), or create [QShortcut](QShortcut)
4142    /// s if you just need key sequences.
4143    /// Both QAction and QShortcut handle all the event filtering for you,
4144    /// and provide signals which are triggered when the user triggers the
4145    /// key sequence, so are much easier to use than this low-level
4146    /// function.
4147    ///
4148    /// **See also:** [`release_shortcut()`]
4149    /// [`set_shortcut_enabled()`]
4150    pub fn grab_shortcut<K: KeySequenceTrait<'a>>(&self, key: &K, context: ShortcutContext) -> i32 {
4151        let (obj_key_1, _funcs) = key.get_key_sequence_obj_funcs();
4152        let enum_context_2 = context as u32;
4153
4154        let (obj_data, funcs) = self.get_widget_obj_funcs();
4155        unsafe {
4156            let ret_val = ((*funcs).grab_shortcut)(obj_data, obj_key_1, enum_context_2);
4157            ret_val
4158        }
4159    }
4160    ///
4161    /// Removes the shortcut with the given *id* from Qt's shortcut
4162    /// system. The widget will no longer receive QEvent::Shortcut events
4163    /// for the shortcut's key sequence (unless it has other shortcuts
4164    /// with the same key sequence).
4165    ///
4166    /// **Warning**: You should not normally need to use this function since
4167    /// Qt's shortcut system removes shortcuts automatically when their
4168    /// parent widget is destroyed. It is best to use QAction or
4169    /// QShortcut to handle shortcuts, since they are easier to use than
4170    /// this low-level function. Note also that this is an expensive
4171    /// operation.
4172    ///
4173    /// **See also:** [`grab_shortcut()`]
4174    /// [`set_shortcut_enabled()`]
4175    pub fn release_shortcut(&self, id: i32) -> &Self {
4176        let (obj_data, funcs) = self.get_widget_obj_funcs();
4177        unsafe {
4178            ((*funcs).release_shortcut)(obj_data, id);
4179        }
4180        self
4181    }
4182    ///
4183    /// If *enable* is true, the shortcut with the given *id* is
4184    /// enabled; otherwise the shortcut is disabled.
4185    ///
4186    /// **Warning**: You should not normally need to use this function since
4187    /// Qt's shortcut system enables/disables shortcuts automatically as
4188    /// widgets become hidden/visible and gain or lose focus. It is best
4189    /// to use QAction or QShortcut to handle shortcuts, since they are
4190    /// easier to use than this low-level function.
4191    ///
4192    /// **See also:** [`grab_shortcut()`]
4193    /// [`release_shortcut()`]
4194    pub fn set_shortcut_enabled(&self, id: i32, enable: bool) -> &Self {
4195        let (obj_data, funcs) = self.get_widget_obj_funcs();
4196        unsafe {
4197            ((*funcs).set_shortcut_enabled)(obj_data, id, enable);
4198        }
4199        self
4200    }
4201    ///
4202    /// If *enable* is true, auto repeat of the shortcut with the
4203    /// given *id* is enabled; otherwise it is disabled.
4204    ///
4205    /// **See also:** [`grab_shortcut()`]
4206    /// [`release_shortcut()`]
4207    pub fn set_shortcut_auto_repeat(&self, id: i32, enable: bool) -> &Self {
4208        let (obj_data, funcs) = self.get_widget_obj_funcs();
4209        unsafe {
4210            ((*funcs).set_shortcut_auto_repeat)(obj_data, id, enable);
4211        }
4212        self
4213    }
4214    ///
4215    /// Returns the widget that is currently grabbing the mouse input.
4216    ///
4217    /// If no widget in this application is currently grabbing the mouse,
4218    /// 0 is returned.
4219    ///
4220    /// **See also:** [`grab_mouse()`]
4221    /// [`keyboard_grabber()`]
4222    pub fn mouse_grabber() -> Option<Widget<'a>> {
4223        let (obj_data, funcs) = unsafe {
4224            (
4225                ::std::ptr::null(),
4226                (*((*rute_ffi_get()).get_widget)(::std::ptr::null()).all_funcs).widget_funcs,
4227            )
4228        };
4229        unsafe {
4230            let ret_val = ((*funcs).mouse_grabber)(obj_data);
4231            if ret_val.qt_data == ::std::ptr::null() {
4232                return None;
4233            }
4234            let t = ret_val;
4235            let ret_val;
4236            if t.host_data != ::std::ptr::null() {
4237                ret_val = Widget::new_from_rc(t);
4238            } else {
4239                ret_val = Widget::new_from_owned(t);
4240            }
4241            Some(ret_val)
4242        }
4243    }
4244    ///
4245    /// Returns the widget that is currently grabbing the keyboard input.
4246    ///
4247    /// If no widget in this application is currently grabbing the
4248    /// keyboard, 0 is returned.
4249    ///
4250    /// **See also:** [`grab_mouse()`]
4251    /// [`mouse_grabber()`]
4252    pub fn keyboard_grabber() -> Option<Widget<'a>> {
4253        let (obj_data, funcs) = unsafe {
4254            (
4255                ::std::ptr::null(),
4256                (*((*rute_ffi_get()).get_widget)(::std::ptr::null()).all_funcs).widget_funcs,
4257            )
4258        };
4259        unsafe {
4260            let ret_val = ((*funcs).keyboard_grabber)(obj_data);
4261            if ret_val.qt_data == ::std::ptr::null() {
4262                return None;
4263            }
4264            let t = ret_val;
4265            let ret_val;
4266            if t.host_data != ::std::ptr::null() {
4267                ret_val = Widget::new_from_rc(t);
4268            } else {
4269                ret_val = Widget::new_from_owned(t);
4270            }
4271            Some(ret_val)
4272        }
4273    }
4274    ///
4275    /// An updates enabled widget receives paint events and has a system
4276    /// background; a disabled widget does not. This also implies that
4277    /// calling update() and repaint() has no effect if updates are
4278    /// disabled.
4279    ///
4280    /// By default, this property is `true.`
4281    ///
4282    /// setUpdatesEnabled() is normally used to disable updates for a
4283    /// short period of time, for instance to avoid screen flicker during
4284    /// large changes. In Qt, widgets normally do not generate screen
4285    /// flicker, but on X11 the server might erase regions on the screen
4286    /// when widgets get hidden before they can be replaced by other
4287    /// widgets. Disabling updates solves this.
4288    ///
4289    /// Example:
4290    ///
4291    /// Disabling a widget implicitly disables all its children. Enabling a widget
4292    /// enables all child widgets *except* top-level widgets or those that
4293    /// have been explicitly disabled. Re-enabling updates implicitly calls
4294    /// update() on the widget.
4295    ///
4296    /// **See also:** [`paint_event()`]
4297    pub fn updates_enabled(&self) -> bool {
4298        let (obj_data, funcs) = self.get_widget_obj_funcs();
4299        unsafe {
4300            let ret_val = ((*funcs).updates_enabled)(obj_data);
4301            ret_val
4302        }
4303    }
4304    pub fn set_updates_enabled(&self, enable: bool) -> &Self {
4305        let (obj_data, funcs) = self.get_widget_obj_funcs();
4306        unsafe {
4307            ((*funcs).set_updates_enabled)(obj_data, enable);
4308        }
4309        self
4310    }
4311    ///
4312    /// An updates enabled widget receives paint events and has a system
4313    /// background; a disabled widget does not. This also implies that
4314    /// calling update() and repaint() has no effect if updates are
4315    /// disabled.
4316    ///
4317    /// By default, this property is `true.`
4318    ///
4319    /// setUpdatesEnabled() is normally used to disable updates for a
4320    /// short period of time, for instance to avoid screen flicker during
4321    /// large changes. In Qt, widgets normally do not generate screen
4322    /// flicker, but on X11 the server might erase regions on the screen
4323    /// when widgets get hidden before they can be replaced by other
4324    /// widgets. Disabling updates solves this.
4325    ///
4326    /// Example:
4327    ///
4328    /// Disabling a widget implicitly disables all its children. Enabling a widget
4329    /// enables all child widgets *except* top-level widgets or those that
4330    /// have been explicitly disabled. Re-enabling updates implicitly calls
4331    /// update() on the widget.
4332    ///
4333    /// **See also:** [`paint_event()`]
4334    ///
4335    /// Notifies the layout system that this widget has changed and may
4336    /// need to change geometry.
4337    ///
4338    /// Call this function if the sizeHint() or sizePolicy() have changed.
4339    ///
4340    /// For explicitly hidden widgets, updateGeometry() is a no-op. The
4341    /// layout system will be notified as soon as the widget is shown.
4342    ///
4343    /// Updates the widget unless updates are disabled or the widget is
4344    /// hidden.
4345    ///
4346    /// This function does not cause an immediate repaint; instead it
4347    /// schedules a paint event for processing when Qt returns to the main
4348    /// event loop. This permits Qt to optimize for more speed and less
4349    /// flicker than a call to repaint() does.
4350    ///
4351    /// Calling update() several times normally results in just one
4352    /// paintEvent() call.
4353    ///
4354    /// Qt normally erases the widget's area before the paintEvent() call.
4355    /// If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is
4356    /// responsible for painting all its pixels with an opaque color.
4357    ///
4358    /// **See also:** [`repaint()`]
4359    /// [`paint_event()`]
4360    /// [`set_updates_enabled()`]
4361    /// {Analog Clock Example}
4362    /// **Overloads**
4363    /// This version updates a rectangle ( *x,* *y,* *w,* *h)* inside
4364    /// the widget.
4365    ///
4366    /// **Overloads**
4367    /// This version updates a rectangle *rect* inside the widget.
4368    ///
4369    /// **Overloads**
4370    /// This version repaints a region *rgn* inside the widget.
4371    ///
4372    /// Updates the widget's micro focus.
4373    pub fn update(&self) -> &Self {
4374        let (obj_data, funcs) = self.get_widget_obj_funcs();
4375        unsafe {
4376            ((*funcs).update)(obj_data);
4377        }
4378        self
4379    }
4380    ///
4381    /// Repaints the widget directly by calling paintEvent() immediately,
4382    /// unless updates are disabled or the widget is hidden.
4383    ///
4384    /// We suggest only using repaint() if you need an immediate repaint,
4385    /// for example during animation. In almost all circumstances update()
4386    /// is better, as it permits Qt to optimize for speed and minimize
4387    /// flicker.
4388    ///
4389    /// **Warning**: If you call repaint() in a function which may itself be
4390    /// called from paintEvent(), you may get infinite recursion. The
4391    /// update() function never causes recursion.
4392    ///
4393    /// **See also:** [`update()`]
4394    /// [`paint_event()`]
4395    /// [`set_updates_enabled()`]
4396    /// **Overloads**
4397    /// This version repaints a rectangle ( *x,* *y,* *w,* *h)* inside
4398    /// the widget.
4399    ///
4400    /// If *w* is negative, it is replaced with `width() - x` , and if
4401    /// *h* is negative, it is replaced width `height() - y` .
4402    /// **Overloads**
4403    /// This version repaints a rectangle *rect* inside the widget.
4404    ///
4405    /// **Overloads**
4406    /// This version repaints a region *rgn* inside the widget.
4407    pub fn repaint(&self) -> &Self {
4408        let (obj_data, funcs) = self.get_widget_obj_funcs();
4409        unsafe {
4410            ((*funcs).repaint)(obj_data);
4411        }
4412        self
4413    }
4414    ///
4415    /// An updates enabled widget receives paint events and has a system
4416    /// background; a disabled widget does not. This also implies that
4417    /// calling update() and repaint() has no effect if updates are
4418    /// disabled.
4419    ///
4420    /// By default, this property is `true.`
4421    ///
4422    /// setUpdatesEnabled() is normally used to disable updates for a
4423    /// short period of time, for instance to avoid screen flicker during
4424    /// large changes. In Qt, widgets normally do not generate screen
4425    /// flicker, but on X11 the server might erase regions on the screen
4426    /// when widgets get hidden before they can be replaced by other
4427    /// widgets. Disabling updates solves this.
4428    ///
4429    /// Example:
4430    ///
4431    /// Disabling a widget implicitly disables all its children. Enabling a widget
4432    /// enables all child widgets *except* top-level widgets or those that
4433    /// have been explicitly disabled. Re-enabling updates implicitly calls
4434    /// update() on the widget.
4435    ///
4436    /// **See also:** [`paint_event()`]
4437    ///
4438    /// Notifies the layout system that this widget has changed and may
4439    /// need to change geometry.
4440    ///
4441    /// Call this function if the sizeHint() or sizePolicy() have changed.
4442    ///
4443    /// For explicitly hidden widgets, updateGeometry() is a no-op. The
4444    /// layout system will be notified as soon as the widget is shown.
4445    ///
4446    /// Updates the widget unless updates are disabled or the widget is
4447    /// hidden.
4448    ///
4449    /// This function does not cause an immediate repaint; instead it
4450    /// schedules a paint event for processing when Qt returns to the main
4451    /// event loop. This permits Qt to optimize for more speed and less
4452    /// flicker than a call to repaint() does.
4453    ///
4454    /// Calling update() several times normally results in just one
4455    /// paintEvent() call.
4456    ///
4457    /// Qt normally erases the widget's area before the paintEvent() call.
4458    /// If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is
4459    /// responsible for painting all its pixels with an opaque color.
4460    ///
4461    /// **See also:** [`repaint()`]
4462    /// [`paint_event()`]
4463    /// [`set_updates_enabled()`]
4464    /// {Analog Clock Example}
4465    /// **Overloads**
4466    /// This version updates a rectangle ( *x,* *y,* *w,* *h)* inside
4467    /// the widget.
4468    ///
4469    /// **Overloads**
4470    /// This version updates a rectangle *rect* inside the widget.
4471    ///
4472    /// **Overloads**
4473    /// This version repaints a region *rgn* inside the widget.
4474    ///
4475    /// Updates the widget's micro focus.
4476    pub fn update_2(&self, x: i32, y: i32, w: i32, h: i32) -> &Self {
4477        let (obj_data, funcs) = self.get_widget_obj_funcs();
4478        unsafe {
4479            ((*funcs).update_2)(obj_data, x, y, w, h);
4480        }
4481        self
4482    }
4483    ///
4484    /// An updates enabled widget receives paint events and has a system
4485    /// background; a disabled widget does not. This also implies that
4486    /// calling update() and repaint() has no effect if updates are
4487    /// disabled.
4488    ///
4489    /// By default, this property is `true.`
4490    ///
4491    /// setUpdatesEnabled() is normally used to disable updates for a
4492    /// short period of time, for instance to avoid screen flicker during
4493    /// large changes. In Qt, widgets normally do not generate screen
4494    /// flicker, but on X11 the server might erase regions on the screen
4495    /// when widgets get hidden before they can be replaced by other
4496    /// widgets. Disabling updates solves this.
4497    ///
4498    /// Example:
4499    ///
4500    /// Disabling a widget implicitly disables all its children. Enabling a widget
4501    /// enables all child widgets *except* top-level widgets or those that
4502    /// have been explicitly disabled. Re-enabling updates implicitly calls
4503    /// update() on the widget.
4504    ///
4505    /// **See also:** [`paint_event()`]
4506    ///
4507    /// Notifies the layout system that this widget has changed and may
4508    /// need to change geometry.
4509    ///
4510    /// Call this function if the sizeHint() or sizePolicy() have changed.
4511    ///
4512    /// For explicitly hidden widgets, updateGeometry() is a no-op. The
4513    /// layout system will be notified as soon as the widget is shown.
4514    ///
4515    /// Updates the widget unless updates are disabled or the widget is
4516    /// hidden.
4517    ///
4518    /// This function does not cause an immediate repaint; instead it
4519    /// schedules a paint event for processing when Qt returns to the main
4520    /// event loop. This permits Qt to optimize for more speed and less
4521    /// flicker than a call to repaint() does.
4522    ///
4523    /// Calling update() several times normally results in just one
4524    /// paintEvent() call.
4525    ///
4526    /// Qt normally erases the widget's area before the paintEvent() call.
4527    /// If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is
4528    /// responsible for painting all its pixels with an opaque color.
4529    ///
4530    /// **See also:** [`repaint()`]
4531    /// [`paint_event()`]
4532    /// [`set_updates_enabled()`]
4533    /// {Analog Clock Example}
4534    /// **Overloads**
4535    /// This version updates a rectangle ( *x,* *y,* *w,* *h)* inside
4536    /// the widget.
4537    ///
4538    /// **Overloads**
4539    /// This version updates a rectangle *rect* inside the widget.
4540    ///
4541    /// **Overloads**
4542    /// This version repaints a region *rgn* inside the widget.
4543    ///
4544    /// Updates the widget's micro focus.
4545    pub fn update_3<R: RectTrait<'a>>(&self, arg0: &R) -> &Self {
4546        let (obj_arg0_1, _funcs) = arg0.get_rect_obj_funcs();
4547
4548        let (obj_data, funcs) = self.get_widget_obj_funcs();
4549        unsafe {
4550            ((*funcs).update_3)(obj_data, obj_arg0_1);
4551        }
4552        self
4553    }
4554    ///
4555    /// An updates enabled widget receives paint events and has a system
4556    /// background; a disabled widget does not. This also implies that
4557    /// calling update() and repaint() has no effect if updates are
4558    /// disabled.
4559    ///
4560    /// By default, this property is `true.`
4561    ///
4562    /// setUpdatesEnabled() is normally used to disable updates for a
4563    /// short period of time, for instance to avoid screen flicker during
4564    /// large changes. In Qt, widgets normally do not generate screen
4565    /// flicker, but on X11 the server might erase regions on the screen
4566    /// when widgets get hidden before they can be replaced by other
4567    /// widgets. Disabling updates solves this.
4568    ///
4569    /// Example:
4570    ///
4571    /// Disabling a widget implicitly disables all its children. Enabling a widget
4572    /// enables all child widgets *except* top-level widgets or those that
4573    /// have been explicitly disabled. Re-enabling updates implicitly calls
4574    /// update() on the widget.
4575    ///
4576    /// **See also:** [`paint_event()`]
4577    ///
4578    /// Notifies the layout system that this widget has changed and may
4579    /// need to change geometry.
4580    ///
4581    /// Call this function if the sizeHint() or sizePolicy() have changed.
4582    ///
4583    /// For explicitly hidden widgets, updateGeometry() is a no-op. The
4584    /// layout system will be notified as soon as the widget is shown.
4585    ///
4586    /// Updates the widget unless updates are disabled or the widget is
4587    /// hidden.
4588    ///
4589    /// This function does not cause an immediate repaint; instead it
4590    /// schedules a paint event for processing when Qt returns to the main
4591    /// event loop. This permits Qt to optimize for more speed and less
4592    /// flicker than a call to repaint() does.
4593    ///
4594    /// Calling update() several times normally results in just one
4595    /// paintEvent() call.
4596    ///
4597    /// Qt normally erases the widget's area before the paintEvent() call.
4598    /// If the Qt::WA_OpaquePaintEvent widget attribute is set, the widget is
4599    /// responsible for painting all its pixels with an opaque color.
4600    ///
4601    /// **See also:** [`repaint()`]
4602    /// [`paint_event()`]
4603    /// [`set_updates_enabled()`]
4604    /// {Analog Clock Example}
4605    /// **Overloads**
4606    /// This version updates a rectangle ( *x,* *y,* *w,* *h)* inside
4607    /// the widget.
4608    ///
4609    /// **Overloads**
4610    /// This version updates a rectangle *rect* inside the widget.
4611    ///
4612    /// **Overloads**
4613    /// This version repaints a region *rgn* inside the widget.
4614    ///
4615    /// Updates the widget's micro focus.
4616    pub fn update_4<R: RegionTrait<'a>>(&self, arg0: &R) -> &Self {
4617        let (obj_arg0_1, _funcs) = arg0.get_region_obj_funcs();
4618
4619        let (obj_data, funcs) = self.get_widget_obj_funcs();
4620        unsafe {
4621            ((*funcs).update_4)(obj_data, obj_arg0_1);
4622        }
4623        self
4624    }
4625    ///
4626    /// Repaints the widget directly by calling paintEvent() immediately,
4627    /// unless updates are disabled or the widget is hidden.
4628    ///
4629    /// We suggest only using repaint() if you need an immediate repaint,
4630    /// for example during animation. In almost all circumstances update()
4631    /// is better, as it permits Qt to optimize for speed and minimize
4632    /// flicker.
4633    ///
4634    /// **Warning**: If you call repaint() in a function which may itself be
4635    /// called from paintEvent(), you may get infinite recursion. The
4636    /// update() function never causes recursion.
4637    ///
4638    /// **See also:** [`update()`]
4639    /// [`paint_event()`]
4640    /// [`set_updates_enabled()`]
4641    /// **Overloads**
4642    /// This version repaints a rectangle ( *x,* *y,* *w,* *h)* inside
4643    /// the widget.
4644    ///
4645    /// If *w* is negative, it is replaced with `width() - x` , and if
4646    /// *h* is negative, it is replaced width `height() - y` .
4647    /// **Overloads**
4648    /// This version repaints a rectangle *rect* inside the widget.
4649    ///
4650    /// **Overloads**
4651    /// This version repaints a region *rgn* inside the widget.
4652    pub fn repaint_2(&self, x: i32, y: i32, w: i32, h: i32) -> &Self {
4653        let (obj_data, funcs) = self.get_widget_obj_funcs();
4654        unsafe {
4655            ((*funcs).repaint_2)(obj_data, x, y, w, h);
4656        }
4657        self
4658    }
4659    ///
4660    /// Repaints the widget directly by calling paintEvent() immediately,
4661    /// unless updates are disabled or the widget is hidden.
4662    ///
4663    /// We suggest only using repaint() if you need an immediate repaint,
4664    /// for example during animation. In almost all circumstances update()
4665    /// is better, as it permits Qt to optimize for speed and minimize
4666    /// flicker.
4667    ///
4668    /// **Warning**: If you call repaint() in a function which may itself be
4669    /// called from paintEvent(), you may get infinite recursion. The
4670    /// update() function never causes recursion.
4671    ///
4672    /// **See also:** [`update()`]
4673    /// [`paint_event()`]
4674    /// [`set_updates_enabled()`]
4675    /// **Overloads**
4676    /// This version repaints a rectangle ( *x,* *y,* *w,* *h)* inside
4677    /// the widget.
4678    ///
4679    /// If *w* is negative, it is replaced with `width() - x` , and if
4680    /// *h* is negative, it is replaced width `height() - y` .
4681    /// **Overloads**
4682    /// This version repaints a rectangle *rect* inside the widget.
4683    ///
4684    /// **Overloads**
4685    /// This version repaints a region *rgn* inside the widget.
4686    pub fn repaint_3<R: RectTrait<'a>>(&self, arg0: &R) -> &Self {
4687        let (obj_arg0_1, _funcs) = arg0.get_rect_obj_funcs();
4688
4689        let (obj_data, funcs) = self.get_widget_obj_funcs();
4690        unsafe {
4691            ((*funcs).repaint_3)(obj_data, obj_arg0_1);
4692        }
4693        self
4694    }
4695    ///
4696    /// Repaints the widget directly by calling paintEvent() immediately,
4697    /// unless updates are disabled or the widget is hidden.
4698    ///
4699    /// We suggest only using repaint() if you need an immediate repaint,
4700    /// for example during animation. In almost all circumstances update()
4701    /// is better, as it permits Qt to optimize for speed and minimize
4702    /// flicker.
4703    ///
4704    /// **Warning**: If you call repaint() in a function which may itself be
4705    /// called from paintEvent(), you may get infinite recursion. The
4706    /// update() function never causes recursion.
4707    ///
4708    /// **See also:** [`update()`]
4709    /// [`paint_event()`]
4710    /// [`set_updates_enabled()`]
4711    /// **Overloads**
4712    /// This version repaints a rectangle ( *x,* *y,* *w,* *h)* inside
4713    /// the widget.
4714    ///
4715    /// If *w* is negative, it is replaced with `width() - x` , and if
4716    /// *h* is negative, it is replaced width `height() - y` .
4717    /// **Overloads**
4718    /// This version repaints a rectangle *rect* inside the widget.
4719    ///
4720    /// **Overloads**
4721    /// This version repaints a region *rgn* inside the widget.
4722    pub fn repaint_4<R: RegionTrait<'a>>(&self, arg0: &R) -> &Self {
4723        let (obj_arg0_1, _funcs) = arg0.get_region_obj_funcs();
4724
4725        let (obj_data, funcs) = self.get_widget_obj_funcs();
4726        unsafe {
4727            ((*funcs).repaint_4)(obj_data, obj_arg0_1);
4728        }
4729        self
4730    }
4731    ///
4732    /// Convenience function, equivalent to setVisible(! *hidden).*
4733    pub fn set_hidden(&self, hidden: bool) -> &Self {
4734        let (obj_data, funcs) = self.get_widget_obj_funcs();
4735        unsafe {
4736            ((*funcs).set_hidden)(obj_data, hidden);
4737        }
4738        self
4739    }
4740    ///
4741    /// Shows the widget minimized, as an icon.
4742    ///
4743    /// Calling this function only affects [windows](isWindow())
4744    ///
4745    ///
4746    /// **See also:** [`show_normal()`]
4747    /// [`show_maximized()`]
4748    /// [`show()`]
4749    /// [`hide()`]
4750    /// [`is_visible()`]
4751    /// [`is_minimized()`]
4752    ///
4753    /// Shows the widget in full-screen mode.
4754    ///
4755    /// Calling this function only affects [windows](isWindow())
4756    ///
4757    ///
4758    /// To return from full-screen mode, call showNormal().
4759    ///
4760    /// Full-screen mode works fine under Windows, but has certain
4761    /// problems under X. These problems are due to limitations of the
4762    /// ICCCM protocol that specifies the communication between X11
4763    /// clients and the window manager. ICCCM simply does not understand
4764    /// the concept of non-decorated full-screen windows. Therefore, the
4765    /// best we can do is to request a borderless window and place and
4766    /// resize it to fill the entire screen. Depending on the window
4767    /// manager, this may or may not work. The borderless window is
4768    /// requested using MOTIF hints, which are at least partially
4769    /// supported by virtually all modern window managers.
4770    ///
4771    /// An alternative would be to bypass the window manager entirely and
4772    /// create a window with the Qt::X11BypassWindowManagerHint flag. This
4773    /// has other severe problems though, like totally broken keyboard focus
4774    /// and very strange effects on desktop changes or when the user raises
4775    /// other windows.
4776    ///
4777    /// X11 window managers that follow modern post-ICCCM specifications
4778    /// support full-screen mode properly.
4779    ///
4780    /// **See also:** [`show_normal()`]
4781    /// [`show_maximized()`]
4782    /// [`show()`]
4783    /// [`hide()`]
4784    /// [`is_visible()`]
4785    ///
4786    /// Shows the widget maximized.
4787    ///
4788    /// Calling this function only affects [windows](isWindow())
4789    ///
4790    ///
4791    /// On X11, this function may not work properly with certain window
4792    /// managers. See the [Window Geometry](Window%20Geometry)
4793    /// documentation for an explanation.
4794    ///
4795    /// **See also:** [`set_window_state()`]
4796    /// [`show_normal()`]
4797    /// [`show_minimized()`]
4798    /// [`show()`]
4799    /// [`hide()`]
4800    /// [`is_visible()`]
4801    ///
4802    /// Restores the widget after it has been maximized or minimized.
4803    ///
4804    /// Calling this function only affects [windows](isWindow())
4805    ///
4806    ///
4807    /// **See also:** [`set_window_state()`]
4808    /// [`show_minimized()`]
4809    /// [`show_maximized()`]
4810    /// [`show()`]
4811    /// [`hide()`]
4812    /// [`is_visible()`]
4813    ///
4814    /// Shows the widget and its child widgets.
4815    ///
4816    /// This is equivalent to calling showFullScreen(), showMaximized(), or setVisible(true),
4817    /// depending on the platform's default behavior for the window flags.
4818    ///
4819    /// **See also:** [`raise()`]
4820    /// [`show_event()`]
4821    /// [`hide()`]
4822    /// [`set_visible()`]
4823    /// [`show_minimized()`]
4824    /// [`show_maximized()`]
4825    /// [`show_normal()`]
4826    /// [`is_visible()`]
4827    /// [`window_flags()`]
4828    ///
4829    /// This event handler can be reimplemented in a subclass to receive
4830    /// widget show events which are passed in the *event* parameter.
4831    ///
4832    /// Non-spontaneous show events are sent to widgets immediately
4833    /// before they are shown. The spontaneous show events of windows are
4834    /// delivered afterwards.
4835    ///
4836    /// Note: A widget receives spontaneous show and hide events when its
4837    /// mapping status is changed by the window system, e.g. a spontaneous
4838    /// hide event when the user minimizes the window, and a spontaneous
4839    /// show event when the window is restored again. After receiving a
4840    /// spontaneous hide event, a widget is still considered visible in
4841    /// the sense of isVisible().
4842    ///
4843    /// **See also:** visible
4844    /// [`event()`]
4845    /// [`ShowEvent`]
4846    pub fn show(&self) -> &Self {
4847        let (obj_data, funcs) = self.get_widget_obj_funcs();
4848        unsafe {
4849            ((*funcs).show)(obj_data);
4850        }
4851        self
4852    }
4853    ///
4854    /// Hides the widget. This function is equivalent to
4855    /// setVisible(false).
4856    ///
4857    /// **Note**: If you are working with QDialog or its subclasses and you invoke
4858    /// the show() function after this function, the dialog will be displayed in
4859    /// its original position.
4860    ///
4861    /// **See also:** [`hide_event()`]
4862    /// [`is_hidden()`]
4863    /// [`show()`]
4864    /// [`set_visible()`]
4865    /// [`is_visible()`]
4866    /// [`close()`]
4867    ///
4868    /// This event handler can be reimplemented in a subclass to receive
4869    /// widget hide events. The event is passed in the *event* parameter.
4870    ///
4871    /// Hide events are sent to widgets immediately after they have been
4872    /// hidden.
4873    ///
4874    /// Note: A widget receives spontaneous show and hide events when its
4875    /// mapping status is changed by the window system, e.g. a spontaneous
4876    /// hide event when the user minimizes the window, and a spontaneous
4877    /// show event when the window is restored again. After receiving a
4878    /// spontaneous hide event, a widget is still considered visible in
4879    /// the sense of isVisible().
4880    ///
4881    /// **See also:** visible
4882    /// [`event()`]
4883    /// [`HideEvent`]
4884    pub fn hide(&self) -> &Self {
4885        let (obj_data, funcs) = self.get_widget_obj_funcs();
4886        unsafe {
4887            ((*funcs).hide)(obj_data);
4888        }
4889        self
4890    }
4891    ///
4892    /// Shows the widget minimized, as an icon.
4893    ///
4894    /// Calling this function only affects [windows](isWindow())
4895    ///
4896    ///
4897    /// **See also:** [`show_normal()`]
4898    /// [`show_maximized()`]
4899    /// [`show()`]
4900    /// [`hide()`]
4901    /// [`is_visible()`]
4902    /// [`is_minimized()`]
4903    pub fn show_minimized(&self) -> &Self {
4904        let (obj_data, funcs) = self.get_widget_obj_funcs();
4905        unsafe {
4906            ((*funcs).show_minimized)(obj_data);
4907        }
4908        self
4909    }
4910    ///
4911    /// Shows the widget maximized.
4912    ///
4913    /// Calling this function only affects [windows](isWindow())
4914    ///
4915    ///
4916    /// On X11, this function may not work properly with certain window
4917    /// managers. See the [Window Geometry](Window%20Geometry)
4918    /// documentation for an explanation.
4919    ///
4920    /// **See also:** [`set_window_state()`]
4921    /// [`show_normal()`]
4922    /// [`show_minimized()`]
4923    /// [`show()`]
4924    /// [`hide()`]
4925    /// [`is_visible()`]
4926    pub fn show_maximized(&self) -> &Self {
4927        let (obj_data, funcs) = self.get_widget_obj_funcs();
4928        unsafe {
4929            ((*funcs).show_maximized)(obj_data);
4930        }
4931        self
4932    }
4933    ///
4934    /// Shows the widget in full-screen mode.
4935    ///
4936    /// Calling this function only affects [windows](isWindow())
4937    ///
4938    ///
4939    /// To return from full-screen mode, call showNormal().
4940    ///
4941    /// Full-screen mode works fine under Windows, but has certain
4942    /// problems under X. These problems are due to limitations of the
4943    /// ICCCM protocol that specifies the communication between X11
4944    /// clients and the window manager. ICCCM simply does not understand
4945    /// the concept of non-decorated full-screen windows. Therefore, the
4946    /// best we can do is to request a borderless window and place and
4947    /// resize it to fill the entire screen. Depending on the window
4948    /// manager, this may or may not work. The borderless window is
4949    /// requested using MOTIF hints, which are at least partially
4950    /// supported by virtually all modern window managers.
4951    ///
4952    /// An alternative would be to bypass the window manager entirely and
4953    /// create a window with the Qt::X11BypassWindowManagerHint flag. This
4954    /// has other severe problems though, like totally broken keyboard focus
4955    /// and very strange effects on desktop changes or when the user raises
4956    /// other windows.
4957    ///
4958    /// X11 window managers that follow modern post-ICCCM specifications
4959    /// support full-screen mode properly.
4960    ///
4961    /// **See also:** [`show_normal()`]
4962    /// [`show_maximized()`]
4963    /// [`show()`]
4964    /// [`hide()`]
4965    /// [`is_visible()`]
4966    pub fn show_full_screen(&self) -> &Self {
4967        let (obj_data, funcs) = self.get_widget_obj_funcs();
4968        unsafe {
4969            ((*funcs).show_full_screen)(obj_data);
4970        }
4971        self
4972    }
4973    ///
4974    /// Restores the widget after it has been maximized or minimized.
4975    ///
4976    /// Calling this function only affects [windows](isWindow())
4977    ///
4978    ///
4979    /// **See also:** [`set_window_state()`]
4980    /// [`show_minimized()`]
4981    /// [`show_maximized()`]
4982    /// [`show()`]
4983    /// [`hide()`]
4984    /// [`is_visible()`]
4985    pub fn show_normal(&self) -> &Self {
4986        let (obj_data, funcs) = self.get_widget_obj_funcs();
4987        unsafe {
4988            ((*funcs).show_normal)(obj_data);
4989        }
4990        self
4991    }
4992    ///
4993    /// Closes this widget. Returns `true` if the widget was closed;
4994    /// otherwise returns `false.`
4995    ///
4996    /// First it sends the widget a QCloseEvent. The widget is
4997    /// [hidden](hide())
4998    /// if it [accepts](QEvent::accept())
4999    ///
5000    /// the close event. If it [ignores](QEvent::ignore())
5001    ///
5002    /// the event, nothing happens. The default
5003    /// implementation of QWidget::closeEvent() accepts the close event.
5004    ///
5005    /// If the widget has the Qt::WA_DeleteOnClose flag, the widget
5006    /// is also deleted. A close events is delivered to the widget no
5007    /// matter if the widget is visible or not.
5008    ///
5009    /// The [QApplication::lastWindowClosed()](QApplication::lastWindowClosed())
5010    /// signal is emitted when the
5011    /// last visible primary window (i.e. window with no parent) with the
5012    /// Qt::WA_QuitOnClose attribute set is closed. By default this
5013    /// attribute is set for all widgets except transient windows such as
5014    /// splash screens, tool windows, and popup menus.
5015    ///
5016    ///
5017    /// This event handler is called with the given *event* when Qt receives a window
5018    /// close request for a top-level widget from the window system.
5019    ///
5020    /// By default, the event is accepted and the widget is closed. You can reimplement
5021    /// this function to change the way the widget responds to window close requests.
5022    /// For example, you can prevent the window from closing by calling [ignore()](QEvent::)
5023    ///
5024    /// on all events.
5025    ///
5026    /// Main window applications typically use reimplementations of this function to check
5027    /// whether the user's work has been saved and ask for permission before closing.
5028    /// For example, the [Application Example](Application%20Example)
5029    /// uses a helper function to determine whether
5030    /// or not to close the window:
5031    ///
5032    /// **See also:** [`event()`]
5033    /// [`hide()`]
5034    /// [`close()`]
5035    /// [`CloseEvent`]
5036    /// {Application Example}
5037    pub fn close(&self) -> bool {
5038        let (obj_data, funcs) = self.get_widget_obj_funcs();
5039        unsafe {
5040            let ret_val = ((*funcs).close)(obj_data);
5041            ret_val
5042        }
5043    }
5044    ///
5045    /// Raises this widget to the top of the parent widget's stack.
5046    ///
5047    /// After this call the widget will be visually in front of any
5048    /// overlapping sibling widgets.
5049    ///
5050    /// **Note**: When using activateWindow(), you can call this function to
5051    /// ensure that the window is stacked on top.
5052    ///
5053    /// **See also:** [`lower()`]
5054    /// [`stack_under()`]
5055    pub fn raise(&self) -> &Self {
5056        let (obj_data, funcs) = self.get_widget_obj_funcs();
5057        unsafe {
5058            ((*funcs).raise)(obj_data);
5059        }
5060        self
5061    }
5062    ///
5063    /// Lowers the widget to the bottom of the parent widget's stack.
5064    ///
5065    /// After this call the widget will be visually behind (and therefore
5066    /// obscured by) any overlapping sibling widgets.
5067    ///
5068    /// **See also:** [`raise()`]
5069    /// [`stack_under()`]
5070    pub fn lower(&self) -> &Self {
5071        let (obj_data, funcs) = self.get_widget_obj_funcs();
5072        unsafe {
5073            ((*funcs).lower)(obj_data);
5074        }
5075        self
5076    }
5077    ///
5078    /// Places the widget under *w* in the parent widget's stack.
5079    ///
5080    /// To make this work, the widget itself and *w* must be siblings.
5081    ///
5082    /// **See also:** [`raise()`]
5083    /// [`lower()`]
5084    pub fn stack_under<W: WidgetTrait<'a>>(&self, arg0: &W) -> &Self {
5085        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
5086
5087        let (obj_data, funcs) = self.get_widget_obj_funcs();
5088        unsafe {
5089            ((*funcs).stack_under)(obj_data, obj_arg0_1);
5090        }
5091        self
5092    }
5093    ///
5094    /// **Overloads**
5095    /// This corresponds to move(QPoint( *x,* *y)).*
5096    ///
5097    /// This event handler can be reimplemented in a subclass to receive
5098    /// widget move events which are passed in the *event* parameter.
5099    /// When the widget receives this event, it is already at the new
5100    /// position.
5101    ///
5102    /// The old position is accessible through QMoveEvent::oldPos().
5103    ///
5104    /// **See also:** [`resize_event()`]
5105    /// [`event()`]
5106    /// [`move()`]
5107    /// [`MoveEvent`]
5108    pub fn move_widget(&self, x: i32, y: i32) -> &Self {
5109        let (obj_data, funcs) = self.get_widget_obj_funcs();
5110        unsafe {
5111            ((*funcs).move_widget)(obj_data, x, y);
5112        }
5113        self
5114    }
5115    ///
5116    /// **Overloads**
5117    /// This corresponds to move(QPoint( *x,* *y)).*
5118    ///
5119    /// This event handler can be reimplemented in a subclass to receive
5120    /// widget move events which are passed in the *event* parameter.
5121    /// When the widget receives this event, it is already at the new
5122    /// position.
5123    ///
5124    /// The old position is accessible through QMoveEvent::oldPos().
5125    ///
5126    /// **See also:** [`resize_event()`]
5127    /// [`event()`]
5128    /// [`move()`]
5129    /// [`MoveEvent`]
5130    pub fn move_2<P: PointTrait<'a>>(&self, arg0: &P) -> &Self {
5131        let (obj_arg0_1, _funcs) = arg0.get_point_obj_funcs();
5132
5133        let (obj_data, funcs) = self.get_widget_obj_funcs();
5134        unsafe {
5135            ((*funcs).move_2)(obj_data, obj_arg0_1);
5136        }
5137        self
5138    }
5139    /// **Overloads**
5140    /// This corresponds to resize(QSize( *w,* *h)).*
5141    ///
5142    /// This event handler can be reimplemented in a subclass to receive
5143    /// widget resize events which are passed in the *event* parameter.
5144    /// When resizeEvent() is called, the widget already has its new
5145    /// geometry. The old size is accessible through
5146    /// QResizeEvent::oldSize().
5147    ///
5148    /// The widget will be erased and receive a paint event immediately
5149    /// after processing the resize event. No drawing need be (or should
5150    /// be) done inside this handler.
5151    ///
5152    /// **See also:** [`move_event()`]
5153    /// [`event()`]
5154    /// [`resize()`]
5155    /// [`ResizeEvent`]
5156    /// [`paint_event()`]
5157    /// {Scribble Example}
5158    pub fn resize(&self, w: i32, h: i32) -> &Self {
5159        let (obj_data, funcs) = self.get_widget_obj_funcs();
5160        unsafe {
5161            ((*funcs).resize)(obj_data, w, h);
5162        }
5163        self
5164    }
5165    /// **Overloads**
5166    /// This corresponds to resize(QSize( *w,* *h)).*
5167    ///
5168    /// This event handler can be reimplemented in a subclass to receive
5169    /// widget resize events which are passed in the *event* parameter.
5170    /// When resizeEvent() is called, the widget already has its new
5171    /// geometry. The old size is accessible through
5172    /// QResizeEvent::oldSize().
5173    ///
5174    /// The widget will be erased and receive a paint event immediately
5175    /// after processing the resize event. No drawing need be (or should
5176    /// be) done inside this handler.
5177    ///
5178    /// **See also:** [`move_event()`]
5179    /// [`event()`]
5180    /// [`resize()`]
5181    /// [`ResizeEvent`]
5182    /// [`paint_event()`]
5183    /// {Scribble Example}
5184    pub fn resize_2<S: SizeTrait<'a>>(&self, arg0: &S) -> &Self {
5185        let (obj_arg0_1, _funcs) = arg0.get_size_obj_funcs();
5186
5187        let (obj_data, funcs) = self.get_widget_obj_funcs();
5188        unsafe {
5189            ((*funcs).resize_2)(obj_data, obj_arg0_1);
5190        }
5191        self
5192    }
5193    ///
5194    /// Adjusts the size of the widget to fit its contents.
5195    ///
5196    /// This function uses sizeHint() if it is valid, i.e., the size hint's width
5197    /// and height are \>= 0. Otherwise, it sets the size to the children
5198    /// rectangle that covers all child widgets (the union of all child widget
5199    /// rectangles).
5200    ///
5201    /// For windows, the screen size is also taken into account. If the sizeHint()
5202    /// is less than (200, 100) and the size policy is [expanding](QSizePolicy::Expanding)
5203    /// , the window will be at least (200, 100). The maximum size of
5204    /// a window is 2/3 of the screen's width and height.
5205    ///
5206    /// **See also:** [`size_hint()`]
5207    /// [`children_rect()`]
5208    pub fn adjust_size(&self) -> &Self {
5209        let (obj_data, funcs) = self.get_widget_obj_funcs();
5210        unsafe {
5211            ((*funcs).adjust_size)(obj_data);
5212        }
5213        self
5214    }
5215    ///
5216    /// Returns `true` if this widget would become visible if *ancestor* is
5217    /// shown; otherwise returns `false.`
5218    ///
5219    /// The true case occurs if neither the widget itself nor any parent
5220    /// up to but excluding *ancestor* has been explicitly hidden.
5221    ///
5222    /// This function will still return true if the widget is obscured by
5223    /// other windows on the screen, but could be physically visible if it
5224    /// or they were to be moved.
5225    ///
5226    /// isVisibleTo(0) is identical to isVisible().
5227    ///
5228    /// **See also:** [`show()`]
5229    /// [`hide()`]
5230    /// [`is_visible()`]
5231    pub fn is_visible(&self) -> bool {
5232        let (obj_data, funcs) = self.get_widget_obj_funcs();
5233        unsafe {
5234            let ret_val = ((*funcs).is_visible)(obj_data);
5235            ret_val
5236        }
5237    }
5238    ///
5239    /// Returns `true` if this widget would become visible if *ancestor* is
5240    /// shown; otherwise returns `false.`
5241    ///
5242    /// The true case occurs if neither the widget itself nor any parent
5243    /// up to but excluding *ancestor* has been explicitly hidden.
5244    ///
5245    /// This function will still return true if the widget is obscured by
5246    /// other windows on the screen, but could be physically visible if it
5247    /// or they were to be moved.
5248    ///
5249    /// isVisibleTo(0) is identical to isVisible().
5250    ///
5251    /// **See also:** [`show()`]
5252    /// [`hide()`]
5253    /// [`is_visible()`]
5254    pub fn is_visible_to<W: WidgetTrait<'a>>(&self, arg0: &W) -> bool {
5255        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
5256
5257        let (obj_data, funcs) = self.get_widget_obj_funcs();
5258        unsafe {
5259            let ret_val = ((*funcs).is_visible_to)(obj_data, obj_arg0_1);
5260            ret_val
5261        }
5262    }
5263    ///
5264    /// Returns `true` if the widget is hidden, otherwise returns `false.`
5265    ///
5266    /// A hidden widget will only become visible when show() is called on
5267    /// it. It will not be automatically shown when the parent is shown.
5268    ///
5269    /// To check visibility, use !isVisible() instead (notice the exclamation mark).
5270    ///
5271    /// isHidden() implies !isVisible(), but a widget can be not visible
5272    /// and not hidden at the same time. This is the case for widgets that are children of
5273    /// widgets that are not visible.
5274    ///
5275    /// Widgets are hidden if:
5276    /// * they were created as independent windows,
5277    /// * they were created as children of visible widgets,
5278    /// * hide() or setVisible(false) was called.
5279    pub fn is_hidden(&self) -> bool {
5280        let (obj_data, funcs) = self.get_widget_obj_funcs();
5281        unsafe {
5282            let ret_val = ((*funcs).is_hidden)(obj_data);
5283            ret_val
5284        }
5285    }
5286    pub fn is_minimized(&self) -> bool {
5287        let (obj_data, funcs) = self.get_widget_obj_funcs();
5288        unsafe {
5289            let ret_val = ((*funcs).is_minimized)(obj_data);
5290            ret_val
5291        }
5292    }
5293    pub fn is_maximized(&self) -> bool {
5294        let (obj_data, funcs) = self.get_widget_obj_funcs();
5295        unsafe {
5296            let ret_val = ((*funcs).is_maximized)(obj_data);
5297            ret_val
5298        }
5299    }
5300    pub fn is_full_screen(&self) -> bool {
5301        let (obj_data, funcs) = self.get_widget_obj_funcs();
5302        unsafe {
5303            let ret_val = ((*funcs).is_full_screen)(obj_data);
5304            ret_val
5305        }
5306    }
5307    ///
5308    /// Returns the current window state. The window state is a OR'ed
5309    /// combination of Qt::WindowState: Qt::WindowMinimized,
5310    /// Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive.
5311    ///
5312    /// **See also:** [`t::window_state()`]
5313    /// [`set_window_state()`]
5314    pub fn window_state(&self) -> WindowStates {
5315        let (obj_data, funcs) = self.get_widget_obj_funcs();
5316        unsafe {
5317            let ret_val = ((*funcs).window_state)(obj_data);
5318            let ret_val = WindowStates::from_bits_truncate(ret_val);
5319            ret_val
5320        }
5321    }
5322    ///
5323    /// Sets the window state to *windowState.* The window state is a OR'ed
5324    /// combination of Qt::WindowState: Qt::WindowMinimized,
5325    /// Qt::WindowMaximized, Qt::WindowFullScreen, and Qt::WindowActive.
5326    ///
5327    /// If the window is not visible (i.e. isVisible() returns `false),` the
5328    /// window state will take effect when show() is called. For visible
5329    /// windows, the change is immediate. For example, to toggle between
5330    /// full-screen and normal mode, use the following code:
5331    ///
5332    /// In order to restore and activate a minimized window (while
5333    /// preserving its maximized and/or full-screen state), use the following:
5334    ///
5335    /// Calling this function will hide the widget. You must call show() to make
5336    /// the widget visible again.
5337    ///
5338    /// **Note**: On some window systems Qt::WindowActive is not immediate, and may be
5339    /// ignored in certain cases.
5340    ///
5341    /// When the window state changes, the widget receives a changeEvent()
5342    /// of type QEvent::WindowStateChange.
5343    ///
5344    /// **See also:** [`t::window_state()`]
5345    /// [`window_state()`]
5346    pub fn set_window_state(&self, state: WindowStates) -> &Self {
5347        let enum_state_1 = state.bits();
5348
5349        let (obj_data, funcs) = self.get_widget_obj_funcs();
5350        unsafe {
5351            ((*funcs).set_window_state)(obj_data, enum_state_1);
5352        }
5353        self
5354    }
5355    pub fn override_window_state(&self, state: WindowStates) -> &Self {
5356        let enum_state_1 = state.bits();
5357
5358        let (obj_data, funcs) = self.get_widget_obj_funcs();
5359        unsafe {
5360            ((*funcs).override_window_state)(obj_data, enum_state_1);
5361        }
5362        self
5363    }
5364    ///
5365    /// If the value of this property is an invalid size, no size is
5366    /// recommended.
5367    ///
5368    /// The default implementation of sizeHint() returns an invalid size
5369    /// if there is no layout for this widget, and returns the layout's
5370    /// preferred size otherwise.
5371    ///
5372    /// **See also:** [`Size::is_valid`]
5373    /// [`minimum_size_hint()`]
5374    /// [`size_policy()`]
5375    /// [`set_minimum_size()`]
5376    /// [`update_geometry()`]
5377    pub fn size_hint(&self) -> Size {
5378        let (obj_data, funcs) = self.get_widget_obj_funcs();
5379        unsafe {
5380            let ret_val = ((*funcs).size_hint)(obj_data);
5381            let t = ret_val;
5382            let ret_val;
5383            if t.host_data != ::std::ptr::null() {
5384                ret_val = Size::new_from_rc(t);
5385            } else {
5386                ret_val = Size::new_from_owned(t);
5387            }
5388            ret_val
5389        }
5390    }
5391    ///
5392    /// If the value of this property is an invalid size, no minimum size
5393    /// is recommended.
5394    ///
5395    /// The default implementation of minimumSizeHint() returns an invalid
5396    /// size if there is no layout for this widget, and returns the
5397    /// layout's minimum size otherwise. Most built-in widgets reimplement
5398    /// minimumSizeHint().
5399    ///
5400    /// [QLayout](QLayout)
5401    /// will never resize a widget to a size smaller than the
5402    /// minimum size hint unless minimumSize() is set or the size policy is
5403    /// set to QSizePolicy::Ignore. If minimumSize() is set, the minimum
5404    /// size hint will be ignored.
5405    ///
5406    /// **See also:** [`Size::is_valid`]
5407    /// [`resize()`]
5408    /// [`set_minimum_size()`]
5409    /// [`size_policy()`]
5410    pub fn minimum_size_hint(&self) -> Size {
5411        let (obj_data, funcs) = self.get_widget_obj_funcs();
5412        unsafe {
5413            let ret_val = ((*funcs).minimum_size_hint)(obj_data);
5414            let t = ret_val;
5415            let ret_val;
5416            if t.host_data != ::std::ptr::null() {
5417                ret_val = Size::new_from_rc(t);
5418            } else {
5419                ret_val = Size::new_from_owned(t);
5420            }
5421            ret_val
5422        }
5423    }
5424    ///
5425    /// If there is a QLayout that manages this widget's children, the
5426    /// size policy specified by that layout is used. If there is no such
5427    /// QLayout, the result of this function is used.
5428    ///
5429    /// The default policy is Preferred/Preferred, which means that the
5430    /// widget can be freely resized, but prefers to be the size
5431    /// sizeHint() returns. Button-like widgets set the size policy to
5432    /// specify that they may stretch horizontally, but are fixed
5433    /// vertically. The same applies to lineedit controls (such as
5434    /// QLineEdit, QSpinBox or an editable QComboBox) and other
5435    /// horizontally orientated widgets (such as QProgressBar).
5436    /// QToolButton's are normally square, so they allow growth in both
5437    /// directions. Widgets that support different directions (such as
5438    /// QSlider, QScrollBar or QHeader) specify stretching in the
5439    /// respective direction only. Widgets that can provide scroll bars
5440    /// (usually subclasses of QScrollArea) tend to specify that they can
5441    /// use additional space, and that they can make do with less than
5442    /// sizeHint().
5443    ///
5444    /// **See also:** [`size_hint()`]
5445    /// [`Layout`]
5446    /// [`SizePolicy`]
5447    /// [`update_geometry()`]
5448    pub fn size_policy(&self) -> SizePolicy {
5449        let (obj_data, funcs) = self.get_widget_obj_funcs();
5450        unsafe {
5451            let ret_val = ((*funcs).size_policy)(obj_data);
5452            let t = ret_val;
5453            let ret_val;
5454            if t.host_data != ::std::ptr::null() {
5455                ret_val = SizePolicy::new_from_rc(t);
5456            } else {
5457                ret_val = SizePolicy::new_from_owned(t);
5458            }
5459            ret_val
5460        }
5461    }
5462    ///
5463    /// **Overloads**
5464    /// Sets the size policy of the widget to *horizontal* and *vertical,* with standard stretch and no height-for-width.
5465    ///
5466    /// **See also:** [`SizePolicy::q_size_policy`]
5467    pub fn set_size_policy<S: SizePolicyTrait<'a>>(&self, arg0: &S) -> &Self {
5468        let (obj_arg0_1, _funcs) = arg0.get_size_policy_obj_funcs();
5469
5470        let (obj_data, funcs) = self.get_widget_obj_funcs();
5471        unsafe {
5472            ((*funcs).set_size_policy)(obj_data, obj_arg0_1);
5473        }
5474        self
5475    }
5476    ///
5477    /// **Overloads**
5478    /// Sets the size policy of the widget to *horizontal* and *vertical,* with standard stretch and no height-for-width.
5479    ///
5480    /// **See also:** [`SizePolicy::q_size_policy`]
5481    pub fn set_size_policy_2(&self, horizontal: Policy, vertical: Policy) -> &Self {
5482        let enum_horizontal_1 = horizontal as u32;
5483        let enum_vertical_2 = vertical as u32;
5484
5485        let (obj_data, funcs) = self.get_widget_obj_funcs();
5486        unsafe {
5487            ((*funcs).set_size_policy_2)(obj_data, enum_horizontal_1, enum_vertical_2);
5488        }
5489        self
5490    }
5491    ///
5492    /// Returns the preferred height for this widget, given the width *w.*
5493    ///
5494    /// If this widget has a layout, the default implementation returns
5495    /// the layout's preferred height. if there is no layout, the default
5496    /// implementation returns -1 indicating that the preferred height
5497    /// does not depend on the width.
5498    pub fn height_for_width(&self, arg0: i32) -> i32 {
5499        let (obj_data, funcs) = self.get_widget_obj_funcs();
5500        unsafe {
5501            let ret_val = ((*funcs).height_for_width)(obj_data, arg0);
5502            ret_val
5503        }
5504    }
5505    ///
5506    /// Returns `true` if the widget's preferred height depends on its width; otherwise returns `false.`
5507    pub fn has_height_for_width(&self) -> bool {
5508        let (obj_data, funcs) = self.get_widget_obj_funcs();
5509        unsafe {
5510            let ret_val = ((*funcs).has_height_for_width)(obj_data);
5511            ret_val
5512        }
5513    }
5514    ///
5515    /// Returns the unobscured region where paint events can occur.
5516    ///
5517    /// For visible widgets, this is an approximation of the area not
5518    /// covered by other widgets; otherwise, this is an empty region.
5519    ///
5520    /// The repaint() function calls this function if necessary, so in
5521    /// general you do not need to call it.
5522    ///
5523    pub fn visible_region(&self) -> Region {
5524        let (obj_data, funcs) = self.get_widget_obj_funcs();
5525        unsafe {
5526            let ret_val = ((*funcs).visible_region)(obj_data);
5527            let t = ret_val;
5528            let ret_val;
5529            if t.host_data != ::std::ptr::null() {
5530                ret_val = Region::new_from_rc(t);
5531            } else {
5532                ret_val = Region::new_from_owned(t);
5533            }
5534            ret_val
5535        }
5536    }
5537    ///
5538    /// Sets the margins around the contents of the widget to have the sizes
5539    /// *left,* *top,* *right,* and *bottom.* The margins are used by
5540    /// the layout system, and may be used by subclasses to specify the area
5541    /// to draw in (e.g. excluding the frame).
5542    ///
5543    /// Changing the margins will trigger a resizeEvent().
5544    ///
5545    /// **See also:** [`contents_rect()`]
5546    /// [`get_contents_margins()`]
5547    ///
5548    /// **Overloads**
5549    ///
5550    /// Sets the margins around the contents of the widget to have the
5551    /// sizes determined by *margins.* The margins are
5552    /// used by the layout system, and may be used by subclasses to
5553    /// specify the area to draw in (e.g. excluding the frame).
5554    ///
5555    /// Changing the margins will trigger a resizeEvent().
5556    ///
5557    /// **See also:** [`contents_rect()`]
5558    /// [`get_contents_margins()`]
5559    pub fn set_contents_margins(&self, left: i32, top: i32, right: i32, bottom: i32) -> &Self {
5560        let (obj_data, funcs) = self.get_widget_obj_funcs();
5561        unsafe {
5562            ((*funcs).set_contents_margins)(obj_data, left, top, right, bottom);
5563        }
5564        self
5565    }
5566    ///
5567    /// Sets the margins around the contents of the widget to have the sizes
5568    /// *left,* *top,* *right,* and *bottom.* The margins are used by
5569    /// the layout system, and may be used by subclasses to specify the area
5570    /// to draw in (e.g. excluding the frame).
5571    ///
5572    /// Changing the margins will trigger a resizeEvent().
5573    ///
5574    /// **See also:** [`contents_rect()`]
5575    /// [`get_contents_margins()`]
5576    ///
5577    /// **Overloads**
5578    ///
5579    /// Sets the margins around the contents of the widget to have the
5580    /// sizes determined by *margins.* The margins are
5581    /// used by the layout system, and may be used by subclasses to
5582    /// specify the area to draw in (e.g. excluding the frame).
5583    ///
5584    /// Changing the margins will trigger a resizeEvent().
5585    ///
5586    /// **See also:** [`contents_rect()`]
5587    /// [`get_contents_margins()`]
5588    pub fn set_contents_margins_2<M: MarginsTrait<'a>>(&self, margins: &M) -> &Self {
5589        let (obj_margins_1, _funcs) = margins.get_margins_obj_funcs();
5590
5591        let (obj_data, funcs) = self.get_widget_obj_funcs();
5592        unsafe {
5593            ((*funcs).set_contents_margins_2)(obj_data, obj_margins_1);
5594        }
5595        self
5596    }
5597    ///
5598    /// **See also:** [`get_contents_margins()`]
5599    /// [`set_contents_margins()`]
5600    /// [`contents_rect()`]
5601    pub fn contents_margins(&self) -> Margins {
5602        let (obj_data, funcs) = self.get_widget_obj_funcs();
5603        unsafe {
5604            let ret_val = ((*funcs).contents_margins)(obj_data);
5605            let t = ret_val;
5606            let ret_val;
5607            if t.host_data != ::std::ptr::null() {
5608                ret_val = Margins::new_from_rc(t);
5609            } else {
5610                ret_val = Margins::new_from_owned(t);
5611            }
5612            ret_val
5613        }
5614    }
5615    ///
5616    /// Returns the area inside the widget's margins.
5617    ///
5618    /// **See also:** [`set_contents_margins()`]
5619    /// [`get_contents_margins()`]
5620    pub fn contents_rect(&self) -> Rect {
5621        let (obj_data, funcs) = self.get_widget_obj_funcs();
5622        unsafe {
5623            let ret_val = ((*funcs).contents_rect)(obj_data);
5624            let t = ret_val;
5625            let ret_val;
5626            if t.host_data != ::std::ptr::null() {
5627                ret_val = Rect::new_from_rc(t);
5628            } else {
5629                ret_val = Rect::new_from_owned(t);
5630            }
5631            ret_val
5632        }
5633    }
5634    ///
5635    /// By default, this property is set to Qt::LeftToRight.
5636    ///
5637    /// When the layout direction is set on a widget, it will propagate to
5638    /// the widget's children, but not to a child that is a window and not
5639    /// to a child for which setLayoutDirection() has been explicitly
5640    /// called. Also, child widgets added *after* setLayoutDirection()
5641    /// has been called for the parent do not inherit the parent's layout
5642    /// direction.
5643    ///
5644    /// This method no longer affects text layout direction since Qt 4.7.
5645    ///
5646    /// **See also:** [`Application::layout_direction()`]
5647    ///
5648    /// Returns the layout manager that is installed on this widget, or 0
5649    /// if no layout manager is installed.
5650    ///
5651    /// The layout manager sets the geometry of the widget's children
5652    /// that have been added to the layout.
5653    ///
5654    /// **See also:** [`set_layout()`]
5655    /// [`size_policy()`]
5656    /// {Layout Management}
5657    pub fn layout(&self) -> Option<Layout> {
5658        let (obj_data, funcs) = self.get_widget_obj_funcs();
5659        unsafe {
5660            let ret_val = ((*funcs).layout)(obj_data);
5661            if ret_val.qt_data == ::std::ptr::null() {
5662                return None;
5663            }
5664            let t = ret_val;
5665            let ret_val;
5666            if t.host_data != ::std::ptr::null() {
5667                ret_val = Layout::new_from_rc(t);
5668            } else {
5669                ret_val = Layout::new_from_owned(t);
5670            }
5671            Some(ret_val)
5672        }
5673    }
5674    ///
5675    /// Sets the layout manager for this widget to *layout.*
5676    ///
5677    /// If there already is a layout manager installed on this widget,
5678    /// QWidget won't let you install another. You must first delete the
5679    /// existing layout manager (returned by layout()) before you can
5680    /// call setLayout() with the new layout.
5681    ///
5682    /// If *layout* is the layout manager on a different widget, setLayout()
5683    /// will reparent the layout and make it the layout manager for this widget.
5684    ///
5685    /// Example:
5686    ///
5687    /// An alternative to calling this function is to pass this widget to
5688    /// the layout's constructor.
5689    ///
5690    /// The QWidget will take ownership of *layout.*
5691    ///
5692    /// **See also:** [`layout()`]
5693    /// {Layout Management}
5694    pub fn set_layout<L: LayoutTrait<'a>>(&self, arg0: &L) -> &Self {
5695        let (obj_arg0_1, _funcs) = arg0.get_layout_obj_funcs();
5696
5697        let (obj_data, funcs) = self.get_widget_obj_funcs();
5698        unsafe {
5699            ((*funcs).set_layout)(obj_data, obj_arg0_1);
5700        }
5701        self
5702    }
5703    ///
5704    /// Sets the parent of the widget to *parent,* and resets the window
5705    /// flags. The widget is moved to position (0, 0) in its new parent.
5706    ///
5707    /// If the new parent widget is in a different window, the
5708    /// reparented widget and its children are appended to the end of the
5709    /// [tab chain](setFocusPolicy())
5710    /// of the new parent
5711    /// widget, in the same internal order as before. If one of the moved
5712    /// widgets had keyboard focus, setParent() calls clearFocus() for that
5713    /// widget.
5714    ///
5715    /// If the new parent widget is in the same window as the
5716    /// old parent, setting the parent doesn't change the tab order or
5717    /// keyboard focus.
5718    ///
5719    /// If the parent widget is the old parent widget, this function
5720    /// does nothing.
5721    ///
5722    /// **Note**: The widget becomes invisible as part of changing its parent,
5723    /// even if it was previously visible. You must call show() to make the
5724    /// widget visible again.
5725    ///
5726    /// **Warning**: It is very unlikely that you will ever need this
5727    /// function. If you have a widget that changes its content
5728    /// dynamically, it is far easier to use [QStackedWidget.](QStackedWidget.)
5729    ///
5730    /// **See also:** [`set_window_flags()`]
5731    ///
5732    /// **Overloads**
5733    /// This function also takes widget flags, *f* as an argument.
5734    pub fn set_parent<W: WidgetTrait<'a>>(&self, parent: &W) -> &Self {
5735        let (obj_parent_1, _funcs) = parent.get_widget_obj_funcs();
5736
5737        let (obj_data, funcs) = self.get_widget_obj_funcs();
5738        unsafe {
5739            ((*funcs).set_parent)(obj_data, obj_parent_1);
5740        }
5741        self
5742    }
5743    ///
5744    /// Sets the parent of the widget to *parent,* and resets the window
5745    /// flags. The widget is moved to position (0, 0) in its new parent.
5746    ///
5747    /// If the new parent widget is in a different window, the
5748    /// reparented widget and its children are appended to the end of the
5749    /// [tab chain](setFocusPolicy())
5750    /// of the new parent
5751    /// widget, in the same internal order as before. If one of the moved
5752    /// widgets had keyboard focus, setParent() calls clearFocus() for that
5753    /// widget.
5754    ///
5755    /// If the new parent widget is in the same window as the
5756    /// old parent, setting the parent doesn't change the tab order or
5757    /// keyboard focus.
5758    ///
5759    /// If the parent widget is the old parent widget, this function
5760    /// does nothing.
5761    ///
5762    /// **Note**: The widget becomes invisible as part of changing its parent,
5763    /// even if it was previously visible. You must call show() to make the
5764    /// widget visible again.
5765    ///
5766    /// **Warning**: It is very unlikely that you will ever need this
5767    /// function. If you have a widget that changes its content
5768    /// dynamically, it is far easier to use [QStackedWidget.](QStackedWidget.)
5769    ///
5770    /// **See also:** [`set_window_flags()`]
5771    ///
5772    /// **Overloads**
5773    /// This function also takes widget flags, *f* as an argument.
5774    pub fn set_parent_2<W: WidgetTrait<'a>>(&self, parent: &W, f: WindowFlags) -> &Self {
5775        let (obj_parent_1, _funcs) = parent.get_widget_obj_funcs();
5776        let enum_f_2 = f.bits();
5777
5778        let (obj_data, funcs) = self.get_widget_obj_funcs();
5779        unsafe {
5780            ((*funcs).set_parent_2)(obj_data, obj_parent_1, enum_f_2);
5781        }
5782        self
5783    }
5784    ///
5785    /// Scrolls the widget including its children *dx* pixels to the
5786    /// right and *dy* downward. Both *dx* and *dy* may be negative.
5787    ///
5788    /// After scrolling, the widgets will receive paint events for
5789    /// the areas that need to be repainted. For widgets that Qt knows to
5790    /// be opaque, this is only the newly exposed parts.
5791    /// For example, if an opaque widget is scrolled 8 pixels to the left,
5792    /// only an 8-pixel wide stripe at the right edge needs updating.
5793    ///
5794    /// Since widgets propagate the contents of their parents by default,
5795    /// you need to set the [autoFillBackground](autoFillBackground)
5796    /// property, or use
5797    /// setAttribute() to set the Qt::WA_OpaquePaintEvent attribute, to make
5798    /// a widget opaque.
5799    ///
5800    /// For widgets that use contents propagation, a scroll will cause an
5801    /// update of the entire scroll area.
5802    ///
5803    /// **See also:** {Transparency and Double Buffering}
5804    ///
5805    /// **Overloads**
5806    /// This version only scrolls *r* and does not move the children of
5807    /// the widget.
5808    ///
5809    /// If *r* is empty or invalid, the result is undefined.
5810    ///
5811    /// **See also:** [`ScrollArea`]
5812    pub fn scroll(&self, dx: i32, dy: i32) -> &Self {
5813        let (obj_data, funcs) = self.get_widget_obj_funcs();
5814        unsafe {
5815            ((*funcs).scroll)(obj_data, dx, dy);
5816        }
5817        self
5818    }
5819    ///
5820    /// Scrolls the widget including its children *dx* pixels to the
5821    /// right and *dy* downward. Both *dx* and *dy* may be negative.
5822    ///
5823    /// After scrolling, the widgets will receive paint events for
5824    /// the areas that need to be repainted. For widgets that Qt knows to
5825    /// be opaque, this is only the newly exposed parts.
5826    /// For example, if an opaque widget is scrolled 8 pixels to the left,
5827    /// only an 8-pixel wide stripe at the right edge needs updating.
5828    ///
5829    /// Since widgets propagate the contents of their parents by default,
5830    /// you need to set the [autoFillBackground](autoFillBackground)
5831    /// property, or use
5832    /// setAttribute() to set the Qt::WA_OpaquePaintEvent attribute, to make
5833    /// a widget opaque.
5834    ///
5835    /// For widgets that use contents propagation, a scroll will cause an
5836    /// update of the entire scroll area.
5837    ///
5838    /// **See also:** {Transparency and Double Buffering}
5839    ///
5840    /// **Overloads**
5841    /// This version only scrolls *r* and does not move the children of
5842    /// the widget.
5843    ///
5844    /// If *r* is empty or invalid, the result is undefined.
5845    ///
5846    /// **See also:** [`ScrollArea`]
5847    pub fn scroll_2<R: RectTrait<'a>>(&self, dx: i32, dy: i32, arg0: &R) -> &Self {
5848        let (obj_arg0_3, _funcs) = arg0.get_rect_obj_funcs();
5849
5850        let (obj_data, funcs) = self.get_widget_obj_funcs();
5851        unsafe {
5852            ((*funcs).scroll_2)(obj_data, dx, dy, obj_arg0_3);
5853        }
5854        self
5855    }
5856    ///
5857    /// Returns the last child of this widget that setFocus had been
5858    /// called on. For top level widgets this is the widget that will get
5859    /// focus in case this window gets activated
5860    ///
5861    /// This is not the same as QApplication::focusWidget(), which returns
5862    /// the focus widget in the currently active window.
5863    pub fn focus_widget(&self) -> Option<Widget> {
5864        let (obj_data, funcs) = self.get_widget_obj_funcs();
5865        unsafe {
5866            let ret_val = ((*funcs).focus_widget)(obj_data);
5867            if ret_val.qt_data == ::std::ptr::null() {
5868                return None;
5869            }
5870            let t = ret_val;
5871            let ret_val;
5872            if t.host_data != ::std::ptr::null() {
5873                ret_val = Widget::new_from_rc(t);
5874            } else {
5875                ret_val = Widget::new_from_owned(t);
5876            }
5877            Some(ret_val)
5878        }
5879    }
5880    ///
5881    /// Returns the next widget in this widget's focus chain.
5882    ///
5883    /// **See also:** [`previous_in_focus_chain()`]
5884    pub fn next_in_focus_chain(&self) -> Option<Widget> {
5885        let (obj_data, funcs) = self.get_widget_obj_funcs();
5886        unsafe {
5887            let ret_val = ((*funcs).next_in_focus_chain)(obj_data);
5888            if ret_val.qt_data == ::std::ptr::null() {
5889                return None;
5890            }
5891            let t = ret_val;
5892            let ret_val;
5893            if t.host_data != ::std::ptr::null() {
5894                ret_val = Widget::new_from_rc(t);
5895            } else {
5896                ret_val = Widget::new_from_owned(t);
5897            }
5898            Some(ret_val)
5899        }
5900    }
5901    ///
5902    /// **See also:** [`next_in_focus_chain()`]
5903    ///
5904    pub fn previous_in_focus_chain(&self) -> Option<Widget> {
5905        let (obj_data, funcs) = self.get_widget_obj_funcs();
5906        unsafe {
5907            let ret_val = ((*funcs).previous_in_focus_chain)(obj_data);
5908            if ret_val.qt_data == ::std::ptr::null() {
5909                return None;
5910            }
5911            let t = ret_val;
5912            let ret_val;
5913            if t.host_data != ::std::ptr::null() {
5914                ret_val = Widget::new_from_rc(t);
5915            } else {
5916                ret_val = Widget::new_from_owned(t);
5917            }
5918            Some(ret_val)
5919        }
5920    }
5921    ///
5922    /// Setting this property to true announces to the system that this
5923    /// widget *may* be able to accept drop events.
5924    ///
5925    /// If the widget is the desktop (windowType() == Qt::Desktop), this may
5926    /// fail if another application is using the desktop; you can call
5927    /// acceptDrops() to test if this occurs.
5928    ///
5929    /// **Warning**: Do not modify this property in a drag and drop event handler.
5930    ///
5931    /// By default, this property is `false.`
5932    ///
5933    /// **See also:** {Drag and Drop}
5934    pub fn accept_drops(&self) -> bool {
5935        let (obj_data, funcs) = self.get_widget_obj_funcs();
5936        unsafe {
5937            let ret_val = ((*funcs).accept_drops)(obj_data);
5938            ret_val
5939        }
5940    }
5941    pub fn set_accept_drops(&self, on: bool) -> &Self {
5942        let (obj_data, funcs) = self.get_widget_obj_funcs();
5943        unsafe {
5944            ((*funcs).set_accept_drops)(obj_data, on);
5945        }
5946        self
5947    }
5948    ///
5949    /// Appends the action *action* to this widget's list of actions.
5950    ///
5951    /// All QWidgets have a list of [QAction](QAction)
5952    /// s, however they can be
5953    /// represented graphically in many different ways. The default use of
5954    /// the QAction list (as returned by actions()) is to create a context
5955    /// QMenu.
5956    ///
5957    /// A QWidget should only have one of each action and adding an action
5958    /// it already has will not cause the same action to be in the widget twice.
5959    ///
5960    /// The ownership of *action* is not transferred to this QWidget.
5961    ///
5962    /// **See also:** [`remove_action()`]
5963    /// [`insert_action()`]
5964    /// [`actions()`]
5965    /// [`Menu`]
5966    ///
5967    /// Inserts the action *action* to this widget's list of actions,
5968    /// before the action *before.* It appends the action if *before* is 0 or
5969    /// *before* is not a valid action for this widget.
5970    ///
5971    /// A QWidget should only have one of each action.
5972    ///
5973    /// **See also:** [`remove_action()`]
5974    /// [`add_action()`]
5975    /// [`Menu`]
5976    /// contextMenuPolicy
5977    /// [`actions()`]
5978    ///
5979    /// Removes the action *action* from this widget's list of actions.
5980    /// **See also:** [`insert_action()`]
5981    /// [`actions()`]
5982    /// [`insert_action()`]
5983    ///
5984    /// Returns the parent of this widget, or 0 if it does not have any
5985    /// parent widget.
5986    pub fn parent_widget(&self) -> Option<Widget> {
5987        let (obj_data, funcs) = self.get_widget_obj_funcs();
5988        unsafe {
5989            let ret_val = ((*funcs).parent_widget)(obj_data);
5990            if ret_val.qt_data == ::std::ptr::null() {
5991                return None;
5992            }
5993            let t = ret_val;
5994            let ret_val;
5995            if t.host_data != ::std::ptr::null() {
5996                ret_val = Widget::new_from_rc(t);
5997            } else {
5998                ret_val = Widget::new_from_owned(t);
5999            }
6000            Some(ret_val)
6001        }
6002    }
6003    pub fn set_window_flags(&self, gtype: WindowFlags) -> &Self {
6004        let enum_gtype_1 = gtype.bits();
6005
6006        let (obj_data, funcs) = self.get_widget_obj_funcs();
6007        unsafe {
6008            ((*funcs).set_window_flags)(obj_data, enum_gtype_1);
6009        }
6010        self
6011    }
6012    ///
6013    /// Window flags are a combination of a type (e.g. Qt::Dialog) and
6014    /// zero or more hints to the window system (e.g.
6015    /// Qt::FramelessWindowHint).
6016    ///
6017    /// If the widget had type Qt::Widget or Qt::SubWindow and becomes a
6018    /// window (Qt::Window, Qt::Dialog, etc.), it is put at position (0,
6019    /// 0) on the desktop. If the widget is a window and becomes a
6020    /// Qt::Widget or Qt::SubWindow, it is put at position (0, 0)
6021    /// relative to its parent widget.
6022    ///
6023    /// **Note**: This function calls setParent() when changing the flags for
6024    /// a window, causing the widget to be hidden. You must call show() to make
6025    /// the widget visible again..
6026    ///
6027    /// **See also:** [`window_type()`]
6028    /// [`set_window_flag()`]
6029    /// {Window Flags Example}
6030    pub fn window_flags(&self) -> WindowFlags {
6031        let (obj_data, funcs) = self.get_widget_obj_funcs();
6032        unsafe {
6033            let ret_val = ((*funcs).window_flags)(obj_data);
6034            let ret_val = WindowFlags::from_bits_truncate(ret_val);
6035            ret_val
6036        }
6037    }
6038    ///
6039    /// Sets the window flag *flag* on this widget if *on* is true;
6040    /// otherwise clears the flag.
6041    ///
6042    /// **See also:** [`set_window_flags()`]
6043    /// [`window_flags()`]
6044    /// [`window_type()`]
6045    ///
6046    /// Sets the window flags for the widget to *flags,*
6047    /// *without* telling the window system.
6048    ///
6049    /// **Warning**: Do not call this function unless you really know what
6050    /// you're doing.
6051    ///
6052    /// **See also:** [`set_window_flags()`]
6053    pub fn override_window_flags(&self, wtype: WindowFlags) -> &Self {
6054        let enum_wtype_1 = wtype.bits();
6055
6056        let (obj_data, funcs) = self.get_widget_obj_funcs();
6057        unsafe {
6058            ((*funcs).override_window_flags)(obj_data, enum_wtype_1);
6059        }
6060        self
6061    }
6062    ///
6063    /// Returns the window type of this widget. This is identical to
6064    /// windowFlags() & Qt::WindowType_Mask.
6065    ///
6066    /// **See also:** windowFlags
6067    ///
6068    /// Returns a pointer to the widget with window identifer/handle *id.*
6069    ///
6070    /// The window identifier type depends on the underlying window
6071    /// system, see `qwindowdefs.h` for the actual definition. If there
6072    /// is no widget with this identifier, 0 is returned.
6073    pub fn find(arg0: u64) -> Option<Widget<'a>> {
6074        let (obj_data, funcs) = unsafe {
6075            (
6076                ::std::ptr::null(),
6077                (*((*rute_ffi_get()).get_widget)(::std::ptr::null()).all_funcs).widget_funcs,
6078            )
6079        };
6080        unsafe {
6081            let ret_val = ((*funcs).find)(obj_data, arg0);
6082            if ret_val.qt_data == ::std::ptr::null() {
6083                return None;
6084            }
6085            let t = ret_val;
6086            let ret_val;
6087            if t.host_data != ::std::ptr::null() {
6088                ret_val = Widget::new_from_rc(t);
6089            } else {
6090                ret_val = Widget::new_from_owned(t);
6091            }
6092            Some(ret_val)
6093        }
6094    }
6095    ///
6096    /// Returns the visible child widget at the position ( *x* , *y* )
6097    /// in the widget's coordinate system. If there is no visible child
6098    /// widget at the specified position, the function returns 0.
6099    ///
6100    /// **Overloads**
6101    /// Returns the visible child widget at point *p* in the widget's own
6102    /// coordinate system.
6103    pub fn child_at(&self, x: i32, y: i32) -> Option<Widget> {
6104        let (obj_data, funcs) = self.get_widget_obj_funcs();
6105        unsafe {
6106            let ret_val = ((*funcs).child_at)(obj_data, x, y);
6107            if ret_val.qt_data == ::std::ptr::null() {
6108                return None;
6109            }
6110            let t = ret_val;
6111            let ret_val;
6112            if t.host_data != ::std::ptr::null() {
6113                ret_val = Widget::new_from_rc(t);
6114            } else {
6115                ret_val = Widget::new_from_owned(t);
6116            }
6117            Some(ret_val)
6118        }
6119    }
6120    ///
6121    /// Returns the visible child widget at the position ( *x* , *y* )
6122    /// in the widget's coordinate system. If there is no visible child
6123    /// widget at the specified position, the function returns 0.
6124    ///
6125    /// **Overloads**
6126    /// Returns the visible child widget at point *p* in the widget's own
6127    /// coordinate system.
6128    pub fn child_at_2<P: PointTrait<'a>>(&self, p: &P) -> Option<Widget> {
6129        let (obj_p_1, _funcs) = p.get_point_obj_funcs();
6130
6131        let (obj_data, funcs) = self.get_widget_obj_funcs();
6132        unsafe {
6133            let ret_val = ((*funcs).child_at_2)(obj_data, obj_p_1);
6134            if ret_val.qt_data == ::std::ptr::null() {
6135                return None;
6136            }
6137            let t = ret_val;
6138            let ret_val;
6139            if t.host_data != ::std::ptr::null() {
6140                ret_val = Widget::new_from_rc(t);
6141            } else {
6142                ret_val = Widget::new_from_owned(t);
6143            }
6144            Some(ret_val)
6145        }
6146    }
6147    ///
6148    /// Returns the widget's paint engine.
6149    ///
6150    /// Note that this function should not be called explicitly by the
6151    /// user, since it's meant for reimplementation purposes only. The
6152    /// function is called by Qt internally, and the default
6153    /// implementation may not always return a valid pointer.
6154    pub fn paint_engine(&self) -> Option<PaintEngine> {
6155        let (obj_data, funcs) = self.get_widget_obj_funcs();
6156        unsafe {
6157            let ret_val = ((*funcs).paint_engine)(obj_data);
6158            if ret_val.qt_data == ::std::ptr::null() {
6159                return None;
6160            }
6161            let t = ret_val;
6162            let ret_val;
6163            if t.host_data != ::std::ptr::null() {
6164                ret_val = PaintEngine::new_from_rc(t);
6165            } else {
6166                ret_val = PaintEngine::new_from_owned(t);
6167            }
6168            Some(ret_val)
6169        }
6170    }
6171    ///
6172    /// Ensures that the widget and its children have been polished by
6173    /// QStyle (i.e., have a proper font and palette).
6174    ///
6175    /// QWidget calls this function after it has been fully constructed
6176    /// but before it is shown the very first time. You can call this
6177    /// function if you want to ensure that the widget is polished before
6178    /// doing an operation, e.g., the correct font size might be needed in
6179    /// the widget's sizeHint() reimplementation. Note that this function
6180    /// *is* called from the default implementation of sizeHint().
6181    ///
6182    /// Polishing is useful for final initialization that must happen after
6183    /// all constructors (from base classes as well as from subclasses)
6184    /// have been called.
6185    ///
6186    /// If you need to change some settings when a widget is polished,
6187    /// reimplement event() and handle the QEvent::Polish event type.
6188    ///
6189    /// **Note:** The function is declared const so that it can be called from
6190    /// other const functions (e.g., sizeHint()).
6191    ///
6192    /// **See also:** [`event()`]
6193    pub fn ensure_polished(&self) -> &Self {
6194        let (obj_data, funcs) = self.get_widget_obj_funcs();
6195        unsafe {
6196            ((*funcs).ensure_polished)(obj_data);
6197        }
6198        self
6199    }
6200    ///
6201    /// Returns `true` if this widget is a parent, (or grandparent and so on
6202    /// to any level), of the given *child,* and both widgets are within
6203    /// the same window; otherwise returns `false.`
6204    pub fn is_ancestor_of<W: WidgetTrait<'a>>(&self, child: &W) -> bool {
6205        let (obj_child_1, _funcs) = child.get_widget_obj_funcs();
6206
6207        let (obj_data, funcs) = self.get_widget_obj_funcs();
6208        unsafe {
6209            let ret_val = ((*funcs).is_ancestor_of)(obj_data, obj_child_1);
6210            ret_val
6211        }
6212    }
6213    ///
6214    /// If enabled, this property will cause Qt to fill the background of the
6215    /// widget before invoking the paint event. The color used is defined by the
6216    /// QPalette::Window color role from the widget's [palette](QPalette)
6217    ///
6218    ///
6219    /// In addition, Windows are always filled with QPalette::Window, unless the
6220    /// WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set.
6221    ///
6222    /// This property cannot be turned off (i.e., set to false) if a widget's
6223    /// parent has a static gradient for its background.
6224    ///
6225    /// **Warning**: Use this property with caution in conjunction with
6226    /// [Qt Style Sheets](Qt%20Style%20Sheets)
6227    /// . When a widget has a style sheet with a valid
6228    /// background or a border-image, this property is automatically disabled.
6229    ///
6230    /// By default, this property is `false.`
6231    ///
6232    /// **See also:** [`t::wa_opaque_paint_event()`]
6233    /// [`t::wa_no_system_background()`]
6234    /// {QWidget#Transparency and Double Buffering}{Transparency and Double Buffering}
6235    pub fn auto_fill_background(&self) -> bool {
6236        let (obj_data, funcs) = self.get_widget_obj_funcs();
6237        unsafe {
6238            let ret_val = ((*funcs).auto_fill_background)(obj_data);
6239            ret_val
6240        }
6241    }
6242    pub fn set_auto_fill_background(&self, enabled: bool) -> &Self {
6243        let (obj_data, funcs) = self.get_widget_obj_funcs();
6244        unsafe {
6245            ((*funcs).set_auto_fill_background)(obj_data, enabled);
6246        }
6247        self
6248    }
6249    ///
6250    /// Returns the QBackingStore this widget will be drawn into.
6251    pub fn backing_store(&self) -> Option<BackingStore> {
6252        let (obj_data, funcs) = self.get_widget_obj_funcs();
6253        unsafe {
6254            let ret_val = ((*funcs).backing_store)(obj_data);
6255            if ret_val.qt_data == ::std::ptr::null() {
6256                return None;
6257            }
6258            let t = ret_val;
6259            let ret_val;
6260            if t.host_data != ::std::ptr::null() {
6261                ret_val = BackingStore::new_from_rc(t);
6262            } else {
6263                ret_val = BackingStore::new_from_owned(t);
6264            }
6265            Some(ret_val)
6266        }
6267    }
6268    ///
6269    /// If this is a native widget, return the associated QWindow.
6270    /// Otherwise return null.
6271    ///
6272    /// Native widgets include toplevel widgets, QGLWidget, and child widgets
6273    /// on which winId() was called.
6274    ///
6275    /// **See also:** [`win_id()`]
6276    pub fn window_handle(&self) -> Option<Window> {
6277        let (obj_data, funcs) = self.get_widget_obj_funcs();
6278        unsafe {
6279            let ret_val = ((*funcs).window_handle)(obj_data);
6280            if ret_val.qt_data == ::std::ptr::null() {
6281                return None;
6282            }
6283            let t = ret_val;
6284            let ret_val;
6285            if t.host_data != ::std::ptr::null() {
6286                ret_val = Window::new_from_rc(t);
6287            } else {
6288                ret_val = Window::new_from_owned(t);
6289            }
6290            Some(ret_val)
6291        }
6292    }
6293    ///
6294    /// Creates a QWidget that makes it possible to embed *window* into
6295    /// a QWidget-based application.
6296    ///
6297    /// The window container is created as a child of *parent* and with
6298    /// window flags *flags.*
6299    ///
6300    /// Once the window has been embedded into the container, the
6301    /// container will control the window's geometry and
6302    /// visibility. Explicit calls to QWindow::setGeometry(),
6303    /// QWindow::show() or QWindow::hide() on an embedded window is not
6304    /// recommended.
6305    ///
6306    /// The container takes over ownership of *window.* The window can
6307    /// be removed from the window container with a call to
6308    /// QWindow::setParent().
6309    ///
6310    /// The window container is attached as a native child window to the
6311    /// toplevel window it is a child of. When a window container is used
6312    /// as a child of a QAbstractScrollArea or QMdiArea, it will
6313    /// create a [native window](Native%20Widgets%20vs%20Alien%20Widgets)
6314    /// for
6315    /// every widget in its parent chain to allow for proper stacking and
6316    /// clipping in this use case. Creating a native window for the window
6317    /// container also allows for proper stacking and clipping. This must
6318    /// be done before showing the window container. Applications with
6319    /// many native child windows may suffer from performance issues.
6320    ///
6321    /// The window container has a number of known limitations:
6322    ///
6323    /// * Stacking order; The embedded window will stack on top of the widget hierarchy as an opaque box. The stacking order of multiple overlapping window container instances is undefined.
6324    /// * Rendering Integration; The window container does not interoperate with QGraphicsProxyWidget, QWidget::render() or similar functionality.
6325    /// * Focus Handling; It is possible to let the window container instance have any focus policy and it will delegate focus to the window via a call to QWindow::requestActivate(). However, returning to the normal focus chain from the QWindow instance will be up to the QWindow instance implementation itself. For instance, when entering a Qt Quick based window with tab focus, it is quite likely that further tab presses will only cycle inside the QML application. Also, whether QWindow::requestActivate() actually gives the window focus, is platform dependent.
6326    /// * Using many window container instances in a QWidget-based application can greatly hurt the overall performance of the application.
6327    pub fn create_window_container<A: WidgetTrait<'a>, W: WindowTrait<'a>>(
6328        window: &W,
6329        parent: &A,
6330        flags: WindowFlags,
6331    ) -> Option<Widget<'a>> {
6332        let (obj_window_1, _funcs) = window.get_window_obj_funcs();
6333        let (obj_parent_2, _funcs) = parent.get_widget_obj_funcs();
6334        let enum_flags_3 = flags.bits();
6335
6336        let (obj_data, funcs) = unsafe {
6337            (
6338                ::std::ptr::null(),
6339                (*((*rute_ffi_get()).get_widget)(::std::ptr::null()).all_funcs).widget_funcs,
6340            )
6341        };
6342        unsafe {
6343            let ret_val = ((*funcs).create_window_container)(
6344                obj_data,
6345                obj_window_1,
6346                obj_parent_2,
6347                enum_flags_3,
6348            );
6349            if ret_val.qt_data == ::std::ptr::null() {
6350                return None;
6351            }
6352            let t = ret_val;
6353            let ret_val;
6354            if t.host_data != ::std::ptr::null() {
6355                ret_val = Widget::new_from_rc(t);
6356            } else {
6357                ret_val = Widget::new_from_owned(t);
6358            }
6359            Some(ret_val)
6360        }
6361    }
6362    ///
6363    /// This signal is emitted when the window's title has changed, with the
6364    /// new *title* as an argument.
6365    ///
6366    pub fn set_window_title_changed_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6367    where
6368        F: Fn(&T, &str) + 'a,
6369        T: 'a,
6370    {
6371        let (obj_data, funcs) = self.get_widget_obj_funcs();
6372
6373        let f: Box<Box<Fn(&T, &str) + 'a>> = Box::new(Box::new(func));
6374        let user_data = data as *const _ as *const c_void;
6375
6376        unsafe {
6377            ((*funcs).set_window_title_changed_event)(
6378                obj_data,
6379                user_data,
6380                Box::into_raw(f) as *const _,
6381                transmute(widget_window_title_changed_trampoline_ud::<T> as usize),
6382            );
6383        }
6384
6385        self
6386    }
6387
6388    pub fn set_window_title_changed_event<F>(&self, func: F) -> &Self
6389    where
6390        F: Fn(&str) + 'a,
6391    {
6392        let (obj_data, funcs) = self.get_widget_obj_funcs();
6393        let f: Box<Box<Fn(&str) + 'a>> = Box::new(Box::new(func));
6394
6395        unsafe {
6396            ((*funcs).set_window_title_changed_event)(
6397                obj_data,
6398                ::std::ptr::null(),
6399                Box::into_raw(f) as *const _,
6400                transmute(widget_window_title_changed_trampoline as usize),
6401            );
6402        }
6403
6404        self
6405    }
6406    ///
6407    /// This signal is emitted when the window's icon has changed, with the
6408    /// new *icon* as an argument.
6409    ///
6410    pub fn set_window_icon_changed_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6411    where
6412        F: Fn(&T, &Icon) + 'a,
6413        T: 'a,
6414    {
6415        let (obj_data, funcs) = self.get_widget_obj_funcs();
6416
6417        let f: Box<Box<Fn(&T, &Icon) + 'a>> = Box::new(Box::new(func));
6418        let user_data = data as *const _ as *const c_void;
6419
6420        unsafe {
6421            ((*funcs).set_window_icon_changed_event)(
6422                obj_data,
6423                user_data,
6424                Box::into_raw(f) as *const _,
6425                transmute(widget_window_icon_changed_trampoline_ud::<T> as usize),
6426            );
6427        }
6428
6429        self
6430    }
6431
6432    pub fn set_window_icon_changed_event<F>(&self, func: F) -> &Self
6433    where
6434        F: Fn(&Icon) + 'a,
6435    {
6436        let (obj_data, funcs) = self.get_widget_obj_funcs();
6437        let f: Box<Box<Fn(&Icon) + 'a>> = Box::new(Box::new(func));
6438
6439        unsafe {
6440            ((*funcs).set_window_icon_changed_event)(
6441                obj_data,
6442                ::std::ptr::null(),
6443                Box::into_raw(f) as *const _,
6444                transmute(widget_window_icon_changed_trampoline as usize),
6445            );
6446        }
6447
6448        self
6449    }
6450    ///
6451    /// This signal is emitted when the window's icon text has changed, with the
6452    /// new *iconText* as an argument.
6453    ///
6454    /// This signal is deprecated.
6455    pub fn set_window_icon_text_changed_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6456    where
6457        F: Fn(&T, &str) + 'a,
6458        T: 'a,
6459    {
6460        let (obj_data, funcs) = self.get_widget_obj_funcs();
6461
6462        let f: Box<Box<Fn(&T, &str) + 'a>> = Box::new(Box::new(func));
6463        let user_data = data as *const _ as *const c_void;
6464
6465        unsafe {
6466            ((*funcs).set_window_icon_text_changed_event)(
6467                obj_data,
6468                user_data,
6469                Box::into_raw(f) as *const _,
6470                transmute(widget_window_icon_text_changed_trampoline_ud::<T> as usize),
6471            );
6472        }
6473
6474        self
6475    }
6476
6477    pub fn set_window_icon_text_changed_event<F>(&self, func: F) -> &Self
6478    where
6479        F: Fn(&str) + 'a,
6480    {
6481        let (obj_data, funcs) = self.get_widget_obj_funcs();
6482        let f: Box<Box<Fn(&str) + 'a>> = Box::new(Box::new(func));
6483
6484        unsafe {
6485            ((*funcs).set_window_icon_text_changed_event)(
6486                obj_data,
6487                ::std::ptr::null(),
6488                Box::into_raw(f) as *const _,
6489                transmute(widget_window_icon_text_changed_trampoline as usize),
6490            );
6491        }
6492
6493        self
6494    }
6495    ///
6496    /// This signal is emitted when the widget's [contextMenuPolicy](contextMenuPolicy)
6497    /// is
6498    /// Qt::CustomContextMenu, and the user has requested a context menu on
6499    /// the widget. The position *pos* is the position of the context menu
6500    /// event that the widget receives. Normally this is in widget
6501    /// coordinates. The exception to this rule is QAbstractScrollArea and
6502    /// its subclasses that map the context menu event to coordinates of the
6503    /// [viewport()](QAbstractScrollArea::viewport())
6504    ///
6505    ///
6506    /// **See also:** [`map_to_global()`]
6507    /// [`Menu`]
6508    /// contextMenuPolicy
6509    pub fn set_custom_context_menu_requested_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6510    where
6511        F: Fn(&T, &Point) + 'a,
6512        T: 'a,
6513    {
6514        let (obj_data, funcs) = self.get_widget_obj_funcs();
6515
6516        let f: Box<Box<Fn(&T, &Point) + 'a>> = Box::new(Box::new(func));
6517        let user_data = data as *const _ as *const c_void;
6518
6519        unsafe {
6520            ((*funcs).set_custom_context_menu_requested_event)(
6521                obj_data,
6522                user_data,
6523                Box::into_raw(f) as *const _,
6524                transmute(widget_custom_context_menu_requested_trampoline_ud::<T> as usize),
6525            );
6526        }
6527
6528        self
6529    }
6530
6531    pub fn set_custom_context_menu_requested_event<F>(&self, func: F) -> &Self
6532    where
6533        F: Fn(&Point) + 'a,
6534    {
6535        let (obj_data, funcs) = self.get_widget_obj_funcs();
6536        let f: Box<Box<Fn(&Point) + 'a>> = Box::new(Box::new(func));
6537
6538        unsafe {
6539            ((*funcs).set_custom_context_menu_requested_event)(
6540                obj_data,
6541                ::std::ptr::null(),
6542                Box::into_raw(f) as *const _,
6543                transmute(widget_custom_context_menu_requested_trampoline as usize),
6544            );
6545        }
6546
6547        self
6548    }
6549    ///
6550    /// This is the main event handler; it handles event *event.* You can
6551    /// reimplement this function in a subclass, but we recommend using
6552    /// one of the specialized event handlers instead.
6553    ///
6554    /// Key press and release events are treated differently from other
6555    /// events. event() checks for Tab and Shift+Tab and tries to move the
6556    /// focus appropriately. If there is no widget to move the focus to
6557    /// (or the key press is not Tab or Shift+Tab), event() calls
6558    /// keyPressEvent().
6559    ///
6560    /// Mouse and tablet event handling is also slightly special: only
6561    /// when the widget is [enabled,](enabled,)
6562    /// event() will call the specialized
6563    /// handlers such as mousePressEvent(); otherwise it will discard the
6564    /// event.
6565    ///
6566    /// This function returns `true` if the event was recognized, otherwise
6567    /// it returns `false.` If the recognized event was accepted (see [QEvent::accepted),](QEvent::accepted),)
6568    /// any further processing such as event
6569    /// propagation to the parent widget stops.
6570    ///
6571    /// **See also:** [`close_event()`]
6572    /// [`focus_in_event()`]
6573    /// [`focus_out_event()`]
6574    /// [`enter_event()`]
6575    /// [`key_press_event()`]
6576    /// [`key_release_event()`]
6577    /// [`leave_event()`]
6578    /// [`mouse_double_click_event()`]
6579    /// [`mouse_move_event()`]
6580    /// [`mouse_press_event()`]
6581    /// [`mouse_release_event()`]
6582    /// [`move_event()`]
6583    /// [`paint_event()`]
6584    /// [`resize_event()`]
6585    /// [`Object::event`]
6586    /// [`Object::timer_event`]
6587    ///
6588    /// This event handler, for event *event,* can be reimplemented in a
6589    /// subclass to receive mouse press events for the widget.
6590    ///
6591    /// If you create new widgets in the mousePressEvent() the
6592    /// mouseReleaseEvent() may not end up where you expect, depending on
6593    /// the underlying window system (or X11 window manager), the widgets'
6594    /// location and maybe more.
6595    ///
6596    /// The default implementation implements the closing of popup widgets
6597    /// when you click outside the window. For other widget types it does
6598    /// nothing.
6599    ///
6600    /// **See also:** [`mouse_release_event()`]
6601    /// [`mouse_double_click_event()`]
6602    /// [`mouse_move_event()`]
6603    /// [`event()`]
6604    /// [`MouseEvent`]
6605    /// {Scribble Example}
6606    pub fn set_mouse_press_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6607    where
6608        F: Fn(&T, &MouseEvent) + 'a,
6609        T: 'a,
6610    {
6611        let (obj_data, funcs) = self.get_widget_obj_funcs();
6612
6613        let f: Box<Box<Fn(&T, &MouseEvent) + 'a>> = Box::new(Box::new(func));
6614        let user_data = data as *const _ as *const c_void;
6615
6616        unsafe {
6617            ((*funcs).set_mouse_press_event)(
6618                obj_data,
6619                user_data,
6620                Box::into_raw(f) as *const _,
6621                transmute(widget_mouse_press_trampoline_ud::<T> as usize),
6622            );
6623        }
6624
6625        self
6626    }
6627
6628    pub fn set_mouse_press_event<F>(&self, func: F) -> &Self
6629    where
6630        F: Fn(&MouseEvent) + 'a,
6631    {
6632        let (obj_data, funcs) = self.get_widget_obj_funcs();
6633        let f: Box<Box<Fn(&MouseEvent) + 'a>> = Box::new(Box::new(func));
6634
6635        unsafe {
6636            ((*funcs).set_mouse_press_event)(
6637                obj_data,
6638                ::std::ptr::null(),
6639                Box::into_raw(f) as *const _,
6640                transmute(widget_mouse_press_trampoline as usize),
6641            );
6642        }
6643
6644        self
6645    }
6646    ///
6647    /// This event handler, for event *event,* can be reimplemented in a
6648    /// subclass to receive mouse release events for the widget.
6649    ///
6650    /// **See also:** [`mouse_press_event()`]
6651    /// [`mouse_double_click_event()`]
6652    /// [`mouse_move_event()`]
6653    /// [`event()`]
6654    /// [`MouseEvent`]
6655    /// {Scribble Example}
6656    pub fn set_mouse_release_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6657    where
6658        F: Fn(&T, &MouseEvent) + 'a,
6659        T: 'a,
6660    {
6661        let (obj_data, funcs) = self.get_widget_obj_funcs();
6662
6663        let f: Box<Box<Fn(&T, &MouseEvent) + 'a>> = Box::new(Box::new(func));
6664        let user_data = data as *const _ as *const c_void;
6665
6666        unsafe {
6667            ((*funcs).set_mouse_release_event)(
6668                obj_data,
6669                user_data,
6670                Box::into_raw(f) as *const _,
6671                transmute(widget_mouse_release_trampoline_ud::<T> as usize),
6672            );
6673        }
6674
6675        self
6676    }
6677
6678    pub fn set_mouse_release_event<F>(&self, func: F) -> &Self
6679    where
6680        F: Fn(&MouseEvent) + 'a,
6681    {
6682        let (obj_data, funcs) = self.get_widget_obj_funcs();
6683        let f: Box<Box<Fn(&MouseEvent) + 'a>> = Box::new(Box::new(func));
6684
6685        unsafe {
6686            ((*funcs).set_mouse_release_event)(
6687                obj_data,
6688                ::std::ptr::null(),
6689                Box::into_raw(f) as *const _,
6690                transmute(widget_mouse_release_trampoline as usize),
6691            );
6692        }
6693
6694        self
6695    }
6696    ///
6697    /// This event handler, for event *event,* can be reimplemented in a
6698    /// subclass to receive mouse double click events for the widget.
6699    ///
6700    /// The default implementation calls mousePressEvent().
6701    ///
6702    /// **Note**: The widget will also receive mouse press and mouse release
6703    /// events in addition to the double click event. It is up to the
6704    /// developer to ensure that the application interprets these events
6705    /// correctly.
6706    ///
6707    /// **See also:** [`mouse_press_event()`]
6708    /// [`mouse_release_event()`]
6709    /// [`mouse_move_event()`]
6710    /// [`event()`]
6711    /// [`MouseEvent`]
6712    pub fn set_mouse_double_click_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6713    where
6714        F: Fn(&T, &MouseEvent) + 'a,
6715        T: 'a,
6716    {
6717        let (obj_data, funcs) = self.get_widget_obj_funcs();
6718
6719        let f: Box<Box<Fn(&T, &MouseEvent) + 'a>> = Box::new(Box::new(func));
6720        let user_data = data as *const _ as *const c_void;
6721
6722        unsafe {
6723            ((*funcs).set_mouse_double_click_event)(
6724                obj_data,
6725                user_data,
6726                Box::into_raw(f) as *const _,
6727                transmute(widget_mouse_double_click_trampoline_ud::<T> as usize),
6728            );
6729        }
6730
6731        self
6732    }
6733
6734    pub fn set_mouse_double_click_event<F>(&self, func: F) -> &Self
6735    where
6736        F: Fn(&MouseEvent) + 'a,
6737    {
6738        let (obj_data, funcs) = self.get_widget_obj_funcs();
6739        let f: Box<Box<Fn(&MouseEvent) + 'a>> = Box::new(Box::new(func));
6740
6741        unsafe {
6742            ((*funcs).set_mouse_double_click_event)(
6743                obj_data,
6744                ::std::ptr::null(),
6745                Box::into_raw(f) as *const _,
6746                transmute(widget_mouse_double_click_trampoline as usize),
6747            );
6748        }
6749
6750        self
6751    }
6752    ///
6753    /// This event handler, for event *event,* can be reimplemented in a
6754    /// subclass to receive mouse move events for the widget.
6755    ///
6756    /// If mouse tracking is switched off, mouse move events only occur if
6757    /// a mouse button is pressed while the mouse is being moved. If mouse
6758    /// tracking is switched on, mouse move events occur even if no mouse
6759    /// button is pressed.
6760    ///
6761    /// QMouseEvent::pos() reports the position of the mouse cursor,
6762    /// relative to this widget. For press and release events, the
6763    /// position is usually the same as the position of the last mouse
6764    /// move event, but it might be different if the user's hand shakes.
6765    /// This is a feature of the underlying window system, not Qt.
6766    ///
6767    /// If you want to show a tooltip immediately, while the mouse is
6768    /// moving (e.g., to get the mouse coordinates with QMouseEvent::pos()
6769    /// and show them as a tooltip), you must first enable mouse tracking
6770    /// as described above. Then, to ensure that the tooltip is updated
6771    /// immediately, you must call QToolTip::showText() instead of
6772    /// setToolTip() in your implementation of mouseMoveEvent().
6773    ///
6774    /// **See also:** [`set_mouse_tracking()`]
6775    /// [`mouse_press_event()`]
6776    /// [`mouse_release_event()`]
6777    /// [`mouse_double_click_event()`]
6778    /// [`event()`]
6779    /// [`MouseEvent`]
6780    /// {Scribble Example}
6781    pub fn set_mouse_move_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6782    where
6783        F: Fn(&T, &MouseEvent) + 'a,
6784        T: 'a,
6785    {
6786        let (obj_data, funcs) = self.get_widget_obj_funcs();
6787
6788        let f: Box<Box<Fn(&T, &MouseEvent) + 'a>> = Box::new(Box::new(func));
6789        let user_data = data as *const _ as *const c_void;
6790
6791        unsafe {
6792            ((*funcs).set_mouse_move_event)(
6793                obj_data,
6794                user_data,
6795                Box::into_raw(f) as *const _,
6796                transmute(widget_mouse_move_trampoline_ud::<T> as usize),
6797            );
6798        }
6799
6800        self
6801    }
6802
6803    pub fn set_mouse_move_event<F>(&self, func: F) -> &Self
6804    where
6805        F: Fn(&MouseEvent) + 'a,
6806    {
6807        let (obj_data, funcs) = self.get_widget_obj_funcs();
6808        let f: Box<Box<Fn(&MouseEvent) + 'a>> = Box::new(Box::new(func));
6809
6810        unsafe {
6811            ((*funcs).set_mouse_move_event)(
6812                obj_data,
6813                ::std::ptr::null(),
6814                Box::into_raw(f) as *const _,
6815                transmute(widget_mouse_move_trampoline as usize),
6816            );
6817        }
6818
6819        self
6820    }
6821    ///
6822    /// This event handler, for event *event,* can be reimplemented in a
6823    /// subclass to receive wheel events for the widget.
6824    ///
6825    /// If you reimplement this handler, it is very important that you
6826    /// [ignore()](QEvent)
6827    /// the event if you do not handle
6828    /// it, so that the widget's parent can interpret it.
6829    ///
6830    /// The default implementation ignores the event.
6831    ///
6832    /// **See also:** [`Event::ignore`]
6833    /// [`Event::accept`]
6834    /// [`event()`]
6835    /// [`WheelEvent`]
6836    pub fn set_wheel_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6837    where
6838        F: Fn(&T, &WheelEvent) + 'a,
6839        T: 'a,
6840    {
6841        let (obj_data, funcs) = self.get_widget_obj_funcs();
6842
6843        let f: Box<Box<Fn(&T, &WheelEvent) + 'a>> = Box::new(Box::new(func));
6844        let user_data = data as *const _ as *const c_void;
6845
6846        unsafe {
6847            ((*funcs).set_wheel_event)(
6848                obj_data,
6849                user_data,
6850                Box::into_raw(f) as *const _,
6851                transmute(widget_wheel_trampoline_ud::<T> as usize),
6852            );
6853        }
6854
6855        self
6856    }
6857
6858    pub fn set_wheel_event<F>(&self, func: F) -> &Self
6859    where
6860        F: Fn(&WheelEvent) + 'a,
6861    {
6862        let (obj_data, funcs) = self.get_widget_obj_funcs();
6863        let f: Box<Box<Fn(&WheelEvent) + 'a>> = Box::new(Box::new(func));
6864
6865        unsafe {
6866            ((*funcs).set_wheel_event)(
6867                obj_data,
6868                ::std::ptr::null(),
6869                Box::into_raw(f) as *const _,
6870                transmute(widget_wheel_trampoline as usize),
6871            );
6872        }
6873
6874        self
6875    }
6876    ///
6877    /// This event handler, for event *event,* can be reimplemented in a
6878    /// subclass to receive key press events for the widget.
6879    ///
6880    /// A widget must call setFocusPolicy() to accept focus initially and
6881    /// have focus in order to receive a key press event.
6882    ///
6883    /// If you reimplement this handler, it is very important that you
6884    /// call the base class implementation if you do not act upon the key.
6885    ///
6886    /// The default implementation closes popup widgets if the user
6887    /// presses the key sequence for QKeySequence::Cancel (typically the
6888    /// Escape key). Otherwise the event is ignored, so that the widget's
6889    /// parent can interpret it.
6890    ///
6891    /// Note that QKeyEvent starts with isAccepted() == true, so you do not
6892    /// need to call QKeyEvent::accept() - just do not call the base class
6893    /// implementation if you act upon the key.
6894    ///
6895    /// **See also:** [`key_release_event()`]
6896    /// [`set_focus_policy()`]
6897    /// [`focus_in_event()`]
6898    /// [`focus_out_event()`]
6899    /// [`event()`]
6900    /// [`KeyEvent`]
6901    /// {Tetrix Example}
6902    pub fn set_key_press_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6903    where
6904        F: Fn(&T, &KeyEvent) + 'a,
6905        T: 'a,
6906    {
6907        let (obj_data, funcs) = self.get_widget_obj_funcs();
6908
6909        let f: Box<Box<Fn(&T, &KeyEvent) + 'a>> = Box::new(Box::new(func));
6910        let user_data = data as *const _ as *const c_void;
6911
6912        unsafe {
6913            ((*funcs).set_key_press_event)(
6914                obj_data,
6915                user_data,
6916                Box::into_raw(f) as *const _,
6917                transmute(widget_key_press_trampoline_ud::<T> as usize),
6918            );
6919        }
6920
6921        self
6922    }
6923
6924    pub fn set_key_press_event<F>(&self, func: F) -> &Self
6925    where
6926        F: Fn(&KeyEvent) + 'a,
6927    {
6928        let (obj_data, funcs) = self.get_widget_obj_funcs();
6929        let f: Box<Box<Fn(&KeyEvent) + 'a>> = Box::new(Box::new(func));
6930
6931        unsafe {
6932            ((*funcs).set_key_press_event)(
6933                obj_data,
6934                ::std::ptr::null(),
6935                Box::into_raw(f) as *const _,
6936                transmute(widget_key_press_trampoline as usize),
6937            );
6938        }
6939
6940        self
6941    }
6942    ///
6943    /// This event handler, for event *event,* can be reimplemented in a
6944    /// subclass to receive key release events for the widget.
6945    ///
6946    /// A widget must [accept focus](setFocusPolicy())
6947    ///
6948    /// initially and [have focus](hasFocus())
6949    /// in order to
6950    /// receive a key release event.
6951    ///
6952    /// If you reimplement this handler, it is very important that you
6953    /// call the base class implementation if you do not act upon the key.
6954    ///
6955    /// The default implementation ignores the event, so that the widget's
6956    /// parent can interpret it.
6957    ///
6958    /// Note that QKeyEvent starts with isAccepted() == true, so you do not
6959    /// need to call QKeyEvent::accept() - just do not call the base class
6960    /// implementation if you act upon the key.
6961    ///
6962    /// **See also:** [`key_press_event()`]
6963    /// [`Event::ignore`]
6964    /// [`set_focus_policy()`]
6965    /// [`focus_in_event()`]
6966    /// [`focus_out_event()`]
6967    /// [`event()`]
6968    /// [`KeyEvent`]
6969    pub fn set_key_release_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
6970    where
6971        F: Fn(&T, &KeyEvent) + 'a,
6972        T: 'a,
6973    {
6974        let (obj_data, funcs) = self.get_widget_obj_funcs();
6975
6976        let f: Box<Box<Fn(&T, &KeyEvent) + 'a>> = Box::new(Box::new(func));
6977        let user_data = data as *const _ as *const c_void;
6978
6979        unsafe {
6980            ((*funcs).set_key_release_event)(
6981                obj_data,
6982                user_data,
6983                Box::into_raw(f) as *const _,
6984                transmute(widget_key_release_trampoline_ud::<T> as usize),
6985            );
6986        }
6987
6988        self
6989    }
6990
6991    pub fn set_key_release_event<F>(&self, func: F) -> &Self
6992    where
6993        F: Fn(&KeyEvent) + 'a,
6994    {
6995        let (obj_data, funcs) = self.get_widget_obj_funcs();
6996        let f: Box<Box<Fn(&KeyEvent) + 'a>> = Box::new(Box::new(func));
6997
6998        unsafe {
6999            ((*funcs).set_key_release_event)(
7000                obj_data,
7001                ::std::ptr::null(),
7002                Box::into_raw(f) as *const _,
7003                transmute(widget_key_release_trampoline as usize),
7004            );
7005        }
7006
7007        self
7008    }
7009    ///
7010    /// This event handler can be reimplemented in a subclass to receive
7011    /// keyboard focus events (focus received) for the widget. The event
7012    /// is passed in the *event* parameter
7013    ///
7014    /// A widget normally must setFocusPolicy() to something other than
7015    /// Qt::NoFocus in order to receive focus events. (Note that the
7016    /// application programmer can call setFocus() on any widget, even
7017    /// those that do not normally accept focus.)
7018    ///
7019    /// The default implementation updates the widget (except for windows
7020    /// that do not specify a focusPolicy()).
7021    ///
7022    /// **See also:** [`focus_out_event()`]
7023    /// [`set_focus_policy()`]
7024    /// [`key_press_event()`]
7025    /// [`key_release_event()`]
7026    /// [`event()`]
7027    /// [`FocusEvent`]
7028    pub fn set_focus_in_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7029    where
7030        F: Fn(&T, &FocusEvent) + 'a,
7031        T: 'a,
7032    {
7033        let (obj_data, funcs) = self.get_widget_obj_funcs();
7034
7035        let f: Box<Box<Fn(&T, &FocusEvent) + 'a>> = Box::new(Box::new(func));
7036        let user_data = data as *const _ as *const c_void;
7037
7038        unsafe {
7039            ((*funcs).set_focus_in_event)(
7040                obj_data,
7041                user_data,
7042                Box::into_raw(f) as *const _,
7043                transmute(widget_focus_in_trampoline_ud::<T> as usize),
7044            );
7045        }
7046
7047        self
7048    }
7049
7050    pub fn set_focus_in_event<F>(&self, func: F) -> &Self
7051    where
7052        F: Fn(&FocusEvent) + 'a,
7053    {
7054        let (obj_data, funcs) = self.get_widget_obj_funcs();
7055        let f: Box<Box<Fn(&FocusEvent) + 'a>> = Box::new(Box::new(func));
7056
7057        unsafe {
7058            ((*funcs).set_focus_in_event)(
7059                obj_data,
7060                ::std::ptr::null(),
7061                Box::into_raw(f) as *const _,
7062                transmute(widget_focus_in_trampoline as usize),
7063            );
7064        }
7065
7066        self
7067    }
7068    ///
7069    /// This event handler can be reimplemented in a subclass to receive
7070    /// keyboard focus events (focus lost) for the widget. The events is
7071    /// passed in the *event* parameter.
7072    ///
7073    /// A widget normally must setFocusPolicy() to something other than
7074    /// Qt::NoFocus in order to receive focus events. (Note that the
7075    /// application programmer can call setFocus() on any widget, even
7076    /// those that do not normally accept focus.)
7077    ///
7078    /// The default implementation updates the widget (except for windows
7079    /// that do not specify a focusPolicy()).
7080    ///
7081    /// **See also:** [`focus_in_event()`]
7082    /// [`set_focus_policy()`]
7083    /// [`key_press_event()`]
7084    /// [`key_release_event()`]
7085    /// [`event()`]
7086    /// [`FocusEvent`]
7087    pub fn set_focus_out_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7088    where
7089        F: Fn(&T, &FocusEvent) + 'a,
7090        T: 'a,
7091    {
7092        let (obj_data, funcs) = self.get_widget_obj_funcs();
7093
7094        let f: Box<Box<Fn(&T, &FocusEvent) + 'a>> = Box::new(Box::new(func));
7095        let user_data = data as *const _ as *const c_void;
7096
7097        unsafe {
7098            ((*funcs).set_focus_out_event)(
7099                obj_data,
7100                user_data,
7101                Box::into_raw(f) as *const _,
7102                transmute(widget_focus_out_trampoline_ud::<T> as usize),
7103            );
7104        }
7105
7106        self
7107    }
7108
7109    pub fn set_focus_out_event<F>(&self, func: F) -> &Self
7110    where
7111        F: Fn(&FocusEvent) + 'a,
7112    {
7113        let (obj_data, funcs) = self.get_widget_obj_funcs();
7114        let f: Box<Box<Fn(&FocusEvent) + 'a>> = Box::new(Box::new(func));
7115
7116        unsafe {
7117            ((*funcs).set_focus_out_event)(
7118                obj_data,
7119                ::std::ptr::null(),
7120                Box::into_raw(f) as *const _,
7121                transmute(widget_focus_out_trampoline as usize),
7122            );
7123        }
7124
7125        self
7126    }
7127    ///
7128    /// This event handler can be reimplemented in a subclass to receive
7129    /// widget enter events which are passed in the *event* parameter.
7130    ///
7131    /// An event is sent to the widget when the mouse cursor enters the
7132    /// widget.
7133    ///
7134    /// **See also:** [`leave_event()`]
7135    /// [`mouse_move_event()`]
7136    /// [`event()`]
7137    pub fn set_enter_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7138    where
7139        F: Fn(&T, &Event) + 'a,
7140        T: 'a,
7141    {
7142        let (obj_data, funcs) = self.get_widget_obj_funcs();
7143
7144        let f: Box<Box<Fn(&T, &Event) + 'a>> = Box::new(Box::new(func));
7145        let user_data = data as *const _ as *const c_void;
7146
7147        unsafe {
7148            ((*funcs).set_enter_event)(
7149                obj_data,
7150                user_data,
7151                Box::into_raw(f) as *const _,
7152                transmute(widget_enter_trampoline_ud::<T> as usize),
7153            );
7154        }
7155
7156        self
7157    }
7158
7159    pub fn set_enter_event<F>(&self, func: F) -> &Self
7160    where
7161        F: Fn(&Event) + 'a,
7162    {
7163        let (obj_data, funcs) = self.get_widget_obj_funcs();
7164        let f: Box<Box<Fn(&Event) + 'a>> = Box::new(Box::new(func));
7165
7166        unsafe {
7167            ((*funcs).set_enter_event)(
7168                obj_data,
7169                ::std::ptr::null(),
7170                Box::into_raw(f) as *const _,
7171                transmute(widget_enter_trampoline as usize),
7172            );
7173        }
7174
7175        self
7176    }
7177    ///
7178    /// This event handler can be reimplemented in a subclass to receive
7179    /// widget leave events which are passed in the *event* parameter.
7180    ///
7181    /// A leave event is sent to the widget when the mouse cursor leaves
7182    /// the widget.
7183    ///
7184    /// **See also:** [`enter_event()`]
7185    /// [`mouse_move_event()`]
7186    /// [`event()`]
7187    pub fn set_leave_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7188    where
7189        F: Fn(&T, &Event) + 'a,
7190        T: 'a,
7191    {
7192        let (obj_data, funcs) = self.get_widget_obj_funcs();
7193
7194        let f: Box<Box<Fn(&T, &Event) + 'a>> = Box::new(Box::new(func));
7195        let user_data = data as *const _ as *const c_void;
7196
7197        unsafe {
7198            ((*funcs).set_leave_event)(
7199                obj_data,
7200                user_data,
7201                Box::into_raw(f) as *const _,
7202                transmute(widget_leave_trampoline_ud::<T> as usize),
7203            );
7204        }
7205
7206        self
7207    }
7208
7209    pub fn set_leave_event<F>(&self, func: F) -> &Self
7210    where
7211        F: Fn(&Event) + 'a,
7212    {
7213        let (obj_data, funcs) = self.get_widget_obj_funcs();
7214        let f: Box<Box<Fn(&Event) + 'a>> = Box::new(Box::new(func));
7215
7216        unsafe {
7217            ((*funcs).set_leave_event)(
7218                obj_data,
7219                ::std::ptr::null(),
7220                Box::into_raw(f) as *const _,
7221                transmute(widget_leave_trampoline as usize),
7222            );
7223        }
7224
7225        self
7226    }
7227    ///
7228    /// This event handler can be reimplemented in a subclass to receive paint
7229    /// events passed in *event.*
7230    ///
7231    /// A paint event is a request to repaint all or part of a widget. It can
7232    /// happen for one of the following reasons:
7233    ///
7234    /// * repaint() or update() was invoked,
7235    /// * the widget was obscured and has now been uncovered, or
7236    /// * many other reasons.
7237    ///
7238    /// Many widgets can simply repaint their entire surface when asked to, but
7239    /// some slow widgets need to optimize by painting only the requested region:
7240    /// QPaintEvent::region(). This speed optimization does not change the result,
7241    /// as painting is clipped to that region during event processing. QListView
7242    /// and QTableView do this, for example.
7243    ///
7244    /// Qt also tries to speed up painting by merging multiple paint events into
7245    /// one. When update() is called several times or the window system sends
7246    /// several paint events, Qt merges these events into one event with a larger
7247    /// region (see QRegion::united()). The repaint() function does not permit this
7248    /// optimization, so we suggest using update() whenever possible.
7249    ///
7250    /// When the paint event occurs, the update region has normally been erased, so
7251    /// you are painting on the widget's background.
7252    ///
7253    /// The background can be set using setBackgroundRole() and setPalette().
7254    ///
7255    /// Since Qt 4.0, QWidget automatically double-buffers its painting, so there
7256    /// is no need to write double-buffering code in paintEvent() to avoid flicker.
7257    ///
7258    /// **Note**: Generally, you should refrain from calling update() or repaint()
7259    /// **inside** a paintEvent(). For example, calling update() or repaint() on
7260    /// children inside a paintEvent() results in undefined behavior; the child may
7261    /// or may not get a paint event.
7262    ///
7263    /// **Warning**: If you are using a custom paint engine without Qt's backingstore,
7264    /// Qt::WA_PaintOnScreen must be set. Otherwise, QWidget::paintEngine() will
7265    /// never be called; the backingstore will be used instead.
7266    ///
7267    /// **See also:** [`event()`]
7268    /// [`repaint()`]
7269    /// [`update()`]
7270    /// [`Painter`]
7271    /// [`Pixmap`]
7272    /// [`PaintEvent`]
7273    /// {Analog Clock Example}
7274    pub fn set_paint_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7275    where
7276        F: Fn(&T, &PaintEvent) + 'a,
7277        T: 'a,
7278    {
7279        let (obj_data, funcs) = self.get_widget_obj_funcs();
7280
7281        let f: Box<Box<Fn(&T, &PaintEvent) + 'a>> = Box::new(Box::new(func));
7282        let user_data = data as *const _ as *const c_void;
7283
7284        unsafe {
7285            ((*funcs).set_paint_event)(
7286                obj_data,
7287                user_data,
7288                Box::into_raw(f) as *const _,
7289                transmute(widget_paint_trampoline_ud::<T> as usize),
7290            );
7291        }
7292
7293        self
7294    }
7295
7296    pub fn set_paint_event<F>(&self, func: F) -> &Self
7297    where
7298        F: Fn(&PaintEvent) + 'a,
7299    {
7300        let (obj_data, funcs) = self.get_widget_obj_funcs();
7301        let f: Box<Box<Fn(&PaintEvent) + 'a>> = Box::new(Box::new(func));
7302
7303        unsafe {
7304            ((*funcs).set_paint_event)(
7305                obj_data,
7306                ::std::ptr::null(),
7307                Box::into_raw(f) as *const _,
7308                transmute(widget_paint_trampoline as usize),
7309            );
7310        }
7311
7312        self
7313    }
7314    ///
7315    /// This event handler can be reimplemented in a subclass to receive
7316    /// widget move events which are passed in the *event* parameter.
7317    /// When the widget receives this event, it is already at the new
7318    /// position.
7319    ///
7320    /// The old position is accessible through QMoveEvent::oldPos().
7321    ///
7322    /// **See also:** [`resize_event()`]
7323    /// [`event()`]
7324    /// [`move()`]
7325    /// [`MoveEvent`]
7326    pub fn set_move_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7327    where
7328        F: Fn(&T, &MoveEvent) + 'a,
7329        T: 'a,
7330    {
7331        let (obj_data, funcs) = self.get_widget_obj_funcs();
7332
7333        let f: Box<Box<Fn(&T, &MoveEvent) + 'a>> = Box::new(Box::new(func));
7334        let user_data = data as *const _ as *const c_void;
7335
7336        unsafe {
7337            ((*funcs).set_move_event)(
7338                obj_data,
7339                user_data,
7340                Box::into_raw(f) as *const _,
7341                transmute(widget_move_trampoline_ud::<T> as usize),
7342            );
7343        }
7344
7345        self
7346    }
7347
7348    pub fn set_move_event<F>(&self, func: F) -> &Self
7349    where
7350        F: Fn(&MoveEvent) + 'a,
7351    {
7352        let (obj_data, funcs) = self.get_widget_obj_funcs();
7353        let f: Box<Box<Fn(&MoveEvent) + 'a>> = Box::new(Box::new(func));
7354
7355        unsafe {
7356            ((*funcs).set_move_event)(
7357                obj_data,
7358                ::std::ptr::null(),
7359                Box::into_raw(f) as *const _,
7360                transmute(widget_move_trampoline as usize),
7361            );
7362        }
7363
7364        self
7365    }
7366    ///
7367    /// This event handler can be reimplemented in a subclass to receive
7368    /// widget resize events which are passed in the *event* parameter.
7369    /// When resizeEvent() is called, the widget already has its new
7370    /// geometry. The old size is accessible through
7371    /// QResizeEvent::oldSize().
7372    ///
7373    /// The widget will be erased and receive a paint event immediately
7374    /// after processing the resize event. No drawing need be (or should
7375    /// be) done inside this handler.
7376    ///
7377    /// **See also:** [`move_event()`]
7378    /// [`event()`]
7379    /// [`resize()`]
7380    /// [`ResizeEvent`]
7381    /// [`paint_event()`]
7382    /// {Scribble Example}
7383    pub fn set_resize_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7384    where
7385        F: Fn(&T, &ResizeEvent) + 'a,
7386        T: 'a,
7387    {
7388        let (obj_data, funcs) = self.get_widget_obj_funcs();
7389
7390        let f: Box<Box<Fn(&T, &ResizeEvent) + 'a>> = Box::new(Box::new(func));
7391        let user_data = data as *const _ as *const c_void;
7392
7393        unsafe {
7394            ((*funcs).set_resize_event)(
7395                obj_data,
7396                user_data,
7397                Box::into_raw(f) as *const _,
7398                transmute(widget_resize_trampoline_ud::<T> as usize),
7399            );
7400        }
7401
7402        self
7403    }
7404
7405    pub fn set_resize_event<F>(&self, func: F) -> &Self
7406    where
7407        F: Fn(&ResizeEvent) + 'a,
7408    {
7409        let (obj_data, funcs) = self.get_widget_obj_funcs();
7410        let f: Box<Box<Fn(&ResizeEvent) + 'a>> = Box::new(Box::new(func));
7411
7412        unsafe {
7413            ((*funcs).set_resize_event)(
7414                obj_data,
7415                ::std::ptr::null(),
7416                Box::into_raw(f) as *const _,
7417                transmute(widget_resize_trampoline as usize),
7418            );
7419        }
7420
7421        self
7422    }
7423    ///
7424    /// This event handler is called with the given *event* when Qt receives a window
7425    /// close request for a top-level widget from the window system.
7426    ///
7427    /// By default, the event is accepted and the widget is closed. You can reimplement
7428    /// this function to change the way the widget responds to window close requests.
7429    /// For example, you can prevent the window from closing by calling [ignore()](QEvent::)
7430    ///
7431    /// on all events.
7432    ///
7433    /// Main window applications typically use reimplementations of this function to check
7434    /// whether the user's work has been saved and ask for permission before closing.
7435    /// For example, the [Application Example](Application%20Example)
7436    /// uses a helper function to determine whether
7437    /// or not to close the window:
7438    ///
7439    /// **See also:** [`event()`]
7440    /// [`hide()`]
7441    /// [`close()`]
7442    /// [`CloseEvent`]
7443    /// {Application Example}
7444    pub fn set_close_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7445    where
7446        F: Fn(&T, &CloseEvent) + 'a,
7447        T: 'a,
7448    {
7449        let (obj_data, funcs) = self.get_widget_obj_funcs();
7450
7451        let f: Box<Box<Fn(&T, &CloseEvent) + 'a>> = Box::new(Box::new(func));
7452        let user_data = data as *const _ as *const c_void;
7453
7454        unsafe {
7455            ((*funcs).set_close_event)(
7456                obj_data,
7457                user_data,
7458                Box::into_raw(f) as *const _,
7459                transmute(widget_close_trampoline_ud::<T> as usize),
7460            );
7461        }
7462
7463        self
7464    }
7465
7466    pub fn set_close_event<F>(&self, func: F) -> &Self
7467    where
7468        F: Fn(&CloseEvent) + 'a,
7469    {
7470        let (obj_data, funcs) = self.get_widget_obj_funcs();
7471        let f: Box<Box<Fn(&CloseEvent) + 'a>> = Box::new(Box::new(func));
7472
7473        unsafe {
7474            ((*funcs).set_close_event)(
7475                obj_data,
7476                ::std::ptr::null(),
7477                Box::into_raw(f) as *const _,
7478                transmute(widget_close_trampoline as usize),
7479            );
7480        }
7481
7482        self
7483    }
7484    ///
7485    /// This event handler, for event *event,* can be reimplemented in a
7486    /// subclass to receive widget context menu events.
7487    ///
7488    /// The handler is called when the widget's [contextMenuPolicy](contextMenuPolicy)
7489    /// is
7490    /// Qt::DefaultContextMenu.
7491    ///
7492    /// The default implementation ignores the context event.
7493    /// See the [QContextMenuEvent](QContextMenuEvent)
7494    /// documentation for more details.
7495    ///
7496    /// **See also:** [`event()`]
7497    /// [`ContextMenuEvent`]
7498    /// [`custom_context_menu_requested()`]
7499    pub fn set_context_menu_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7500    where
7501        F: Fn(&T, &ContextMenuEvent) + 'a,
7502        T: 'a,
7503    {
7504        let (obj_data, funcs) = self.get_widget_obj_funcs();
7505
7506        let f: Box<Box<Fn(&T, &ContextMenuEvent) + 'a>> = Box::new(Box::new(func));
7507        let user_data = data as *const _ as *const c_void;
7508
7509        unsafe {
7510            ((*funcs).set_context_menu_event)(
7511                obj_data,
7512                user_data,
7513                Box::into_raw(f) as *const _,
7514                transmute(widget_context_menu_trampoline_ud::<T> as usize),
7515            );
7516        }
7517
7518        self
7519    }
7520
7521    pub fn set_context_menu_event<F>(&self, func: F) -> &Self
7522    where
7523        F: Fn(&ContextMenuEvent) + 'a,
7524    {
7525        let (obj_data, funcs) = self.get_widget_obj_funcs();
7526        let f: Box<Box<Fn(&ContextMenuEvent) + 'a>> = Box::new(Box::new(func));
7527
7528        unsafe {
7529            ((*funcs).set_context_menu_event)(
7530                obj_data,
7531                ::std::ptr::null(),
7532                Box::into_raw(f) as *const _,
7533                transmute(widget_context_menu_trampoline as usize),
7534            );
7535        }
7536
7537        self
7538    }
7539    ///
7540    /// This event handler, for event *event,* can be reimplemented in a
7541    /// subclass to receive tablet events for the widget.
7542    ///
7543    /// If you reimplement this handler, it is very important that you
7544    /// [ignore()](QEvent)
7545    /// the event if you do not handle
7546    /// it, so that the widget's parent can interpret it.
7547    ///
7548    /// The default implementation ignores the event.
7549    ///
7550    /// If tablet tracking is switched off, tablet move events only occur if the
7551    /// stylus is in contact with the tablet, or at least one stylus button is
7552    /// pressed, while the stylus is being moved. If tablet tracking is switched on,
7553    /// tablet move events occur even while the stylus is hovering in proximity of
7554    /// the tablet, with no buttons pressed.
7555    ///
7556    /// **See also:** [`Event::ignore`]
7557    /// [`Event::accept`]
7558    /// [`event()`]
7559    /// [`set_tablet_tracking()`]
7560    /// [`TabletEvent`]
7561    pub fn set_tablet_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7562    where
7563        F: Fn(&T, &TabletEvent) + 'a,
7564        T: 'a,
7565    {
7566        let (obj_data, funcs) = self.get_widget_obj_funcs();
7567
7568        let f: Box<Box<Fn(&T, &TabletEvent) + 'a>> = Box::new(Box::new(func));
7569        let user_data = data as *const _ as *const c_void;
7570
7571        unsafe {
7572            ((*funcs).set_tablet_event)(
7573                obj_data,
7574                user_data,
7575                Box::into_raw(f) as *const _,
7576                transmute(widget_tablet_trampoline_ud::<T> as usize),
7577            );
7578        }
7579
7580        self
7581    }
7582
7583    pub fn set_tablet_event<F>(&self, func: F) -> &Self
7584    where
7585        F: Fn(&TabletEvent) + 'a,
7586    {
7587        let (obj_data, funcs) = self.get_widget_obj_funcs();
7588        let f: Box<Box<Fn(&TabletEvent) + 'a>> = Box::new(Box::new(func));
7589
7590        unsafe {
7591            ((*funcs).set_tablet_event)(
7592                obj_data,
7593                ::std::ptr::null(),
7594                Box::into_raw(f) as *const _,
7595                transmute(widget_tablet_trampoline as usize),
7596            );
7597        }
7598
7599        self
7600    }
7601    ///
7602    /// This event handler is called when a drag is in progress and the
7603    /// mouse enters this widget. The event is passed in the *event* parameter.
7604    ///
7605    /// If the event is ignored, the widget won't receive any [drag
7606    /// move events](dragMoveEvent())
7607    ///
7608    ///
7609    /// See the [Drag-and-drop documentation](dnd.html)
7610    /// for an
7611    /// overview of how to provide drag-and-drop in your application.
7612    ///
7613    /// **See also:** [`Drag`]
7614    /// [`DragEnterEvent`]
7615    pub fn set_drag_enter_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7616    where
7617        F: Fn(&T, &DragEnterEvent) + 'a,
7618        T: 'a,
7619    {
7620        let (obj_data, funcs) = self.get_widget_obj_funcs();
7621
7622        let f: Box<Box<Fn(&T, &DragEnterEvent) + 'a>> = Box::new(Box::new(func));
7623        let user_data = data as *const _ as *const c_void;
7624
7625        unsafe {
7626            ((*funcs).set_drag_enter_event)(
7627                obj_data,
7628                user_data,
7629                Box::into_raw(f) as *const _,
7630                transmute(widget_drag_enter_trampoline_ud::<T> as usize),
7631            );
7632        }
7633
7634        self
7635    }
7636
7637    pub fn set_drag_enter_event<F>(&self, func: F) -> &Self
7638    where
7639        F: Fn(&DragEnterEvent) + 'a,
7640    {
7641        let (obj_data, funcs) = self.get_widget_obj_funcs();
7642        let f: Box<Box<Fn(&DragEnterEvent) + 'a>> = Box::new(Box::new(func));
7643
7644        unsafe {
7645            ((*funcs).set_drag_enter_event)(
7646                obj_data,
7647                ::std::ptr::null(),
7648                Box::into_raw(f) as *const _,
7649                transmute(widget_drag_enter_trampoline as usize),
7650            );
7651        }
7652
7653        self
7654    }
7655    ///
7656    /// This event handler is called if a drag is in progress, and when
7657    /// any of the following conditions occur: the cursor enters this widget,
7658    /// the cursor moves within this widget, or a modifier key is pressed on
7659    /// the keyboard while this widget has the focus. The event is passed
7660    /// in the *event* parameter.
7661    ///
7662    /// See the [Drag-and-drop documentation](dnd.html)
7663    /// for an
7664    /// overview of how to provide drag-and-drop in your application.
7665    ///
7666    /// **See also:** [`Drag`]
7667    /// [`DragMoveEvent`]
7668    pub fn set_drag_move_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7669    where
7670        F: Fn(&T, &DragMoveEvent) + 'a,
7671        T: 'a,
7672    {
7673        let (obj_data, funcs) = self.get_widget_obj_funcs();
7674
7675        let f: Box<Box<Fn(&T, &DragMoveEvent) + 'a>> = Box::new(Box::new(func));
7676        let user_data = data as *const _ as *const c_void;
7677
7678        unsafe {
7679            ((*funcs).set_drag_move_event)(
7680                obj_data,
7681                user_data,
7682                Box::into_raw(f) as *const _,
7683                transmute(widget_drag_move_trampoline_ud::<T> as usize),
7684            );
7685        }
7686
7687        self
7688    }
7689
7690    pub fn set_drag_move_event<F>(&self, func: F) -> &Self
7691    where
7692        F: Fn(&DragMoveEvent) + 'a,
7693    {
7694        let (obj_data, funcs) = self.get_widget_obj_funcs();
7695        let f: Box<Box<Fn(&DragMoveEvent) + 'a>> = Box::new(Box::new(func));
7696
7697        unsafe {
7698            ((*funcs).set_drag_move_event)(
7699                obj_data,
7700                ::std::ptr::null(),
7701                Box::into_raw(f) as *const _,
7702                transmute(widget_drag_move_trampoline as usize),
7703            );
7704        }
7705
7706        self
7707    }
7708    ///
7709    /// This event handler is called when a drag is in progress and the
7710    /// mouse leaves this widget. The event is passed in the *event*
7711    /// parameter.
7712    ///
7713    /// See the [Drag-and-drop documentation](dnd.html)
7714    /// for an
7715    /// overview of how to provide drag-and-drop in your application.
7716    ///
7717    /// **See also:** [`Drag`]
7718    /// [`DragLeaveEvent`]
7719    pub fn set_drag_leave_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7720    where
7721        F: Fn(&T, &DragLeaveEvent) + 'a,
7722        T: 'a,
7723    {
7724        let (obj_data, funcs) = self.get_widget_obj_funcs();
7725
7726        let f: Box<Box<Fn(&T, &DragLeaveEvent) + 'a>> = Box::new(Box::new(func));
7727        let user_data = data as *const _ as *const c_void;
7728
7729        unsafe {
7730            ((*funcs).set_drag_leave_event)(
7731                obj_data,
7732                user_data,
7733                Box::into_raw(f) as *const _,
7734                transmute(widget_drag_leave_trampoline_ud::<T> as usize),
7735            );
7736        }
7737
7738        self
7739    }
7740
7741    pub fn set_drag_leave_event<F>(&self, func: F) -> &Self
7742    where
7743        F: Fn(&DragLeaveEvent) + 'a,
7744    {
7745        let (obj_data, funcs) = self.get_widget_obj_funcs();
7746        let f: Box<Box<Fn(&DragLeaveEvent) + 'a>> = Box::new(Box::new(func));
7747
7748        unsafe {
7749            ((*funcs).set_drag_leave_event)(
7750                obj_data,
7751                ::std::ptr::null(),
7752                Box::into_raw(f) as *const _,
7753                transmute(widget_drag_leave_trampoline as usize),
7754            );
7755        }
7756
7757        self
7758    }
7759    ///
7760    /// This event handler is called when the drag is dropped on this
7761    /// widget. The event is passed in the *event* parameter.
7762    ///
7763    /// See the [Drag-and-drop documentation](dnd.html)
7764    /// for an
7765    /// overview of how to provide drag-and-drop in your application.
7766    ///
7767    /// **See also:** [`Drag`]
7768    /// [`DropEvent`]
7769    pub fn set_drop_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7770    where
7771        F: Fn(&T, &DropEvent) + 'a,
7772        T: 'a,
7773    {
7774        let (obj_data, funcs) = self.get_widget_obj_funcs();
7775
7776        let f: Box<Box<Fn(&T, &DropEvent) + 'a>> = Box::new(Box::new(func));
7777        let user_data = data as *const _ as *const c_void;
7778
7779        unsafe {
7780            ((*funcs).set_drop_event)(
7781                obj_data,
7782                user_data,
7783                Box::into_raw(f) as *const _,
7784                transmute(widget_drop_trampoline_ud::<T> as usize),
7785            );
7786        }
7787
7788        self
7789    }
7790
7791    pub fn set_drop_event<F>(&self, func: F) -> &Self
7792    where
7793        F: Fn(&DropEvent) + 'a,
7794    {
7795        let (obj_data, funcs) = self.get_widget_obj_funcs();
7796        let f: Box<Box<Fn(&DropEvent) + 'a>> = Box::new(Box::new(func));
7797
7798        unsafe {
7799            ((*funcs).set_drop_event)(
7800                obj_data,
7801                ::std::ptr::null(),
7802                Box::into_raw(f) as *const _,
7803                transmute(widget_drop_trampoline as usize),
7804            );
7805        }
7806
7807        self
7808    }
7809    ///
7810    /// This event handler can be reimplemented in a subclass to receive
7811    /// widget show events which are passed in the *event* parameter.
7812    ///
7813    /// Non-spontaneous show events are sent to widgets immediately
7814    /// before they are shown. The spontaneous show events of windows are
7815    /// delivered afterwards.
7816    ///
7817    /// Note: A widget receives spontaneous show and hide events when its
7818    /// mapping status is changed by the window system, e.g. a spontaneous
7819    /// hide event when the user minimizes the window, and a spontaneous
7820    /// show event when the window is restored again. After receiving a
7821    /// spontaneous hide event, a widget is still considered visible in
7822    /// the sense of isVisible().
7823    ///
7824    /// **See also:** visible
7825    /// [`event()`]
7826    /// [`ShowEvent`]
7827    pub fn set_show_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7828    where
7829        F: Fn(&T, &ShowEvent) + 'a,
7830        T: 'a,
7831    {
7832        let (obj_data, funcs) = self.get_widget_obj_funcs();
7833
7834        let f: Box<Box<Fn(&T, &ShowEvent) + 'a>> = Box::new(Box::new(func));
7835        let user_data = data as *const _ as *const c_void;
7836
7837        unsafe {
7838            ((*funcs).set_show_event)(
7839                obj_data,
7840                user_data,
7841                Box::into_raw(f) as *const _,
7842                transmute(widget_show_trampoline_ud::<T> as usize),
7843            );
7844        }
7845
7846        self
7847    }
7848
7849    pub fn set_show_event<F>(&self, func: F) -> &Self
7850    where
7851        F: Fn(&ShowEvent) + 'a,
7852    {
7853        let (obj_data, funcs) = self.get_widget_obj_funcs();
7854        let f: Box<Box<Fn(&ShowEvent) + 'a>> = Box::new(Box::new(func));
7855
7856        unsafe {
7857            ((*funcs).set_show_event)(
7858                obj_data,
7859                ::std::ptr::null(),
7860                Box::into_raw(f) as *const _,
7861                transmute(widget_show_trampoline as usize),
7862            );
7863        }
7864
7865        self
7866    }
7867    ///
7868    /// This event handler can be reimplemented in a subclass to receive
7869    /// widget hide events. The event is passed in the *event* parameter.
7870    ///
7871    /// Hide events are sent to widgets immediately after they have been
7872    /// hidden.
7873    ///
7874    /// Note: A widget receives spontaneous show and hide events when its
7875    /// mapping status is changed by the window system, e.g. a spontaneous
7876    /// hide event when the user minimizes the window, and a spontaneous
7877    /// show event when the window is restored again. After receiving a
7878    /// spontaneous hide event, a widget is still considered visible in
7879    /// the sense of isVisible().
7880    ///
7881    /// **See also:** visible
7882    /// [`event()`]
7883    /// [`HideEvent`]
7884    pub fn set_hide_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7885    where
7886        F: Fn(&T, &HideEvent) + 'a,
7887        T: 'a,
7888    {
7889        let (obj_data, funcs) = self.get_widget_obj_funcs();
7890
7891        let f: Box<Box<Fn(&T, &HideEvent) + 'a>> = Box::new(Box::new(func));
7892        let user_data = data as *const _ as *const c_void;
7893
7894        unsafe {
7895            ((*funcs).set_hide_event)(
7896                obj_data,
7897                user_data,
7898                Box::into_raw(f) as *const _,
7899                transmute(widget_hide_trampoline_ud::<T> as usize),
7900            );
7901        }
7902
7903        self
7904    }
7905
7906    pub fn set_hide_event<F>(&self, func: F) -> &Self
7907    where
7908        F: Fn(&HideEvent) + 'a,
7909    {
7910        let (obj_data, funcs) = self.get_widget_obj_funcs();
7911        let f: Box<Box<Fn(&HideEvent) + 'a>> = Box::new(Box::new(func));
7912
7913        unsafe {
7914            ((*funcs).set_hide_event)(
7915                obj_data,
7916                ::std::ptr::null(),
7917                Box::into_raw(f) as *const _,
7918                transmute(widget_hide_trampoline as usize),
7919            );
7920        }
7921
7922        self
7923    }
7924    ///
7925    /// This event handler can be reimplemented to handle state changes.
7926    ///
7927    /// The state being changed in this event can be retrieved through the *event*
7928    /// supplied.
7929    ///
7930    /// Change events include: QEvent::ToolBarChange,
7931    /// QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange,
7932    /// QEvent::StyleChange, QEvent::PaletteChange,
7933    /// QEvent::WindowTitleChange, QEvent::IconTextChange,
7934    /// QEvent::ModifiedChange, QEvent::MouseTrackingChange,
7935    /// QEvent::ParentChange, QEvent::WindowStateChange,
7936    /// QEvent::LanguageChange, QEvent::LocaleChange,
7937    /// QEvent::LayoutDirectionChange, QEvent::ReadOnlyChange.
7938    ///
7939    pub fn set_change_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
7940    where
7941        F: Fn(&T, &Event) + 'a,
7942        T: 'a,
7943    {
7944        let (obj_data, funcs) = self.get_widget_obj_funcs();
7945
7946        let f: Box<Box<Fn(&T, &Event) + 'a>> = Box::new(Box::new(func));
7947        let user_data = data as *const _ as *const c_void;
7948
7949        unsafe {
7950            ((*funcs).set_change_event)(
7951                obj_data,
7952                user_data,
7953                Box::into_raw(f) as *const _,
7954                transmute(widget_change_trampoline_ud::<T> as usize),
7955            );
7956        }
7957
7958        self
7959    }
7960
7961    pub fn set_change_event<F>(&self, func: F) -> &Self
7962    where
7963        F: Fn(&Event) + 'a,
7964    {
7965        let (obj_data, funcs) = self.get_widget_obj_funcs();
7966        let f: Box<Box<Fn(&Event) + 'a>> = Box::new(Box::new(func));
7967
7968        unsafe {
7969            ((*funcs).set_change_event)(
7970                obj_data,
7971                ::std::ptr::null(),
7972                Box::into_raw(f) as *const _,
7973                transmute(widget_change_trampoline as usize),
7974            );
7975        }
7976
7977        self
7978    }
7979    ///
7980    /// Initializes the *painter* pen, background and font to the same as
7981    /// the given widget's. This function is called automatically when the
7982    /// painter is opened on a QWidget.
7983    ///
7984    /// This event handler, for event *event,* can be reimplemented in a
7985    /// subclass to receive Input Method composition events. This handler
7986    /// is called when the state of the input method changes.
7987    ///
7988    /// Note that when creating custom text editing widgets, the
7989    /// Qt::WA_InputMethodEnabled window attribute must be set explicitly
7990    /// (using the setAttribute() function) in order to receive input
7991    /// method events.
7992    ///
7993    /// The default implementation calls event->ignore(), which rejects the
7994    /// Input Method event. See the [QInputMethodEvent](QInputMethodEvent)
7995    /// documentation for more
7996    /// details.
7997    ///
7998    /// **See also:** [`event()`]
7999    /// [`InputMethodEvent`]
8000    ///
8001    /// This is only relevant for input widgets. It is used by
8002    /// the input method to retrieve hints as to how the input method
8003    /// should operate. For example, if the Qt::ImhFormattedNumbersOnly flag
8004    /// is set, the input method may change its visual components to reflect
8005    /// that only numbers can be entered.
8006    ///
8007    /// **Warning**: Some widgets require certain flags in order to work as
8008    /// intended. To set a flag, do `w->setInputMethodHints(w->inputMethodHints()|f)`
8009    /// instead of `w->setInputMethodHints(f)` .
8010    ///
8011    /// **Note**: The flags are only hints, so the particular input method
8012    /// implementation is free to ignore them. If you want to be
8013    /// sure that a certain type of characters are entered,
8014    /// you should also set a QValidator on the widget.
8015    ///
8016    /// The default value is Qt::ImhNone.
8017    ///
8018    /// **See also:** [`input_method_query()`]
8019    pub fn input_method_hints(&self) -> InputMethodHints {
8020        let (obj_data, funcs) = self.get_widget_obj_funcs();
8021        unsafe {
8022            let ret_val = ((*funcs).input_method_hints)(obj_data);
8023            let ret_val = InputMethodHints::from_bits_truncate(ret_val);
8024            ret_val
8025        }
8026    }
8027    pub fn set_input_method_hints(&self, hints: InputMethodHints) -> &Self {
8028        let enum_hints_1 = hints.bits();
8029
8030        let (obj_data, funcs) = self.get_widget_obj_funcs();
8031        unsafe {
8032            ((*funcs).set_input_method_hints)(obj_data, enum_hints_1);
8033        }
8034        self
8035    }
8036    #[doc(hidden)]
8037    pub fn painting_active(&self) -> bool {
8038        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8039        unsafe {
8040            let ret_val = ((*funcs).painting_active)(obj_data);
8041            ret_val
8042        }
8043    }
8044    #[doc(hidden)]
8045    pub fn logical_dpi_x(&self) -> i32 {
8046        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8047        unsafe {
8048            let ret_val = ((*funcs).logical_dpi_x)(obj_data);
8049            ret_val
8050        }
8051    }
8052    #[doc(hidden)]
8053    pub fn logical_dpi_y(&self) -> i32 {
8054        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8055        unsafe {
8056            let ret_val = ((*funcs).logical_dpi_y)(obj_data);
8057            ret_val
8058        }
8059    }
8060    #[doc(hidden)]
8061    pub fn physical_dpi_x(&self) -> i32 {
8062        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8063        unsafe {
8064            let ret_val = ((*funcs).physical_dpi_x)(obj_data);
8065            ret_val
8066        }
8067    }
8068    #[doc(hidden)]
8069    pub fn physical_dpi_y(&self) -> i32 {
8070        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8071        unsafe {
8072            let ret_val = ((*funcs).physical_dpi_y)(obj_data);
8073            ret_val
8074        }
8075    }
8076    #[doc(hidden)]
8077    pub fn device_pixel_ratio(&self) -> i32 {
8078        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8079        unsafe {
8080            let ret_val = ((*funcs).device_pixel_ratio)(obj_data);
8081            ret_val
8082        }
8083    }
8084    #[doc(hidden)]
8085    pub fn device_pixel_ratio_f(&self) -> f32 {
8086        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8087        unsafe {
8088            let ret_val = ((*funcs).device_pixel_ratio_f)(obj_data);
8089            ret_val
8090        }
8091    }
8092    #[doc(hidden)]
8093    pub fn color_count(&self) -> i32 {
8094        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8095        unsafe {
8096            let ret_val = ((*funcs).color_count)(obj_data);
8097            ret_val
8098        }
8099    }
8100    #[doc(hidden)]
8101    pub fn depth(&self) -> i32 {
8102        let (obj_data, funcs) = self.get_paint_device_obj_funcs();
8103        unsafe {
8104            let ret_val = ((*funcs).depth)(obj_data);
8105            ret_val
8106        }
8107    }
8108    #[doc(hidden)]
8109    pub fn object_name(&self) -> String {
8110        let (obj_data, funcs) = self.get_object_obj_funcs();
8111        unsafe {
8112            let ret_val = ((*funcs).object_name)(obj_data);
8113            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
8114            ret_val
8115        }
8116    }
8117    #[doc(hidden)]
8118    pub fn set_object_name(&self, name: &str) -> &Self {
8119        let str_in_name_1 = CString::new(name).unwrap();
8120
8121        let (obj_data, funcs) = self.get_object_obj_funcs();
8122        unsafe {
8123            ((*funcs).set_object_name)(obj_data, str_in_name_1.as_ptr());
8124        }
8125        self
8126    }
8127    #[doc(hidden)]
8128    pub fn is_widget_type(&self) -> bool {
8129        let (obj_data, funcs) = self.get_object_obj_funcs();
8130        unsafe {
8131            let ret_val = ((*funcs).is_widget_type)(obj_data);
8132            ret_val
8133        }
8134    }
8135    #[doc(hidden)]
8136    pub fn is_window_type(&self) -> bool {
8137        let (obj_data, funcs) = self.get_object_obj_funcs();
8138        unsafe {
8139            let ret_val = ((*funcs).is_window_type)(obj_data);
8140            ret_val
8141        }
8142    }
8143    #[doc(hidden)]
8144    pub fn signals_blocked(&self) -> bool {
8145        let (obj_data, funcs) = self.get_object_obj_funcs();
8146        unsafe {
8147            let ret_val = ((*funcs).signals_blocked)(obj_data);
8148            ret_val
8149        }
8150    }
8151    #[doc(hidden)]
8152    pub fn block_signals(&self, b: bool) -> bool {
8153        let (obj_data, funcs) = self.get_object_obj_funcs();
8154        unsafe {
8155            let ret_val = ((*funcs).block_signals)(obj_data, b);
8156            ret_val
8157        }
8158    }
8159    #[doc(hidden)]
8160    pub fn start_timer(&self, interval: i32, timer_type: TimerType) -> i32 {
8161        let enum_timer_type_2 = timer_type as u32;
8162
8163        let (obj_data, funcs) = self.get_object_obj_funcs();
8164        unsafe {
8165            let ret_val = ((*funcs).start_timer)(obj_data, interval, enum_timer_type_2);
8166            ret_val
8167        }
8168    }
8169    #[doc(hidden)]
8170    pub fn start_timer_2(&self, time: u32, timer_type: TimerType) -> i32 {
8171        let enum_timer_type_2 = timer_type as u32;
8172
8173        let (obj_data, funcs) = self.get_object_obj_funcs();
8174        unsafe {
8175            let ret_val = ((*funcs).start_timer_2)(obj_data, time, enum_timer_type_2);
8176            ret_val
8177        }
8178    }
8179    #[doc(hidden)]
8180    pub fn kill_timer(&self, id: i32) -> &Self {
8181        let (obj_data, funcs) = self.get_object_obj_funcs();
8182        unsafe {
8183            ((*funcs).kill_timer)(obj_data, id);
8184        }
8185        self
8186    }
8187    #[doc(hidden)]
8188    pub fn install_event_filter<O: ObjectTrait<'a>>(&self, filter_obj: &O) -> &Self {
8189        let (obj_filter_obj_1, _funcs) = filter_obj.get_object_obj_funcs();
8190
8191        let (obj_data, funcs) = self.get_object_obj_funcs();
8192        unsafe {
8193            ((*funcs).install_event_filter)(obj_data, obj_filter_obj_1);
8194        }
8195        self
8196    }
8197    #[doc(hidden)]
8198    pub fn dump_object_tree(&self) -> &Self {
8199        let (obj_data, funcs) = self.get_object_obj_funcs();
8200        unsafe {
8201            ((*funcs).dump_object_tree)(obj_data);
8202        }
8203        self
8204    }
8205    #[doc(hidden)]
8206    pub fn dump_object_info(&self) -> &Self {
8207        let (obj_data, funcs) = self.get_object_obj_funcs();
8208        unsafe {
8209            ((*funcs).dump_object_info)(obj_data);
8210        }
8211        self
8212    }
8213    #[doc(hidden)]
8214    pub fn dump_object_tree_2(&self) -> &Self {
8215        let (obj_data, funcs) = self.get_object_obj_funcs();
8216        unsafe {
8217            ((*funcs).dump_object_tree_2)(obj_data);
8218        }
8219        self
8220    }
8221    #[doc(hidden)]
8222    pub fn dump_object_info_2(&self) -> &Self {
8223        let (obj_data, funcs) = self.get_object_obj_funcs();
8224        unsafe {
8225            ((*funcs).dump_object_info_2)(obj_data);
8226        }
8227        self
8228    }
8229    #[doc(hidden)]
8230    pub fn parent(&self) -> Option<Object> {
8231        let (obj_data, funcs) = self.get_object_obj_funcs();
8232        unsafe {
8233            let ret_val = ((*funcs).parent)(obj_data);
8234            if ret_val.qt_data == ::std::ptr::null() {
8235                return None;
8236            }
8237            let t = ret_val;
8238            let ret_val;
8239            if t.host_data != ::std::ptr::null() {
8240                ret_val = Object::new_from_rc(t);
8241            } else {
8242                ret_val = Object::new_from_owned(t);
8243            }
8244            Some(ret_val)
8245        }
8246    }
8247    #[doc(hidden)]
8248    pub fn delete_later(&self) -> &Self {
8249        let (obj_data, funcs) = self.get_object_obj_funcs();
8250        unsafe {
8251            ((*funcs).delete_later)(obj_data);
8252        }
8253        self
8254    }
8255    #[doc(hidden)]
8256    pub fn set_custom_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
8257    where
8258        F: Fn(&T, &Event) + 'a,
8259        T: 'a,
8260    {
8261        let (obj_data, funcs) = self.get_object_obj_funcs();
8262
8263        let f: Box<Box<Fn(&T, &Event) + 'a>> = Box::new(Box::new(func));
8264        let user_data = data as *const _ as *const c_void;
8265
8266        unsafe {
8267            ((*funcs).set_custom_event)(
8268                obj_data,
8269                user_data,
8270                Box::into_raw(f) as *const _,
8271                transmute(object_custom_trampoline_ud::<T> as usize),
8272            );
8273        }
8274
8275        self
8276    }
8277
8278    pub fn set_custom_event<F>(&self, func: F) -> &Self
8279    where
8280        F: Fn(&Event) + 'a,
8281    {
8282        let (obj_data, funcs) = self.get_object_obj_funcs();
8283        let f: Box<Box<Fn(&Event) + 'a>> = Box::new(Box::new(func));
8284
8285        unsafe {
8286            ((*funcs).set_custom_event)(
8287                obj_data,
8288                ::std::ptr::null(),
8289                Box::into_raw(f) as *const _,
8290                transmute(object_custom_trampoline as usize),
8291            );
8292        }
8293
8294        self
8295    }
8296
8297    pub fn build(&self) -> Self {
8298        self.clone()
8299    }
8300}
8301pub trait WidgetTrait<'a> {
8302    #[inline]
8303    #[doc(hidden)]
8304    fn get_widget_obj_funcs(&self) -> (*const RUBase, *const RUWidgetFuncs);
8305}
8306
8307impl<'a> ObjectTrait<'a> for Widget<'a> {
8308    #[doc(hidden)]
8309    fn get_object_obj_funcs(&self) -> (*const RUBase, *const RUObjectFuncs) {
8310        let obj = self.data.get().unwrap();
8311        unsafe { (obj, (*self.all_funcs).object_funcs) }
8312    }
8313}
8314
8315impl<'a> PaintDeviceTrait<'a> for Widget<'a> {
8316    #[doc(hidden)]
8317    fn get_paint_device_obj_funcs(&self) -> (*const RUBase, *const RUPaintDeviceFuncs) {
8318        let obj = self.data.get().unwrap();
8319        unsafe { (obj, (*self.all_funcs).paint_device_funcs) }
8320    }
8321}
8322
8323impl<'a> WidgetTrait<'a> for Widget<'a> {
8324    #[doc(hidden)]
8325    fn get_widget_obj_funcs(&self) -> (*const RUBase, *const RUWidgetFuncs) {
8326        let obj = self.data.get().unwrap();
8327        unsafe { (obj, (*self.all_funcs).widget_funcs) }
8328    }
8329}
8330bitflags! {
8331    pub struct RenderFlag: u32 {
8332        const DrawWindowBackground = 0x1;
8333        const DrawChildren = 0x2;
8334        const IgnoreMask = 0x4;
8335    }
8336}
8337
8338pub type RenderFlags = RenderFlag;