{
Q_OBJECT
public:
~CallButton();
protected:
};
class CallButton : public QWidget
{
Q_OBJECT
public:
CallButton(QWidget *parent = 0);
~CallButton();
protected:
void mousePressEvent(QMouseEvent *event);
QGroupBox *groupBox;
QLabel *label;
QLabel *icon;
};
To copy to clipboard, switch view to plain text mode
CallButton
::CallButton(QWidget *parent
){
label
= new QLabel("Label...");
icon->setPixmap(pixmap);
mainLayout->addWidget(label);
mainLayout->addWidget(icon);
mainLayout->insertStretch(1);
groupBox
->setStyleSheet
(QString::fromUtf8("\ QGroupBox {\
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\
stop: 0 #FFFFFF, stop: 1 #E0E0E0);\
border: 2px solid gray;\
border-radius: 5px;\
}"));
groupBox->resize(180,60);
groupBox->setLayout(mainLayout);
}
void CallButton
::mousePressEvent ( QMouseEvent * event
) {
groupBox
->setStyleSheet
(QString::fromUtf8("\ QGroupBox {\
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\
stop: 0 #E0E0E0, stop: 1 #FFFFFF);\
border: 2px solid gray;\
border-radius: 5px;\
}"));
}
CallButton::~CallButton()
{
delete groupBox;
delete label;
delete icon;
}
CallButton::CallButton(QWidget *parent)
: QWidget(parent)
{
groupBox = new QGroupBox(this);
label = new QLabel("Label...");
icon = new QLabel;
QIcon fakeIcon = QIcon("eclipse24.png");
QPixmap pixmap = fakeIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On);
icon->setPixmap(pixmap);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addWidget(label);
mainLayout->addWidget(icon);
mainLayout->insertStretch(1);
groupBox->setStyleSheet(QString::fromUtf8("\
QGroupBox {\
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\
stop: 0 #FFFFFF, stop: 1 #E0E0E0);\
border: 2px solid gray;\
border-radius: 5px;\
}"));
groupBox->resize(180,60);
groupBox->setLayout(mainLayout);
}
void CallButton::mousePressEvent ( QMouseEvent * event )
{
groupBox->setStyleSheet(QString::fromUtf8("\
QGroupBox {\
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\
stop: 0 #E0E0E0, stop: 1 #FFFFFF);\
border: 2px solid gray;\
border-radius: 5px;\
}"));
}
CallButton::~CallButton()
{
delete groupBox;
delete label;
delete icon;
}
To copy to clipboard, switch view to plain text mode
Bookmarks