13#ifndef STREAMS_PASSWORD_DELEGATE_H
14#define STREAMS_PASSWORD_DELEGATE_H
17#include <QStyledItemDelegate>
19namespace toolx::streams {
27 using QStyledItemDelegate::QStyledItemDelegate;
32 QWidget *
createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
33 const QModelIndex &index)
const override
35 auto *editor = QStyledItemDelegate::createEditor(parent, option, index);
36 if (
auto *line = qobject_cast<QLineEdit *>(editor)) {
37 line->setEchoMode(QLineEdit::Password);
44 void initStyleOption(QStyleOptionViewItem *option,
const QModelIndex &index)
const override
46 QStyledItemDelegate::initStyleOption(option, index);
47 option->text = QString(index.data(Qt::EditRole).toString().size(), QChar(0x2022));