diff --git a/resources/images/plaster.png b/resources/images/plaster.png deleted file mode 100644 index 38c615a..0000000 Binary files a/resources/images/plaster.png and /dev/null differ diff --git a/resources/minimal_resources.qrc b/resources/minimal_resources.qrc index cf719b1..8eafbab 100644 --- a/resources/minimal_resources.qrc +++ b/resources/minimal_resources.qrc @@ -1,6 +1,5 @@ - images/plaster.png images/crate.png images/stone.png images/wood.png diff --git a/resources/resources.qrc b/resources/resources.qrc index 7f88b11..e98785d 100644 --- a/resources/resources.qrc +++ b/resources/resources.qrc @@ -1,6 +1,5 @@ - images/plaster.png images/crate.png images/stone.png images/wood.png diff --git a/src/app/qtkmainwindow.cpp b/src/app/qtkmainwindow.cpp index 763a33d..f05b54a 100644 --- a/src/app/qtkmainwindow.cpp +++ b/src/app/qtkmainwindow.cpp @@ -62,7 +62,7 @@ MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent) ui_->menuView->addAction(ui_->qtk__TreeView->toggleViewAction()); // Set the window icon used for Qtk. - setWindowIcon(Qtk::getIcon()); + setWindowIcon(getIcon()); } MainWindow::~MainWindow() diff --git a/src/app/qtkmainwindow.h b/src/app/qtkmainwindow.h index 42f0c1f..40c5df9 100644 --- a/src/app/qtkmainwindow.h +++ b/src/app/qtkmainwindow.h @@ -132,6 +132,11 @@ class MainWindow : public QMainWindow */ void setScene(Qtk::Scene * scene); + /** + * @return Default icon to use for Qtk desktop application. + */ + static QIcon getIcon() { return QIcon(":/icons/icon.png"); } + public slots: /** * Trigger a refresh for widgets related to a scene that has been updated. diff --git a/src/designer-plugins/widgetplugin.cpp b/src/designer-plugins/widgetplugin.cpp index b9edef2..41798ea 100644 --- a/src/designer-plugins/widgetplugin.cpp +++ b/src/designer-plugins/widgetplugin.cpp @@ -67,7 +67,7 @@ QString WidgetPlugin::whatsThis() const QIcon WidgetPlugin::icon() const { - return Qtk::getIcon(); + return QIcon(":/icons/icon.png"); } bool WidgetPlugin::isContainer() const diff --git a/src/qtk/qtkapi.h b/src/qtk/qtkapi.h index 9464720..dcaf24f 100644 --- a/src/qtk/qtkapi.h +++ b/src/qtk/qtkapi.h @@ -43,14 +43,6 @@ namespace Qtk } return widget; } - - /** - * @return Default icon to use for Qtk desktop application. - */ - static QIcon getIcon() - { - return QIcon(":/icons/icon.png"); - } } // namespace Qtk #endif // QTK_QTKAPI_H diff --git a/src/qtk/texture.cpp b/src/qtk/texture.cpp index a1debfa..4eb3828 100644 --- a/src/qtk/texture.cpp +++ b/src/qtk/texture.cpp @@ -8,6 +8,7 @@ #include #include +#include #include "texture.h" @@ -65,6 +66,22 @@ QOpenGLTexture * OpenGLTextureFactory::initCubeMap(const char * right, QImage(back)); } +QImage OpenGLTextureFactory::defaultTexture() +{ + QImage image({256, 256}, QImage::Format_RGBA8888); + image.fill(Qt::lightGray); + + // Draw a red '?' to the center of the image. + QPainter painter(&image); + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(Qt::red); + painter.setFont({"Helvetica", 100, QFont::Bold}); + constexpr QRect rect(0, 0, 256, 256); + painter.drawText(rect, Qt::AlignCenter, "?"); + + return image; +} + QOpenGLTexture * OpenGLTextureFactory::initCubeMap(const QImage & right, const QImage & top, const QImage & front, diff --git a/src/qtk/texture.h b/src/qtk/texture.h index 18b52d9..bbc474d 100644 --- a/src/qtk/texture.h +++ b/src/qtk/texture.h @@ -145,13 +145,7 @@ namespace Qtk const char * back); /// The texture used in place of a missing texture. - static QImage defaultTexture() - { - // Use plaster for default texture if image fails to load. - // This prevents segfaults when loading a texture that doesn't exist. - // TODO: Replace with a '?' texture to indicate missing texture. - return QImage(":/textures/plaster.png"); - } + static QImage defaultTexture(); private: // Private ctor to prevent creating instances of this class