Esempio n. 1
0
void ImageCluster::sRefresh()
{
  if (DEBUG)
    qDebug("%s::sRefresh()", qPrintable(objectName()));

  VirtualCluster::sRefresh();
  if (id() == -1)
  {
    if (DEBUG)
      qDebug("ImageCluster::sRefresh() without a picture");
    _image->setText(tr("picture here"));
    _image->setPixmap(_nullPixmap);
  }
  else
  {
    XSqlQuery data;
    data.prepare("SELECT image_data FROM image WHERE image_id=:image_id");
    data.bindValue(":image_id", id());
    data.exec();
    if (data.first())
    {
      if (DEBUG)
        qDebug("ImageCluster::sRefresh() has picture %s, %d",
               qPrintable(_description->text().right(128)),
               data.value("image_data").toString().length());
      QImage tmpImage;
      tmpImage.loadFromData(QUUDecode(data.value("image_data").toString()));
      _image->setPixmap(QPixmap::fromImage(tmpImage));
    }
  }

  if (DEBUG)
    qDebug("ImageCluster::sRefresh() returning");
}
Esempio n. 2
0
void XLabel::setImage(QString image)
{
  if (_data->_image == image)
    return;

  _data->_image = image;
  XSqlQuery qry;
  qry.prepare("SELECT image_data "
              "FROM image "
              "WHERE (image_name=:image);");
  qry.bindValue(":image", _data->_image);
  qry.exec();
  if (qry.first())
  {
    QImage img;
    img.loadFromData(QUUDecode(qry.value("image_data").toString()));
    setPixmap(QPixmap::fromImage(img));
    return;
  }
  else if (qry.lastError().type() != QSqlError::NoError)
    QMessageBox::critical(this, tr("A System Error occurred at %1::%2.")
                          .arg(__FILE__)
                          .arg(__LINE__),
                          qry.lastError().databaseText());
  setPixmap(QPixmap());
}
Esempio n. 3
0
void MenuButton::setImage(const QString & image)
{
  _image = image;

  if (_shown)
  {
    XSqlQuery qry;
    qry.prepare("SELECT image_data "
                "FROM image "
                "WHERE (image_name=:image);");
    qry.bindValue(":image", _image);
    qry.exec();
    if (qry.first())
    {
      QImage img;
      img.loadFromData(QUUDecode(qry.value("image_data").toString()));
      _button->setIcon(QIcon(QPixmap::fromImage(img)));
      return;
    }
    else if (qry.lastError().type() != QSqlError::NoError)
      QMessageBox::critical(this, tr("A System Error occurred at %1::%2.")
                            .arg(__FILE__)
                            .arg(__LINE__),
                            qry.lastError().databaseText());
    _button->setIcon(QIcon(QPixmap(":/widgets/images/folder_zoom_64.png")));
  }
}
Esempio n. 4
0
void ImageEditor::setImageData( QString dat )
{
    uudata = dat;
    QByteArray bytes = QUUDecode(dat);
    QImage i = QImage(bytes);
    QPainter p(frmPreview);
    p.drawImage(frmPreview->frameRect(),i);
}
Esempio n. 5
0
void ImageEditor::setImageData( QString dat )
{
    uudata = dat;
    QByteArray bytes = QUUDecode(dat);
    QImage i;
    i.loadFromData(bytes);
    frmPreview->setPixmap(QPixmap::fromImage(i));
}
Esempio n. 6
0
void itemImages::loadImage()
{
  _prev->setEnabled(_images.at() != 0);
  _next->setEnabled(_images.at() < (_images.size() - 1));

  _description->setText(_images.value("purpose").toString() + " - " + _images.value("image_descrip").toString());

  QImage image;
  image.loadFromData(QUUDecode(_images.value("image_data").toString()));
  _image->setPixmap(QPixmap::fromImage(image));
}
Esempio n. 7
0
void ReportProperties::setBgImageData( QString dat )
{
    _uudata = dat;
    if(!_uudata.isEmpty()) {
        QByteArray bytes = QUUDecode(dat);
        QImage i = QImage(bytes);
        _pixmap->setPixmap(QPixmap::fromImage(i));
    } else {
        _pixmap->setPixmap(QPixmap());
    }
}
Esempio n. 8
0
static QIcon iconFromImageByName(QString name)
{
  QImage    image;
  XSqlQuery imageq;
  imageq.prepare("SELECT image_data FROM image WHERE image_name=:name LIMIT 1;");
  imageq.bindValue(":name", name);
  if (imageq.exec() && imageq.first())
  {
    image.loadFromData(QUUDecode(imageq.value("image_data").toString()));
    return QIcon(QPixmap::fromImage(image));
  }
  return QIcon();
}
void imageview::populate()
{
  XSqlQuery image;
  image.prepare( "SELECT image_name, image_descrip, image_data "
                 "FROM image "
                 "WHERE (image_id=:image_id);" );
  image.bindValue(":image_id", _imageviewid);
  image.exec();
  if (image.first())
  {
    _name->setText(image.value("image_name").toString());
    _descrip->setText(image.value("image_descrip").toString());

    __imageview.loadFromData(QUUDecode(image.value("image_data").toString()));
    _imageview->setPixmap(QPixmap::fromImage(__imageview));
  }
}
Esempio n. 10
0
void ImageCluster::sRefresh()
{
  if (DEBUG) qDebug("ImageCluster::sRefresh()");
  VirtualCluster::sRefresh();
  if (_description->text().isEmpty())
  {
    if (DEBUG) qDebug("ImageCluster::sRefresh() without a picture");
    _image = new QLabel("picture here");
    _image->setPixmap(QPixmap());
  }
  else
  {
    if (DEBUG) qDebug("ImageCluster::sRefresh() has a picture");
    QImage tmpImage;
    tmpImage.loadFromData(QUUDecode(_description->text()));
    _image->setPixmap(QPixmap::fromImage(tmpImage));
  }
  if (DEBUG) qDebug("ImageCluster::sRefresh() returning");
}
Esempio n. 11
0
/*!
  Adds image \a name from the xTuple databes to the icon.
*/
void QIconProto::addDbImage(const QString& name)
{
  QIcon *item = qscriptvalue_cast<QIcon*>(thisObject());
  if (item)
  {
    QImage img;
    XSqlQuery image;
    image.prepare( "SELECT image_data "
                   "FROM image "
                   "WHERE (image_name=:name);" );
    image.bindValue(":name", name);
    image.exec();
    if (image.first())
    {
      img.loadFromData(QUUDecode(image.value("image_data").toString()));
      item->addPixmap(QPixmap::fromImage(img));
    }
  }
}