QWidget *widget = new QWidget; widget->setGeometry(50, 50, 200, 100); // Sets the position to (50, 50) and size to 200x100
QWidget *widget = new QWidget; int x = widget->x(); // Retrieves the x coordinate of the top-left corner of the widget int y = widget->y(); // Retrieves the y coordinate of the top-left corner of the widget int width = widget->width(); // Retrieves the width of the widget int height = widget->height(); // Retrieves the height of the widget
QWidget *widget = new QWidget; widget->move(100, 100); // Moves the widget to position (100, 100)These examples use the Qt package library, specifically the QWidget class which is part of the QtGui module.