Remove qt resource images from libqtk.
This commit is contained in:
		
							parent
							
								
									310f337f57
								
							
						
					
					
						commit
						c5e21bd731
					
				
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 3.8 MiB  | 
@ -1,6 +1,5 @@
 | 
				
			|||||||
<RCC>
 | 
					<RCC>
 | 
				
			||||||
    <qresource prefix="/textures">
 | 
					    <qresource prefix="/textures">
 | 
				
			||||||
        <file alias="plaster.png">images/plaster.png</file>
 | 
					 | 
				
			||||||
        <file alias="crate.png">images/crate.png</file>
 | 
					        <file alias="crate.png">images/crate.png</file>
 | 
				
			||||||
        <file alias="stone.png">images/stone.png</file>
 | 
					        <file alias="stone.png">images/stone.png</file>
 | 
				
			||||||
        <file alias="wood.png">images/wood.png</file>
 | 
					        <file alias="wood.png">images/wood.png</file>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
<RCC>
 | 
					<RCC>
 | 
				
			||||||
    <qresource prefix="/textures">
 | 
					    <qresource prefix="/textures">
 | 
				
			||||||
        <file alias="plaster.png">images/plaster.png</file>
 | 
					 | 
				
			||||||
        <file alias="crate.png">images/crate.png</file>
 | 
					        <file alias="crate.png">images/crate.png</file>
 | 
				
			||||||
        <file alias="stone.png">images/stone.png</file>
 | 
					        <file alias="stone.png">images/stone.png</file>
 | 
				
			||||||
        <file alias="wood.png">images/wood.png</file>
 | 
					        <file alias="wood.png">images/wood.png</file>
 | 
				
			||||||
 | 
				
			|||||||
@ -62,7 +62,7 @@ MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent)
 | 
				
			|||||||
  ui_->menuView->addAction(ui_->qtk__TreeView->toggleViewAction());
 | 
					  ui_->menuView->addAction(ui_->qtk__TreeView->toggleViewAction());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Set the window icon used for Qtk.
 | 
					  // Set the window icon used for Qtk.
 | 
				
			||||||
  setWindowIcon(Qtk::getIcon());
 | 
					  setWindowIcon(getIcon());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MainWindow::~MainWindow()
 | 
					MainWindow::~MainWindow()
 | 
				
			||||||
 | 
				
			|||||||
@ -132,6 +132,11 @@ class MainWindow : public QMainWindow
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void setScene(Qtk::Scene * scene);
 | 
					    void setScene(Qtk::Scene * scene);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @return Default icon to use for Qtk desktop application.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    static QIcon getIcon() { return QIcon(":/icons/icon.png"); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public slots:
 | 
					  public slots:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Trigger a refresh for widgets related to a scene that has been updated.
 | 
					     * Trigger a refresh for widgets related to a scene that has been updated.
 | 
				
			||||||
 | 
				
			|||||||
@ -67,7 +67,7 @@ QString WidgetPlugin::whatsThis() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
QIcon WidgetPlugin::icon() const
 | 
					QIcon WidgetPlugin::icon() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return Qtk::getIcon();
 | 
					  return QIcon(":/icons/icon.png");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool WidgetPlugin::isContainer() const
 | 
					bool WidgetPlugin::isContainer() const
 | 
				
			||||||
 | 
				
			|||||||
@ -43,14 +43,6 @@ namespace Qtk
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return widget;
 | 
					    return widget;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * @return Default icon to use for Qtk desktop application.
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  static QIcon getIcon()
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    return QIcon(":/icons/icon.png");
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}  // namespace Qtk
 | 
					}  // namespace Qtk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // QTK_QTKAPI_H
 | 
					#endif  // QTK_QTKAPI_H
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
#include <QImageReader>
 | 
					#include <QImageReader>
 | 
				
			||||||
 | 
					#include <QPainter>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "texture.h"
 | 
					#include "texture.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -65,6 +66,22 @@ QOpenGLTexture * OpenGLTextureFactory::initCubeMap(const char * right,
 | 
				
			|||||||
                     QImage(back));
 | 
					                     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,
 | 
					QOpenGLTexture * OpenGLTextureFactory::initCubeMap(const QImage & right,
 | 
				
			||||||
                                                   const QImage & top,
 | 
					                                                   const QImage & top,
 | 
				
			||||||
                                                   const QImage & front,
 | 
					                                                   const QImage & front,
 | 
				
			||||||
 | 
				
			|||||||
@ -145,13 +145,7 @@ namespace Qtk
 | 
				
			|||||||
                                          const char * back);
 | 
					                                          const char * back);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /// The texture used in place of a missing texture.
 | 
					      /// The texture used in place of a missing texture.
 | 
				
			||||||
      static QImage defaultTexture()
 | 
					      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");
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
      // Private ctor to prevent creating instances of this class
 | 
					      // Private ctor to prevent creating instances of this class
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user