Hi.
I have code like:
class GraphItem : public QGraphicsWidget
{
virtual void resizeEvent(QGraphicsSceneResizeEvent* event)
{
//it doesn't call
}
}
class Form : public QGraphicsWidget
{
public:
Form()
{
GraphItem* item1 = new GraphItem;
GraphItem* item2 = new GraphItem;
GraphItem* item3 = new GraphItem;
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout;
layout->addItem(item3);
layout->addItem(item3);
layout->addItem(item3);
setLayout(layout);
};
}
{
Form* form = new Form;
scene->addItem(form);
setScene(scene);
}
{
setSceneRect(0,0,geometry().width(),geometry().height());
form->setGeometry(0,0,geometry().width(),geometry().height());
}
class GraphItem : public QGraphicsWidget
{
virtual void resizeEvent(QGraphicsSceneResizeEvent* event)
{
//it doesn't call
}
}
class Form : public QGraphicsWidget
{
public:
Form()
{
GraphItem* item1 = new GraphItem;
GraphItem* item2 = new GraphItem;
GraphItem* item3 = new GraphItem;
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout;
layout->addItem(item3);
layout->addItem(item3);
layout->addItem(item3);
setLayout(layout);
};
}
class GraphWidget : public QGraphicsView
{
QGraphicsScene* scene = new QGraphicsScene;
Form* form = new Form;
scene->addItem(form);
setScene(scene);
}
void GraphWidget::resizeEvent(QResizeEvent* event)
{
setSceneRect(0,0,geometry().width(),geometry().height());
form->setGeometry(0,0,geometry().width(),geometry().height());
QWidget::resizeEvent(event);
}
To copy to clipboard, switch view to plain text mode
Could somebody explain why resizeEvent doesn't call and how to fix it?
Bookmarks