Now with a picture-button that does a thing

This commit is contained in:
R. Aidan Campbell 2018-04-28 17:21:05 -07:00
parent 7f6d0c7484
commit e5c336223c
4 changed files with 22 additions and 0 deletions

View file

@ -6,6 +6,12 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow) ui(new Ui::MainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
myButton = new QPushButton(this);
myButton->setIcon(QIcon(":/res/icon128.png"));
myButton->setIconSize(QSize(128, 128));
myButton->resize(QSize(128, 128));
connect(myButton, &QAbstractButton::clicked, this, &MainWindow::on_actionExit_triggered);
} }
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
@ -28,6 +34,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete ui; delete ui;
delete myButton;
} }
void MainWindow::on_actionExit_triggered() void MainWindow::on_actionExit_triggered()

View file

@ -24,6 +24,7 @@ private slots:
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QAbstractButton *myButton = nullptr;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View file

@ -34,3 +34,6 @@ HEADERS += \
FORMS += \ FORMS += \
mainwindow.ui mainwindow.ui
RESOURCES += \
resources.qrc

11
resources.qrc Normal file
View file

@ -0,0 +1,11 @@
<RCC>
<qresource prefix="/">
<file>res/icon128.png</file>
<file>res/ic_add_to_queue_white_48px.svg</file>
<file>res/ic_remove_circle_outline_white_48px.svg</file>
<file>res/ic_remove_from_queue_white_48px.svg</file>
<file>res/ic_tv_white_48px.svg</file>
<file>res/ic_videogame_asset_white_48px.svg</file>
<file>res/no_app_image.png</file>
</qresource>
</RCC>