INI--------------------------| unique_ID | QByteArray |--------------------------
#ifndef MYPUSHBUTTON_H#define MYPUSHBUTTON_H#include <QPushButton>#include <QMutex>#include "connectiontcp.h"class myPushButton : public QPushButton{ Q_OBJECT;public: myPushButton(); void setConnection(connectionTCP * connection); connectionTCP* getConnection();public slots: void setNamePush(QString name);private: QMutex mutex; connectionTCP * pConnection; void focusInEvent(QFocusEvent * event); void focusOutEvent(QFocusEvent * event);};#endif // MYPUSHBUTTON_H
#include "mypushbutton.h"#include <QDebug>#include <QIcon>#include <QPixmap>myPushButton::myPushButton() :QPushButton(){setFlat(true);setIcon(QIcon(":/mycomputer.ico"));setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed);}void myPushButton::setNamePush(QString name){ setText(name);}void myPushButton::focusInEvent(QFocusEvent *event){ setFlat(false); setMinimumSize(minimumSize()+QSize(0,100));}void myPushButton::focusOutEvent(QFocusEvent *event){ setFlat(true); setMinimumSize(minimumSize()-QSize(0,100));}void myPushButton::setConnection(connectionTCP *connection){ pConnection=connection;}connectionTCP* myPushButton::getConnection(){ return pConnection;}