Moving through images in image viewer example
-
Hi everyone.
I am really new to Qt and am still in early learning phase.
I am trying to learn through the documentations given alongwith the software.
Currently I am working in the image viewer example given with the SDK.
I want to add some functions in the program.
So, here’s what I am looking for-
I opened an image in the window. Now I want to move through the folder i.e. create 2 new Acts of previous and next in the view menu. So, can anyone guide me through the task as in tell me step by step and referring to the same example preferably, about how to program the given functions. -
Hi,
If you refer the code you can see how they create the Actions and add them to the Menu. Similarly you have to create 2 actions you require and add them to the Menu.
Then connect these two Actions to a slot so that they are called when the actions are triggered.
Now to display the images as per the actions, first get all absolute paths of the images from a folder(Iterate over that folder using QDir) and store it in QStringList and then just access the items ( using QStringList::at(int i) ) of this QStringList as per the Actions performed (i.e increment or decrement i).
Then once you get the current fullpath of the image just display it
Hope this helps.