Skip to content
Snippets Groups Projects
Commit b5414322 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

New experimental InfoLabelWidget to display messages on top of arbitrary viewports

parent 73f35421
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ Qt::ItemFlags FitParameterAbsModel::flags(const QModelIndex &index) const
Qt::ItemFlags returnVal = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
if(SessionItem *item = itemForIndex(index)) {
if(item->isEditable()) returnVal |= Qt::ItemIsEditable;
if(item->isEditable() && index.column() != 0) returnVal |= Qt::ItemIsEditable;
if(item->parent()->modelType() == Constants::FitParameterLinkType && index.column() == 0) {
returnVal |= Qt::ItemIsDragEnabled;
}
......
......@@ -28,6 +28,7 @@
#include "FitModelHelper.h"
#include "SessionModelDelegate.h"
#include "CustomEventFilters.h"
#include "InfoLabelWidget.h"
#include <QMenu>
#include <QSignalMapper>
#include <QTreeView>
......@@ -271,6 +272,10 @@ void FitParameterWidget::init_fit_model()
spanParameters();
connectFitParametersSelection(true);
InfoLabelWidget *label = new InfoLabelWidget(this);
label->setPosition(0, 0);
}
//! Adds to JobItem all fit containers, if necessary.
......
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file coregui/Views/InfoWidgets/InfoLabelWidget.cpp
//! @brief Implements class InfoLabelWidget
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov
//! @authors Walter Van Herck, Joachim Wuttke
//
// ************************************************************************** //
#include "InfoLabelWidget.h"
#include <QPainter>
InfoLabelWidget::InfoLabelWidget(QWidget *parent)
: QWidget(parent)
, m_text("xxx")
{
m_bounding_rect.setWidth(200);
m_bounding_rect.setHeight(30);
}
void InfoLabelWidget::setPosition(int x, int y)
{
setGeometry(x, y, m_bounding_rect.width(), m_bounding_rect.height());
}
void InfoLabelWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.drawText(m_bounding_rect, Qt::AlignCenter, tr("Qt\nProject"));
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file coregui/Views/InfoWidgets/InfoLabelWidget.h
//! @brief Declares class InfoLabelWidget
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov
//! @authors Walter Van Herck, Joachim Wuttke
//
// ************************************************************************** //
#ifndef INFOLABELWIDGET_H
#define INFOLABELWIDGET_H
#include "WinDllMacros.h"
#include <QWidget>
#include <QString>
#include <QRect>
//! The InfoLabelWidget is a semi-transparent overlay label to palce on top of other
//! widgets outside of any layout context.
class InfoLabelWidget : public QWidget
{
public:
InfoLabelWidget(QWidget *parent = 0);
void setPosition(int x, int y);
void setWarningMessage(const QString &text) {m_text = text;}
protected:
void paintEvent(QPaintEvent *event);
private:
QString m_text;
QRect m_bounding_rect;
};
#endif
......@@ -22,8 +22,6 @@
#include <QPixmap>
#include <QString>
class QAbstractScrollArea;
//! The WarningSignWidget is an transparent widget with warning sign pixmap intended to be
//! overlayed onto other widget at some arbitrary position.
class WarningSignWidget : public QWidget
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment