defuze.me
Client
|
00001 /************************************************************************** 00002 ** defuze.me Epitech Innovative Project 00003 ** 00004 ** Copyright 2010-2011 00005 ** Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard 00006 ** Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier 00007 ** 00008 ** All rights reserved. 00009 **************************************************************************/ 00010 00011 #include <QDebug> 00012 #include "gridelement.hpp" 00013 #include "gridwidget.hpp" 00014 00015 using namespace Gui; 00016 00017 GridElement::GridElement(const QString &title, GridWidget *parent) : 00018 QWidget(parent), gridWidget(parent) 00019 { 00020 setupUi(this); 00021 titleLabel->setText("<b>" + title + "</b>"); 00022 paramsButton->hide(); 00023 } 00024 00025 void GridElement::showParams() 00026 { 00027 //module->parametersCategory->show(); 00028 } 00029 00030 void GridElement::setModule(Module *module) 00031 { 00032 this->module = module; 00033 this->setSizePolicy(module->colSizePolicy, module->sizePolicy); 00034 elementWidget->addWidget(module->getWidget()); 00035 elementWidget->setStretch(1, 1); 00036 setPosition(module->getPosition()); 00037 // if (module->hasParameters()) 00038 // { 00039 // paramsButton->show(); 00040 // connect(paramsButton, SIGNAL(clicked()), this, SLOT(showParams())); 00041 // } 00042 } 00043 00044 Module *GridElement::getModule() const 00045 { 00046 return module; 00047 } 00048 00049 GridWidget *GridElement::getGridWidget() const 00050 { 00051 return gridWidget; 00052 } 00053 00054 int GridElement::getColumn() const 00055 { 00056 return position.x(); 00057 } 00058 00059 void GridElement::setColumn(int column) 00060 { 00061 setPosition(QPoint(column, position.y())); 00062 } 00063 00064 int GridElement::getRow() const 00065 { 00066 return position.y(); 00067 } 00068 00069 void GridElement::setRow(int row) 00070 { 00071 setPosition(QPoint(position.x(), row)); 00072 } 00073 00074 const QPoint& GridElement::getPosition() const 00075 { 00076 return position; 00077 } 00078 00079 void GridElement::setPosition(QPoint position) 00080 { 00081 this->position = position; 00082 //positionLabel->setText("(" + QVariant(position.x()).toString() + "," + QVariant(position.y()).toString() + ")"); 00083 } 00084 00085 void GridElement::changeEvent(QEvent *e) 00086 { 00087 QWidget::changeEvent(e); 00088 switch (e->type()) { 00089 case QEvent::LanguageChange: 00090 retranslateUi(this); 00091 break; 00092 default: 00093 break; 00094 } 00095 }