mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Delete with segfault
This commit is contained in:
parent
b022c428d3
commit
2c905aa6a8
@ -63,26 +63,6 @@
|
|||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Forme</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -127,6 +107,26 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Forme</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pushButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -140,6 +140,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QPushButton" name="action_delete">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete Cube</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -254,6 +264,9 @@
|
|||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Linear</string>
|
<string>Linear</string>
|
||||||
</property>
|
</property>
|
||||||
@ -262,6 +275,9 @@
|
|||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Nearest</string>
|
<string>Nearest</string>
|
||||||
</property>
|
</property>
|
||||||
@ -270,6 +286,9 @@
|
|||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Linear MipMap Linear</string>
|
<string>Linear MipMap Linear</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@ -202,6 +202,7 @@ void Viewer::mousePressEvent(QMouseEvent* e) {
|
|||||||
}
|
}
|
||||||
selectedObj.shape = selectedGeom.shape;
|
selectedObj.shape = selectedGeom.shape;
|
||||||
selectedObj.shape->getParent()->addChild(selection);
|
selectedObj.shape->getParent()->addChild(selection);
|
||||||
|
cubeSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!selectedGeom.position.isIdentity() && e->modifiers().testFlag(Qt::ShiftModifier))
|
if(!selectedGeom.position.isIdentity() && e->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
@ -786,6 +787,26 @@ void Viewer::setMinLinear(bool on) {
|
|||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewer::deleteSelected() {
|
||||||
|
// Remove Shape from its parent
|
||||||
|
|
||||||
|
selectedObj.shape->getParent()->getChildren()->erase(
|
||||||
|
std::remove(selectedObj.shape->getParent()->getChildren()->begin(),
|
||||||
|
selectedObj.shape->getParent()->getChildren()->end(),
|
||||||
|
selection),
|
||||||
|
selectedObj.shape->getParent()->getChildren()->end());
|
||||||
|
|
||||||
|
selectedObj.shape->getParent()->getChildren()->erase(
|
||||||
|
std::remove(selectedObj.shape->getParent()->getChildren()->begin(),
|
||||||
|
selectedObj.shape->getParent()->getChildren()->end(),
|
||||||
|
selectedObj.shape),
|
||||||
|
selectedObj.shape->getParent()->getChildren()->end());
|
||||||
|
|
||||||
|
selectedObj.shape = new Cube(); // Rebind to "null"
|
||||||
|
|
||||||
|
cubeSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Viewer::changeColor(QColor c){
|
void Viewer::changeColor(QColor c){
|
||||||
if(activeCell->getChildren()->size()){
|
if(activeCell->getChildren()->size()){
|
||||||
|
|||||||
@ -62,9 +62,11 @@ public slots:
|
|||||||
void setPhong(bool);
|
void setPhong(bool);
|
||||||
void setMagLinear(bool);
|
void setMagLinear(bool);
|
||||||
void setMinLinear(bool);
|
void setMinLinear(bool);
|
||||||
|
void deleteSelected();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
int shapeSelected(int);
|
int shapeSelected(int);
|
||||||
|
bool cubeSelected(bool);
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
|
|||||||
@ -45,6 +45,9 @@ void MainWindow::addViewer(Viewer* viewer)
|
|||||||
connect(ui->actionPhong, SIGNAL(toggled(bool)), viewer, SLOT(setPhong(bool)));
|
connect(ui->actionPhong, SIGNAL(toggled(bool)), viewer, SLOT(setPhong(bool)));
|
||||||
connect(ui->actionMagLinear, SIGNAL(toggled(bool)), viewer, SLOT(setMagLinear(bool)));
|
connect(ui->actionMagLinear, SIGNAL(toggled(bool)), viewer, SLOT(setMagLinear(bool)));
|
||||||
connect(ui->actionMinLin, SIGNAL(toggled(bool)), viewer, SLOT(setMinLinear(bool)));
|
connect(ui->actionMinLin, SIGNAL(toggled(bool)), viewer, SLOT(setMinLinear(bool)));
|
||||||
|
|
||||||
|
connect(ui->action_delete, SIGNAL(clicked(bool)), viewer, SLOT(deleteSelected()));
|
||||||
|
connect(viewer, SIGNAL(cubeSelected(bool)), ui->action_delete, SLOT(setEnabled(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onColorPickerActivate(){
|
void MainWindow::onColorPickerActivate(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user