Mercurial > hg > svgui
comparison widgets/PropertyStack.cpp @ 242:50c0a548d23e sv1-1.0pre4
...
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2007 12:28:06 +0000 |
parents | fe4fd011ef5d |
children | e6d0b097d102 |
comparison
equal
deleted
inserted
replaced
241:fe4fd011ef5d | 242:50c0a548d23e |
---|---|
16 #include "PropertyStack.h" | 16 #include "PropertyStack.h" |
17 #include "PropertyBox.h" | 17 #include "PropertyBox.h" |
18 #include "base/PropertyContainer.h" | 18 #include "base/PropertyContainer.h" |
19 #include "view/View.h" | 19 #include "view/View.h" |
20 #include "layer/Layer.h" | 20 #include "layer/Layer.h" |
21 #include "layer/LayerFactory.h" | |
21 #include "widgets/NotifyingTabBar.h" | 22 #include "widgets/NotifyingTabBar.h" |
22 | 23 |
23 #include <QIcon> | 24 #include <QIcon> |
24 #include <QTabWidget> | 25 #include <QTabWidget> |
25 | 26 |
38 connect(bar, SIGNAL(mouseLeft()), this, SLOT(mouseLeftTabBar())); | 39 connect(bar, SIGNAL(mouseLeft()), this, SLOT(mouseLeftTabBar())); |
39 connect(bar, SIGNAL(activeTabClicked()), this, SLOT(activeTabClicked())); | 40 connect(bar, SIGNAL(activeTabClicked()), this, SLOT(activeTabClicked())); |
40 | 41 |
41 setTabBar(bar); | 42 setTabBar(bar); |
42 | 43 |
43 // setElideMode(Qt::ElideRight); | 44 #if (QT_VERSION >= 0x0402) |
45 setElideMode(Qt::ElideNone); | |
44 tabBar()->setUsesScrollButtons(true); | 46 tabBar()->setUsesScrollButtons(true); |
45 tabBar()->setIconSize(QSize(16, 16)); | 47 tabBar()->setIconSize(QSize(16, 16)); |
48 #endif | |
46 | 49 |
47 repopulate(); | 50 repopulate(); |
48 | 51 |
49 connect(this, SIGNAL(currentChanged(int)), | 52 connect(this, SIGNAL(currentChanged(int)), |
50 this, SLOT(selectedContainerChanged(int))); | 53 this, SLOT(selectedContainerChanged(int))); |
88 for (size_t i = 0; i < m_client->getPropertyContainerCount(); ++i) { | 91 for (size_t i = 0; i < m_client->getPropertyContainerCount(); ++i) { |
89 | 92 |
90 PropertyContainer *container = m_client->getPropertyContainer(i); | 93 PropertyContainer *container = m_client->getPropertyContainer(i); |
91 QString name = container->getPropertyContainerName(); | 94 QString name = container->getPropertyContainerName(); |
92 | 95 |
93 QString iconName = container->getPropertyContainerIconName(); | |
94 | |
95 PropertyBox *box = new PropertyBox(container); | 96 PropertyBox *box = new PropertyBox(container); |
96 | 97 |
97 connect(box, SIGNAL(showLayer(bool)), this, SLOT(showLayer(bool))); | 98 connect(box, SIGNAL(showLayer(bool)), this, SLOT(showLayer(bool))); |
98 connect(box, SIGNAL(contextHelpChanged(const QString &)), | 99 connect(box, SIGNAL(contextHelpChanged(const QString &)), |
99 this, SIGNAL(contextHelpChanged(const QString &))); | 100 this, SIGNAL(contextHelpChanged(const QString &))); |
101 Layer *layer = dynamic_cast<Layer *>(container); | 102 Layer *layer = dynamic_cast<Layer *>(container); |
102 if (layer) { | 103 if (layer) { |
103 box->layerVisibilityChanged(!layer->isLayerDormant(m_client)); | 104 box->layerVisibilityChanged(!layer->isLayerDormant(m_client)); |
104 } | 105 } |
105 | 106 |
107 QString shortName = name; | |
108 | |
109 if (layer) { | |
110 shortName = LayerFactory::getInstance()->getLayerPresentationName | |
111 (LayerFactory::getInstance()->getLayerType(layer)); | |
112 } | |
113 | |
114 shortName = QString("&%1 %2").arg(i + 1).arg(shortName); | |
115 | |
116 #ifdef Q_WS_MAC | |
117 | |
118 // Qt 4.2 on OS/X doesn't show the icons in the tab bar, and | |
119 // I'm not sure why -- use labels instead | |
120 | |
121 addTab(box, shortName); | |
122 | |
123 #else | |
124 | |
125 // Icons on other platforms | |
126 | |
127 QString iconName = container->getPropertyContainerIconName(); | |
128 | |
106 QIcon icon(QString(":/icons/%1.png").arg(iconName)); | 129 QIcon icon(QString(":/icons/%1.png").arg(iconName)); |
107 if (icon.isNull()) { | 130 if (icon.isNull()) { |
108 addTab(box, name); | 131 addTab(box, shortName); |
109 } else { | 132 } else { |
110 addTab(box, icon, QString("&%1").arg(i + 1)); | 133 addTab(box, icon, QString("&%1").arg(i + 1)); |
111 tabBar()->setTabToolTip(count() - 1, name); | 134 setTabToolTip(i, name); |
112 tabBar()->setTabIcon(count() - 1, icon); | 135 } |
113 } | 136 |
137 #endif | |
114 | 138 |
115 m_boxes.push_back(box); | 139 m_boxes.push_back(box); |
116 } | 140 } |
117 | 141 |
118 blockSignals(false); | 142 blockSignals(false); |