Status Bar - StatusTipRole
Hi,
I tried to use the StatusBar feature in my Model/View application by selecting the right role in my data() method:
if (role == Qt::StatusTipRole)
return QVariant("Hello World");
but nothing happens :-/ Do I have to activate the status bar in my main window ? Or what is my mistake ?
Thanks for your help,
Alex
Re: Status Bar - StatusTipRole
I am sorry, I didnt get what you want to achieve.
If you want to display message in the status bar,
u can use - statusBar()->showMessage() method in the QMainWindow class of ur application.
Re: Status Bar - StatusTipRole
No this is not, what I want to have.
Qt's Model/View architecture has a data() method, which provides information from the model to the view.
The data() method has different "roles" which provide different types of data to the view.
Code:
{
if (!index.isValid())
{
qDebug("DEBUG: index is not valid:");
}
if (role == Qt::DisplayRole)
return displayRole(index);
else if
(role == Qt::DecorationRole)
return decorationRole(index);
else if
(role == Qt::BackgroundRole)
return backgroundRole(index);
else if
(role == Qt::ToolTipRole)
return toolTipRole(index);
else if
(role == Qt::StatusTipRole)
{
/* if(index.row() == 0 && index.column() == 0 || index.row() == 0 && index.column() == 1)
return QVariant(" hello world");*/
}
{
// return QVariant(QIcon("arrowOpen.png"));
}
so the role:
(role == Qt::StatusTipRole)
return QVariant("status");
should return a String to the view, which will be presented automatically in the status bar. As far as I understand, I need not to implement some code for the representation of the status bar, it is done by the MV architecture. Am I right ? The problem is, the statusbar role seem not to work.
Re: Status Bar - StatusTipRole
Re: Status Bar - StatusTipRole
Which exact version of Qt are you using? Try:
Code:
view->viewport()->setMouseTracking(true);