disable element visibility buttons that do not apply to the respective cell type

report
Marc Zinnschlag 10 years ago
parent b7cf114d5d
commit 406cf2b981

@ -22,6 +22,7 @@
#include "../widget/scenetooltoggle.hpp"
#include "../widget/scenetoolmode.hpp"
#include "../widget/scenetooltoggle2.hpp"
#include "editmode.hpp"
#include "elements.hpp"
@ -212,6 +213,14 @@ void CSVRender::PagedWorldspaceWidget::mouseDoubleClickEvent (QMouseEvent *event
WorldspaceWidget::mouseDoubleClickEvent(event);
}
void CSVRender::PagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (Element_Terrain, "Terrain");
tool->addButton (Element_Fog, "Fog", "", true);
}
void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (
CSVWidget::SceneToolMode *tool)
{

@ -83,6 +83,8 @@ namespace CSVRender
protected:
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);
virtual void addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool);
virtual void updateOverlay();

@ -153,6 +153,14 @@ void CSVRender::UnpagedWorldspaceWidget::referenceAdded (const QModelIndex& pare
flagAsModified();
}
void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (Element_Terrain, "Terrain", "", true);
tool->addButton (Element_Fog, "Fog");
}
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()
{
Ogre::Vector3 position = getCamera()->getPosition();

@ -60,6 +60,10 @@ namespace CSVRender
virtual std::string getStartupInstruction();
protected:
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);
private slots:
void cellDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);

@ -263,10 +263,8 @@ void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
tool->addButton (Element_Reference, "References");
tool->addButton (Element_Terrain, "Terrain");
tool->addButton (Element_Water, "Water");
tool->addButton (Element_Pathgrid, "Pathgrid");
tool->addButton (Element_Fog, "Fog");
}
void CSVRender::WorldspaceWidget::addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool)

@ -72,7 +72,7 @@ void CSVWidget::SceneToolToggle2::showPanel (const QPoint& position)
}
void CSVWidget::SceneToolToggle2::addButton (unsigned int id,
const QString& name, const QString& tooltip)
const QString& name, const QString& tooltip, bool disabled)
{
std::ostringstream stream;
stream << mSingleIcon << id;
@ -84,6 +84,9 @@ void CSVWidget::SceneToolToggle2::addButton (unsigned int id,
button->setIconSize (QSize (mIconSize, mIconSize));
button->setFixedSize (mButtonSize, mButtonSize);
if (disabled)
button->setDisabled (true);
mLayout->addWidget (button);
ButtonDesc desc;
@ -95,7 +98,7 @@ void CSVWidget::SceneToolToggle2::addButton (unsigned int id,
connect (button, SIGNAL (clicked()), this, SLOT (selected()));
if (mButtons.size()==1)
if (mButtons.size()==1 && !disabled)
mFirst = button;
}

@ -56,7 +56,7 @@ namespace CSVWidget
/// \attention After the last button has been added, setSelection must be called at
/// least once to finalise the layout.
void addButton (unsigned int id,
const QString& name, const QString& tooltip = "");
const QString& name, const QString& tooltip = "", bool disabled = false);
unsigned int getSelection() const;

Loading…
Cancel
Save