Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Italian
  4. Sovrapporre e salvare immagini

Sovrapporre e salvare immagini

Scheduled Pinned Locked Moved Italian
1 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ivny
    wrote on last edited by
    #1

    Buongiorno a tutti
    Premesso che sto imparando da poco a usare queste librerie , sto avendo un problema con una parte di codice in cui il programma carica tre immagini da una cartella, le inserisce in un'immagine creata ex-novo sovrapponendole e poi salva il tutto.
    Il codice che ho scritto, per ora, è questo:

    @ /* INIZIO CREAZIONE IMMAGINE*/

        QString IMGPath="./ImagesData/";
        QPixmap MatchImage;
        QPixmap MatchBack;
        MatchBack.load(IMGPath + "RisultatoBack.jpeg","JPEG",Qt::ColorOnly);
        MatchBack.scaled(1024,300);
        QPixmap MatchTeam [2];
        MatchTeam[0].load(IMGPath + ui->Team1Name->currentText() + ".png","PNG",Qt::ColorOnly);
        MatchTeam[1].load(IMGPath + ui->Team2Name->currentText() + ".png","PNG",Qt::ColorOnly);
        QPainter painter(this);
    
        painter.begin(&MatchImage);
        painter.drawPixmap(0,0,MatchBack);
        painter.end();
    
        MatchImage.save("prova.jpeg","JPEG",-1);
    
        /* FINE CREAZIONE IMMAGINE*/@
    

    Mancano ancora numerose parti del codice, ma per ora ho provato ad eseguire l'applicazione così come è, ma mi dà numerosi problemi:

    1. commentando tutta la parte riguardante QPainter, non viene salvata alcuna immagine, nemmeno vuota, cosa che succedeva se dichiaravo MatchImage come QPicture
    2. Una volta compilato il programma, non c'è neanche un warning, ma quando provo ad eseguire questa parte, mi vengono scritte queste segnalazioni:
      QPixmap::scaled: Pixmap is a null pixmap
      QWidget::paintEngine: Should no longer be called
      QPainter::begin: Paint device returned engine == 0, type: 1
      QPainter::begin: Paint device returned engine == 0, type: 2
      QPainter::end: Painter not active, aborted

    Sapreste chiarirmi la situazione e/o indicarmi un buon tutorial su come editare le immagini con Qt?
    Grazie mille a tutti :)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved