Skip to content

Commit

Permalink
Re #10578. Ability to resize columns.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jun 2, 2015
1 parent 9c50ef2 commit ee01705
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Code/Mantid/MantidQt/MantidWidgets/src/FunctionBrowser.cpp
Expand Up @@ -148,6 +148,9 @@ void FunctionBrowser::createBrowser()
WorkspaceEditorFactory* workspaceEditorFactory = new WorkspaceEditorFactory(this);

m_browser = new QtTreePropertyBrowser(NULL,options);
if (m_multiDataset) {
m_browser->setColumnSizes(100, 100, 45);
}
// assign factories to property managers
m_browser->setFactoryForManager(m_parameterManager, parameterEditorFactory);
m_browser->setFactoryForManager(m_attributeStringManager, lineEditFactory);
Expand Down
15 changes: 15 additions & 0 deletions Code/Mantid/QtPropertyBrowser/src/qttreepropertybrowser.cpp
Expand Up @@ -185,6 +185,7 @@ class QtTreePropertyBrowserPrivate
QTreeWidgetItem *editedItem() const;

const QStringList& options() const {return m_options;}
void setColumnSizes(int s0, int s1, int s2);

private:
void updateItem(QTreeWidgetItem *item);
Expand Down Expand Up @@ -833,6 +834,15 @@ void QtTreePropertyBrowserPrivate::editItem(QtBrowserItem *browserItem)
}
}

void QtTreePropertyBrowserPrivate::setColumnSizes(int s0, int s1, int s2)
{
m_treeWidget->header()->setResizeMode(QHeaderView::Interactive);
m_treeWidget->header()->setStretchLastSection(false);
m_treeWidget->header()->resizeSection(0, s0);
m_treeWidget->header()->resizeSection(1, s1);
m_treeWidget->header()->resizeSection(2, s2);
}

/**
\class QtTreePropertyBrowser
Expand Down Expand Up @@ -1192,6 +1202,11 @@ void QtTreePropertyBrowser::editItem(QtBrowserItem *item)
d_ptr->editItem(item);
}

void QtTreePropertyBrowser::setColumnSizes(int s0, int s1, int s2)
{
d_ptr->setColumnSizes(s0, s1, s2);
}

#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/QtPropertyBrowser/src/qttreepropertybrowser.h
Expand Up @@ -153,6 +153,7 @@ class QT_QTPROPERTYBROWSER_EXPORT QtTreePropertyBrowser : public QtAbstractPrope
bool propertiesWithoutValueMarked() const;

void editItem(QtBrowserItem *item);
void setColumnSizes(int s0, int s1, int s2);

Q_SIGNALS:

Expand Down

0 comments on commit ee01705

Please sign in to comment.