Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ addons:
- qt510-meta-minimal
- qt510declarative
- qt510webengine
- qt510svg
- qt510imageformats
- mesa-common-dev
- cmake
install:
Expand Down
3 changes: 3 additions & 0 deletions QtWidgetsApplication/QtWidgetsApplication.pro
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ icon.files = QtWidgetsApplication.png
desktop_entry.path = $$PREFIX/share/applications
desktop_entry.files = QtWidgetsApplication.desktop
INSTALLS += target icon desktop_entry

RESOURCES += \
resources/icons/icons.qrc
336 changes: 336 additions & 0 deletions QtWidgetsApplication/QtWidgetsApplication.pro.user

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions QtWidgetsApplication/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QAction *action = new QAction(this);
QIcon icon;
auto iconThemeName = QStringLiteral("list-add");
if (QIcon::hasThemeIcon(iconThemeName)) {
icon = QIcon::fromTheme(iconThemeName);
} else {
icon.addFile(QStringLiteral("."), QSize(), QIcon::Normal, QIcon::Off);
}
action->setIcon(icon);
ui->mainToolBar->addAction(action);

// There is no warranty that a given icon will be present in the target platform icons theme
// therefore we must provide a fallback
QIcon addIcon = QIcon::fromTheme("list-add", QIcon(":/scalable/list-add.svg"));
QAction *addAction = new QAction(addIcon, tr("&Add..."), this);

ui->mainToolBar->addAction(addAction);
}

MainWindow::~MainWindow()
Expand Down
5 changes: 5 additions & 0 deletions QtWidgetsApplication/resources/icons/icons.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>scalable/list-add.svg</file>
</qresource>
</RCC>
104 changes: 104 additions & 0 deletions QtWidgetsApplication/resources/icons/scalable/list-add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.