Add "switch to textures" button on terrain page

This commit is contained in:
Michaël Lemaire 2013-06-20 22:21:09 +02:00
parent 62a956a65f
commit 2021817082
5 changed files with 24 additions and 5 deletions

View file

@ -1,12 +1,13 @@
#include "freeformhelper.h" #include "freeformhelper.h"
#include <cmath>
#include <QDialog> #include <QDialog>
#include <QVariant> #include <QVariant>
#include <QResizeEvent> #include <QResizeEvent>
#include <QSlider> #include <QSlider>
#include <QPushButton> #include <QPushButton>
#include <cmath> #include <QWidget>
#include <qt4/QtGui/qwidget.h> #include "mainwindow.h"
#include "dialogrender.h" #include "dialogrender.h"
#include "dialogexplorer.h" #include "dialogexplorer.h"
#include "rendering/scenery.h" #include "rendering/scenery.h"
@ -194,6 +195,15 @@ void FreeFormHelper::openDialog(QDialog* dialog)
} }
} }
void FreeFormHelper::gotoMainTab(int position)
{
QWidget* window = _form_widget->window();
if (window->inherits("MainWindow"))
{
((MainWindow*)window)->openTab(position);
}
}
void FreeFormHelper::processDataChange() void FreeFormHelper::processDataChange()
{ {
_data_changed = true; _data_changed = true;

View file

@ -39,6 +39,7 @@ public:
void setLabelText(QString widget_name, QString text); void setLabelText(QString widget_name, QString text);
void openDialog(QDialog* dialog); void openDialog(QDialog* dialog);
void gotoMainTab(int position);
signals: signals:
void revertClicked(); void revertClicked();
@ -75,4 +76,4 @@ private:
QPushButton* _button_render; QPushButton* _button_render;
}; };
#endif // FREEFORMHELPER_H #endif

View file

@ -168,6 +168,11 @@ void MainWindow::refreshAll()
cameraDeleteDefinition(camera); cameraDeleteDefinition(camera);
} }
void MainWindow::openTab(int position)
{
ui->tabs->setCurrentIndex(position);
}
void MainWindow::fileNew() void MainWindow::fileNew()
{ {
if (QMessageBox::question(this, tr("Paysages 3D - New scenery"), tr("Do you want to start a new scenery ? Any unsaved changes will be lost."), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) if (QMessageBox::question(this, tr("Paysages 3D - New scenery"), tr("Do you want to start a new scenery ? Any unsaved changes will be lost."), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)

View file

@ -28,6 +28,8 @@ public:
public slots: public slots:
void refreshAll(); void refreshAll();
void openTab(int position);
void fileNew(); void fileNew();
void fileSave(); void fileSave();
void fileLoad(); void fileLoad();

View file

@ -127,5 +127,6 @@ void MainTerrainForm::buttonPaintingPressed()
void MainTerrainForm::buttonTexturesPressed() void MainTerrainForm::buttonTexturesPressed()
{ {
// TODO Switch to textures tab // Switch to textures tab
_form_helper->gotoMainTab(1);
} }