Subversion Repositories OpenInventory

Rev

Rev 167 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#include "iconform.h"
#include "ui_iconform.h"
#include "classeditor.h"


IconForm::IconForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::IconForm)
{
    ui->setupUi(this);
    IconForm::fdataIsChanged = false;
}

IconForm::~IconForm()
{
    delete ui;
}

void IconForm::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}


void IconForm::on_pushButton_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó"

    QString  fileName;
        fileName = QFileDialog::getOpenFileName(this,
         tr("Open Image"), "", tr("Image Files (*.png *.jpg *.bmp)"));

    if (fileName.isEmpty()) return;
    Pixmap.load(fileName);

    ui->label->setPixmap(Pixmap);
    IconForm::fdataIsChanged = true;
//    IconForm::close();
}

void IconForm::on_pushButton_2_clicked(){          // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü èêîíêó"

    QPixmap pix_tmp;
    Pixmap = pix_tmp;
    ui->label->setPixmap(Pixmap);
    IconForm::fdataIsChanged = true;

   }




void IconForm::setPixmap (QPixmap newPixmap){
Pixmap = newPixmap;
  ui->label->setPixmap(Pixmap);

}


QPixmap IconForm::pixmap (){
    return Pixmap;
}


bool IconForm::dataIsChanged(){
    return IconForm::fdataIsChanged;
}


// void IconForm::clearPixmap(){}