1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #include "AboutView.h"
- #include "AppInfoWidget.h"
- #include <QBoxLayout>
- #include <QApplication>
- #include <QPainter>
- #include <QLabel>
- #include <QResizeEvent>
- #include <QDebug>
- AboutView::AboutView(QWidget *parent) : QWidget(parent)
- {
- setWindowTitle("关于");
- }
- void AboutView::showEvent(QShowEvent *event)
- {
- qDebug() << __FUNCTION__;
- QWidget::showEvent(event);
- initialize();
- }
- void AboutView::hideEvent(QHideEvent *event)
- {
- qDebug() << __FUNCTION__ << __LINE__ << endl;
- QWidget::hideEvent(event);
- }
- void AboutView::resizeEvent(QResizeEvent *event)
- {
- QWidget::resizeEvent(event);
- initialize();
- m_bgLabel->resize(event->size());
- m_bgLabel->setPixmap(pixmap.scaled(width(), height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
- }
- void AboutView::initialize()
- {
- if (m_initilized == true) {
- return;
- }
- m_bgLabel = new QLabel(this);
- pixmap = QPixmap(":/resource/background/1.jpg");
- m_vBoxLayout = new QVBoxLayout(this);
- m_appInfoWidget = new AppInfoWidget(this);
- m_vBoxLayout->addWidget(m_appInfoWidget);
- m_initilized = true;
- }
|