You could use a QLabel with HTML links for your letter selector. In its LinkActivated you handle the update of the file list.
some (pseudo)code to get you started:
void MyWidget::MyWidget(..)
{
// Initialization..
connect(label,
SIGNAL(linkActivated
(QString),
this,
SLOT(OnLinkActivated
(QString));
OnLinkActivated('A');
}
void MyWidget
::UpdateLabel(QChar capitalLetter
) {
through all letters c, where files exist..
{
if (d == capitalLetter) d = d.toUpper();
labeltext += "<a href="+c+" style=\"text-decoration:none;\">"+d+"</a>";
}
label.setText(labeltext);
}
void MyWidget
::OnLinkActivated(QString letter
) {
UpdateLabel(letter);
// update your file list accordingly..
}
void MyWidget::MyWidget(..)
{
// Initialization..
connect(label,SIGNAL(linkActivated(QString),this,SLOT(OnLinkActivated(QString));
OnLinkActivated('A');
}
void MyWidget::UpdateLabel(QChar capitalLetter)
{
QString labeltext = "";
through all letters c, where files exist..
{
QChar d = c;
if (d == capitalLetter) d = d.toUpper();
labeltext += "<a href="+c+" style=\"text-decoration:none;\">"+d+"</a>";
}
label.setText(labeltext);
}
void MyWidget::OnLinkActivated(QString letter)
{
UpdateLabel(letter);
// update your file list accordingly..
}
To copy to clipboard, switch view to plain text mode
Hope it get's you started..
Good luck,
Johannes
Bookmarks