comparison widgets/ItemLayerList.cpp @ 56:81921835ddf1

first layer list pre-version
author benoitrigolleau
date Wed, 23 May 2007 13:09:19 +0000
parents
children 4f3e6a09239a
comparison
equal deleted inserted replaced
55:41f1491c841b 56:81921835ddf1
1
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3
4 /*
5 Sound Access
6 EASAIER client application.
7 Silogic 2007. Benoit Rigolleau.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #include "ItemLayerList.h"
17
18 #include "data/model/LayerItemModel.h"
19
20 #include <QWidget>
21
22 #include <QApplication>
23 #include <QLabel>
24
25 ItemLayerList::ItemLayerList(QWidget *parent) : GenericItemList(parent){
26 setAcceptDrops(true);
27
28 /* Init all variables*/
29 labelIcon = new QLabel;
30 labelName = new QLabel;
31 checkBox1 = new QCheckBox;
32 checkBox2 = new QCheckBox;
33 layoutMain = new QHBoxLayout;
34
35 /* set the correct widget parameters*/
36 labelIcon->setMaximumSize(25,25);
37 //labelIcon->setPixmap(QIcon(":icons/layerViewer_btn_config.png").pixmap(20));
38
39 labelName->setMaximumHeight(25);
40 //labelName->setText("ljdh lksdf hl");
41
42 checkBox1->setLayoutDirection(Qt::RightToLeft);
43 checkBox1->setMaximumSize(30,30);
44 //checkBox1->setText("");
45 checkBox1->setAutoFillBackground(true);
46 //QPalette palette;
47 //palette.setColor(QPalette::Button,QColor ( 100, 60, 20));
48 //checkBox1->setPalette(palette);
49
50 checkBox2->setMaximumSize(20,30);
51
52 layoutMain->setSpacing(5);
53 layoutMain->setMargin(0);
54
55 this->setMaximumHeight(30);
56 this->setMinimumHeight(30);
57 this->setFrameStyle(QFrame::Panel | QFrame::Raised);
58 this->setLineWidth(1);
59
60 /* build the interface*/
61 layoutMain->addWidget(checkBox1);
62 layoutMain->addWidget(checkBox2);
63 layoutMain->addWidget(labelIcon);
64 layoutMain->addWidget(labelName);
65
66 /*add the main layout in this widget*/
67 this->setLayout(layoutMain);
68
69 connect(this, SIGNAL(doubleClicked()), this, SLOT(openPropertyBox()));
70 }
71
72 void ItemLayerList::setIcon(QString &icon){
73 labelIcon->setPixmap(QIcon(icon).pixmap(25));
74 }
75
76 void ItemLayerList::setName(QString &name){
77 labelName->setText(name);
78 }
79
80 void ItemLayerList::setColor(QColor &color){
81 QPalette palette;
82 palette.setColor(QPalette::Button,color);
83 checkBox1->setPalette(palette);
84 }
85
86 void ItemLayerList::changeCheckBox1State(bool state){
87 checkBox1->setChecked(state);
88 }
89
90 void ItemLayerList::changeCheckBox2State(bool state){
91 checkBox2->setChecked(state);
92 }
93
94 void ItemLayerList::setPropertyBox(PropertyBox *box){
95 m_propertyBox = box;
96 }
97
98 void ItemLayerList::configAction(){
99 if(m_propertyBox!=0){
100 m_propertyBox->close();
101 m_propertyBox->show();
102 }
103 }
104
105
106 /*********SLOTS ************/
107 void ItemLayerList::openPropertyBox(){
108 ItemLayerList::configAction();
109 }
110
111
112
113
114
115
116