Interactive QGraphicsRectItem: Left-Edge Resizing and Shape Dragging in Qt
To create interactive rectangles in a Qt QGraphicsScene, you can subclass QGraphicsRectItem and override its mouse event hendlers. This approach allows you to implement specific behaviors, such as resizing the shape by dragging a specific edge or moving the antire shape across the scene.
Left-Edge Resizing Implementation
The first implementatio ...
Posted on Fri, 16 Oct 2026 16:08:02 +0000 by Nimbuz
Monitoring Caps Lock State in Qt Applications
Implementation Overview
This article demonstrates three approaches for detecting Caps Lock key state changes in Qt applications, with focus on providing real-time visual feedback to users during password entry.
Caps Lock Detection Method
The fundamental technique for determining Caps Lock state uses the Windows API:
bool KeyboardMonitor::checkC ...
Posted on Sun, 11 Oct 2026 16:49:39 +0000 by nagalenoj
Understanding the Model-View Architecture in Qt
Core Concepts of the Model-View Pattern
The Model-View pattern is a fundamental architectural design that promotes separation of concerns in application development. Its primary objective is to decouple the management of data from its presentation, allowing each component to be developed and modified independently.
Key Principles
Separation of ...
Posted on Sat, 10 Oct 2026 16:52:20 +0000 by deansp2001
Implementing Custom Graphics in Qt with QPainter
Qt Drawing Fundamentals
Qt's graphics system provides a comprehensive set of classes for rendering custom graphics on widgets. The framework enables developers to create rich visual interfaces through its powerful drawing capabilities.
Core Drawing Classes
The primary components of Qt's drawing system include:
QPainter: The main drawing class ...
Posted on Sat, 10 Oct 2026 16:35:57 +0000 by markhard
Qt Coordinate Systems for Graphics Rendering
Fundamentals of Coordinate Systems
Qt employs two distinct coordinate systems for graphics rendering:
Device Coordinate System
Origin positioned at top-left corner (0,0)
Measured in physical pixels
X-axis extends rightward, Y-axis extends downward
Logical Coordinate System
Abstract mathematical representation
Unit measurement determined by a ...
Posted on Sat, 10 Oct 2026 16:11:17 +0000 by jdeer0618
Customizing QComboBox Widgets in Qt
Custom List Implementation
For advanced dropdown lists containing images, text, and interactive elements (similar to QQ login interface), we need to extend QComboBox functionality:
class CustomItemWidget : public QWidget {
Q_OBJECT
signals:
void itemClicked();
void textChanged(const QString &);
public:
CustomItemWidget(cons ...
Posted on Fri, 09 Oct 2026 16:28:06 +0000 by kevinlcarlson
Using Qt’s Built-in Dialogs: Font, Progress, and Print Pickers
Font Selection Dialog
The QFontDialog widget lets users pick a typeface and its attributes at run time. Typical workflow:
Create the dialog.
Seed it with an initial font.
Show it modally and read the chosen font if the user accepts.
void pickFont()
{
QFontDialog dlg;
dlg.setWindowTitle("Font Picker");
dlg.setCurrentFont( ...
Posted on Mon, 05 Oct 2026 16:20:49 +0000 by Dan Coates
Practical Techniques for Qt UI Development
Creating Separator Lines
QFrame* separator = new QFrame();
separator->setFrameShape(QFrame::HLine);
separator->setFrameShadow(QFrame::Sunken);
Making QLabel Resize to Text Content
QLabel widget;
widget.setText("content");
widget.adjustSize();
widget.setFixedWidth(widget.width());
widget.setFixedHeight(widget.height());
Adddin ...
Posted on Sun, 04 Oct 2026 16:21:26 +0000 by frost110
Using QML ListView with Custom C++ Data Models
Overview
This example demonstrates how to populate a QML ListView using a custom data model created in C++. The ListView displays items with custom text content and configurable background colors.
DataObject Implementation
The DataObject class serves as the data container for each list item. To expose a C++ class to the QML system, it must inhe ...
Posted on Sat, 03 Oct 2026 16:43:28 +0000 by nemethpeter
Custom Selection Area Rendering for QTableView
Implementation Overview
This article demonstrates how to implement custom selection area rendering for Qt's QTableView component. While Qt provides built-in selection functionality, it lacks customization options for border colors and visual details. The solution involves custom painting techniques to achieve Excel-like selection visuals.
Visua ...
Posted on Sat, 03 Oct 2026 16:11:46 +0000 by trink