From LXDE.org (mirror gist)
-
9 Appendix: List of equivalent GTK+ and Qt functionality
- 9.1 Development Tools
- 9.2 Windows
- 9.3 Display Widgets
- 9.4 Buttons and Toggles
- 9.5 Numeric/Text Data Entry
- 9.6 Multiline Text Editor
- 9.7 Tree, List and Icon Grid Widgets (Tree Model/View architecture)
- 9.8 Menus, Combo Box, Toolbar
- 9.9 Selectors (Color/File/Font)
- 9.10 Layout Containers
- 9.11 Scrolling
- 9.12 Printing
- 9.13 Miscellaneous
- 9.14 Abstract Base Classes
- 9.15 Cross-process Embedding
- 9.16 Recently Used Documents
- 9.17 Choosing from installed applications
- 9.18 Interface builder
- 9.19 Application support
- 9.20 Deprecated
Qt is a nice platform for GUI application development. More and more people are using Qt. One of the famous Linux distros, Ubuntu, is also moving from Gnome/GTK+ to Qt. Normally, people start learning Qt from reading the Qt tutorial/books and the "hello world" example. For those who already know GTK+, learning Qt is much easier since most of the GTK+ concepts still applies. Only some "translation" is needed. This document focuses on translating your existing GTK+ knowledge and experience to Qt. So you can start to develop with Qt "immediately".
- If you don't know what's GTK+ or Qt, this doc is not for you. Go to find a Qt tutorial and read it.
- If you're using GTK+ and want to use Qt instead, this is definitely for you
- If you plan to use QML, this is not for you. We focus on desktop development with Qt Widgets.
A very efficient shortcut for a GTK+ developers to migrate to Qt is:
- Read a Qt tutorial (hello world) [1]
- Read this guide
- Start coding immediately (Create your project with KDevelop or QtCreator can make your life much easier. Personally I highly recommend KDevelop)
- If you encounter any problem, use Qt assitant to look it up in Qt API doc, or ask questions in the KDE/Qt community.
At the end of this document we provide a table listing the Qt equivalence of some common Gtk+ classes.
In Gtk+, nearly everything is a GObject. In Qt, almost all major classes are derived from QObject. They provides very similar functionality but also differs in many ways.
Problem GObject Way Qt Way
Object construction Have to do initialize in four places.
- class init function
- Object constructor function, handle construction properties
- Object init function
- The *_new() function for the object
Just use a normal C++ constructor and C++ "new" operator
Object destruction Need to do two-step destruction to break cyclic references.
- Free references to other objects in "dispose" handler
- Free the allocated memory in "finalize" method
- Need to make sure that all objects are owned, or you need to do g_object_ref_sink() to cancel its floating state. Otherwise you'll get errors
Just delete the object with C++ "delete" operator.
Memory management Reference counting. Objects are freed when the last reference is released. No reference counting, only parent-child association between objects (optional). While destructing parent objects, child objects will be freed automatically.
Define new signals
- Write a marshal list file
- Use glib-gen-marshal command to parse the marshal list file, and generates some glue code for the C closures used by the signal
- Call g_signal_new() in class init function to register new signals, and store the signal ID somewhere for later use.
In *.h C++ header file:
class MyObject: public QObject {
Q_OBJECT // This macro is required
public Q_SIGNALS:
void mySignal();
}
In *.cpp C++ implementation file:
// include the moc file generated by meta object compiler (moc)
#include "myobject.moc"
(The moc is invoked by makefiles automatically)
Connect signals g_signal_connect(object, "signal_name", G_CALLBACK(handler), user_data); QObject::connect(object, SIGNAL(signalName()), SLOT(handler()));
Disconnect signals g_signal_handler_disconnect(object, handler_id); QObject::disconnect(object, SIGNAL(signalName()), SLOT(handler()));
Signal handler
Most of time are static functions, the first parameter is the sender of the signal. Additional data required by the handler are passed with user_data parameter.
static void handler(SenderObject* sender,
ParamType param1,...,
gpointer user_data)
{
ReceiverObject* receiver = RECEIVER_OBJECT(user_data);
do_something(receiver);
}
Signal handlers are often class methods of the receiver object. Additional data are stored in the receiver object, so no user_data parameter is needed.
void ReceiverObject::handler(ParamType param1, ...) {
// call QObject::sender() to get the sender of the current signal
SenderObject* sender = static_cast<SenderObject*>(sender());
doSomething();
}
Object property g_object_class_install_property() Add Q_PROPERTY() macro in class declaration.[2]
Key-value based object data g_object_set_data() QObject::setProperty() does totally the same thing. Though it's named dynamic property in the API doc, actually, it's per-instance, not per-class (like Q_PROPERTY). It's actually the equivalence of g_object_set_data().
Problem | GTK+ Way | Qt Way |
---|---|---|
Create toplevel windows | Use GtkWindow or GtkDialog | Any QWidget object can be toplevel windows |
Painting | Connect to "expose-event" (GTK+2) or "draw" (GTK+3) signal, and paint using cairo | Override paintEvent() virtual function and create a QPainter object for painting |
Handle mouse events | Connect to "button-press-event", "motion-notify-event", and "button-release-event" | Override virtual functions. |
Create popup context menu | Connect to "button-press-event", detect right click, and do it yourself | has special handling for context menus |
Handle drag and drop | Connect to "drag-begin", "drag-motion", "drag-drop", ... signals | Override dragBegin(),...etc virtual functions. |
Obtain information about screen and monitors | GdkDisplay/GdkScreen | QDesktopWidget |
Destroy a widget | gtk_widget_destroy(), directly unref the widget object sometimes causes problems. Need to handle "dispose" and do two-step destruction to break cyclic references. | No floating reference or any reference counting. Just delete the widget object. Very simple. |
Implement custom widget | Need to handle "realize" and create the underlying X window manually, or use GTK_NO_WINDOW flags, very low level | Just create a derived class from an existing QWidget-based class. However, don't forget to add Q_OBJECT macro and #include the generated *.moc file in your cpp file. Otherwise signal/slot and RTTI won't work. |
In Qt, it also has model/view architecture, just like GTK+ has GtkTreeModel and GtkTreeView. Their designs, however, differ in some ways.
In GTK+, To create a list-like view, you need to do this:
- Create a GtkListStore as the model providing data source
- Create a GtkTreeView for display the model
- Add several GtkTreeViewColumn objects to the GtkTreeView to add columns
- Set column attributes to map columns in the model (list store) to the visible columns in the view.
- Pack several GtkCellRendererPixbuf and GtkCellRendererText renderers into GtkTreeViewColumn to paint the content of that column
- Set the model to the view
In Qt, you have two choices for your model
- QStandardItemModel: a ready-to-use generic model class which has more feature than GtkListStore and GtkTreeStore. This should work in most of the cases.
- QAbstractItemModel: a base class for deriving your own model class if QStandardItemModel is not enough. more complicated, roughly equals to implementing your own GtkTreeModel interface with GObject.
There are several places where Qt is quite different:
- Columns in the view are created by adding GtkTreeViewColumn objects while in Qt the column information (title, size, ...) is "provided by the model", not the view. However, if you need to change the column header, it's managed by QHeaderView which can be retrieved by calling QTreeView::header().
- Qt does not use cell renderer layout. Every cell can have an optional icon and text, and even other data associated with it. Qt calls different data stored in a cell "roles". Icons are decoration roles, and text for display in the cell is called display role.
- In Gtk+, to refer to a row, you have to use GtkTreePath and GtkTreeIter. In Qt what you only need is QModelIndex, which provides functionality of GtkTreePath + GtkTreeIter.
- In Gtk+ every "row" have a GtkTreePath and GtkTreeIter. Different cells in a row are referenced by using different column indicis or IDs. In Qt, every single cell can have their own QModelIndex.
- If you need to draw custom content in a cell, in Gtk+ you can create a custom GtkCellRenderer. With Qt, derive your own QStyledItemDelegate, which is essentially a Qt cell renderer.
- Gtk+ provides various kinds of cell renderers, Qt does not. You have to derive your custom item delegates for this. This is not difficult and a Google search usually gives you many examples for how to do it.
- Gtk+ cell renderers provides rich text rendering (markup text), but Qt does not provide it. You can emulate the same feature with a custom delegate. Here are some good examples from Razor-Qt project and Stack overflow
Here are some good Qt model/view examples:
At the end of the article, we have a table summarizing equivalent Gtk+ and Qt classes for model/view architecture. Jump to the table
Forget the political issues. Qt and Gtk/Gnome are not enemy and there are many really nice non-GUI libraries from the Gnome/Gtk world. Qt now has glib mainloop integration. So using glib-based libraries is possible in Qt programs. (The Qt library must be compiled with glib support turned on, thogh)
There are some issue developers need to pay attention to.
You need to call g_type_init() before using any GObject-based stuff. Normally gtk_init() calls g_type_init() for us if you're using Gtk. With Qt, however, you need to initialize the GObject type system manually.
To make programming easier, Qt added some "Qt-specific" reserved words to C++, such as the notorious "signals", "slots", "emit", and "foreach". They received much criticism on not using standard C++ syntax here. Non-standard, however, is not the real issue. The problem is, these words are used in other C++ libraries for class, methods, or variable names. The most famous one is boost::signal. These Qt keywords create significant name clashes. Glib/gio also uses these Qt keywords for variable names in their header files. So it creates a big headache. Fortunately, in Qt 4 this improved. Instead of new keywords, you can replace all of the "keywords" with macros. Use Qt macros Q_SIGNALS (or Q_SIGNAL), Q_SLOTS (or Q_SLOT), Q_EMIT, and Q_FOREACH to replace the old "keywords" and everything will compile. You also need to define "QT_NO_KEYWORDS" with compiler flags -DQT_NO_KEYWORDS to make it work.
- While glib uses UTF-8 to encode all strings, Qt uses UTF-16 internally. A C-style string, if not specified, is treated as a latin1 string. To convert from UTF-8 to UTF-16, calling QString::fromUtf8() explicitly is needed. If you don't do this, UTF-8 strings will be treated as latin1 by default and the bug can be hard to find.
- To avoid the error, define QT_NO_CAST_FROM_ASCII flag to disable automatic conversion from C string to UTF-16.
- Avoid using C++ reserved words as variable or function names in your C code, especially in the header files. The most common example: Replace "class" with "klass" in your C code because class is a reserved word in C++. Don't use "new" as your function or variable name since its a C++ operator.
- If you use glib, add G_BEGIN_DECLS and G_END_DECLS in your C language *.h files like this:
#include <glib.h>
G_BEGIN_DECLS
// Your function declaration here
// ...
G_END_DECLS
Please refer to glib API doc for the explanation of these two macros. They're translated to something like this:
#ifdef __cplusplus
extern "C" {
#endif
// Your function declaration here
//...
#ifdef __cplusplus
}
#endif
This prevent C++ compilers from doing name mangling.
- If you're not using glib, do the above ifdef and extern "C" manually
- Qt QTBUG-32859: Calling QObject::deleteLater() inside a glib signal, timeout, or idle handlers has no effect. To workardound this bug, use QTimer::singleShot(0, object, SLOT(deleteLater()));
While using Autotools to build Qt code is possible, I won't recommend doing that. The officially suggested way to build Qt code is to use qmake bundled with Qt and *.pro project file. This approach, however, is not suitable for more complicated real world applications. Many huge projects developed with Qt, like KDE, uses CMake instead.
TODO
TODO
TODO
Some useful macros:
- qt4_add_resources to add embedded resources to your app,
- qt4_wrap_ui to add a widget form,
- qt4_create_translation for translation,
- qt4_add_dbus_adaptor & qt4_add_dbus_interface to generate D-Bus-related code.
- The -DQT_NO_KEYWORDS flag: turn off Qt specific keywords
- The -fpermissive flag: If you're using some C libraries in your Qt code, you may encounter some type-casting related errors. Because C++ is more strict on type safety, some code allowed in C is not allowed in C++. You should fix the code if possible. Otherwise, add -fpermissive flag to omit the errors to make it compile.
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
ABI = application binary interface. It's extremely important for you if you're developing a library. Wikipedia has introduction for it. [3]
Due to the design and language features of C++, ABI (application binary interface) can break much more easily than in C if developers do not pay special attention to it.
KDE teams provide a very comprehensive guide about how to prevent C++ ABI breakage. Please read the nice article here [4].
Then make sure you bump the libtool version number. See this doc explaining how to set the version info correctly: http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
GTK+ Tools | Qt Tools | Comment |
---|---|---|
Devhelp | Qt Assistent | Nice viewer of API docs with search ability |
Glade | Qt Designer | WYSIWYG GUI designer |
Various po file editor | Qt Linguist | Editor for translation files |
Verious conguration tools | qtconfig | GUI editor for some basic configuration like theme, colors, ...etc. |
The following list of Gtk classes is taken from gtk+ API doc here: https://developer.gnome.org/gtk3/stable/
GTK+ class | Qt class | Comment |
---|---|---|
GtkDialog | QDialog | Create popup windows |
GtkInvisible | A widget which is not displayed | |
GtkMessageDialog | QMessageBox | A convenient message window |
GtkWindow | QMainWindow or QWidget | Toplevel which can contain other widgets |
GtkWindowGroup | Limit the effect of grabs | |
GtkAboutDialog | N/A | Display information about an application |
GtkAssistant | QWizard | A widget used to guide users through multi-step operations |
GtkOffscreenWindow | ? | A toplevel to manage offscreen rendering of child widgets |
GTK+ class | Qt class | Comment |
---|---|---|
GtkAccelLabel | N/A, but you can use QAction + QKeySequence | A label which displays an accelerator key on the right of the text |
GtkImage | QLabel | A widget displaying an image |
GtkLabel | QLabel | A widget that displays a small to medium amount of text |
GtkProgressBar | QProgressBar | A widget which indicates progress visually |
GtkStatusbar | QStatusBar | Report messages of minor importance to the user |
GtkLevelBar | ? | A bar that can used as a level indicator |
GtkInfoBar | ? | Report important messages to the user |
GtkStatusIcon | QSystemTrayIcon | Display an icon in the system tray |
GtkSpinner | N/A, can be emulated with QLabel::setMovie() + QMovie | Show a spinner animation |
GTK+ class | Qt class | Comment |
---|---|---|
GtkButton | QPushButton | A widget that emits a signal when clicked on |
GtkCheckButton | QCheckBox | Create widgets with a discrete toggle button |
GtkRadioButton | QRadioButton | A choice from multiple check buttons |
GtkToggleButton | QAbstractButton | Create buttons which retain their state |
GtkLinkButton | QCommandLinkButton? (not sure) | Create buttons bound to a URL |
GtkScaleButton | N/A | A button which pops up a scale |
GtkVolumeButton | N/A | A button which pops up a volume control |
GtkSwitch | ? | A "light switch" style toggle |
GtkLockButton | N/A | A widget to unlock or lock privileged operations |
GtkMenuButton | QPushButton::setMenu() | A widget that shows a menu when clicked on |
GTK+ class | Qt class | Comment |
---|---|---|
GtkEntry | QLineEdit | A single line text entry field |
GtkEntryBuffer | N/A | Text buffer for GtkEntry |
GtkEntryCompletion | QCompleter | Completion functionality for GtkEntry |
GtkScale | QSlider | A slider widget for selecting a value from a range |
GtkSpinButton | QSpinBox | Retrieve an integer or floating-point number from the user |
GtkSearchEntry | ? | An entry which shows a search icon |
GtkEditable | N/A | Interface for text-editing widgets |
GTK+ class | Qt class | Comment |
---|---|---|
GtkTextIter | QTextCursor | Text buffer iterator |
GtkTextMark | ? | A position in the buffer preserved across buffer modifications |
GtkTextBuffer | QTextDocument | Stores attributed text for display in a GtkTextView |
GtkTextTag | QTextFormat (not really the same, but similar in concept) | A tag that can be applied to text in a GtkTextBuffer |
GtkTextTagTable | ? | Collection of tags that can be used together |
GtkTextView | QTextEdit (supports plain text and Rich Text), a good alternative is the 3rd party class QScintilla [5] | Widget that displays a GtkTextBuffer |
GTK+ class | Qt class | Comment |
---|---|---|
GtkTreeModel | QStandardItemModel(easy but less optimized), QAbstractItemModel(low level and complicated) | The tree interface used by GtkTreeView |
GtkTreeSelection | QItemSelectionModel | The selection object for GtkTreeView |
GtkTreeViewColumn | QHeaderView | A visible column in a GtkTreeView widget |
GtkTreeView | QTreeView, QTreeWidget | A widget for displaying both trees and lists |
GtkTreeView drag-and-drop | ? Interfaces for drag-and-drop support in GtkTreeView | |
GtkCellView | N/A | A widget displaying a single row of a GtkTreeModel |
GtkIconView | QListView | A widget which displays a list of icons in a grid |
GtkTreeSortable | Not needed in Qt | The interface for sortable models used by GtkTreeView |
GtkTreeModelSort | QSortFilterProxyModel | A GtkTreeModel which makes an underlying tree model sortable |
GtkTreeModelFilter | QSortFilterProxyModel | A GtkTreeModel which hides parts of an underlying tree model |
GtkCellLayout | N/A | An interface for packing cells |
GtkCellArea | N/A | An abstract class for laying out GtkCellRenderers |
GtkCellAreaBox | N/A | A cell area that renders GtkCellRenderers into a row or a column |
GtkCellAreaContext | N/A | Stores geometrical information for a series of rows in a GtkCellArea |
GtkCellRenderer | QStyledItemDelegate | An object for rendering a single cell |
GtkCellEditable | QStyledItemDelegate | Interface for widgets which can are used for editing cells |
GtkCellRendererAccel | N/A, but can be done with a custom QItemDelegate. | Renders a keyboard accelerator in a cell |
GtkCellRendererCombo | N/A, but can be done with a custom QItemDelegate. See a good example here. [6] | Renders a combobox in a cell |
GtkCellRendererPixbuf | N/A, but every column can show an optional icon with decoration roles | Renders a pixbuf in a cell |
GtkCellRendererProgress | N/A, but can be done with a custom QItemDelegate. | Renders numbers as progress bars |
GtkCellRendererSpin | N/A, but can be done with a custom QItemDelegate. | Renders a spin button in a cell |
GtkCellRendererText | Not needed, but Qt cannot render rich text (markup text) by default. You need to implement your own custom delegate to emulate this feature. Here are some good examples from Razor-Qt project and Stack overflow | Renders text in a cell |
GtkCellRendererToggle | N/A, but can be done with a custom QItemDelegate. | Renders a toggle button in a cell |
GtkCellRendererSpinner | N/A, but can be done with a custom QItemDelegate. | Renders a spinning animation in a cell |
GtkListStore | QStandardItemModel (generic, suitable for all cases), QStringListModel (specialized for string items) | A list-like data structure that can be used with the GtkTreeView |
GtkTreeStore | QStandardItemModel | A tree-like data structure that can be used with the GtkTreeView |
GTK+ class | Qt class | Comment |
---|---|---|
GtkComboBox | QComboBox | A widget used to choose from a list of items |
GtkComboBoxText | QComboBox | A simple, text-only combo box |
GtkMenu | QMenu | A menu widget |
GtkMenuBar | QMenuBar | A subclass of GtkMenuShell which holds GtkMenuItem widgets |
GtkMenuItem | N/A, Qt uses QAction only (equivalent to GtkAction or GAction) | The widget used for item in menus |
GtkImageMenuItem | QAction::setIcon() | A menu item with an icon |
GtkRadioMenuItem | QAction::setChekable() + QAction::setActionGroup() | A choice from multiple check menu items |
GtkCheckMenuItem | QAction::setCheckable() | A menu item with a check box |
GtkSeparatorMenuItem | QMenu::addSeparator() | A separator used in menus |
GtkToolShell | not needed, QToolBar is enough | Interface for containers containing GtkToolItem widgets |
GtkToolbar | QToolBar | Create bars of buttons and other widgets |
GtkToolItem | QToolBar::addWidget() | The base class of widgets that can be added to GtkToolShell |
GtkToolPalette | QToolBox | A tool palette with categories |
GtkToolItemGroup | QActionGroup? | A sub container used in a tool palette |
GtkSeparatorToolItem | QToolBar::addSeparator() | A toolbar item that separates groups of other toolbar items |
GtkToolButton | QToolButton | A GtkToolItem subclass that displays buttons |
GtkMenuToolButton | QAction | A GtkToolItem containing a button with an additional dropdown menu |
GtkToggleToolButton | QAction | A GtkToolItem containing a toggle button |
GtkRadioToolButton | QAction | A toolbar item that contains a radio button Action-based menus and toolbars |
GtkUIManager | QUiLoader | Constructing menus and toolbars from an XML description |
GtkActionGroup | Qt has QActionGroup but it does different things | A group of actions |
GtkAction | QAction | An action which can be triggered by a menu or toolbar item |
GtkToggleAction | QAction | An action which can be toggled between two states |
GtkRadioAction | QAction | An action of which only one in a group can be active |
GtkRecentAction | N/A | An action of which represents a list of recently used files |
GtkActivatable | N/A | An interface for activatable widgets |
GTK+ class | Qt class | Comment |
---|---|---|
GtkColorChooser | N/A | Interface implemented by widgets for choosing colors |
GtkColorButton | N/A, but it's very easy to implement yourself, see [7] | A button to launch a color selection dialog |
GtkColorChooserWidget | N/A | A widget for choosing colors |
GtkColorChooserDialog | QColorDialog | A dialog for choosing colors |
GtkFileChooser | N/A | File chooser interface used by GtkFileChooserWidget and GtkFileChooserDialog |
GtkFileChooserButton | N/A, but it's easy to implement with Qt | A button to launch a file selection dialog |
GtkFileChooserDialog | QFileDialog | A file chooser dialog, suitable for "File/Open" or "File/Save" commands |
GtkFileChooserWidget | N/A | File chooser widget that can be embedded in other widgets |
GtkFileFilter | QFileDialog::selectNameFilter() | A filter for selecting a file subset |
GtkFontChooser | N/A | Interface implemented by widgets displaying fonts |
GtkFontButton | Only has QFontComboBox, but a font chooser button is very easy to implement. See the example [8] | A button to launch a font chooser dialog |
GtkFontChooserWidget | N/A | A widget for selecting fonts |
GtkFontChooserDialog | QFontDialog | A dialog for selecting fonts |
In Gtk+, widget layout are largely done with boxes. In Qt, however, there are no box containers. Instead, they used QLayout objects to manage the layout of widgets. QLayout and its derivatives are not containers nor widgets. They're just "managers" of the layout of child widgets. The child widgets belongs to their parent container widgets, not belongs to the layout managers. This is totally different from Gtk+.
GTK+ class | Qt class | Comment |
---|---|---|
GtkGrid | QGridLayout / QFormLayout | Pack widgets in a rows and columns |
GtkAlignment | N/A | A widget which controls the alignment and size of its child |
GtkAspectFrame | N/A | A frame that constrains its child to a particular aspect ratio |
GtkBox | QBoxLayout | A container box |
GtkButtonBox | QDialogButtonBox (only works for dialogs and only some standard buttons are allowed) | A container for arranging buttons |
GtkFixed | N/A | A container which allows you to position widgets at fixed coordinates |
GtkPaned | QSplitter | A widget with two adjustable panes |
GtkLayout | QScrollArea? | Infinite scrollable area containing child widgets and/or custom drawing |
GtkNotebook | QTabWidget or QStackedWidget + QTabBar | A tabbed notebook container |
GtkExpander | N/A | A container which can hide its child |
GtkOverlay | QStackedWidget | A container which overlays widgets on top of each other |
GtkOrientable | Not used in Qt | An interface for flippable widgets |
GtkFrame | QFrame | A bin with a decorative frame and optional label |
GtkSeparator | QFrame with shape property set to QFrame::VLine or QFrame::HLine | A separator widget |
GTK+ class | Qt class | Comment |
---|---|---|
GtkScrollbar | QScrollBar | A Scrollbar |
GtkScrolledWindow | QScrollArea | Adds scrollbars to its child widget |
GtkScrollable | N/A | An interface for scrollable widgets |
GTK+ class | Qt class | Comment |
---|---|---|
GtkPrintOperation | ? | High-level Printing API |
GtkPrintContext | ? | Encapsulates context for drawing pages |
GtkPrintSettings | ? | Stores print settings |
GtkPageSetup | ? | Stores page setup information |
GtkPaperSize | ? | Support for named paper sizes |
GtkPrinter | ? | Represents a printer |
GtkPrintJob | ? | Represents a print job |
GtkPrintUnixDialog | QPrintDialog | A print dialog |
GtkPageSetupUnixDialog | QPageSetupDialog | A page setup dialog |
GTK+ class | Qt class | Comment |
---|---|---|
GtkAdjustment | ? | A representation of an adjustable bounded value |
GtkArrow | N/A, can be emulated with QStyle | Displays an arrow |
GtkCalendar | QCalendarWidget | Displays a calendar and allows the user to select a date |
GtkDrawingArea | Not needed, you can paint on any Qt widgets | A widget for custom user interface elements |
GtkEventBox | Not needed in Qt | A widget used to catch events for widgets which do not have their own window |
GtkHandleBox | QDockWidget (not equal, but does similar things) | a widget for detachable window portions |
GtkIMContextSimple | QInputContext | An input method context supporting table-based input methods |
GtkIMMulticontext | QInputContext | An input method context supporting multiple, loadable input methods |
GtkSizeGroup | N/A | Grouping widgets so they request the same size |
GtkTooltip | QToolTip (rarely used. usually QWidget::setTooltip() is enough | Add tips to your widgets |
GtkViewport | Not needed in Qt | An adapter which makes widgets scrollable |
GtkAccessible | ? | Accessibility support for widgets |
GTK+ class | Qt class | Comment |
---|---|---|
GtkWidget | QWidget | Base class for all widgets |
GtkContainer | N/A and not needed in Qt | Base class for widgets which contain other widgets |
GtkBin | N/A and not needed in Qt | A container with just one child |
GtkMenuShell | N/A and not needed in Qt | A base class for menu objects |
GtkMisc | N/A and not needed in Qt | Base class for widgets with alignments and padding |
GtkRange | QAbstractSlider | Base class for widgets which visualize an adjustment |
GtkIMContext | QInputContext | Base class for input method contexts |
GTK+ class | Qt class | Comment |
---|---|---|
GtkPlug | QX11EmbedWidget | Toplevel for embedding into other processes |
GtkSocket | QX11EmbedContainer | Container for widgets from other processes |
GTK+ class | Qt class | Comment |
---|---|---|
GtkRecentManager | N/A | Managing recently used files |
GtkRecentChooser | N/A | Interface implemented by widgets displaying recently used files |
GtkRecentChooserDialog | N/A | Displays recently used files in a dialog |
GtkRecentChooserMenu | N/A | Displays recently used files in a menu |
GtkRecentChooserWidget | N/A | Displays recently used files |
GtkRecentFilter | N/A | A filter for selecting a subset of recently used files |
GTK+ class | Qt class | Comment |
---|---|---|
GtkAppChooser | N/A | Interface implemented by widgets for choosing an application |
GtkAppChooserButton | N/A | A button to launch an application chooser dialog |
GtkAppChooserDialog | N/A | An application chooser dialog |
GtkAppChooserWidget | N/A | Application chooser widget that can be embedded in other widgets |
GTK+ class | Qt class | Comment |
---|---|---|
GtkBuildable | N/A and not needed in Qt | Interface for objects that can be built by GtkBuilder |
GtkBuilder | QUiLoader | Build an interface from an XML UI definition |
GTK+ class | Qt class | Comment |
---|---|---|
GtkApplication | QApplication | Application class |
GtkApplicationWindow | N/A and not needed in Qt | GtkWindow subclass with GtkApplication support |
GtkActionable | N/A and not needed in Qt | An interface for widgets that can be associated with actions |
GTK+ class | Qt class | Comment |
---|---|---|
GtkStyle | QStyle | Deprecated object that holds style information for widgets |
GtkHBox | QHBoxLayout | A horizontal container box |
GtkVBox | QVBoxLayout | A vertical container box |
GtkHButtonBox | ? | A container for arranging buttons horizontally |
GtkVButtonBox | ? | A container for arranging buttons vertically |
GtkHPaned | ? | A container with two panes arranged horizontally |
GtkVPaned | ? | A container with two panes arranged vertically |
GtkTable | QTableWidget, QGridLayout | Pack widgets in regular patterns |
GtkHSeparator | ? | A horizontal separator |
GtkVSeparator | ? | A vertical separator |
GtkHScrollbar | ? | A horizontal scrollbar |
GtkVScrollbar | ? | A vertical scrollbar |