Hello!
I've created my own button. But when I try to connect it with SLOT(quit()) this slot dosn't work. Could anybody find a problem?
Code:
Code:
#include <QtGui> #include "MYbutton.h" static const int buttonWidth=233; static const int buttonHeight=55; { setAutoFillBackground(true); setMaximumSize(frameSize); setMinimumSize(frameSize); m_leave=true; m_enter=false; m_mousePressEvent=false; m_mouseReleaseEvent=false; } MYButton::~MYButton() { } { Q_UNUSED(pe); defaultImage->load(defaultImageFileName); actionImage->load(actionImageFileName); if (!m_enter) { image=defaultImage; } else { image=actionImage; }; QPointF point; if(!m_mousePressEvent) { point.setX(1); point.setY(1); } else { point.setX(3); point.setY(3); } painter.drawImage(point, *image); } { return buttonSize; } { m_enter=true; this->repaint(); } { m_enter=false; m_mousePressEvent=false; this->repaint(); } { m_mousePressEvent=true; this->repaint(); } { m_mousePressEvent=false; this->repaint(); } { actionImageFileName=filename; } { defaultImageFileName=filename; }
Code:
#include <QtGui/QApplication> #include <QtGui/QVBoxLayout> #include "MYbutton.h" int main(int argc, char *argv[]) { MYButton *button1=new MYButton; button1->show(); return a.exec(); }
