Closed ghost closed 3 years ago
Indeed, here is the source of a simple view showing an image : the cpp file :
#include "GaleryView.h"
#include "apps/i18n.h"
#include "PourLeTravail_image.h"
namespace PourLeTravail {
GaleryView::GaleryView() :
View()
{
m_image.setImage(ImageStore::PourLeTravailImage);
}
void GaleryView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(KDRect(0, 0, bounds().width(), bounds().height()), KDColorWhite);
}
View * GaleryView::subviewAtIndex(int index) {
assert(index==0);
return &m_image;
}
void GaleryView::layoutSubviews(bool force) {
m_image.setFrame(KDRect(0,0,58,56), force);
}
}
the h file :
#ifndef POURLETRAVAIL_GALERY_VIEW_H
#define POURLETRAVAIL_GALERY_VIEW_H
#include <escher.h>
namespace PourLeTravail {
class GaleryView : public View {
public:
GaleryView();
void drawRect(KDContext * ctx, KDRect rect) const override;
private:
int numberOfSubviews() const override { return 1; }
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;
ImageView m_image;
};
}
#endif
Omega Version: 1.20.3
Whenever I call drawRect(ctx,rect) after calling setImage(img) nothing will appear, the image won't at all show up, and theres no change, nothing is being drawn
My code is
Is there something im doing wrong?