What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view?
Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)?
Can anyone link to some example code that achieves this? Then again, perhaps this isn't the place to look for Qt-specific code.
You're doing it wrong if you are generating pixmaps inside any of the delegate methods (paint, draw...).
Try to generate the thumbnails only once (on worker thread or maybe not even at runtime, if possible) and have the delegate just display them for the appropriate role.
If you do it at runtime display a default picture until you have the thumbnail generated (like web browsers do with pictures that are not yet downloaded).
Related
I want to be able to create an simple internal theming system for my program (by internal I mean I don't need to be able to load custom themes from user system... all themes will be embedded inside the program itself.)
I can think of some ways:
simply put all color inside the main stylesheet of the program, every time the colors need to change, retrieve main stylesheet, parse and change the colors, and then reapply it again (or have multiple stylesheet with different colors, and apply them when its needed).
Create a top widget that only hold the colors for each widget, and then a child widget that hold other stylesheet for other styling, and all the UI as child of this widget... in this way we need to only change the first stylesheet.
... (not sure about other ways, but I'm sure there is some... maybe using QStyle or something..?)
I'm not sure what is the best way to achieve what I'm after, that will be best at both performance and the code itself...
I know the first way will be heavy in performance side, to each time change the whole stylesheet and rerender the whole program. (I think at least)
the second option though, I'm not sure how it will work, I mean its any better then the first one?!
or there is any other better methods..?
you should create a .qss file and add it in your .qrc like you add your icons.
then write all your stylesheet there. you can have multiple Style.qss files and these files are your themes and whenever you change it your theme will change.
add your Style.qss File in your Resources(.qrc)
write these codes in main.cpp
Load the application style
QFile styleFile(":/style.qss");
styleFile.open(QFile::ReadOnly);
Apply the loaded stylesheet
QString style(styleFile.readAll());
a.setStyleSheet(style);
For more information :
https://github.com/GTRONICK/QSS
https://github.com/ColinDuquesnoy/QDarkStyleSheet
I am allowing a user to dynamically create jssor slideshows each with their own image library. I also allow the user to delete slideshows along with their image libraries. This is a dynamic editor that avoids page reloading (an important point).
If I use .remove() to delete the slideshow container the user sees it disappear and while that appears to be the desired result there's a hidden problem.
Because the directory of images has also been deleted the browser's javascript console is generating a continuous stream of not found errors for the thumb images. In other words, though it appears to be completely removed the jssor code is still trying to retrieve images. I've read all the documentation and there doesn't appear to be any actual destructor for jssor. JavaScript delete() is not an answer.
Since this is a dynamic editor the user must be able to create and delete jssor objects at will without page reloading. Is there any way to really destroy the jssor object?
I've solve my own problem... it was simple enough. Simply put the slideshow in Pause before deleting it. This stops the image accessing and stops the bandwidth consumption.
I have set up a BlackBerry Cascades-UI project. I am using QML to define the look and feel of the user interface. I need to provide the user a method of selecting an image from the device photo gallery after the screen has been touched.
Does anyone have any idea on how to provide a list on the screen with all the images in the gallery and their appropriate names after a touch event has been triggered?
Perhaps someone would like to know even though nobody answered.
There currently is no Photo Gallery dialog (though it is announced and will probably be released in an update in the near future). However, it is possible to invoke a native file selection dialog from another thread. For more information about this, go to the support forums for Cascades and find a topic called: "Using native filebrowse and filesave dialog in Cascades".
Here is a link.
on beta 3, you can use file picker to select file(s)
i like to display image from server without downloading it , sure i can use qwebkit.
but i like to be able to display the image in some kind of list . what option do i have ?
I know that QTextEdit supports img tags, and I use them in lists. However, I don't know if it actually supports full URLs for those images, I just use images from the resource file. You could however give it a try.
Use setHTML() to set the HTML source code, setText() assumes plain-text.
You -have to- download the image manually and load it into a QPixmap to show it. You can use libcurl to download the image, it's pretty solid and works on virtually any platform. And really easy to use.
could you please point c++ code example to display videos and images thumbnails in listview?
I can help with images, but not videos:
http://www.codeproject.com/KB/GDI-plus/GdiPThumbnailsViewer.aspx
Basically you use a normal list control and add the images to an associated image list. There are some gotchas though - looks like you have to use the CImageView::ReplaceImage instead of CImageView::AddImage, else the images don't appear correctly. Masking the image may also require some work.