Fix copyright header and namespace for cafShortenedQLabel

This commit is contained in:
Gaute Lindkvist 2019-04-05 17:30:55 +02:00
parent 867c541b7b
commit a8e14e9f9a
18 changed files with 140 additions and 26 deletions

View File

@ -98,7 +98,7 @@ QWidget* PdmUiCheckBoxEditor::createEditorWidget(QWidget* parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiCheckBoxEditor::createLabelWidget(QWidget* parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -67,7 +67,7 @@ QWidget* PdmUiCheckBoxTristateEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiCheckBoxTristateEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -120,7 +120,7 @@ QWidget* PdmUiColorEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiColorEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -388,7 +388,7 @@ QWidget* PdmUiComboBoxEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiComboBoxEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -107,7 +107,7 @@ QWidget* PdmUiDateEditor::createEditorWidget(QWidget* parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDateEditor::createLabelWidget(QWidget* parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -147,7 +147,7 @@ QWidget* PdmUiDoubleSliderEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDoubleSliderEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -119,7 +119,7 @@ QWidget* PdmUiDoubleValueEditor::createEditorWidget(QWidget* parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDoubleValueEditor::createLabelWidget(QWidget* parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -117,7 +117,7 @@ QWidget* PdmUiFilePathEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiFilePathEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -78,7 +78,7 @@ QWidget* PdmUiLineEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiLineEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -317,7 +317,7 @@ QWidget* PdmUiListEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiListEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -158,7 +158,7 @@ QWidget* PdmUiPushButtonEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiPushButtonEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -126,7 +126,7 @@ QWidget* PdmUiSliderEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiSliderEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -116,12 +116,12 @@ QWidget* PdmUiTableViewEditor::createLabelWidget(QWidget * parent)
{
if (m_tableHeading.isNull())
{
m_tableHeading = new cafShortenedQLabel(parent);
m_tableHeading = new ShortenedQLabel(parent);
}
if (m_tableHeadingIcon.isNull())
{
m_tableHeadingIcon = new cafShortenedQLabel(parent);
m_tableHeadingIcon = new ShortenedQLabel(parent);
}
QHBoxLayout* layoutForIconLabel = new QHBoxLayout();

View File

@ -196,7 +196,7 @@ QWidget* PdmUiTextEditor::createEditorWidget(QWidget * parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiTextEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -407,7 +407,7 @@ QWidget* PdmUiTreeSelectionEditor::createEditorWidget(QWidget* parent)
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiTreeSelectionEditor::createLabelWidget(QWidget * parent)
{
m_label = new cafShortenedQLabel(parent);
m_label = new ShortenedQLabel(parent);
return m_label;
}

View File

@ -0,0 +1,40 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2019- Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
namespace caf
{
class

View File

@ -1,13 +1,50 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2019- Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "cafShortenedQLabel.h"
#include <QApplication>
#include <QFontMetrics>
#include <QResizeEvent>
using namespace caf;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cafShortenedQLabel::cafShortenedQLabel(QWidget* parent /*= nullptr*/, Qt::WindowFlags f /*= Qt::WindowFlags()*/)
ShortenedQLabel::ShortenedQLabel(QWidget* parent /*= nullptr*/, Qt::WindowFlags f /*= Qt::WindowFlags()*/)
: QLabel(parent, f)
{
}
@ -15,7 +52,7 @@ cafShortenedQLabel::cafShortenedQLabel(QWidget* parent /*= nullptr*/, Qt::Window
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize cafShortenedQLabel::minimumSizeHint() const
QSize ShortenedQLabel::minimumSizeHint() const
{
int minimumWidth = 0;
@ -40,7 +77,7 @@ QSize cafShortenedQLabel::minimumSizeHint() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize cafShortenedQLabel::sizeHint() const
QSize ShortenedQLabel::sizeHint() const
{
QFontMetrics fontMetrics = QApplication::fontMetrics();
QString labelText = fullText();
@ -52,7 +89,7 @@ QSize cafShortenedQLabel::sizeHint() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void cafShortenedQLabel::resizeEvent(QResizeEvent* event)
void ShortenedQLabel::resizeEvent(QResizeEvent* event)
{
QString labelText = fullText();
QFontMetrics fontMetrics = QApplication::fontMetrics();
@ -72,7 +109,7 @@ void cafShortenedQLabel::resizeEvent(QResizeEvent* event)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void cafShortenedQLabel::setDisplayText(const QString& shortText)
void ShortenedQLabel::setDisplayText(const QString& shortText)
{
// Store original text if we haven't already done so.
if (m_fullLengthText.isEmpty())
@ -85,7 +122,7 @@ void cafShortenedQLabel::setDisplayText(const QString& shortText)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString cafShortenedQLabel::fullText() const
QString ShortenedQLabel::fullText() const
{
if (!m_fullLengthText.isEmpty())
{

View File

@ -1,12 +1,49 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2019- Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
#include <QLabel>
class cafShortenedQLabel : public QLabel
namespace caf
{
class ShortenedQLabel : public QLabel
{
Q_OBJECT
public:
explicit cafShortenedQLabel(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
explicit ShortenedQLabel(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
@ -14,9 +51,9 @@ protected:
void resizeEvent(QResizeEvent *event) override;
void setDisplayText(const QString& shortText);
QString fullText() const;
QString firstWord() const;
private:
QString m_fullLengthText;
};
}