QObject isWidgetType is a method used in Qt framework library for C++. It is used to check if a QObject is of type QWidget or any of its derived subclasses, such as QLabel or QPushButton.
Example 1: A QComboBox object is created and checked if it is of type QWidget.
QComboBox* comboBox = new QComboBox();
if(comboBox->isWidgetType())
{
qDebug() << "comboBox is a QWidget";
}
Example 2: A QLabel object is created and checked if it is of type QPushButton.
QLabel* label = new QLabel();
if(label->isWidgetType())
{
qDebug() << "label is a QWidget";
}
Package library: Qt Core library.
C++ (Cpp) QObject::isWidgetType - 30 examples found. These are the top rated real world C++ (Cpp) examples of QObject::isWidgetType extracted from open source projects. You can rate examples to help us improve the quality of examples.