franco.amato
12th March 2010, 06:40
Hi to all,
I built a dialog with designer to create an audiotrack list.
With the dialog the user can add/remove audio tracks. In the dialog there is a QListWidget so the user can see the list of the sounds he added.
I would show an "audio" icon near the name of the audio track but it doesn't work.
I set the viewmode to QListView::IconMode so:
ui.trackList->setViewMode(QListView::IconMode);
but it doesn't work. I only see the name of the tracks and not the icon.
This is the ctor of the dialog:
TrackListDlg::TrackListDlg(QStringList& trackList_, QString& srcDir_, QWidget *parent)
: QDialog(parent),
m_trackList(trackList_),
m_srcDir(srcDir_)
{
ui.setupUi(this);
ui.trackList->setSortingEnabled( true );
ui.trackList->setViewMode(QListView::IconMode); //<-- doesn't work
ui.trackList->setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px ; color:rgb(255,255,255)}");
for (int i = 0; i < m_trackList.size(); ++i)
{
QFileInfo fi( m_trackList.at(i) );
ui.trackList->addItem(fi.fileName());
}
connect( ui.cancelBtn, SIGNAL( released() ), this, SLOT( slotCancel() ) );
connect( ui.addBtn, SIGNAL( released() ), this, SLOT( slotAdd() ) );
}
The audio tracks can only be *.mp3 or *.wav and I think windows should set the right icon for such files or I'm wrong?
Do I have to set the icons manually?
I hope to get help.
Best Regards,
Franco
I built a dialog with designer to create an audiotrack list.
With the dialog the user can add/remove audio tracks. In the dialog there is a QListWidget so the user can see the list of the sounds he added.
I would show an "audio" icon near the name of the audio track but it doesn't work.
I set the viewmode to QListView::IconMode so:
ui.trackList->setViewMode(QListView::IconMode);
but it doesn't work. I only see the name of the tracks and not the icon.
This is the ctor of the dialog:
TrackListDlg::TrackListDlg(QStringList& trackList_, QString& srcDir_, QWidget *parent)
: QDialog(parent),
m_trackList(trackList_),
m_srcDir(srcDir_)
{
ui.setupUi(this);
ui.trackList->setSortingEnabled( true );
ui.trackList->setViewMode(QListView::IconMode); //<-- doesn't work
ui.trackList->setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px ; color:rgb(255,255,255)}");
for (int i = 0; i < m_trackList.size(); ++i)
{
QFileInfo fi( m_trackList.at(i) );
ui.trackList->addItem(fi.fileName());
}
connect( ui.cancelBtn, SIGNAL( released() ), this, SLOT( slotCancel() ) );
connect( ui.addBtn, SIGNAL( released() ), this, SLOT( slotAdd() ) );
}
The audio tracks can only be *.mp3 or *.wav and I think windows should set the right icon for such files or I'm wrong?
Do I have to set the icons manually?
I hope to get help.
Best Regards,
Franco