Skip to content
Snippets Groups Projects
Commit b9eba8ae authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rename class and sources GUI/View/Tool/ItemDelegateForHTML -> GUI/View/Tool/ListItemDelegate

parent a4e33ec1
Branches
Tags
1 merge request!2359Use same tree view with delegate for datafiles, samples, and instruments. Also move some code between GUI/View directories. Restore Py wrappers lost in previous MR.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "GUI/Model/Sample/SamplesSet.h" #include "GUI/Model/Sample/SamplesSet.h"
#include "GUI/View/Layout/ApplicationSettings.h" #include "GUI/View/Layout/ApplicationSettings.h"
#include "GUI/View/Sample/SamplesQModel.h" #include "GUI/View/Sample/SamplesQModel.h"
#include "GUI/View/Tool/ItemDelegateForHTML.h" #include "GUI/View/Tool/ListItemDelegate.h"
#include "GUI/View/Widget/ItemViewOverlayButtons.h" #include "GUI/View/Widget/ItemViewOverlayButtons.h"
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
namespace { namespace {
class ItemDelegateForSampleTree : public ItemDelegateForHTML { class ItemDelegateForSampleTree : public ListItemDelegate {
public: public:
ItemDelegateForSampleTree(QObject* parent) ItemDelegateForSampleTree(QObject* parent)
: ItemDelegateForHTML(parent) : ListItemDelegate(parent)
{ {
} }
...@@ -39,7 +39,7 @@ protected: ...@@ -39,7 +39,7 @@ protected:
void paint(QPainter* painter, const QStyleOptionViewItem& option, void paint(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index) const override const QModelIndex& index) const override
{ {
ItemDelegateForHTML::paint(painter, option, index); ListItemDelegate::paint(painter, option, index);
QStyleOptionViewItem options = option; QStyleOptionViewItem options = option;
initStyleOption(&options, index); initStyleOption(&options, index);
...@@ -54,7 +54,7 @@ protected: ...@@ -54,7 +54,7 @@ protected:
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override
{ {
auto s = ItemDelegateForHTML::sizeHint(option, index); auto s = ListItemDelegate::sizeHint(option, index);
s.setHeight(std::max(s.height(), 32)); s.setHeight(std::max(s.height(), 32));
return s; return s;
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// //
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/View/Tool/ItemDelegateForHTML.cpp //! @file GUI/View/Tool/ListItemDelegate.cpp
//! @brief Implements class ItemDelegateForHTML. //! @brief Implements class ListItemDelegate.
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#include "GUI/View/Tool/ItemDelegateForHTML.h" #include "GUI/View/Tool/ListItemDelegate.h"
#include <QAbstractItemView> #include <QAbstractItemView>
#include <QAbstractTextDocumentLayout> #include <QAbstractTextDocumentLayout>
#include <QApplication> #include <QApplication>
...@@ -33,13 +33,13 @@ QSize mySizeHint(const QString& text) ...@@ -33,13 +33,13 @@ QSize mySizeHint(const QString& text)
} // namespace } // namespace
ItemDelegateForHTML::ItemDelegateForHTML(QObject* parent) ListItemDelegate::ListItemDelegate(QObject* parent)
: QStyledItemDelegate(parent) : QStyledItemDelegate(parent)
{ {
} }
void ItemDelegateForHTML::paint(QPainter* painter, const QStyleOptionViewItem& option, void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index) const const QModelIndex& index) const
{ {
QStyleOptionViewItem options = option; QStyleOptionViewItem options = option;
initStyleOption(&options, index); initStyleOption(&options, index);
...@@ -47,8 +47,7 @@ void ItemDelegateForHTML::paint(QPainter* painter, const QStyleOptionViewItem& o ...@@ -47,8 +47,7 @@ void ItemDelegateForHTML::paint(QPainter* painter, const QStyleOptionViewItem& o
QStyledItemDelegate::paint(painter, option, index); QStyledItemDelegate::paint(painter, option, index);
} }
QSize ItemDelegateForHTML::sizeHint(const QStyleOptionViewItem& option, QSize ListItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
const QModelIndex& index) const
{ {
QSize s = QStyledItemDelegate::sizeHint(option, index); QSize s = QStyledItemDelegate::sizeHint(option, index);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// //
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file GUI/View/Tool/ItemDelegateForHTML.h //! @file GUI/View/Tool/ListItemDelegate.h
//! @brief Defines class ItemDelegateForHTML. //! @brief Defines class ListItemDelegate.
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#ifndef BORNAGAIN_GUI_VIEW_TOOL_ITEMDELEGATEFORHTML_H #ifndef BORNAGAIN_GUI_VIEW_TOOL_LISTITEMDELEGATE_H
#define BORNAGAIN_GUI_VIEW_TOOL_ITEMDELEGATEFORHTML_H #define BORNAGAIN_GUI_VIEW_TOOL_LISTITEMDELEGATE_H
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
//! For representing HTML text in an item */ //! For representing HTML text in an item */
class ItemDelegateForHTML : public QStyledItemDelegate { class ListItemDelegate : public QStyledItemDelegate {
Q_OBJECT Q_OBJECT
public: public:
ItemDelegateForHTML(QObject* parent); ListItemDelegate(QObject* parent);
protected: protected:
void paint(QPainter* painter, const QStyleOptionViewItem& option, void paint(QPainter* painter, const QStyleOptionViewItem& option,
...@@ -30,4 +30,4 @@ protected: ...@@ -30,4 +30,4 @@ protected:
}; };
#endif // BORNAGAIN_GUI_VIEW_TOOL_ITEMDELEGATEFORHTML_H #endif // BORNAGAIN_GUI_VIEW_TOOL_LISTITEMDELEGATE_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment