Exemple #1
0
void MainWindow::updateStatusBar()
{
	if (activeImageDisplay())
	{
		int format = (int)activeImageDisplay()->getImage().format();
		QString string = imageFormatToString(format);
		imageFormatLabel->setText(string);

		int height = (int)activeImageDisplay()->getImage().height();
		int width = (int)activeImageDisplay()->getImage().width();
		string = tr("Image size: %1 x %2").arg(width).arg(height);
		imageSizeLabel->setText(string);
	}
	else
	{
		imageFormatLabel->setText("");
		imageSizeLabel->setText("");
	}
}
QVariant ImageInfoModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (role == Qt::DisplayRole || role == Qt::EditRole || role == Qt::ToolTipRole) {
        if (index.column() == ColumnName) {
            switch (index.row()) {
            case RowType: return tr("Type");
            case RowWidth: return tr("Width");
            case RowHeight: return tr("Height");
            case RowDepth: return tr("Depth");
            case RowImageFormat: return tr("Image format");
            case RowName: return tr("Name");
            case RowImageCount: return tr("Image count");
            case RowMipmapCount: return tr("Mipmap count");
            case RowImageDelay: return tr("Frame delay");
            case RowLoopCount: return tr("Loop count");
            default:
                break;
            }
        } else if (index.column() == ColumnValue) {
            if (_contents.isNull())
                return QString();
            switch (index.row()) {
            case RowType: return typeToString(_contents.header().type());
            case RowWidth: return _contents.header().width();
            case RowHeight: return _contents.header().height();
            case RowDepth: return _contents.header().depth();
            case RowImageFormat: return imageFormatToString(_contents.header().imageFormat());
            case RowName: return _contents.header().name();
            case RowImageCount: return _contents.header().imageCount();
            case RowMipmapCount: return _contents.header().mipmapCount();
            case RowImageDelay: return _contents.header().frameDelay();
            case RowLoopCount: return _contents.header().loopCount();
            default:
                break;
            }
        }
    }

    return QVariant();
}