diff --git a/src/backend/core/AspectTreeModel.cpp b/src/backend/core/AspectTreeModel.cpp index 171430d02..8fc129b09 100644 --- a/src/backend/core/AspectTreeModel.cpp +++ b/src/backend/core/AspectTreeModel.cpp @@ -1,495 +1,495 @@ /*************************************************************************** File : AspectTreeModel.h Project : LabPlot Description : Represents a tree of AbstractAspect objects as a Qt item model. -------------------------------------------------------------------- Copyright : (C) 2007-2009 by Knut Franke (knut.franke@gmx.de) Copyright : (C) 2007-2009 by Tilman Benkert (thzs@gmx.net) Copyright : (C) 2011-2016 Alexander Semke (alexander.semke@web.de) ***************************************************************************/ /*************************************************************************** * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * ***************************************************************************/ #include "backend/core/AbstractAspect.h" #include "backend/core/column/Column.h" #include "backend/worksheet/WorksheetElement.h" #include "backend/core/AspectTreeModel.h" #include #include #include #include #include #include /** * \class AspectTreeModel * \brief Represents a tree of AbstractAspect objects as a Qt item model. * * This class is an adapter between an AbstractAspect hierarchy and Qt's view classes. * * It represents children of an Aspect as rows in the model, with the fixed columns * Name (AbstractAspect::name()), Type (the class name), Created (AbstractAspect::creationTime()) * and Comment (AbstractAspect::comment()). Name is decorated using AbstractAspect::icon(). * The tooltip for all columns is generated from AbstractAspect::caption(). * * Name and Comment are editable. * * For views which support this (currently ProjectExplorer), the menu created by * AbstractAspect::createContextMenu() is made available via the custom role ContextMenuRole. */ /** * \enum AspectTreeModel::CustomDataRole * \brief Custom data roles used in addition to Qt::ItemDataRole */ /** * \var AspectTreeModel::ContextMenuRole * \brief pointer to a new context menu for an Aspect */ /** * \fn QModelIndex AspectTreeModel::modelIndexOfAspect(const AbstractAspect *aspect, int column=0) const * \brief Convenience wrapper around QAbstractItemModel::createIndex(). */ AspectTreeModel::AspectTreeModel(AbstractAspect* root, QObject* parent) : QAbstractItemModel(parent), m_root(root), m_readOnly(false), m_folderSelectable(true), m_numericColumnsOnly(false), m_nonEmptyNumericColumnsOnly(false), m_showPlotDesignation(false), m_filterCaseSensitivity(Qt::CaseInsensitive), m_matchCompleteWord(false) { connect(m_root, &AbstractAspect::aspectDescriptionChanged, this, &AspectTreeModel::aspectDescriptionChanged); connect(m_root, &AbstractAspect::aspectAboutToBeAdded, this, &AspectTreeModel::aspectAboutToBeAdded); connect(m_root, &AbstractAspect::aspectAboutToBeRemoved, this, &AspectTreeModel::aspectAboutToBeRemoved); connect(m_root, &AbstractAspect::aspectAdded, this, &AspectTreeModel::aspectAdded); connect(m_root, &AbstractAspect::aspectRemoved, this, &AspectTreeModel::aspectRemoved); connect(m_root, &AbstractAspect::aspectHiddenAboutToChange, this, &AspectTreeModel::aspectHiddenAboutToChange); connect(m_root, &AbstractAspect::aspectHiddenChanged, this, &AspectTreeModel::aspectHiddenChanged); } /*! \c list contains the class names of the aspects, that can be selected in the corresponding model view. */ void AspectTreeModel::setSelectableAspects(QList list) { m_selectableAspects=list; } void AspectTreeModel::setReadOnly(bool readOnly) { m_readOnly = readOnly; } void AspectTreeModel::enableNumericColumnsOnly(bool value) { m_numericColumnsOnly = value; } void AspectTreeModel::enableNonEmptyNumericColumnsOnly(bool value) { m_nonEmptyNumericColumnsOnly = value; } void AspectTreeModel::enableShowPlotDesignation(bool value) { m_showPlotDesignation = value; } QModelIndex AspectTreeModel::index(int row, int column, const QModelIndex &parent) const { if (!hasIndex(row, column, parent)) return QModelIndex(); if(!parent.isValid()) { if(row != 0) return QModelIndex(); return createIndex(row, column, m_root); } AbstractAspect *parent_aspect = static_cast(parent.internalPointer()); AbstractAspect *child_aspect = parent_aspect->child(row); if (!child_aspect) return QModelIndex(); return createIndex(row, column, child_aspect); } QModelIndex AspectTreeModel::parent(const QModelIndex &index) const { if (!index.isValid()) return QModelIndex(); AbstractAspect *parent_aspect = static_cast(index.internalPointer())->parentAspect(); if (!parent_aspect) return QModelIndex(); return modelIndexOfAspect(parent_aspect); } int AspectTreeModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) return 1; AbstractAspect *parent_aspect = static_cast(parent.internalPointer()); return parent_aspect->childCount(); } int AspectTreeModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent); return 4; } QVariant AspectTreeModel::headerData(int section, Qt::Orientation orientation, int role) const { if(orientation != Qt::Horizontal) return QVariant(); switch(role) { case Qt::DisplayRole: switch(section) { case 0: return i18n("Name"); case 1: return i18n("Type"); case 2: return i18n("Created"); case 3: return i18n("Comment"); default: return QVariant(); } default: return QVariant(); } } QVariant AspectTreeModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); AbstractAspect* aspect = static_cast(index.internalPointer()); switch(role) { case Qt::DisplayRole: case Qt::EditRole: switch(index.column()) { case 0: { const Column* column = dynamic_cast(aspect); if (column) { QString name = aspect->name(); if (m_numericColumnsOnly && !(column->columnMode() == AbstractColumn::Numeric || column->columnMode() == AbstractColumn::Integer)) name += QLatin1String(" (") + i18n("non-numeric data") + QLatin1Char(')'); else if (m_nonEmptyNumericColumnsOnly && !column->hasValues()) name += QLatin1String(" (") + i18n("no values") + QLatin1Char(')'); if (m_showPlotDesignation) { QString designation; switch(column->plotDesignation()) { case AbstractColumn::NoDesignation: break; case AbstractColumn::X: designation = QLatin1String(" [X]"); break; case AbstractColumn::Y: designation = QLatin1String(" [Y]"); break; case AbstractColumn::Z: designation = QLatin1String(" [Z]"); break; case AbstractColumn::XError: designation = QLatin1String(" [") + i18n("X-error") + QLatin1Char(']'); break; case AbstractColumn::XErrorPlus: designation = QLatin1String(" [") + i18n("X-error +") + QLatin1Char(']'); break; case AbstractColumn::XErrorMinus: designation = QLatin1String(" [") + i18n("X-error -") + QLatin1Char(']'); break; case AbstractColumn::YError: designation = QLatin1String(" [") + i18n("Y-error") + QLatin1Char(']'); break; case AbstractColumn::YErrorPlus: designation = QLatin1String(" [") + i18n("Y-error +") + QLatin1Char(']'); break; case AbstractColumn::YErrorMinus: designation = QLatin1String(" [") + i18n("Y-error -") + QLatin1Char(']'); break; } name += QLatin1Char('\t') + designation; } return name; } else return aspect->name(); } case 1: if (aspect->metaObject()->className() != QLatin1String("CantorWorksheet")) return aspect->metaObject()->className(); else return QLatin1String("CAS Worksheet"); case 2: return aspect->creationTime().toString(); case 3: return aspect->comment().replace('\n', ' ').simplified(); default: return QVariant(); } case Qt::ToolTipRole: if (aspect->comment().isEmpty()) - return aspect->name(); + return QLatin1String("") + aspect->name() + QLatin1String(""); else - return aspect->name() + QLatin1String(", ") + aspect->comment(); + return QLatin1String("") + aspect->name() + QLatin1String("

") + aspect->comment().replace(QLatin1Char('\n'), QLatin1String("
")); case Qt::DecorationRole: return index.column() == 0 ? aspect->icon() : QIcon(); case Qt::ForegroundRole: { const WorksheetElement* we = qobject_cast(aspect); if (we) { if (!we->isVisible()) return QVariant( QApplication::palette().color(QPalette::Disabled,QPalette::Text ) ); } return QVariant( QApplication::palette().color(QPalette::Active,QPalette::Text ) ); } default: return QVariant(); } } Qt::ItemFlags AspectTreeModel::flags(const QModelIndex &index) const { if (!index.isValid()) return 0; Qt::ItemFlags result; AbstractAspect *aspect = static_cast(index.internalPointer()); if (!m_selectableAspects.isEmpty()) { foreach(const char * classString, m_selectableAspects) { if (aspect->inherits(classString)) { result = Qt::ItemIsEnabled | Qt::ItemIsSelectable; if( index!=this->index(0,0,QModelIndex()) && !m_filterString.isEmpty() ) { if (this->containsFilterString(aspect)) result = Qt::ItemIsEnabled | Qt::ItemIsSelectable; else result &= ~Qt::ItemIsEnabled; } break; } else result &= ~Qt::ItemIsEnabled; } } else { //default case: the list for the selectable aspects is empty and all aspects are selectable. // Apply filter, if available. Indices, that don't match the filter are not selectable. //Don't apply any filter to the very first index in the model - this top index corresponds to the project item. if ( index!=this->index(0,0,QModelIndex()) && !m_filterString.isEmpty() ) { if (this->containsFilterString(aspect)) result = Qt::ItemIsEnabled | Qt::ItemIsSelectable; else result = Qt::ItemIsSelectable; } else result = Qt::ItemIsEnabled | Qt::ItemIsSelectable; } //the columns "name" and "description" are editable if (!m_readOnly) { if (index.column() == 0 || index.column() == 3) result |= Qt::ItemIsEditable; } const Column* column = dynamic_cast(aspect); if (column) { //allow to drag and drop columns for the faster creation of curves in the plots. //TODO: allow drag&drop later for other objects too, once we implement copy and paste in the project explorer result = result |Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; if (m_numericColumnsOnly && !(column->columnMode() == AbstractColumn::Numeric || column->columnMode() == AbstractColumn::Integer)) result &= ~Qt::ItemIsEnabled; if (m_nonEmptyNumericColumnsOnly && !column->hasValues()) result &= ~Qt::ItemIsEnabled; } return result; } void AspectTreeModel::aspectDescriptionChanged(const AbstractAspect *aspect) { emit dataChanged(modelIndexOfAspect(aspect), modelIndexOfAspect(aspect, 3)); } void AspectTreeModel::aspectAboutToBeAdded(const AbstractAspect *parent, const AbstractAspect *before, const AbstractAspect *child) { Q_UNUSED(child); int index = parent->indexOfChild(before); if (index == -1) index = parent->childCount(); beginInsertRows(modelIndexOfAspect(parent), index, index); } void AspectTreeModel::aspectAdded(const AbstractAspect *aspect) { endInsertRows(); AbstractAspect * parent = aspect->parentAspect(); emit dataChanged(modelIndexOfAspect(parent), modelIndexOfAspect(parent, 3)); connect(aspect, &AbstractAspect::renameRequested, this, &AspectTreeModel::renameRequestedSlot); for (const auto* child : aspect->children()) connect(child, &AbstractAspect::renameRequested, this, &AspectTreeModel::renameRequestedSlot); connect(aspect, &AbstractAspect::childAspectSelectedInView, this, &AspectTreeModel::aspectSelectedInView); connect(aspect, &AbstractAspect::childAspectDeselectedInView, this, &AspectTreeModel::aspectDeselectedInView); } void AspectTreeModel::aspectAboutToBeRemoved(const AbstractAspect *aspect) { AbstractAspect * parent = aspect->parentAspect(); int index = parent->indexOfChild(aspect); beginRemoveRows(modelIndexOfAspect(parent), index, index); } void AspectTreeModel::aspectRemoved() { endRemoveRows(); } void AspectTreeModel::aspectHiddenAboutToChange(const AbstractAspect * aspect) { for (AbstractAspect * i = aspect->parentAspect(); i; i = i->parentAspect()) if (i->hidden()) return; if (aspect->hidden()) aspectAboutToBeAdded(aspect->parentAspect(), aspect, aspect); else aspectAboutToBeRemoved(aspect); } void AspectTreeModel::aspectHiddenChanged(const AbstractAspect *aspect) { for (AbstractAspect * i = aspect->parentAspect(); i; i = i->parentAspect()) if (i->hidden()) return; if (aspect->hidden()) aspectRemoved(); else aspectAdded(aspect); } bool AspectTreeModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!index.isValid() || role != Qt::EditRole) return false; AbstractAspect *aspect = static_cast(index.internalPointer()); switch (index.column()) { case 0: aspect->setName(value.toString()); break; case 3: aspect->setComment(value.toString()); break; default: return false; } emit dataChanged(index, index); return true; } QModelIndex AspectTreeModel::modelIndexOfAspect(const AbstractAspect* aspect, int column) const { AbstractAspect* parent = aspect->parentAspect(); return createIndex(parent ? parent->indexOfChild(aspect) : 0, column, const_cast(aspect)); } /*! returns the model index of an aspect defined via its path. */ QModelIndex AspectTreeModel::modelIndexOfAspect(const QString& path, int column) const { //determine the aspect out of aspect path AbstractAspect* aspect = nullptr; auto children = m_root->children("AbstractAspect", AbstractAspect::Recursive); for (auto* child: children) { if (child->path() == path) { aspect = child; break; } } //return the model index of the aspect if (aspect) return modelIndexOfAspect(aspect, column); else return QModelIndex(); } void AspectTreeModel::setFilterString(const QString & s) { m_filterString=s; QModelIndex topLeft = this->index(0,0, QModelIndex()); QModelIndex bottomRight = this->index(this->rowCount()-1,3, QModelIndex()); emit dataChanged(topLeft, bottomRight); } void AspectTreeModel::setFilterCaseSensitivity(Qt::CaseSensitivity cs) { m_filterCaseSensitivity = cs; } void AspectTreeModel::setFilterMatchCompleteWord(bool b) { m_matchCompleteWord = b; } bool AspectTreeModel::containsFilterString(const AbstractAspect* aspect) const { if (m_matchCompleteWord) { if (aspect->name().compare(m_filterString, m_filterCaseSensitivity) == 0) return true; } else { if (aspect->name().contains(m_filterString, m_filterCaseSensitivity)) return true; } //check for the occurrence of the filter string in the names of the parents if ( aspect->parentAspect() ) return this->containsFilterString(aspect->parentAspect()); else return false; //TODO make this optional // //check for the occurrence of the filter string in the names of the children // foreach(const AbstractAspect * child, aspect->children()){ // if ( this->containsFilterString(child) ) // return true; // } } //############################################################################## //################################# SLOTS #################################### //############################################################################## void AspectTreeModel::renameRequestedSlot() { AbstractAspect* aspect = qobject_cast(QObject::sender()); if (aspect) emit renameRequested(modelIndexOfAspect(aspect)); } void AspectTreeModel::aspectSelectedInView(const AbstractAspect* aspect) { if (aspect->hidden()) { //a hidden aspect was selected in the view (e.g. plot title in WorksheetView) //select the parent aspect first, if available AbstractAspect* parent = aspect->parentAspect(); if (parent) emit indexSelected(modelIndexOfAspect(parent)); //emit also this signal, so the GUI can handle this selection. emit hiddenAspectSelected(aspect); } else emit indexSelected(modelIndexOfAspect(aspect)); //deselect the root item when one of the children was selected in the view //in order to avoid multiple selection with the project item (if selected) in the project explorer emit indexDeselected(modelIndexOfAspect(m_root)); } void AspectTreeModel::aspectDeselectedInView(const AbstractAspect* aspect) { if (aspect->hidden()) { AbstractAspect* parent = aspect->parentAspect(); if (parent) emit indexDeselected(modelIndexOfAspect(parent)); } else emit indexDeselected(modelIndexOfAspect(aspect)); } diff --git a/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp b/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp index 08ed3cb4f..06468a9c4 100644 --- a/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp +++ b/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp @@ -1,226 +1,226 @@ /*************************************************************************** File : SpreadsheetDock.cpp Project : LabPlot Description : widget for spreadsheet properties -------------------------------------------------------------------- Copyright : (C) 2010-2015 by Alexander Semke (alexander.semke@web.de) Copyright : (C) 2012-2013 by Stefan Gerlach (stefan.gerlach@uni-konstanz.de) ***************************************************************************/ /*************************************************************************** * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * ***************************************************************************/ #include "SpreadsheetDock.h" #include "commonfrontend/spreadsheet/SpreadsheetView.h" #include "backend/spreadsheet/Spreadsheet.h" #include "kdefrontend/TemplateHandler.h" #include #include #include /*! \class SpreadsheetDock \brief Provides a widget for editing the properties of the spreadsheets currently selected in the project explorer. \ingroup kdefrontend */ SpreadsheetDock::SpreadsheetDock(QWidget* parent): QWidget(parent), m_spreadsheet(0), m_initializing(false) { ui.setupUi(this); connect(ui.leName, &QLineEdit::returnPressed, this, &SpreadsheetDock::nameChanged); - connect(ui.leComment, &QLineEdit::returnPressed, this, &SpreadsheetDock::commentChanged); + connect(ui.teComment, &QTextEdit::textChanged, this, &SpreadsheetDock::commentChanged); connect(ui.sbColumnCount, static_cast(&QSpinBox::valueChanged), this, &SpreadsheetDock::columnCountChanged); connect(ui.sbRowCount, static_cast(&QSpinBox::valueChanged), this, &SpreadsheetDock::rowCountChanged); connect(ui.cbShowComments, &QCheckBox::stateChanged, this, &SpreadsheetDock::commentsShownChanged); TemplateHandler* templateHandler = new TemplateHandler(this, TemplateHandler::Spreadsheet); ui.gridLayout->addWidget(templateHandler, 11, 0, 1, 4); templateHandler->show(); connect(templateHandler, &TemplateHandler::loadConfigRequested, this, &SpreadsheetDock::loadConfigFromTemplate); connect(templateHandler, &TemplateHandler::saveConfigRequested, this, &SpreadsheetDock::saveConfigAsTemplate); connect(templateHandler, &TemplateHandler::info, this, &SpreadsheetDock::info); } /*! set the current spreadsheet(s) */ void SpreadsheetDock::setSpreadsheets(QList list) { m_initializing = true; m_spreadsheetList = list; m_spreadsheet = list.first(); if (list.size() == 1) { ui.leName->setEnabled(true); - ui.leComment->setEnabled(true); + ui.teComment->setEnabled(true); ui.leName->setText(m_spreadsheet->name()); - ui.leComment->setText(m_spreadsheet->comment()); + ui.teComment->setText(m_spreadsheet->comment()); } else { //disable the fields "Name" and "Comment" if there are more then one spreadsheet ui.leName->setEnabled(false); - ui.leComment->setEnabled(false); + ui.teComment->setEnabled(false); ui.leName->setText(""); - ui.leComment->setText(""); + ui.teComment->setText(""); } //show the properties of the first Spreadsheet in the list this->load(); // undo functions connect(m_spreadsheet, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(spreadsheetDescriptionChanged(const AbstractAspect*))); connect(m_spreadsheet, SIGNAL(rowCountChanged(int)),this, SLOT(spreadsheetRowCountChanged(int))); connect(m_spreadsheet, SIGNAL(columnCountChanged(int)),this, SLOT(spreadsheetColumnCountChanged(int))); //TODO: show comments m_initializing = false; } //************************************************************* //****** SLOTs for changes triggered in SpreadsheetDock ******* //************************************************************* void SpreadsheetDock::nameChanged() { if (m_initializing) return; m_spreadsheet->setName(ui.leName->text()); } void SpreadsheetDock::commentChanged() { if (m_initializing) return; - m_spreadsheet->setComment(ui.leComment->text()); + m_spreadsheet->setComment(ui.teComment->document()->toPlainText()); } void SpreadsheetDock::rowCountChanged(int rows) { if (m_initializing) return; for (auto* spreadsheet: m_spreadsheetList) spreadsheet->setRowCount(rows); } void SpreadsheetDock::columnCountChanged(int columns) { if (m_initializing) return; for (auto* spreadsheet: m_spreadsheetList) spreadsheet->setColumnCount(columns); } /*! switches on/off the comment header in the views of the selected spreadsheets. */ void SpreadsheetDock::commentsShownChanged(int state) { for (auto* spreadsheet: m_spreadsheetList) qobject_cast(spreadsheet->view())->showComments(state); } //************************************************************* //******** SLOTs for changes triggered in Spreadsheet ********* //************************************************************* void SpreadsheetDock::spreadsheetDescriptionChanged(const AbstractAspect* aspect) { if (m_spreadsheet != aspect) return; m_initializing = true; - if (aspect->name() != ui.leName->text()) { + if (aspect->name() != ui.leName->text()) ui.leName->setText(aspect->name()); - } else if (aspect->comment() != ui.leComment->text()) { - ui.leComment->setText(aspect->comment()); - } + else if (aspect->comment() != ui.teComment->toPlainText()) + ui.teComment->document()->setPlainText(aspect->comment()); + m_initializing = false; } void SpreadsheetDock::spreadsheetRowCountChanged(int count) { m_initializing = true; ui.sbRowCount->setValue(count); m_initializing = false; } void SpreadsheetDock::spreadsheetColumnCountChanged(int count) { m_initializing = true; ui.sbColumnCount->setValue(count); m_initializing = false; } void SpreadsheetDock::spreadsheetShowCommentsChanged(int checked) { m_initializing = true; ui.cbShowComments->setChecked(checked); m_initializing = false; } //************************************************************* //******************** SETTINGS ******************************* //************************************************************* void SpreadsheetDock::load() { ui.sbColumnCount->setValue(m_spreadsheet->columnCount()); ui.sbRowCount->setValue(m_spreadsheet->rowCount()); SpreadsheetView* view = qobject_cast(m_spreadsheet->view()); ui.cbShowComments->setChecked(view->areCommentsShown()); } void SpreadsheetDock::loadConfigFromTemplate(KConfig& config) { //extract the name of the template from the file name QString name; int index = config.name().lastIndexOf(QDir::separator()); if (index != -1) name = config.name().right(config.name().size() - index - 1); else name = config.name(); int size = m_spreadsheetList.size(); if (size>1) m_spreadsheet->beginMacro(i18n("%1 spreadsheets: template \"%2\" loaded", size, name)); else m_spreadsheet->beginMacro(i18n("%1: template \"%2\" loaded", m_spreadsheet->name(), name)); this->loadConfig(config); m_spreadsheet->endMacro(); } /*! loads saved spreadsheet properties from \c config. */ void SpreadsheetDock::loadConfig(KConfig& config) { KConfigGroup group = config.group( "Spreadsheet" ); ui.sbColumnCount->setValue(group.readEntry("ColumnCount", m_spreadsheet->columnCount())); ui.sbRowCount->setValue(group.readEntry("RowCount", m_spreadsheet->rowCount())); SpreadsheetView* view = qobject_cast(m_spreadsheet->view()); ui.cbShowComments->setChecked(group.readEntry("ShowComments", view->areCommentsShown())); } /*! saves spreadsheet properties to \c config. */ void SpreadsheetDock::saveConfigAsTemplate(KConfig& config) { KConfigGroup group = config.group( "Spreadsheet" ); group.writeEntry("ColumnCount", ui.sbColumnCount->value()); group.writeEntry("RowCount", ui.sbRowCount->value()); group.writeEntry("ShowComments",ui.cbShowComments->isChecked()); config.sync(); } diff --git a/src/kdefrontend/ui/dockwidgets/spreadsheetdock.ui b/src/kdefrontend/ui/dockwidgets/spreadsheetdock.ui index 672c4cb1d..a25cf0fdb 100644 --- a/src/kdefrontend/ui/dockwidgets/spreadsheetdock.ui +++ b/src/kdefrontend/ui/dockwidgets/spreadsheetdock.ui @@ -1,183 +1,196 @@ SpreadsheetDock 0 0 280 324 Name Qt::Horizontal QSizePolicy::Fixed 10 23 Comment - - - - 0 - 0 - - - + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + Qt::Vertical QSizePolicy::Fixed 58 13 75 true Dimensions: Rows 0 16777215 Columns 0 16777215 Qt::Vertical QSizePolicy::Fixed 58 13 75 true Format: Column comments true Qt::Vertical 20 13 + + + ResizableTextEdit + QTextEdit +
src/kdefrontend/widgets/ResizableTextEdit.h
+
+