1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
/// C++ type: <span style='color: green;'>```QCloseEvent```</span>
///
/// <a href="http://doc.qt.io/qt-5/qcloseevent.html">C++ documentation:</a> <div style='border: 1px solid #5CFF95; background: #D6FFE4; padding: 16px;'><p>The <a href="http://doc.qt.io/qt-5/qcloseevent.html">QCloseEvent</a> class contains parameters that describe a close event.</p>
/// <p>Close events are sent to widgets that the user wants to close, usually by choosing "Close" from the window menu, or by clicking the <b>X</b> title bar button. They are also sent when you call <a href="http://doc.qt.io/qt-5/qwidget.html#close">QWidget::close</a>() to close a widget programmatically.</p>
/// <p>Close events contain a flag that indicates whether the receiver wants the widget to be closed or not. When a widget accepts the close event, it is hidden (and destroyed if it was created with the <a href="http://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum">Qt::WA_DeleteOnClose</a> flag). If it refuses to accept the close event nothing happens. (Under X11 it is possible that the window manager will forcibly close the window; but at the time of writing we are not aware of any window manager that does this.)</p>
/// <p>The event handler <a href="http://doc.qt.io/qt-5/qwidget.html#closeEvent">QWidget::closeEvent</a>() receives close events. The default implementation of this event handler accepts the close event. If you do not want your widget to be hidden, or want some special handling, you should reimplement the event handler and <a href="http://doc.qt.io/qt-5/qevent.html#ignore">ignore</a>() the event.</p>
/// <p>The <a href="http://doc.qt.io/qt-5/qtwidgets-mainwindows-application-example.html#close-event-handler">closeEvent() in the Application example</a> shows a close event handler that asks whether to save a document before closing.</p>
/// <p>If you want the widget to be deleted when it is closed, create it with the <a href="http://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum">Qt::WA_DeleteOnClose</a> flag. This is very useful for independent top-level windows in a multi-window application.</p>
/// <p><a href="http://doc.qt.io/qt-5/qobject.html">QObject</a>s emits the <a href="http://doc.qt.io/qt-5/qobject.html#destroyed">destroyed()</a> signal when they are deleted.</p>
/// <p>If the last top-level window is closed, the <a href="http://doc.qt.io/qt-5/qguiapplication.html#lastWindowClosed">QGuiApplication::lastWindowClosed</a>() signal is emitted.</p>
/// <p>The <a href="http://doc.qt.io/qt-5/qevent.html#accepted-prop">isAccepted</a>() function returns <code>true</code> if the event's receiver has agreed to close the widget; call <a href="http://doc.qt.io/qt-5/qevent.html#accept">accept</a>() to agree to close the widget and call <a href="http://doc.qt.io/qt-5/qevent.html#ignore">ignore</a>() if the receiver of this event does not want the widget to be closed.</p></div>
#[repr(C)]
pub struct CloseEvent(u8);
impl CloseEvent {
/// C++ method: <span style='color: green;'>```[constructor] void QCloseEvent::QCloseEvent()```</span>
///
/// <a href="http://doc.qt.io/qt-5/qcloseevent.html#QCloseEvent">C++ documentation:</a> <div style='border: 1px solid #5CFF95; background: #D6FFE4; padding: 16px;'><p>Constructs a close event object.</p>
/// <p><b>See also </b><a href="http://doc.qt.io/qt-5/qevent.html#accept">accept</a>().</p></div>
pub fn new() -> ::cpp_utils::CppBox<::close_event::CloseEvent> {
let ffi_result = unsafe { ::ffi::qt_gui_c_QCloseEvent_new() };
unsafe { ::cpp_utils::CppBox::new(ffi_result) }
}
}
impl ::cpp_utils::CppDeletable for ::close_event::CloseEvent {
fn deleter() -> ::cpp_utils::Deleter<Self> {
::ffi::qt_gui_c_QCloseEvent_delete
}
}
impl ::cpp_utils::StaticCast<::qt_core::event::Event> for ::close_event::CloseEvent {
fn static_cast_mut(&mut self) -> &mut ::qt_core::event::Event {
let ffi_result =
unsafe { ::ffi::qt_gui_c_QCloseEvent_G_static_cast_QEvent_ptr(self as *mut ::close_event::CloseEvent) };
unsafe { ffi_result.as_mut() }.expect("Attempted to convert null pointer to reference")
}
fn static_cast(&self) -> &::qt_core::event::Event {
let ffi_result = unsafe { ::ffi::qt_gui_c_QCloseEvent_G_static_cast_QEvent_ptr(self as *const ::close_event::CloseEvent as *mut ::close_event::CloseEvent) };
unsafe { ffi_result.as_ref() }.expect("Attempted to convert null pointer to reference")
}
}
impl ::cpp_utils::UnsafeStaticCast<::close_event::CloseEvent> for ::qt_core::event::Event {
unsafe fn static_cast_mut(&mut self) -> &mut ::close_event::CloseEvent {
let ffi_result = ::ffi::qt_gui_c_QCloseEvent_G_static_cast_QCloseEvent_ptr(self as *mut ::qt_core::event::Event);
ffi_result.as_mut().expect("Attempted to convert null pointer to reference")
}
unsafe fn static_cast(&self) -> &::close_event::CloseEvent {
let ffi_result = ::ffi::qt_gui_c_QCloseEvent_G_static_cast_QCloseEvent_ptr(self as *const ::qt_core::event::Event as *mut ::qt_core::event::Event);
ffi_result.as_ref().expect("Attempted to convert null pointer to reference")
}
}
impl ::std::ops::Deref for ::close_event::CloseEvent {
type Target = ::qt_core::event::Event;
fn deref(&self) -> &::qt_core::event::Event {
let ffi_result = unsafe { ::ffi::qt_gui_c_QCloseEvent_G_static_cast_QEvent_ptr(self as *const ::close_event::CloseEvent as *mut ::close_event::CloseEvent) };
unsafe { ffi_result.as_ref() }.expect("Attempted to convert null pointer to reference")
}
}
impl ::std::ops::DerefMut for ::close_event::CloseEvent {
fn deref_mut(&mut self) -> &mut ::qt_core::event::Event {
let ffi_result =
unsafe { ::ffi::qt_gui_c_QCloseEvent_G_static_cast_QEvent_ptr(self as *mut ::close_event::CloseEvent) };
unsafe { ffi_result.as_mut() }.expect("Attempted to convert null pointer to reference")
}
}