Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Pitiot
CGoGN
Commits
6a1baf21
Commit
6a1baf21
authored
Aug 30, 2013
by
Pierre Kraemer
Browse files
enable / disable plugin tabs wrt. selected view
parent
48969dd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
SCHNApps/include/schnapps.h
View file @
6a1baf21
...
...
@@ -79,8 +79,9 @@ public:
void
addPluginDockTab
(
Plugin
*
plugin
,
QWidget
*
tabWidget
,
const
QString
&
tabText
);
void
removePluginDockTab
(
Plugin
*
plugin
,
QWidget
*
tabWidget
);
// void enablePluginTabWidgets(Plugin* plugin);
// void disablePluginTabWidgets(Plugin* plugin);
private
slots
:
void
enablePluginTabWidgets
(
PluginInteraction
*
plugin
);
void
disablePluginTabWidgets
(
PluginInteraction
*
plugin
);
/*********************************************************
* MANAGE MAPS
...
...
SCHNApps/src/schnapps.cpp
View file @
6a1baf21
...
...
@@ -233,25 +233,21 @@ View* SCHNApps::getView(const QString& name) const
void
SCHNApps
::
setSelectedView
(
View
*
view
)
{
// if(m_selectedView)
// {
// const QList<Plugin*>& oldPlugins = m_currentView->getLinkedPlugins();
// foreach(Plugin* p, oldPlugins)
// disablePluginTabWidgets(p);
// disconnect(m_currentView, SIGNAL(pluginLinked(Plugin*)), this, SLOT(enablePluginTabWidgets(Plugin*)));
// disconnect(m_currentView, SIGNAL(pluginUnlinked(Plugin*)), this, SLOT(disablePluginTabWidgets(Plugin*)));
// }
if
(
m_selectedView
)
{
foreach
(
PluginInteraction
*
p
,
m_selectedView
->
getLinkedPlugins
())
disablePluginTabWidgets
(
p
);
disconnect
(
m_selectedView
,
SIGNAL
(
pluginLinked
(
PluginInteraction
*
)),
this
,
SLOT
(
enablePluginTabWidgets
(
PluginInteraction
*
)));
disconnect
(
m_selectedView
,
SIGNAL
(
pluginUnlinked
(
PluginInteraction
*
)),
this
,
SLOT
(
disablePluginTabWidgets
(
PluginInteraction
*
)));
}
View
*
oldSelected
=
m_selectedView
;
m_selectedView
=
view
;
// const QList<Plugin*>& newPlugins = m_currentView->getLinkedPlugins();
// foreach(Plugin* p, newPlugins)
// enablePluginTabWidgets(p);
// connect(m_currentView, SIGNAL(pluginLinked(Plugin*)), this, SLOT(enablePluginTabWidgets(Plugin*)));
// connect(m_currentView, SIGNAL(pluginUnlinked(Plugin*)), this, SLOT(disablePluginTabWidgets(Plugin*)));
foreach
(
PluginInteraction
*
p
,
m_selectedView
->
getLinkedPlugins
())
enablePluginTabWidgets
(
p
);
connect
(
m_selectedView
,
SIGNAL
(
pluginLinked
(
PluginInteraction
*
)),
this
,
SLOT
(
enablePluginTabWidgets
(
PluginInteraction
*
)));
connect
(
m_selectedView
,
SIGNAL
(
pluginUnlinked
(
PluginInteraction
*
)),
this
,
SLOT
(
disablePluginTabWidgets
(
PluginInteraction
*
)));
emit
(
selectedViewChanged
(
oldSelected
,
m_selectedView
));
...
...
@@ -436,27 +432,31 @@ void SCHNApps::removePluginDockTab(Plugin* plugin, QWidget *tabWidget)
}
}
//
void SCHNApps::enablePluginTabWidgets(Plugin* plugin)
//
{
void
SCHNApps
::
enablePluginTabWidgets
(
Plugin
Interaction
*
plugin
)
{
// int currentTab = m_dockTabWidget->currentIndex();
// const QList<QWidget*> tabWidgets = plugin->getTabWidgets();
// foreach(QWidget* w, tabWidgets)
// m_dockTabWidget->setTabEnabled(m_dockTabWidget->indexOf(w), true);
if
(
m_pluginTabs
.
contains
(
plugin
))
{
foreach
(
QWidget
*
w
,
m_pluginTabs
[
plugin
])
m_pluginDockTabWidget
->
setTabEnabled
(
m_pluginDockTabWidget
->
indexOf
(
w
),
true
);
}
// m_dockTabWidget->setCurrentIndex(currentTab);
//
}
}
//
void SCHNApps::disablePluginTabWidgets(Plugin* plugin)
//
{
void
SCHNApps
::
disablePluginTabWidgets
(
Plugin
Interaction
*
plugin
)
{
// int currentTab = m_dockTabWidget->currentIndex();
// const QList<QWidget*> tabWidgets = plugin->getTabWidgets();
// foreach(QWidget* w, tabWidgets)
// m_dockTabWidget->setTabEnabled(m_dockTabWidget->indexOf(w), false);
if
(
m_pluginTabs
.
contains
(
plugin
))
{
foreach
(
QWidget
*
w
,
m_pluginTabs
[
plugin
])
m_pluginDockTabWidget
->
setTabEnabled
(
m_pluginDockTabWidget
->
indexOf
(
w
),
false
);
}
// m_dockTabWidget->setCurrentIndex(currentTab);
//
}
}
/*********************************************************
* MANAGE MAPS
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment