PDA

View Full Version : Role to display QLabel?



hailflex
13th December 2009, 20:11
hello... in my data() overriding i have a column where i must display a clickable text in everyitem that opens a QDialog when clicked... im trying to use a QLabel for that. The QDialog is already done too. (ActiveLabel already have the clicked() support)

In this example im returning just the text of the QLabel using Qt::DisplayRole, but i want this text to open the sentToDialog when clicked, can someone help me on how is that possible?


if (column == SenderColumn) {
switch (role) {
case Qt::DisplayRole:
SentToDialog* sentToDialog = new SentToDialog();
ActiveLabel* reglabel = new ActiveLabel(sentToDialog);
return reglabel->text();
}
}

wysota
13th December 2009, 21:30
The view has a clicked() signal you can connect to.