r17385 by jghali - merge trunk revisions up to r17383
scribus-commit
scribus-commit at lists.scribus.net
Sat Mar 17 13:57:00 UTC 2012
Author: jghali
Date: Sat Mar 17 13:57:00 2012
New Revision: 17385
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17385
Log:
merge trunk revisions up to r17383
Modified:
branches/ScribusOIF/scribus/ui/propertiespalette.cpp
branches/ScribusOIF/scribus/ui/propertiespalette.h
branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_table.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
branches/ScribusOIF/scribus/ui/sctreewidget.cpp
branches/ScribusOIF/scribus/ui/sctreewidget.h
Modified: branches/ScribusOIF/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.cpp Sat Mar 17 13:57:00 2012
@@ -80,112 +80,39 @@
setObjectName(QString::fromLocal8Bit("PropertiesPalette"));
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
-// MpalLayout = new QVBoxLayout();
-// MpalLayout->setMargin(5);
-// MpalLayout->setSpacing(1);
-// setLayout(MpalLayout);
-
QFont f(font());
f.setPointSize(f.pointSize()-1);
setFont(f);
- TabStack = new QToolBox( this );
-
- page = new QWidget( TabStack );
-
- pageLayout = new QVBoxLayout( page );
- pageLayout->setMargin(0);
- pageLayout->setSpacing(5);
-
- xyzPal = new PropertiesPalette_XYZ( page );
- pageLayout->addWidget( xyzPal );
-
- QSpacerItem* spacer13 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
- pageLayout->addItem( spacer13 );
- idXYZItem = TabStack->addItem( page, "X, Y, &Z" );
-
- page_2 = new QWidget( TabStack );
- pageLayout_2 = new QVBoxLayout( page_2 );
- pageLayout_2->setSpacing( 5 );
- pageLayout_2->setMargin( 0 );
-
- shapePal = new PropertiesPalette_Shape( page_2 );
- pageLayout_2->addWidget( shapePal );
-
- QSpacerItem* spacer6 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
- pageLayout_2->addItem( spacer6 );
- idShapeItem = TabStack->addItem( page_2, "&Shape" );
-
- page_group = new QWidget(TabStack);
- page_group_layout = new QVBoxLayout( page_group );
- page_group_layout->setSpacing( 5 );
- page_group_layout->setMargin( 0 );
-
- groupPal = new PropertiesPalette_Group( page_group );
- page_group_layout->addWidget( groupPal );
-
- QSpacerItem* spacerTr2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
- page_group_layout->addItem( spacerTr2 );
- idGroupItem = TabStack->addItem(page_group, "Groups");
-
- page_3 = new QWidget( TabStack );
- pageLayout_3 = new QVBoxLayout( page_3 );
- pageLayout_3->setSpacing( 5 );
- pageLayout_3->setMargin( 0 );
- pageLayout_3->setAlignment( Qt::AlignLeft );
-
- textPal = new PropertiesPalette_Text( page_group );
- pageLayout_3->addWidget( textPal );
-
- idTextItem = TabStack->addItem( page_3, "&Text" );
-
- page_4 = new QWidget( TabStack );
- pageLayout_4 = new QVBoxLayout( page_4 );
- pageLayout_4->setSpacing( 5 );
- pageLayout_4->setMargin( 0 );
-
- imagePal = new PropertiesPalette_Image(page_4);
- pageLayout_4->addWidget(imagePal);
-
- QSpacerItem* spacer9 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
- pageLayout_4->addItem( spacer9 );
- idImageItem=TabStack->addItem( page_4, "&Image" );
-
- page_5 = new QWidget( TabStack );
- pageLayout_5 = new QVBoxLayout( page_5 );
- pageLayout_5->setSpacing( 5 );
- pageLayout_5->setMargin( 0 );
-
- linePal = new PropertiesPalette_Line(page_5);
- pageLayout_5->addWidget(linePal);
-
- idLineItem=TabStack->addItem( page_5, "&Line" );
-
- page_6 = new QWidget( TabStack );
- pageLayout_6 = new QVBoxLayout( page_6 );
- pageLayout_6->setSpacing( 5 );
- pageLayout_6->setMargin( 0 );
- Cpal = new Cpalette(page_6);
- pageLayout_6->addWidget( Cpal );
- idColorsItem = TabStack->addItem(page_6, "&Colors" );
-
- page_7 = new QWidget( TabStack );
- pageLayout_7 = new QVBoxLayout( page_7 );
- pageLayout_7->setSpacing( 5 );
- pageLayout_7->setMargin( 0 );
- Tpal = new Tpalette(page_7);
- pageLayout_7->addWidget( Tpal );
- idTransparencyItem = TabStack->addItem(page_7, "&Transparency" );
-
- page_8 = new QWidget(TabStack);
- pageLayout_8 = new QVBoxLayout(page_8);
- pageLayout_8->setSpacing(5);
- pageLayout_8->setMargin(0);
- tablePal = new PropertiesPalette_Table(page_8);
- pageLayout_8->addWidget(tablePal);
- idTableItem = TabStack->addItem(page_8, "T&able" );
-
-// MpalLayout->addWidget( TabStack );
+ TabStack = new ScTreeWidget( this );
+ TabStack->setToolBoxMode(true);
+
+ xyzPal = new PropertiesPalette_XYZ( this );
+ idXYZItem = TabStack->addItem( xyzPal, "X, Y, &Z" );
+
+ shapePal = new PropertiesPalette_Shape( this );
+ idShapeItem = TabStack->addItem( shapePal, "&Shape" );
+
+ groupPal = new PropertiesPalette_Group( this );
+ idGroupItem = TabStack->addItem(groupPal, "Groups");
+
+ textPal = new PropertiesPalette_Text( this );
+ idTextItem = TabStack->addItem( textPal, "&Text" );
+
+ imagePal = new PropertiesPalette_Image(this);
+ idImageItem=TabStack->addItem( imagePal, "&Image" );
+
+ linePal = new PropertiesPalette_Line(this);
+ idLineItem=TabStack->addItem( linePal, "&Line" );
+
+ Cpal = new Cpalette(this);
+ idColorsItem = TabStack->addItem(Cpal, "&Colors" );
+
+ Tpal = new Tpalette(this);
+ idTransparencyItem = TabStack->addItem(Tpal, "&Transparency" );
+
+ tablePal = new PropertiesPalette_Table(this);
+ idTableItem = TabStack->addItem(tablePal, "T&able" );
setWidget( TabStack );
Modified: branches/ScribusOIF/scribus/ui/propertiespalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.h Sat Mar 17 13:57:00 2012
@@ -114,30 +114,7 @@
protected:
ScribusMainWindow *m_ScMW;
-
- QVBoxLayout* MpalLayout;
- QVBoxLayout* pageLayout;
- QVBoxLayout* pageLayout_2;
- QVBoxLayout* pageLayout_3;
- QVBoxLayout* pageLayout_4;
- QVBoxLayout* pageLayout_5;
- QVBoxLayout* pageLayout_6;
- QVBoxLayout* pageLayout_7;
- QVBoxLayout* pageLayout_8;
-
- QVBoxLayout* page_group_layout;
-
- QWidget* page;
- QWidget* page_2;
- QWidget* page_3;
- QWidget* page_4;
- QWidget* page_5;
- QWidget* page_6;
- QWidget* page_7;
- QWidget* page_8;
- QWidget* page_group;
-
- QToolBox* TabStack;
+ ScTreeWidget* TabStack;
bool m_haveDoc;
bool m_haveItem;
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp Sat Mar 17 13:57:00 2012
@@ -77,6 +77,7 @@
m_tmpSelection->clear();
setupUi(this);
+ setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
textFlowDisabled->setIcon(QIcon(loadIcon("flow-none.png")));
textFlowUsesFrameShape->setIcon(QIcon(loadIcon("flow-frame.png")));
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp Sat Mar 17 13:57:00 2012
@@ -42,7 +42,7 @@
connect(userActionSniffer, SIGNAL(actionEnd()), this, SLOT(spinboxFinishUserAction()));
setupUi(this);
- setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+ setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
imagePageNumber->setMinimum(0);
imagePageNumber->setSpecialValueText(tr( "Auto" ));
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp Sat Mar 17 13:57:00 2012
@@ -43,7 +43,7 @@
m_unitRatio = 1.0;
setupUi(this);
- setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+ setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
lineType->addItem( tr("Custom"));
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp Sat Mar 17 13:57:00 2012
@@ -48,7 +48,7 @@
m_tmpSelection->clear();
setupUi(this);
- setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+ setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
roundRectLabel->setBuddy(roundRect);
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_table.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette_table.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_table.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_table.cpp Sat Mar 17 13:57:00 2012
@@ -29,6 +29,7 @@
m_mainWindow(0), m_doc(0), m_item(0), m_previousItem(0)
{
setupUi(this);
+ setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
addBorderLineButton->setIcon(QIcon(loadIcon("penciladd.png")));
removeBorderLineButton->setIcon(QIcon(loadIcon("pencilsub.png")));
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp Sat Mar 17 13:57:00 2012
@@ -55,9 +55,9 @@
m_haveItem = false;
m_unitRatio = 1.0;
- setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
setupUi(this);
+ setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
fontSize->setPrefix( "" );
fontSizeLabel->setPixmap(loadIcon("Zeichen.xpm"));
@@ -69,7 +69,7 @@
charStyleClear->setIcon(loadIcon("16/edit-clear.png"));
colorWidgets = new PropertyWidget_TextColor(textTree);
- colorWidgetsItem = textTree->addWidget( tr("Color & Effects"), colorWidgets);
+ colorWidgetsItem = textTree->addWidget( tr("Color && Effects"), colorWidgets);
flopBox = new PropertyWidget_Flop(textTree);
flopItem = textTree->addWidget( tr("First Line Offset"), flopBox);
@@ -81,7 +81,7 @@
dropcapsItem = textTree->addWidget( tr("Drop Cap"), dropcapsBox);
distanceWidgets = new PropertyWidget_Distance(textTree);
- distanceItem = textTree->addWidget( tr("Columns & Text Distances"), distanceWidgets);
+ distanceItem = textTree->addWidget( tr("Columns && Text Distances"), distanceWidgets);
//<< Optical Margins
optMargins = new PropertyWidget_OptMargins(textTree);
@@ -670,10 +670,10 @@
paraStyleLabel->setText( tr("Paragraph St&yle:"));
charStyleLabel->setText( tr("Character St&yle:"));
- colorWidgetsItem->setText(0, tr("Color & Effects"));
+ colorWidgetsItem->setText(0, tr("Color && Effects"));
advancedWidgetsItem->setText(0, tr("Advanced Settings"));
flopItem->setText(0, tr("First Line Offset"));
- distanceItem->setText(0, tr("Columns & Text Distances"));
+ distanceItem->setText(0, tr("Columns && Text Distances"));
optMarginsItem->setText(0, tr("Optical Margins"));
orphanItem->setText(0, tr("Orphans and Widows"));
pathTextItem->setText(0, tr("Path Text Properties"));
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp Sat Mar 17 13:57:00 2012
@@ -51,7 +51,7 @@
m_unitRatio = 1.0;
setupUi(this);
- setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+ setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
_userActionOn = false;
userActionSniffer = new UserActionSniffer(this);
Modified: branches/ScribusOIF/scribus/ui/sctreewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/sctreewidget.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/sctreewidget.cpp (original)
+++ branches/ScribusOIF/scribus/ui/sctreewidget.cpp Sat Mar 17 13:57:00 2012
@@ -26,6 +26,7 @@
#include <QPainter>
#include <QHeaderView>
#include <QLayout>
+#include <QShortcutEvent>
#include "sctreewidget.h"
@@ -51,13 +52,12 @@
buttonOption.palette = option.palette;
buttonOption.features = QStyleOptionButton::None;
m_view->style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter, m_view);
- QStyleOption branchOption;
static const int i = 9; // ### hardcoded in qcommonstyle.cpp
QRect r = option.rect;
painter->save();
painter->setBrush(Qt::black);
painter->setPen(Qt::NoPen);
- QRect rect = QRect(r.left()+5, r.top()+5, r.height()-10, r.height()-10);
+ QRect rect = QRect(r.left()+6, r.top()+6, r.height()-12, r.height()-12);
QPolygon pa(3);
if (m_view->isExpanded(index))
{
@@ -76,8 +76,8 @@
painter->restore();
// draw text
QRect textrect = QRect(r.left() + i*2, r.top(), r.width() - ((5*i)/2), r.height());
- QString text = elidedText(option.fontMetrics, textrect.width(), Qt::ElideMiddle, model->data(index, Qt::DisplayRole).toString());
- m_view->style()->drawItemText(painter, textrect, Qt::AlignCenter, option.palette, m_view->isEnabled(), text);
+ QString text = option.fontMetrics.elidedText(model->data(index, Qt::DisplayRole).toString(), Qt::ElideMiddle, textrect.width(), Qt::TextShowMnemonic);
+ m_view->style()->drawItemText(painter, textrect, Qt::AlignCenter | Qt::TextShowMnemonic, option.palette, (option.state & QStyle::State_Enabled), text, QPalette::Text);
}
else
QItemDelegate::paint(painter, option, index);
@@ -85,8 +85,7 @@
QSize ScTreeWidgetDelegate::sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const
{
- QStyleOptionViewItem option = opt;
- QSize sz = QItemDelegate::sizeHint(opt, index) + QSize(2, 2);
+ QSize sz = QItemDelegate::sizeHint(opt, index) + QSize(2, 6);
return sz;
}
@@ -100,7 +99,24 @@
header()->hide();
header()->setResizeMode(QHeaderView::Stretch);
viewport()->setBackgroundRole(QPalette::Window);
+ m_toolbox_mode = false;
connect(this, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(handleMousePress(QTreeWidgetItem*)));
+}
+
+bool ScTreeWidget::event(QEvent *e)
+{
+ if (e->type() == QEvent::Shortcut)
+ {
+ QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
+ if (se != NULL)
+ {
+ int k = se->shortcutId();
+ QTreeWidgetItem *item1 = keySList.value(k);
+ handleMousePress(item1);
+ return true;
+ }
+ }
+ return QTreeWidget::event(e);
}
QTreeWidgetItem* ScTreeWidget::addWidget(QString title, QWidget* widget)
@@ -116,28 +132,140 @@
item2->setSizeHint(0, widget->layout()->minimumSize());
// end hack
setItemWidget(item2, 0, widget);
+ QKeySequence newMnemonic = QKeySequence::mnemonic(title);
+// grabShortcut(newMnemonic);
+ keySList.insert(grabShortcut(newMnemonic), item1);
return item1;
}
+void ScTreeWidget::setToolBoxMode(bool enable)
+{
+ m_toolbox_mode = enable;
+}
+
+int ScTreeWidget::addItem(QWidget* widget, QString title)
+{
+ QTreeWidgetItem *top = addWidget(title, widget);
+ return indexOfTopLevelItem(top);
+}
+
+QWidget* ScTreeWidget::widget(int index)
+{
+ if ((index < 0) || (index >= topLevelItemCount()))
+ return NULL;
+ QTreeWidgetItem *top = topLevelItem(index);
+ if (top->childCount() == 0)
+ return NULL;
+ QTreeWidgetItem *child = top->child(0);
+ return itemWidget(child, 0);
+}
+
+void ScTreeWidget::setItemEnabled(int index, bool enable)
+{
+ if ((index < 0) || (index >= topLevelItemCount()))
+ return;
+ if (enable)
+ topLevelItem(index)->setFlags(Qt::ItemIsEnabled);
+ else
+ topLevelItem(index)->setFlags(0);
+}
+
+bool ScTreeWidget::isItemEnabled(int index)
+{
+ if ((index < 0) || (index >= topLevelItemCount()))
+ return false;
+ return !topLevelItem(index)->isDisabled();
+}
+
+void ScTreeWidget::setCurrentIndex(int index)
+{
+ if ((index < 0) || (index >= topLevelItemCount()))
+ return;
+ int tops = topLevelItemCount();
+ for (int t = 0; t < tops; t++)
+ {
+ setItemExpanded(topLevelItem(t), false);
+ }
+ QTreeWidgetItem *top = topLevelItem(index);
+ setCurrentItem(top);
+ setItemExpanded(top, true);
+ int wide = 0;
+ if (top->childCount() != 0)
+ {
+ QTreeWidgetItem *child = top->child(0);
+ if (child != 0)
+ wide = itemWidget(child, 0)->minimumSizeHint().width()+5;
+ }
+ if (wide != 0)
+ setColumnWidth(0, wide);
+ else
+ resizeColumnToContents(0);
+}
+
+int ScTreeWidget::currentIndex()
+{
+ int index = -1;
+ QTreeWidgetItem* item = currentItem();
+ if (item->parent() == 0)
+ index = indexOfTopLevelItem(item);
+ else
+ index = indexOfTopLevelItem(item->parent());
+ return index;
+}
+
+void ScTreeWidget::setItemText(int index, QString text)
+{
+ if ((index < 0) || (index >= topLevelItemCount()))
+ return;
+ topLevelItem(index)->setText(0, text);
+}
+
void ScTreeWidget::handleMousePress(QTreeWidgetItem *item)
{
if (item == 0)
return;
if (item->parent() == 0)
{
- setItemExpanded(item, !isItemExpanded(item));
+ if (item->isDisabled())
+ {
+ setItemExpanded(item, false);
+ return;
+ }
+ int wide = 0;
int tops = topLevelItemCount();
- int wide = 0;
- for (int t = 0; t < tops; t++)
- {
- QTreeWidgetItem *top = topLevelItem(t);
- if (isItemExpanded(top))
+ if (m_toolbox_mode)
+ {
+ for (int t = 0; t < tops; t++)
{
- if (top->childCount() != 0)
+ setItemExpanded(topLevelItem(t), false);
+ }
+ setCurrentItem(item);
+ setItemExpanded(item, true);
+ if (item->childCount() != 0)
+ {
+ QTreeWidgetItem *child = item->child(0);
+ if (child != 0)
+ wide = itemWidget(child, 0)->minimumSizeHint().width()+5;
+ }
+ if (wide != 0)
+ setColumnWidth(0, wide);
+ else
+ resizeColumnToContents(0);
+ }
+ else
+ {
+ setItemExpanded(item, !isItemExpanded(item));
+ for (int t = 0; t < tops; t++)
+ {
+ QTreeWidgetItem *top = topLevelItem(t);
+ if (isItemExpanded(top))
{
- QTreeWidgetItem *child = top->child(0);
- if (child != 0)
- wide = qMax(wide, itemWidget(child, 0)->minimumSizeHint().width()+5);
+ if (top->childCount() != 0)
+ {
+ QTreeWidgetItem *child = top->child(0);
+ if (child != 0)
+ wide = qMax(wide, itemWidget(child, 0)->minimumSizeHint().width()+5);
+ }
}
}
}
@@ -145,6 +273,6 @@
setColumnWidth(0, wide);
else
resizeColumnToContents(0);
- return;
- }
-}
+ emit currentChanged(indexOfTopLevelItem(item));
+ }
+}
Modified: branches/ScribusOIF/scribus/ui/sctreewidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17385&path=/branches/ScribusOIF/scribus/ui/sctreewidget.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/sctreewidget.h (original)
+++ branches/ScribusOIF/scribus/ui/sctreewidget.h Sat Mar 17 13:57:00 2012
@@ -28,6 +28,8 @@
#include <QTreeWidget>
#include <QString>
#include <QWidget>
+#include <QHash>
+#include <QEvent>
#include "scribusapi.h"
class SCRIBUS_API ScTreeWidgetDelegate : public QItemDelegate
@@ -50,7 +52,22 @@
ScTreeWidget(QWidget* pa);
~ScTreeWidget() {};
QTreeWidgetItem* addWidget(QString title, QWidget* widget);
+ void setToolBoxMode(bool enable);
+ int addItem(QWidget* widget, QString title);
+ QWidget* widget(int index);
+ void setItemEnabled(int index, bool enable);
+ bool isItemEnabled(int index);
+ void setCurrentIndex(int index);
+ int currentIndex();
+ void setItemText(int index, QString text);
private slots:
void handleMousePress(QTreeWidgetItem *item);
+signals:
+ void currentChanged(int);
+private:
+ bool m_toolbox_mode;
+ QHash<int, QTreeWidgetItem*> keySList;
+protected:
+ bool event(QEvent *e);
};
#endif
More information about the scribus-commit
mailing list