关于label->setGeometry()
bool example_first::eventFilter(QObject* watched,QEvent* event)
{
x = this->width();
y = this->height();
size = (x > y) ? y/18 : x/18;
x -= size;
y -= size;
if(watched == label1)
{
if(event->type() == QEvent::MouseButtonRelease)
{
label1->setGeometry(QRect(3*x/16, 9*y/18, size, size));
label21->setText(tr("Mouse button released from left image"));
}
}
return QMainWindow::eventFilter(watched,event);
}