Mercurial > hg > easaier-soundaccess
diff widgets/ItemLayerList.cpp @ 56:81921835ddf1
first layer list pre-version
author | benoitrigolleau |
---|---|
date | Wed, 23 May 2007 13:09:19 +0000 |
parents | |
children | 4f3e6a09239a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/ItemLayerList.cpp Wed May 23 13:09:19 2007 +0000 @@ -0,0 +1,116 @@ + +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sound Access + EASAIER client application. + Silogic 2007. Benoit Rigolleau. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include "ItemLayerList.h" + +#include "data/model/LayerItemModel.h" + +#include <QWidget> + +#include <QApplication> +#include <QLabel> + +ItemLayerList::ItemLayerList(QWidget *parent) : GenericItemList(parent){ + setAcceptDrops(true); + + /* Init all variables*/ + labelIcon = new QLabel; + labelName = new QLabel; + checkBox1 = new QCheckBox; + checkBox2 = new QCheckBox; + layoutMain = new QHBoxLayout; + + /* set the correct widget parameters*/ + labelIcon->setMaximumSize(25,25); + //labelIcon->setPixmap(QIcon(":icons/layerViewer_btn_config.png").pixmap(20)); + + labelName->setMaximumHeight(25); + //labelName->setText("ljdh lksdf hl"); + + checkBox1->setLayoutDirection(Qt::RightToLeft); + checkBox1->setMaximumSize(30,30); + //checkBox1->setText(""); + checkBox1->setAutoFillBackground(true); + //QPalette palette; + //palette.setColor(QPalette::Button,QColor ( 100, 60, 20)); + //checkBox1->setPalette(palette); + + checkBox2->setMaximumSize(20,30); + + layoutMain->setSpacing(5); + layoutMain->setMargin(0); + + this->setMaximumHeight(30); + this->setMinimumHeight(30); + this->setFrameStyle(QFrame::Panel | QFrame::Raised); + this->setLineWidth(1); + + /* build the interface*/ + layoutMain->addWidget(checkBox1); + layoutMain->addWidget(checkBox2); + layoutMain->addWidget(labelIcon); + layoutMain->addWidget(labelName); + + /*add the main layout in this widget*/ + this->setLayout(layoutMain); + + connect(this, SIGNAL(doubleClicked()), this, SLOT(openPropertyBox())); +} + +void ItemLayerList::setIcon(QString &icon){ + labelIcon->setPixmap(QIcon(icon).pixmap(25)); +} + +void ItemLayerList::setName(QString &name){ + labelName->setText(name); +} + +void ItemLayerList::setColor(QColor &color){ + QPalette palette; + palette.setColor(QPalette::Button,color); + checkBox1->setPalette(palette); +} + +void ItemLayerList::changeCheckBox1State(bool state){ + checkBox1->setChecked(state); +} + +void ItemLayerList::changeCheckBox2State(bool state){ + checkBox2->setChecked(state); +} + +void ItemLayerList::setPropertyBox(PropertyBox *box){ + m_propertyBox = box; +} + +void ItemLayerList::configAction(){ + if(m_propertyBox!=0){ + m_propertyBox->close(); + m_propertyBox->show(); + } +} + + +/*********SLOTS ************/ +void ItemLayerList::openPropertyBox(){ + ItemLayerList::configAction(); +} + + + + + + +