Files
ResInsight/ApplicationCode/UserInterface/RiuResultInfoPanel.cpp
T

85 lines
2.7 KiB
C++
Raw Normal View History

2012-05-18 09:45:23 +02:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
2013-03-22 17:30:50 +01:00
#include "RiuResultInfoPanel.h"
2012-05-18 09:45:23 +02:00
2015-09-25 15:57:43 +02:00
#include <QDockWidget>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QWidget>
2012-05-18 09:45:23 +02:00
//==================================================================================================
///
2013-03-22 17:30:50 +01:00
/// \class RiuResultInfoPanel
2012-05-18 09:45:23 +02:00
/// \ingroup ResInsight
///
///
///
//==================================================================================================
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuResultInfoPanel::RiuResultInfoPanel(QDockWidget* parent)
2012-05-18 09:45:23 +02:00
: QWidget(parent)
{
m_textEdit = new QTextEdit(this);
m_textEdit->setReadOnly(true);
m_textEdit->setLineWrapMode(QTextEdit::NoWrap);
2012-05-18 09:45:23 +02:00
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(m_textEdit);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
2012-05-18 09:45:23 +02:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuResultInfoPanel::setInfo(const QString& info)
2012-05-18 09:45:23 +02:00
{
QString tmp(info);
convertStringToHTML(&tmp);
2012-05-18 09:45:23 +02:00
m_textEdit->setText(info);
2012-05-18 09:45:23 +02:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuResultInfoPanel::convertStringToHTML(QString* str)
2012-05-18 09:45:23 +02:00
{
str->replace("\n", "<br>");
str->replace(" ", "&nbsp;");
2012-05-18 09:45:23 +02:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuResultInfoPanel::sizeHint () const
2012-05-18 09:45:23 +02:00
{
2017-03-29 11:22:04 +02:00
// As small as possible for now
2012-05-18 09:45:23 +02:00
return QSize(20, 20);
}