-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
31 lines (26 loc) · 856 Bytes
/
mainwindow.cpp
File metadata and controls
31 lines (26 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
mascotSrc(new QPixmap(":/Anke_2200px.jpg")) {
ui->setupUi(this);
ui->centralWidget->setLayout(ui->verticalLayout);
ui->scrollAreaWidgetContents->setLayout(ui->verticalLayout_2);
ui->lineEdit->setText(QString::fromLatin1(QByteArray::fromStdString("test1")));
syncBackground();
}
void MainWindow::syncBackground() {
QPixmap bkgnd = mascotSrc->scaled(this->size(), Qt::KeepAspectRatioByExpanding);
QPalette palette;
palette.setBrush(QPalette::Background, bkgnd);
this->setPalette(palette);
}
MainWindow::~MainWindow() {
delete mascotSrc;
delete ui;
}
void MainWindow::resizeEvent(QResizeEvent *event) {
syncBackground();
QWidget::resizeEvent(event);
}