I want to Devlope slideshow of images available in qrc file when I click on left key and right key it will show next image . Can anyone give some idea for that or any reference file to me that help me to create this?
I want to Devlope slideshow of images available in qrc file when I click on left key and right key it will show next image . Can anyone give some idea for that or any reference file to me that help me to create this?
The usual way to load and display images is using a QLabel to display the image and QPixmap or QImage to load the image from the resource file using the "qrc:///path-to-resource/image-file.png" or ":/path-to-resource/image-file.png" resource file name conventions.
To change the pictures, you will need to implement an event handler for QWidget::keyPressEvent() or QWidget::keyReleaseEvent(), looking for QKeyEvent::key() values equal to Qt::Key_Left or Qt::Key_Right.
The easiest way is to derive a new class from QLabel and override the keyPressEvent() or keyReleaseEvent(). In your event handler, you load the next image from the qrc file and display it using QLabel::setPixmap().
I am not going to give you source code. This sounds a lot like a homework project, and the goal of homework is to force you to learn how to solve your own programming problems.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
When I use key press(QKeyEvent *event) and then inside I use if else to check key using event->key() value equal to Qt:Key_Left or Right and i increase value of I and then I use stringlist to store more image paths and show in label using this statement
Ui->label->setPixmap(image paths[ยก]) but when I run and press key my application forcefully close
The you need to make a Debug version of your program, run it in the debugger, and find out what is causing the crash. In the one line of code you posted, I see at least four things that could cause a crash:but when I run and press key my application forcefully close
1 - Does "Ui" contain a valid pointer?
2 - Does "label" contain valid pointer, and does it point to a QLabel instance?
3 - Does "i" have a valid value?
4 - Does "image paths[i]" contain a valid path name?
5 - Did the call to setPixmap() succeed?
Your code doesn't check for any errors, and it assumes everything will work perfectly.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
What is means sigabrt signal that cause my application crash?
Hi, sigabrt is for example used by the C library to notify your program of critical error, e.g. problems with the heap.
Ginsengelf
Can anyone tell how to access stringlist where I save all path of my images.
In this code this line will create problem and give sigabrt signal. Can you please tell how to access element in list?Qt Code:
}To copy to clipboard, switch view to plain text mode
Last edited by Rd1912; 20th September 2019 at 07:28.
If you want help, you are going to have to show more than one line of code. Show the code that gives the definitions (data types) for "d", "imagePaths", and "currentSlide" and show how you are loading these variables with values. In other words, copy enough of your actual code that we could study it and try to find your error.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
i able to detect error that lead crash.it is because i (for list) not getting valid value. now it works fine.
Bookmarks