[SOLVED]QPixmap on click checking



  • Hello!

    How to check pixmap on click? Possibly QSignalmapper?
    I wouldn't like use buttons.

    Thank you!



  • Why don't you want to use QPushButton with an icon on it? Could you please provide more details about your goal?



  • I wanted pass a QPushButton array for function and return, but not worked.
    Therefore I would like use QPushButton instead QPixmap.


  • Moderators

    Did you check "the qsignalmapper docs?":http://qt-project.org/doc/qt-5/qsignalmapper.html#details

    There is an example of what I think you want.

    Otherwise please show us what you have coded and what's not working



  • @
    QPushButton Paklikeveres::kartyaosztas(QString pakli[], QPushButton* jpakli[], QString gep1_pakli[], QString gep2_pakli[], QString gep3_pakli[],
    int pakli_felsolap, int jpakliszam, int gep1pakliszam, int gep2pakliszam, int gep3pakliszam)
    {
    pakli_felsolap = 0;
    jpakliszam = 0;
    gep1pakliszam = 0;
    gep2pakliszam = 0;
    gep3pakliszam = 0;

    for(int i = 0; i <= 5-1; i++)
    {
        jpakli[i]->setObjectName(pakli[i]);
        jpakliszam++;
        //qDebug() << jpakli[i]->objectName();
        //qDebug() << jpakliszam;
    
        gep1_pakli[i] = pakli[i + 1];
        gep1pakliszam++;
    
        gep2_pakli[i] = pakli[i + 2];
        gep2pakliszam++;
    
        gep3_pakli[i] = pakli[i + 3];
        gep3pakliszam++;
    
        pakli_felsolap += 4;
    }
    
    //Gép pakli feltöltés
    for(int i = 0; i <= gep1pakliszam; i++)
    {
        if(i < 4)
        {
            paklistring1 += gep1_pakli[i] + " ";
            paklistring2 += gep2_pakli[i] + " ";
            paklistring3 += gep3_pakli[i] + " ";
        }else{
            paklistring1 += gep1_pakli[i];
            paklistring2 += gep2_pakli[i];
            paklistring3 += gep3_pakli[i];
        }
    }
    jadatbazisa->gepadatok("gep1", paklistring1);
    jadatbazisa->gepadatok("gep2", paklistring2);
    jadatbazisa->gepadatok("gep3", paklistring3);
    
    return *jpakli;
    

    }
    @

    Error:
    /Users/ivanicsmark/Desktop/Uno/paklikeveres.cpp:138: error: no viable conversion from 'QPushButton *' to 'QPushButton'
    return *jpakli;
    ^~~~~~~

    How to return give QPushButton array?


  • Lifetime Qt Champion

    Hi,

    You can't return a QPushButton, it implies a copy and QObject derived class can't be copied.



  • I see.

    Thank you for help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.