Remove qt resource images from libqtk.

This commit is contained in:
Shaun Reed 2025-03-22 11:33:56 -04:00
parent 310f337f57
commit c5e21bd731
9 changed files with 25 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

View File

@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/textures">
<file alias="plaster.png">images/plaster.png</file>
<file alias="crate.png">images/crate.png</file>
<file alias="stone.png">images/stone.png</file>
<file alias="wood.png">images/wood.png</file>

View File

@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/textures">
<file alias="plaster.png">images/plaster.png</file>
<file alias="crate.png">images/crate.png</file>
<file alias="stone.png">images/stone.png</file>
<file alias="wood.png">images/wood.png</file>

View File

@ -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()

View File

@ -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.

View File

@ -67,7 +67,7 @@ QString WidgetPlugin::whatsThis() const
QIcon WidgetPlugin::icon() const
{
return Qtk::getIcon();
return QIcon(":/icons/icon.png");
}
bool WidgetPlugin::isContainer() const

View File

@ -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

View File

@ -8,6 +8,7 @@
#include <QDebug>
#include <QImageReader>
#include <QPainter>
#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,

View File

@ -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