Reputation: 658
I have a labels with images added through the designer, and I want to handle their resize event. So I want a specific function to be called once they are resized. How should I do that?
Upvotes: 0
Views: 1144
Reputation: 2602
You can install an event filter to the labels.
For more details you can see the Qt documentation about Event filters
Example:
MainWidget::MainWidget(QWidget* parent) : QWidget(parent)
{
ui.setupUi(this);
theLabel->installEventFilter(this);
}
bool MainWidget::eventFilter(QObject* o, QEvent* e)
{
if(e->type() == QEvent::Resize)
{
//manage the resize event
}
return false;
}
Upvotes: 3