我有一个标签,通过设计师添加图像,我想处理他们的调整大小事件。因此,我希望在它们被调整大小后,调用一个特定的函数。我该怎么做?
发布于 2017-03-28 23:41:38
可以在标签上安装事件筛选器。
有关详细信息,请参阅关于事件过滤器的Qt文档。
示例:
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;
}
https://stackoverflow.com/questions/43087155
复制