Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Taglib OGG CoverArt
I want to get coverart of ogg files with taglib. I want to be able to get a QImage from the coverart. I searched the internet but I couldn't find a good solution. Can someone help?
disclaimer: I dont know taglib.
he seems to get image this way
image.loadFromData((const uchar *) coverArt.data().data(),coverArt.data().size());
So I wonder if it works for ogg too?
No it does not. I tried to treat the ogg file like m4a or mp3 bu it didn't work. I got these to functions for getting images:
QImage Music::imageForTag(TagLib::ID3v2::Tag *tag)
TagLib::ID3v2::FrameList l = tag->frameList("APIC");
QImage image; if(l.isEmpty()) return image; TagLib::ID3v2::AttachedPictureFrame *f = static_cast<TagLib::ID3v2::AttachedPictureFrame *>(l.front()); image.loadFromData((const uchar *) f->picture().data(), f->picture().size()); return image;
QImage Music::imageForTagMP4(TagLib::MP4::Tag *tag)
if (tag->isEmpty()) return image; TagLib::MP4::ItemListMap itemsListMap = tag->itemListMap(); TagLib::MP4::Item coverItem = itemsListMap["covr"]; TagLib::MP4::CoverArtList coverArtList = coverItem.toCoverArtList(); TagLib::MP4::CoverArt coverArt = coverArtList.front(); image.loadFromData((const uchar *) coverArt.data().data(),coverArt.data().size()); return image;
I dont think ogg files have cover art. ( not as default)
It says it is officially not supported. then I will set the default coverart icon for them.
One more problem:
I have a QMenu in my QMenuBar and it has an icon and a title. when I run the project it shows the icon but when I click on it it shows the title but I want it to show the icon. what should I do?
Hi, if I create a default project and create a menu item and set its icon.
the icon and text is displayed all the time so not sure what happens to your icon/text.
Hi, see it your self:
can I set the menu to only show the icon?
What happens if you don't set text for the menu item?
when you don't click on it it shows the icon and when you do it becomes empty