##// END OF EJS Templates
Sync
Jeandet Alexis -
r2:50dc05326188 default
parent child
Show More
@@ -7,7 +7,7 peripheralWidget::peripheralWidget(const
7 7 for(int i=0;i<10;i++)
8 8 {
9 9 registersWdgts.append(new registerWidget(QString("REG%1").arg(i),i*8));
10 registersWdgts.at(i)->setValue(-1);
10 registersWdgts.at(i)->setValue((i<<24)+(i<<8)+i);
11 11 mainLayout->addWidget(registersWdgts.at(i));
12 12 }
13 13 setLayout(mainLayout);
@@ -53,18 +53,26 protected:
53 53
54 54 class bitfieldsElement: public regWidgetElement
55 55 {
56 struct bitAttribute
56 class bitFieldAttribute
57 57 {
58 public:
59 bitFieldAttribute(bool rw,QString description)
60 {
61 this->rw = rw;
62 this->description = description;
63 }
58 64 bool rw;
59 int descIndex;
65 QString description;
60 66 };
61 67 public:
62 68 bitfieldsElement(const QString& value,QFont font,int xMargin,int yMargin)
63 69 :regWidgetElement(value,font,xMargin,yMargin)
64 70 {
71 this->attributesLUT.append(new bitFieldAttribute(true,"desc1"));
72 this->attributesLUT.append(new bitFieldAttribute(false,"desc2"));
65 73 for(int i=0;i<32;i++)
66 74 {
67 attributes[i].rw = false;
75 attributesIndex[i] = i&1;
68 76 }
69 77 updateBoundingRect();
70 78 }
@@ -78,7 +86,7 public:
78 86 {
79 87 for(int l = 0;l<4;l++)
80 88 {
81 if(attributes[(i*4)+l].rw==false)
89 if(attributesLUT[attributesIndex[(i*4)+l]]->rw==false)
82 90 painter->fillRect(xpos-1,0,dx,p_boundingRec.height(),Qt::lightGray);
83 91 else
84 92 painter->fillRect(xpos-1,0,dx,p_boundingRec.height(),Qt::white);
@@ -101,8 +109,14 public:
101 109 int width = (((4*(QFontMetrics(p_font).width("0") + 2)) + p_xMargins) * 8) + (p_xMargins);
102 110 p_boundingRec.setWidth(width);
103 111 }
112 void setValue(const QString& value)
113 {
114 p_valueStr = value;
115 updateBoundingRect();
116 }
104 117 private:
105 struct bitAttribute attributes[32];
118 int attributesIndex[32];
119 QList<bitFieldAttribute*> attributesLUT;
106 120 };
107 121
108 122
General Comments 0
You need to be logged in to leave comments. Login now