当前位置:网站首页>QT use qlisview to realize QQ login history list

QT use qlisview to realize QQ login history list

2022-07-19 13:39:00 Climb on the grass

One . effect

The realistic effect has no white border

Two . Realization

As can be seen from the renderings , Has the following characteristics :
1. Floating scroll bar
Custom translucent scroll bar suspended in Item above , With the original occupation Item The width of the scroll bar has the same effect
2. It supports specifying the maximum number of rows to be displayed
The maximum support for displaying three lines in the rendering , When the delete item When there are only three lines left , The scroll bar disappears automatically
3. The delete button has a click effect
When you click the delete button , The delete button turns red
4.popup Pop ups are useless shadows
Usually popup Pop up windows will have shadows , As shown in the figure below


The way to remove the shadow is to add Qt::NoDropShadowWindowHint sign

setWindowFlags(Qt::FramelessWindowHint | Qt::Popup | Qt::NoDropShadowWindowHint);

This article is based on QListView、QStyledItemDelegate and QStandardItemModel
QStyledItemDelegate Used for processing Item Drawing and Item event , Source code is as follows :
QHItemDelegate.h

#ifndef QHITEMDELEGATE_H
#define QHITEMDELEGATE_H

#include <QStyledItemDelegate>
#include <QMetaType>

typed
原网站

版权声明
本文为[Climb on the grass]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207171820577997.html