Mercurial > hg > svgui
comparison widgets/PropertyStack.cpp @ 1582:01a41a37bd26
Add a tab-bar context menu signal to the property stack
author | Chris Cannam |
---|---|
date | Wed, 25 Mar 2020 12:08:34 +0000 |
parents | 284a38c43721 |
children |
comparison
equal
deleted
inserted
replaced
1580:a2ff9c01889e | 1582:01a41a37bd26 |
---|---|
43 | 43 |
44 connect(bar, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredTabBar())); | 44 connect(bar, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredTabBar())); |
45 connect(bar, SIGNAL(mouseLeft()), this, SLOT(mouseLeftTabBar())); | 45 connect(bar, SIGNAL(mouseLeft()), this, SLOT(mouseLeftTabBar())); |
46 connect(bar, SIGNAL(activeTabClicked()), this, SLOT(activeTabClicked())); | 46 connect(bar, SIGNAL(activeTabClicked()), this, SLOT(activeTabClicked())); |
47 | 47 |
48 bar->setContextMenuPolicy(Qt::CustomContextMenu); | |
49 connect(bar, SIGNAL(customContextMenuRequested(const QPoint &)), | |
50 this, SLOT(tabBarContextMenuRequested(const QPoint &))); | |
51 | |
48 setTabBar(bar); | 52 setTabBar(bar); |
49 | 53 |
50 setElideMode(Qt::ElideNone); | 54 setElideMode(Qt::ElideNone); |
51 tabBar()->setUsesScrollButtons(true); | 55 tabBar()->setUsesScrollButtons(true); |
52 tabBar()->setIconSize(WidgetScale::scaleQSize(QSize(16, 16))); | 56 tabBar()->setIconSize(WidgetScale::scaleQSize(QSize(16, 16))); |
162 } | 166 } |
163 | 167 |
164 blockSignals(false); | 168 blockSignals(false); |
165 } | 169 } |
166 | 170 |
171 void | |
172 PropertyStack::tabBarContextMenuRequested(const QPoint &pos) | |
173 { | |
174 int tab = tabBar()->tabAt(pos); | |
175 if (!in_range_for(m_boxes, tab)) { | |
176 return; | |
177 } | |
178 | |
179 emit propertyContainerContextMenuRequested(m_client, | |
180 m_boxes[tab]->getContainer(), | |
181 mapToGlobal(pos)); | |
182 } | |
183 | |
167 bool | 184 bool |
168 PropertyStack::containsContainer(PropertyContainer *pc) const | 185 PropertyStack::containsContainer(PropertyContainer *pc) const |
169 { | 186 { |
170 for (int i = 0; i < m_client->getPropertyContainerCount(); ++i) { | 187 for (int i = 0; i < m_client->getPropertyContainerCount(); ++i) { |
171 PropertyContainer *container = m_client->getPropertyContainer(i); | 188 PropertyContainer *container = m_client->getPropertyContainer(i); |