mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Merge branch 'master' of github.com:fataku/LOG750-LAB2
This commit is contained in:
commit
b95b9b628c
@ -63,26 +63,6 @@
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</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">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
@ -127,6 +107,26 @@
|
||||
</item>
|
||||
</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="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Forme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
@ -140,6 +140,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
@ -254,6 +264,9 @@
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Linear</string>
|
||||
</property>
|
||||
@ -262,6 +275,9 @@
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Nearest</string>
|
||||
</property>
|
||||
@ -270,6 +286,9 @@
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Linear MipMap Linear</string>
|
||||
</property>
|
||||
|
||||
@ -199,6 +199,7 @@ void Viewer::mousePressEvent(QMouseEvent* e) {
|
||||
}
|
||||
selectedObj.shape = selectedGeom.shape;
|
||||
selectedObj.shape->getParent()->addChild(selection);
|
||||
cubeSelected(true);
|
||||
}
|
||||
|
||||
if(!selectedGeom.position.isIdentity() && e->modifiers().testFlag(Qt::ShiftModifier))
|
||||
@ -779,6 +780,26 @@ void Viewer::setMinLinear(bool on) {
|
||||
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){
|
||||
if(activeCell->getChildren()->size()){
|
||||
|
||||
@ -62,9 +62,11 @@ public slots:
|
||||
void setPhong(bool);
|
||||
void setMagLinear(bool);
|
||||
void setMinLinear(bool);
|
||||
void deleteSelected();
|
||||
|
||||
signals:
|
||||
int shapeSelected(int);
|
||||
bool cubeSelected(bool);
|
||||
|
||||
protected :
|
||||
virtual void draw();
|
||||
|
||||
@ -45,6 +45,9 @@ void MainWindow::addViewer(Viewer* viewer)
|
||||
connect(ui->actionPhong, SIGNAL(toggled(bool)), viewer, SLOT(setPhong(bool)));
|
||||
connect(ui->actionMagLinear, SIGNAL(toggled(bool)), viewer, SLOT(setMagLinear(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(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user