Commit ee581809 authored by David Thompson's avatar David Thompson

Replace qtDescriptivePhraseEditor with QLineEdit for now.

parent 4187198a
......@@ -13,7 +13,6 @@ set(QAttrLibSrcs
qtCollapsibleGroupWidget.cxx
qtComponentItem.cxx
qtDescriptivePhraseDelegate.cxx
qtDescriptivePhraseEditor.cxx
qtDescriptivePhraseModel.cxx
qtGroupView.cxx
qtAnalysisView.cxx
......@@ -81,7 +80,6 @@ set(QAttrLibMocHeaders
qtComponentItem.h
qtEmittingStringBuffer.h
qtDescriptivePhraseDelegate.h
qtDescriptivePhraseEditor.h
qtDescriptivePhraseModel.h
qtGroupView.h
qtAnalysisView.h
......
......@@ -9,11 +9,11 @@
//=========================================================================
#include "smtk/extension/qt/qtDescriptivePhraseDelegate.h"
#include "smtk/extension/qt/qtDescriptivePhraseEditor.h"
#include "smtk/extension/qt/qtDescriptivePhraseModel.h"
#include <QAbstractProxyModel>
#include <QApplication>
#include <QLineEdit>
#include <QMouseEvent>
#include <QPainter>
......@@ -279,7 +279,7 @@ QWidget* qtDescriptivePhraseDelegate::createEditor(
// Otherwise, edit the title if the item says we can.
if (idx.data(qtDescriptivePhraseModel::TitleTextMutableRole).toBool())
{
smtk::extension::qtDescriptivePhraseEditor* editor = new qtDescriptivePhraseEditor(owner);
QLineEdit* editor = new QLineEdit(owner);
return editor;
}
return nullptr;
......@@ -336,24 +336,20 @@ void qtDescriptivePhraseDelegate::updateEditorGeometry(
void qtDescriptivePhraseDelegate::setEditorData(QWidget* editor, const QModelIndex& idx) const
{
smtk::extension::qtDescriptivePhraseEditor* entityEditor =
qobject_cast<smtk::extension::qtDescriptivePhraseEditor*>(editor);
if (entityEditor)
QLineEdit* titleEditor = qobject_cast<QLineEdit*>(editor);
if (titleEditor)
{
entityEditor->setTitle(idx.data(qtDescriptivePhraseModel::TitleTextRole).toString());
// TODO: editor should also allow adjusting entity type?
titleEditor->setText(idx.data(qtDescriptivePhraseModel::TitleTextRole).toString());
}
}
void qtDescriptivePhraseDelegate::setModelData(
QWidget* editor, QAbstractItemModel* model, const QModelIndex& idx) const
{
smtk::extension::qtDescriptivePhraseEditor* entityEditor =
qobject_cast<smtk::extension::qtDescriptivePhraseEditor*>(editor);
if (entityEditor)
QLineEdit* titleEditor = qobject_cast<QLineEdit*>(editor);
if (titleEditor)
{
// TODO: editor should also allow adjusting entity type?
model->setData(idx, entityEditor->title(), qtDescriptivePhraseModel::TitleTextRole);
model->setData(idx, titleEditor->text(), qtDescriptivePhraseModel::TitleTextRole);
}
}
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#include "smtk/extension/qt/qtDescriptivePhraseEditor.h"
#include <QHBoxLayout>
#include <QLineEdit>
namespace smtk
{
namespace extension
{
qtDescriptivePhraseEditor::qtDescriptivePhraseEditor(QWidget* super)
: QWidget(super)
{
m_title = new QLineEdit(this);
this->setFocusProxy(m_title);
new QHBoxLayout(this);
QObject::connect(m_title, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
}
qtDescriptivePhraseEditor::~qtDescriptivePhraseEditor()
{
}
/*
QSize qtDescriptivePhraseEditor::sizeHint() const
{
return m_title->sizeHint();
}
*/
QString qtDescriptivePhraseEditor::title() const
{
return m_title->text();
}
void qtDescriptivePhraseEditor::setTitle(const QString& text)
{
m_title->setText(text);
}
} // namespace model
} // namespace smtk
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#ifndef __smtk_extension_qtDescriptivePhraseEditor_h
#define __smtk_extension_qtDescriptivePhraseEditor_h
#include "smtk/extension/qt/Exports.h"
#include <QWidget>
class QLineEdit;
namespace smtk
{
namespace extension
{
/**\brief Allow user edits to an smtk::model::Resource instance via qtDescriptivePhraseModel.
*
*/
class SMTKQTEXT_EXPORT qtDescriptivePhraseEditor : public QWidget
{
Q_OBJECT
public:
qtDescriptivePhraseEditor(QWidget* parent = 0);
~qtDescriptivePhraseEditor() override;
//QSize sizeHint() const;
QString title() const;
void setTitle(const QString& text);
signals:
void editingFinished();
protected:
QLineEdit* m_title;
};
} // namespace model
} // namespace smtk
#endif // __smtk_extension_qtDescriptivePhraseEditor_h
......@@ -10,7 +10,6 @@
#include "smtk/extension/qt/qtResourceBrowser.h"
#include "smtk/extension/qt/qtDescriptivePhraseDelegate.h"
#include "smtk/extension/qt/qtDescriptivePhraseEditor.h"
#include "smtk/extension/qt/qtDescriptivePhraseModel.h"
#include "smtk/extension/qt/qtSMTKUtilities.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment