void PlaylistDelegateBase::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { QueuedItemDelegate::paint(painter, Adjusted(option, index), index); // Stop after indicator if (index.column() == Playlist::Column_Title) { if (index.data(Playlist::Role_StopAfter).toBool()) { QRect rect(option.rect); rect.setRight(rect.right() - queue_indicator_size(index)); DrawBox(painter, rect, option.font, tr("stop")); } } }
void DirectusComboLabelText::Initialize(QString labelText) { m_validator = new QDoubleValidator(-2147483647, 2147483647, 4); m_validator->setProperty("notation", QDoubleValidator::StandardNotation); // Initialize the text m_text = new QLineEdit(); m_text->setValidator(m_validator); // Initialize the label m_label = new DirectusAdjustLabel(); m_label->setText(labelText); m_label->setAlignment(Qt::AlignRight); m_label->Initialize(m_text); // textChanged(QString) -> emits signal when changed through code // textEdited(QString) -> doesn't emit signal when changed through code connect(m_label, SIGNAL(Adjusted()), this, SLOT(TextGotEdited())); connect(m_text, SIGNAL(textEdited(QString)), this, SLOT(TextGotEdited())); }