Unsolved QLabel + QImage Error.
-
Copy and paste the picture into QGraphicsView to create an RGB representation. What is the problem?
-
@Pada_ Can you please rephrase your question? I really don't understand what you're asking...
-
@jsulm
This does not happen on Linux, only on Windows. Use the capture tool. After capturing, ctrl + C / ctrl + V will create a RGB Sign like the picture in the lower left corner. Is there a way to get rid of it? -
-
I want to create an image in QGraphicsView in QGraphicsScene with the Ctrl + V image copied from the clipboard.
The capture tool is a tool provided by Windows.
It is created in the corner like a photograph.
-
Run the capture tool provided by Windows.
-
Do not save to the path, right-click, and then click Copy.
-
Set the image on the label. There is an RGB display in the lower left corner.
-
-
@Pada_ I don't see how you can set image on a QLabel via copy/paste? You need to select a resource or image file.
So, how exactly do you do this "Set the image on the label"? -
It is set to QLabel-> setPixMap.
I'm importing QImgae from the clipboard and converting it to Pixmapd.
No, I already did it because I could do it by setting the image on the path and setting it.
However, if you save the image to the clipboard without a path and paste it, it is created without the path.
This is also created by setting the image on the label. But as I said, there is an RGB Sign in the corner. That may explain why it occurs and how to get rid of it. I'm asking that.
-
@Pada_ said in QLabel + QImage Error.:
I'm importing QImgae from the clipboard and converting it to Pixmapd.
How?
"However, if you save the image to the clipboard without a path and paste it, it is created without the path." - paste where?
I really don't understand what you're doing. Where exactly do you do Ctrl-v? -
QGraphicsScene, as I said before.
There is an item in the sceneItem that deals with the image, but it is not the same as me.
I did not put it anywhere. Just the label of the new projet and the way I told you before, there's an RGB mark in the corner.
-
Hi
Im not sure what tool that is. ?
Seems not to be installed in my windows. -
use this tool.
-
Ok.
But i cant get to it to paste anything to a QGraphicsView .
Nothing happens.
Did you write some code to allow this ? -
QGraphicsView I'm working on it, so you can do it with Ctrl + V.
In addition to QGraphicsView, the result is the same even if you create a new project and set the Image stored in the Clipboard in the QLabel.
-
Capture the image with the capture tool and do not save it. Then click the right mouse button and click Copy. It will then enter the Clipboard.
-
Run it as my source.
-
Looking at the left corner or the corners of the image, you will see the RGB dots.
QClipboard *clipboard = QApplication::clipboard();
if(!clipboard)
return;
test source !
#include "mainwindow.h"
#include "ui_mainwindow.h"#include <QBuffer>
#include <QClipboard>
#include <QMimeData>MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);QClipboard *clipboard = QApplication::clipboard(); if(!clipboard) return; const QMimeData *mimeData = clipboard->mimeData(); if(!mimeData) return; if(mimeData->hasImage()) { QImage image = qvariant_cast<QImage> (mimeData->imageData()); ui->label->setPixmap(QPixmap::fromImage(image)); }
}
MainWindow::~MainWindow()
{
delete ui;
} -
-
Hi
Using your code and paste to QLabel did not show RGB dots
What Qt version are you using ?
-
I am using Qt5.4 version and Windows8 64Bit.
The same phenomenon came out on Windows10 64Bit.
I did it with the same source, but did not come out with RGB dots like the picture?
Can I check the source?
-
@Pada_
Which source ?
I used your QClipboard *clipboard = QApplication::clipboard(); code and a blank project with QLabel. -
I also tested it with the source I wrote.
But it looks like a picture. I do not know where the problem is.
-
@Pada_
Are you saying the code you show here and QLablel works but
in real program it don't with QGraphicsView ?Would it be possible to test with a newer Qt version ?
5.4 is pretty old. -
-
@Pada_
nope. i dont have 5.4.