diff options
Diffstat (limited to 'src/gtk2_in_qt5.cpp')
-rw-r--r-- | src/gtk2_in_qt5.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/gtk2_in_qt5.cpp b/src/gtk2_in_qt5.cpp index 69b4dce..a5c98f1 100644 --- a/src/gtk2_in_qt5.cpp +++ b/src/gtk2_in_qt5.cpp @@ -54,21 +54,21 @@ struct SuilGtk2InQt5Wrapper { static void on_size_request(GtkWidget*, GtkRequisition* requisition, gpointer user_data) { - auto* const wrap = (QWidget*)user_data; + auto* const wrap = static_cast<QWidget*>(user_data); wrap->setMinimumSize(requisition->width, requisition->height); } static void on_size_allocate(GtkWidget*, GdkRectangle* allocation, gpointer user_data) { - auto* const wrap = (QWidget*)user_data; + auto* const wrap = static_cast<QWidget*>(user_data); wrap->resize(allocation->width, allocation->height); } static void wrapper_free(SuilWrapper* wrapper) { - auto* impl = (SuilGtk2InQt5Wrapper*)wrapper->impl; + auto* impl = static_cast<SuilGtk2InQt5Wrapper*>(wrapper->impl); if (impl->window) { impl->window->setParent(nullptr); @@ -87,17 +87,19 @@ wrapper_free(SuilWrapper* wrapper) static int wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance) { - auto* const impl = (SuilGtk2InQt5Wrapper*)wrapper->impl; + auto* const impl = static_cast<SuilGtk2InQt5Wrapper*>(wrapper->impl); auto* const wrap = new QWidget(nullptr, Qt::Window); GtkWidget* const plug = gtk_plug_new(0); - auto* const widget = (GtkWidget*)instance->ui_widget; + auto* const widget = static_cast<GtkWidget*>(instance->ui_widget); gtk_container_add(GTK_CONTAINER(plug), widget); gtk_widget_show_all(plug); - const WId wid = (WId)gtk_plug_get_id((GtkPlug*)plug); - QWindow* window = QWindow::fromWinId(wid); - QWidget* container = + const WId wid = + static_cast<WId>(gtk_plug_get_id(reinterpret_cast<GtkPlug*>(plug))); + + QWindow* window = QWindow::fromWinId(wid); + QWidget* container = QWidget::createWindowContainer(window, wrap, Qt::WindowFlags()); auto* layout = new QVBoxLayout(); @@ -155,9 +157,9 @@ suil_wrapper_new(SuilHost* host, /* Create wrapper implementation. */ auto* const impl = - (SuilGtk2InQt5Wrapper*)calloc(1, sizeof(SuilGtk2InQt5Wrapper)); + static_cast<SuilGtk2InQt5Wrapper*>(calloc(1, sizeof(SuilGtk2InQt5Wrapper))); - auto* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper)); + auto* wrapper = static_cast<SuilWrapper*>(calloc(1, sizeof(SuilWrapper))); wrapper->wrap = wrapper_wrap; wrapper->free = wrapper_free; wrapper->impl = impl; |