Page MenuHomeLubuntu Development

Port from GTK to Qt
Updated 616 Days AgoPublic

This is a document which purpose is to help people who wants to port applications from GTK to Qt.
Some resources are written for C++ and some for Python, both are very similar, the changes I've seen are mainly syntax (class::method vs class.method) and some things that work in C++ but not in Python (TODO: insert info here)

Here is a good page to start from:

I add to which is mentioned there:

  • classes:

GtkBox (box_driver_action) ->QGroupBox

  • methods:

set_sensitive() ---> setEnabled()
set_visible ---> setVisible()
set_text ---> setText()
set_halign(Gtk.Align.CENTER) ---> setAlignment(Qt.AlignHcenter)
set_valign(Gtk.Align.START) ---> setAlignment(Qt.AlignTop)
set_halign(Gtk.Align.START) ---> setAlignment(Qt.AlignLeft)
radio_button.set_active() ---> radio_button.setChecked()
set_label() ---> setText()

box_driver_action.pack_end() #put item at the end of Box

  • others:

Icons in label should be put as pixmap, example:

driver_status = Gtk.Image()
driver_status.set_from_icon_name(icon, Gtk.IconSize.MENU)
driver_status = QLabel()
pixmap = QIcon.fromTheme(icon).pixmap(QSize(16, 16))

Last Author
Last Edited
May 22 2019, 6:42 PM