Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75023

QLabel setPixmap Image Error.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.4.0
    • Tools: Designer
    • None
    • windows 8 64Bit
    • Windows

    Description

      QLabel과 QPixmap을 사용하여 QLabel에 이미지를 표시하고 싶습니다.

      Linux 사양에서 잘 작동하며 Windows에서만 발생합니다.

      Windows에서 제공하는 캡처 도구를 사용하여 캡처 기능을 수행 한 후에는 경로에 저장하지 않고 마우스 오른쪽 단추를 클릭하십시오.

      이미지가 클립 보드에로드되면 이미지가 Qt 클립 보드에서 검색되고 이미지는 QLabel의 setPixmap에 의해 설정됩니다.

      그런 다음 세 개의 RGB 도트가 설정 이미지의 왼쪽 하단 모서리에 생성됩니다.

      저장된 경로가있는 파일을로드하여 QLabel에 설정하는 것이 일반적입니다.

       

      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)); }

      Attachments

        1. 2.PNG
          2.PNG
          213 kB
        2. 그림1.png
          그림1.png
          35 kB
        3. 캡처.PNG
          캡처.PNG
          22 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            pada_ Ha sang su
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes