summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lslayoutwindow.cpp5
-rw-r--r--lspaneeditor.cpp12
-rw-r--r--lspaneeditor.h4
-rw-r--r--lsscenemodel.cpp28
-rw-r--r--lsscenemodel.h6
5 files changed, 42 insertions, 13 deletions
diff --git a/lslayoutwindow.cpp b/lslayoutwindow.cpp
index d19e397..718e92d 100644
--- a/lslayoutwindow.cpp
+++ b/lslayoutwindow.cpp
@@ -85,11 +85,13 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q
m_widthBox->setValue(m_layout->width);
m_heightBox->setValue(m_layout->height);
+ LSSceneModel *scnModel = new LSSceneModel(m_layout, true, this);
+
m_sceneGraph->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_sceneGraph->setDragEnabled(true);
m_sceneGraph->setAcceptDrops(true);
m_sceneGraph->setDropIndicatorShown(true);
- m_sceneGraph->setModel(new LSSceneModel(m_layout, this));
+ m_sceneGraph->setModel(scnModel);
m_sceneGraph->expandAll();
connect(m_sceneGraph->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(selectedPaneChanged(QModelIndex,QModelIndex)));
@@ -107,6 +109,7 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q
m_renderer->show();
connect(m_paneEditor, SIGNAL(mustRedrawLayout()), m_renderer, SLOT(updateGL()));
+ connect(scnModel, SIGNAL(paneVisibilityChanged()), m_renderer, SLOT(updateGL()));
// clean up here
setAttribute(Qt::WA_DeleteOnClose);
diff --git a/lspaneeditor.cpp b/lspaneeditor.cpp
index 659fd1e..ee7e310 100644
--- a/lspaneeditor.cpp
+++ b/lspaneeditor.cpp
@@ -106,8 +106,8 @@ void LSPaneEditor::createPaneTab() {
m_widescreen = new QCheckBox("Widescreen", this);
connect(m_widescreen, SIGNAL(toggled(bool)), SLOT(handleWidescreenChanged(bool)));
- m_visible = new QCheckBox("Visible", this);
- connect(m_visible, SIGNAL(toggled(bool)), SLOT(handleVisibleChanged(bool)));
+ //m_visible = new QCheckBox("Visible", this);
+ //connect(m_visible, SIGNAL(toggled(bool)), SLOT(handleVisibleChanged(bool)));
// Column 0
gLayout->addWidget(new QLabel("Width:", geoBox), 0, 0, 1, 1);
@@ -123,7 +123,7 @@ void LSPaneEditor::createPaneTab() {
// Row 2
gLayout->addWidget(m_widescreen, 2, 0, 1, 2);
- gLayout->addWidget(m_visible, 2, 2, 1, 2);
+ //gLayout->addWidget(m_visible, 2, 2, 1, 2);
// Positioning Box
@@ -192,7 +192,7 @@ void LSPaneEditor::setPane(LYTPane *pane) {
m_vertOrigin->setCurrentIndex((int)pane->vertOrigin);
m_widescreen->setChecked(pane->isWidescreen);
- m_visible->setChecked(pane->visible);
+ //m_visible->setChecked(pane->visible);
m_transX->setValue(pane->xTrans);
@@ -274,12 +274,12 @@ void LSPaneEditor::handleWidescreenChanged(bool value) {
}
}
-void LSPaneEditor::handleVisibleChanged(bool value) {
+/*void LSPaneEditor::handleVisibleChanged(bool value) {
if (!m_currentlyLoadingPane) {
m_pane->visible = value;
emit mustRedrawLayout();
}
-}
+}*/
void LSPaneEditor::handleTransXChanged(double value) {
if (!m_currentlyLoadingPane) {
diff --git a/lspaneeditor.h b/lspaneeditor.h
index 0c4ddc3..22a7a7d 100644
--- a/lspaneeditor.h
+++ b/lspaneeditor.h
@@ -36,7 +36,7 @@ private:
QDoubleSpinBox *m_width, *m_height;
QComboBox *m_horzOrigin, *m_vertOrigin;
- QCheckBox *m_widescreen, *m_visible;
+ QCheckBox *m_widescreen; //, *m_visible;
QDoubleSpinBox *m_transX, *m_transY, *m_transZ;
QDoubleSpinBox *m_rotX, *m_rotY, *m_rotZ;
@@ -57,7 +57,7 @@ private slots:
void handleHorzOriginChanged(int value);
void handleVertOriginChanged(int value);
void handleWidescreenChanged(bool value);
- void handleVisibleChanged(bool value);
+ //void handleVisibleChanged(bool value);
void handleTransXChanged(double value);
void handleTransYChanged(double value);
void handleTransZChanged(double value);
diff --git a/lsscenemodel.cpp b/lsscenemodel.cpp
index acb059c..1e55cdd 100644
--- a/lsscenemodel.cpp
+++ b/lsscenemodel.cpp
@@ -1,8 +1,8 @@
#include "lsscenemodel.h"
#include "lsglobals.h"
-LSSceneModel::LSSceneModel(LYTLayout *layout, QObject *parent) :
- QAbstractItemModel(parent)
+LSSceneModel::LSSceneModel(LYTLayout *layout, bool exposeVisibility, QObject *parent) :
+ QAbstractItemModel(parent), m_exposesVisibility(exposeVisibility)
{
m_layout = layout;
@@ -72,19 +72,41 @@ QVariant LSSceneModel::data(const QModelIndex &index, int role) const {
case Qt::DecorationRole:
return m_paneIcons[pane->type()];
}
+
+ if (m_exposesVisibility && role == Qt::CheckStateRole) {
+ return pane->visible ? Qt::Checked : Qt::Unchecked;
+ }
}
return QVariant();
}
+bool LSSceneModel::setData(const QModelIndex &index, const QVariant &value, int role) {
+ if (m_exposesVisibility && role == Qt::CheckStateRole) {
+ LYTPane *pane = (LYTPane*)index.internalPointer();
+
+ bool newVisible = value.toBool();
+ if (pane->visible != newVisible) {
+ pane->visible = newVisible;
+ emit dataChanged(index, index);
+ emit paneVisibilityChanged();
+ }
+ }
+
+ return false;
+}
+
Qt::ItemFlags LSSceneModel::flags(const QModelIndex &index) const {
Qt::ItemFlags flag;
flag = Qt::ItemIsEnabled | Qt::ItemIsSelectable |
- Qt::ItemIsDropEnabled | Qt::ItemIsEditable;
+ Qt::ItemIsDropEnabled;
if (index.isValid() && index.parent().isValid())
flag |= Qt::ItemIsDragEnabled;
+ if (m_exposesVisibility)
+ flag |= Qt::ItemIsUserCheckable;
+
return flag;
}
diff --git a/lsscenemodel.h b/lsscenemodel.h
index 11ef4a6..e089e46 100644
--- a/lsscenemodel.h
+++ b/lsscenemodel.h
@@ -8,7 +8,7 @@
class LSSceneModel : public QAbstractItemModel {
Q_OBJECT
public:
- explicit LSSceneModel(LYTLayout *layout, QObject *parent = 0);
+ explicit LSSceneModel(LYTLayout *layout, bool exposeVisibility, QObject *parent = 0);
~LSSceneModel();
LYTLayout *layout() const { return m_layout; }
@@ -18,6 +18,7 @@ public:
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role);
Qt::ItemFlags flags(const QModelIndex &index) const;
Qt::DropActions supportedDropActions() const;
@@ -32,8 +33,11 @@ private:
QPersistentModelIndex *m_movingPaneParent;
int m_movingPaneRow, m_movingPaneCount;
+
+ bool m_exposesVisibility;
signals:
+ void paneVisibilityChanged();
public slots: