27 #include "../../../se/ExternalGraphic.h" 
   28 #include "../../../xlink/SimpleLink.h" 
   30 #include "ui_LocalImageWidgetForm.h" 
   33 #include <QFileDialog> 
   34 #include <QImageReader> 
   35 #include <QMessageBox> 
   42     m_ui(new Ui::LocalImageWidgetForm),
 
   43     m_eg(new te::se::ExternalGraphic)
 
   49   QList<QByteArray> formats = QImageReader::supportedImageFormats();
 
   50   for(
int i = 0; i < formats.size() - 1; ++i)
 
   84   QString path = link->
getHref().c_str();
 
   85   m_ui->m_pathLineEdit->setText(path);
 
   91     QMessageBox::critical(
this, tr(
"Error"), tr(
"The referenced image cannot be loaded."));
 
   96   QString details = QString::number(img.width()) + 
" x " + QString::number(img.height()) + 
" pixels\n";
 
   97   details += tr(
"Format: ") + QImageReader::imageFormat(path).toUpper() + 
"\n";
 
   98   details += QString::number(img.depth()) + 
" " + tr(
"bits per pixel") + 
"\n";
 
  100   img.hasAlphaChannel() ? alpha = tr(
"Yes") : alpha = tr(
"No");
 
  101   details += tr(
"Alpha Channel: ") + alpha;
 
  102   m_ui->m_detailsTextEdit->setText(details);
 
  105   if(img.width() > m_ui->m_imageLabel->size().width())
 
  106     img = img.scaledToWidth(m_ui->m_imageLabel->size().width(), Qt::SmoothTransformation);
 
  107   m_ui->m_imageLabel->setPixmap(QPixmap::fromImage(img));
 
  112   QString path = QFileDialog::getOpenFileName(
this, tr(
"Select an Image File"), 
"", m_filter);
 
  120     QMessageBox::critical(
this, tr(
"Error"), tr(
"The selected image cannot be loaded."));
 
  126   link->
setHref(path.toStdString());
 
  127   m_eg->setOnlineResource(link);
 
  130   QString f(QImageReader::imageFormat(path));
 
  131   m_eg->setFormat(
"image/" + f.toStdString()); 
 
  133   emit externalGraphicChanged(img.size());
 
void setHref(const std::string &href)
 
const std::string & getHref() const 
 
The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in...
 
ExternalGraphic * clone() const 
It creates a new copy of this object.