diff --git a/classes/bitmapcontainer.cpp b/classes/bitmapcontainer.cpp index 7bf2263..ae651a2 100644 --- a/classes/bitmapcontainer.cpp +++ b/classes/bitmapcontainer.cpp @@ -9,8 +9,8 @@ BitmapContainer::BitmapContainer(QObject *parent) : QObject(parent) { //this->mImage = NULL; - this->mImage = new QImage(":/images/template"); - this->mImage = new QImage(this->mImage->scaled(20, 10)); + //this->mImage = new QImage(":/images/template"); + this->mImage = new QImage(QImage(":/images/template").scaled(20, 10)); //this->createNew(10, 10); } //----------------------------------------------------------------------------- diff --git a/classes/fontcontainer.cpp b/classes/fontcontainer.cpp index 2d04fcb..cfaddeb 100644 --- a/classes/fontcontainer.cpp +++ b/classes/fontcontainer.cpp @@ -23,9 +23,12 @@ QImage *FontContainer::image(const QString &key) //----------------------------------------------------------------------------- void FontContainer::setImage(const QString &key, QImage *image) { - QImage *imageOld = this->mImageMap.value(key); - this->mImageMap.remove(key); - delete imageOld; + if (this->mImageMap.contains(key)) + { + QImage *imageOld = this->mImageMap.value(key); + this->mImageMap.remove(key); + delete imageOld; + } this->mImageMap.insert(key, image); emit this->imageChanged(key); } diff --git a/controls/editortabfont.cpp b/controls/editortabfont.cpp index 082e859..c599eca 100644 --- a/controls/editortabfont.cpp +++ b/controls/editortabfont.cpp @@ -59,6 +59,11 @@ void EditorTabFont::on_editor_dataChanged() emit this->dataChanged(); } //----------------------------------------------------------------------------- +void EditorTabFont::on_listWidgetCharacters_currentTextChanged(const QString &value) +{ + this->mEditor->selectImage(value); +} +//----------------------------------------------------------------------------- bool EditorTabFont::load(const QString &fileName) { bool result = false; @@ -190,6 +195,7 @@ void EditorTabFont::assignFontCharacters(const QString &chars, for (int i = 0; i < chars.count(); i++) { this->ui->listWidgetCharacters->addItem(QString(chars.at(i))); + this->mContainer->setImage(QString(chars.at(i)), new QImage(":/images/template")); } } //----------------------------------------------------------------------------- diff --git a/controls/editortabfont.h b/controls/editortabfont.h index 040f430..9e8efa5 100644 --- a/controls/editortabfont.h +++ b/controls/editortabfont.h @@ -52,6 +52,7 @@ private: private slots: void on_editor_dataChanged(); + void on_listWidgetCharacters_currentTextChanged(const QString &value); signals: void dataChanged(); };