r19707 by jghali - fix a few issues in property tree
scribus-commit
scribus-commit at lists.scribus.net
Wed Dec 31 22:34:11 UTC 2014
Author: jghali
Date: Wed Dec 31 22:34:11 2014
New Revision: 19707
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19707
Log:
fix a few issues in property tree
Modified:
trunk/Scribus/scribus/ui/proptree.cpp
Modified: trunk/Scribus/scribus/ui/proptree.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19707&path=/trunk/Scribus/scribus/ui/proptree.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/proptree.cpp (original)
+++ trunk/Scribus/scribus/ui/proptree.cpp Wed Dec 31 22:34:11 2014
@@ -113,7 +113,10 @@
QWidget *PropTreeItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &index) const
{
QWidget *edito = NULL;
- PropTreeItem* item = (PropTreeItem*)m_parent->indexToItem(index);
+ PropTreeItem* item = (PropTreeItem*) m_parent->indexToItem(index);
+ if (!item)
+ return 0;
+
if (item->m_type == PropTreeItem::IntSpinBox)
{
ScrSpinBox *editor = new ScrSpinBox(parent, item->m_unit);
@@ -165,7 +168,7 @@
else
edito = 0;
m_edit = edito;
- if (item)
+ if (item && m_edit)
emit item->editStarted();
return edito;
}
@@ -202,7 +205,7 @@
void PropTreeItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
- PropTreeItem* item = (PropTreeItem*)m_parent->indexToItem(index);
+ PropTreeItem* item = (PropTreeItem*) m_parent->indexToItem(index);
if (item->m_type == PropTreeItem::IntSpinBox)
{
ScrSpinBox *spinBox = static_cast<ScrSpinBox*>(editor);
@@ -307,6 +310,12 @@
{
int val = 0;
val = data(1, Qt::UserRole).toInt();
+ if (m_type == ComboBox)
+ {
+ QStringList vals = data(1, Qt::UserRole + 1).toStringList();
+ if (m_comboIndex < vals.count())
+ val = m_comboIndex;
+ }
return val;
}
More information about the scribus-commit
mailing list