I want to connect clicked() signal of QWidget-container to my slot. So I wrote this code:
hpp:
class LinkWidget : public QWidget
{
Q_OBJECT
public:
explicit LinkWidget(QWidget * parent = 0 );
~LinkWidget();
signals:
void clicked();
protected:
void mousePressEvent(QMouseEvent * event ) ;
};
cpp:
LinkWidget::LinkWidget(QWidget * parent) :
QWidget(parent)
{
}
LinkWidget::~LinkWidget()
{
}
void LinkWidget::mousePressEvent(QMouseEvent * event)
{
emit clicked();
}
Everything works fine, but I can't assign stylesheet to this widget anymore:
That works:
QWidget * statuspanel = new QWidget(this);
statuspanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
statuspanel->setMinimumHeight(20);
statuspanel->setMaximumHeight(20);
statuspanel->setStyleSheet("border-bottom: 1px solid rgb(206, 203, 186);"
"border-right : 1px solid rgb(206, 203, 186);");
That doesn't:
LinkWidget * statuspanel = new LinkWidget(this);
statuspanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
statuspanel->setMinimumHeight(20);
statuspanel->setMaximumHeight(20);
statuspanel->setStyleSheet("border-bottom: 1px solid rgb(206, 203, 186);"
"border-right : 1px solid rgb(206, 203, 186);");
What am I doing wrong?
Thanks!