Trying to change spinboxdelegate example from spinbox to QTextEdit but it dosn’t show
Hi
im trying to find out why i can’t see QTextEdit in item delegate , in my application so i remembered there is simple example in the examples
i did put simple QTextEdit in the sample code and it also didn’t show the QTextEdit why ? what im doing wrong
here is the modified code:
Code:
{
//QSpinBox *editor = new QSpinBox(parent);
//editor->setMinimum(0);
//editor->setMaximum(100);
//editor->setGeometry(QRect(40, 30, 401, 31));
editor->setLayoutDirection(Qt::LeftToRight);
editor
->setFrameShape
(QFrame::WinPanel);
editor->setLineWidth(0);
editor->setReadOnly(true);
editor->setText("This is text test!!1");
return editor;
}
//! [1]
//! [2]
void SpinBoxDelegate
::setEditorData(QWidget *editor,
{
/* int value = index.model()->data(index, Qt::EditRole).toInt();
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
spinBox->setValue(value);*/
QTextEdit *textEdit
= static_cast<QTextEdit
*>
(editor
);
textEdit->setText("This is text test!!1");
}
//! [2]
//! [3]
{
/*QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
spinBox->interpretText();
int value = spinBox->value();
model->setData(index, value, Qt::EditRole);*/
QTextEdit *textEdit
= static_cast<QTextEdit
*>
(editor
);
}
//! [3]
//! [4]
void SpinBoxDelegate
::updateEditorGeometry(QWidget *editor,
{
editor->setGeometry(option.rect);
}
Re: Trying to change spinboxdelegate example from spinbox to QTextEdit but it dosn’t
So what does it show when you enter edit mode?