Page MenuHomeLubuntu Development

Port from GTK to Qt
Updated 33 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:
https://wiki.lxde.org/en/Migrate_from_GTK%2B_to_Qt

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_valign(Gtk.Align.START)
driver_status.set_halign(Gtk.Align.CENTER)
driver_status.set_from_icon_name(icon, Gtk.IconSize.MENU)
to:
driver_status = QLabel()
driver_status.setAlignment(Qt.AlignTop)
driver_status.setAlignment(Qt.AlignHCenter)
pixmap = QIcon.fromTheme(icon).pixmap(QSize(16, 16))
driver_status.setPixmap(pixmap)

Last Author
hmollercl
Last Edited
May 22 2019, 1:42 PM

Event Timeline

hmollercl created this document.May 22 2019, 7:42 AM
hmollercl edited the content of this document. (Show Details)
hmollercl edited the content of this document. (Show Details)May 22 2019, 7:44 AM
hmollercl edited the content of this document. (Show Details)May 22 2019, 7:59 AM
hmollercl edited the content of this document. (Show Details)May 22 2019, 8:02 AM
hmollercl added a subscriber: hmollercl.
hmollercl edited the content of this document. (Show Details)May 22 2019, 8:08 AM
hmollercl edited the content of this document. (Show Details)May 22 2019, 8:39 AM
hmollercl edited the content of this document. (Show Details)May 22 2019, 8:46 AM
hmollercl edited the content of this document. (Show Details)May 22 2019, 1:42 PM