|
1 #include "CustomListWidget.h" |
|
2 #include <qlistwidget.h> |
|
3 #include <qboxlayout.h> |
|
4 #include <qlabel.h> |
|
5 #include <qdebug.h> |
|
6 #include "ScreenSize.h" |
|
7 #include <qpushbutton.h> |
|
8 #include "WidgetConstants.h" |
|
9 |
|
10 CustomListWidget::CustomListWidget() |
|
11 { |
|
12 setStyleSheet("selection-color: yellow;" |
|
13 "selection-background-color: grey;"); |
|
14 } |
|
15 CustomListWidget::~CustomListWidget() |
|
16 { |
|
17 |
|
18 } |
|
19 |
|
20 void CustomListWidget::AddListItem(QString aIconPath,QString aFirstLine,QString aSecondLine) |
|
21 { |
|
22 QWidget* customwidget = new QWidget; |
|
23 QHBoxLayout* HMainlayout = new QHBoxLayout(customwidget); |
|
24 QLabel *lab =new QLabel(); |
|
25 lab->setPixmap(QPixmap(aIconPath)); |
|
26 lab->setFixedSize(60,60); |
|
27 HMainlayout->addWidget(lab); |
|
28 |
|
29 //To add First & second row horizontal layouts |
|
30 QVBoxLayout* VTextlayout = new QVBoxLayout; |
|
31 |
|
32 QHBoxLayout* HFirstrowLayout = new QHBoxLayout; |
|
33 //Add FirstLine label |
|
34 QLabel *lab1 =new QLabel(aFirstLine); |
|
35 lab1->setStyleSheet("font: bold 20px;"); |
|
36 HFirstrowLayout->addWidget(lab1); |
|
37 //Add Images to |
|
38 QLabel *Img1lab =new QLabel(); |
|
39 Img1lab->setPixmap(QPixmap(aIconPath)); |
|
40 Img1lab->setFixedSize(10,10); |
|
41 QLabel *Img2lab =new QLabel(); |
|
42 Img2lab->setPixmap(QPixmap(aIconPath)); |
|
43 Img2lab->setFixedSize(10,10); |
|
44 QLabel *Img3lab =new QLabel(); |
|
45 Img3lab->setPixmap(QPixmap(aIconPath)); |
|
46 Img3lab->setFixedSize(10,10); |
|
47 |
|
48 HFirstrowLayout->addWidget(Img1lab); |
|
49 HFirstrowLayout->addWidget(Img2lab); |
|
50 HFirstrowLayout->addWidget(Img3lab); |
|
51 |
|
52 // HFirstrowLayout->setAlignment(Img3lab,Qt::AlignRight); |
|
53 // HFirstrowLayout->setAlignment(Img2lab,Qt::AlignRight); |
|
54 // HFirstrowLayout->setAlignment(Img1lab,Qt::AlignRight); |
|
55 |
|
56 VTextlayout->addLayout(HFirstrowLayout); |
|
57 |
|
58 |
|
59 QHBoxLayout* HSecondrowLayout = new QHBoxLayout; |
|
60 QLabel *lab2 =new QLabel(aSecondLine); |
|
61 lab2->setStyleSheet("font: 16px;"); |
|
62 HSecondrowLayout->addWidget(lab2); |
|
63 |
|
64 QLabel *Timestamplabel =new QLabel("00:00 JUL 12"); |
|
65 Timestamplabel->setStyleSheet("font: 12px;"); |
|
66 HSecondrowLayout->addWidget(Timestamplabel); |
|
67 |
|
68 HSecondrowLayout->setAlignment(Timestamplabel,Qt::AlignRight); |
|
69 |
|
70 VTextlayout->addLayout(HSecondrowLayout); |
|
71 |
|
72 |
|
73 HMainlayout->addLayout(VTextlayout); |
|
74 customwidget->setLayout(HMainlayout); |
|
75 QListWidgetItem *item=new QListWidgetItem; |
|
76 |
|
77 //customlist->adjustSize(); |
|
78 //customlist->adjustSize(); |
|
79 item->setSizeHint(QSize(60,60)); |
|
80 |
|
81 addItem(item); |
|
82 setItemWidget(item,customwidget); |
|
83 } |
|
84 void CustomListWidget::AddListItem(QString aPlaylistname) |
|
85 { |
|
86 qDebug()<<"CustomListWidget AddList Item Widget = "<<aPlaylistname; |
|
87 QWidget* customwidget = new QWidget; |
|
88 QHBoxLayout* HMainlayout = new QHBoxLayout(customwidget); |
|
89 qDebug()<<"CustomListWidget AddList Item Widget = 2"; |
|
90 QLabel *lab =new QLabel(aPlaylistname); |
|
91 qDebug()<<"CustomListWidget AddList Item Widget = 3"; |
|
92 |
|
93 |
|
94 HMainlayout->addWidget(lab); |
|
95 |
|
96 qDebug()<<"CustomListWidget AddList Item Widget = 4"; |
|
97 |
|
98 //To add First & second row horizontal layouts |
|
99 /* QVBoxLayout* VTextlayout = new QVBoxLayout; |
|
100 |
|
101 QHBoxLayout* HFirstrowLayout = new QHBoxLayout; |
|
102 //Add FirstLine label |
|
103 QLabel *lab1 =new QLabel(aFirstLine); |
|
104 lab1->setStyleSheet("font: bold 20px;"); |
|
105 HFirstrowLayout->addWidget(lab1); |
|
106 //Add Images to |
|
107 QLabel *Img1lab =new QLabel(); |
|
108 Img1lab->setPixmap(QPixmap(aIconPath)); |
|
109 Img1lab->setFixedSize(10,10); |
|
110 QLabel *Img2lab =new QLabel(); |
|
111 Img2lab->setPixmap(QPixmap(aIconPath)); |
|
112 Img2lab->setFixedSize(10,10); |
|
113 QLabel *Img3lab =new QLabel(); |
|
114 Img3lab->setPixmap(QPixmap(aIconPath)); |
|
115 Img3lab->setFixedSize(10,10); |
|
116 |
|
117 HFirstrowLayout->addWidget(Img1lab); |
|
118 HFirstrowLayout->addWidget(Img2lab); |
|
119 HFirstrowLayout->addWidget(Img3lab); |
|
120 |
|
121 // HFirstrowLayout->setAlignment(Img3lab,Qt::AlignRight); |
|
122 // HFirstrowLayout->setAlignment(Img2lab,Qt::AlignRight); |
|
123 // HFirstrowLayout->setAlignment(Img1lab,Qt::AlignRight); |
|
124 |
|
125 VTextlayout->addLayout(HFirstrowLayout); |
|
126 |
|
127 |
|
128 QHBoxLayout* HSecondrowLayout = new QHBoxLayout; |
|
129 QLabel *lab2 =new QLabel(aSecondLine); |
|
130 lab2->setStyleSheet("font: 16px;"); |
|
131 HSecondrowLayout->addWidget(lab2); |
|
132 |
|
133 QLabel *Timestamplabel =new QLabel("00:00 JUL 12"); |
|
134 Timestamplabel->setStyleSheet("font: 12px;"); |
|
135 HSecondrowLayout->addWidget(Timestamplabel); |
|
136 |
|
137 HSecondrowLayout->setAlignment(Timestamplabel,Qt::AlignRight); |
|
138 |
|
139 VTextlayout->addLayout(HSecondrowLayout); |
|
140 |
|
141 |
|
142 HMainlayout->addLayout(VTextlayout);*/ |
|
143 qDebug()<<"CustomListWidget AddList Item Widget = 5"; |
|
144 |
|
145 customwidget->setLayout(HMainlayout); |
|
146 qDebug()<<"CustomListWidget AddList Item Widget = 6"; |
|
147 |
|
148 QListWidgetItem *item=new QListWidgetItem; |
|
149 |
|
150 qDebug()<<"CustomListWidget AddList Item Widget = 7"; |
|
151 |
|
152 |
|
153 //customlist->adjustSize(); |
|
154 //customlist->adjustSize(); |
|
155 item->setSizeHint(QSize(60,60)); |
|
156 qDebug()<<"CustomListWidget AddList Item Widget = 8"; |
|
157 |
|
158 |
|
159 addItem(item); |
|
160 qDebug()<<"CustomListWidget AddList Item Widget = 9"; |
|
161 |
|
162 setItemWidget(item,customwidget); |
|
163 qDebug()<<"CustomListWidget AddList Item Widget = 10"; |
|
164 |
|
165 } |
|
166 |
|
167 void CustomListWidget::AddListItem(QMainWindow *mainWindow,QStringList aIconPath,QStringList aNames) |
|
168 { |
|
169 qDebug()<<"Inside GridView::CreateGridView()"; |
|
170 qDebug()<<"aIconPath count = "<<aIconPath.count(); |
|
171 qDebug()<<"names count = "<<aNames.count(); |
|
172 |
|
173 int row; |
|
174 int col; |
|
175 //QWidget* widget = new QWidget(); |
|
176 QGridLayout* GridLayout = new QGridLayout(this); |
|
177 if((6 == aIconPath.count()) || (5 == aIconPath.count())) |
|
178 { |
|
179 row = 3; |
|
180 col = 2; |
|
181 } |
|
182 else if((4 == aIconPath.count()) || (3 == aIconPath.count())) |
|
183 { |
|
184 row = col = 2; |
|
185 } |
|
186 else if((2 == aIconPath.count()) || (1 == aIconPath.count())) |
|
187 { |
|
188 row = 1; |
|
189 col = 2; |
|
190 } |
|
191 else if(0 == aIconPath.count()) |
|
192 { |
|
193 row = col = 0; |
|
194 } |
|
195 |
|
196 int rowSpace = (ScreenSize::GetScreenRect().height() - (KHeadNameHeight+ToolbarIconHeight+2*KWidgetGapFactor))/row; |
|
197 int colSpace = (ScreenSize::GetScreenRect().width() - 2*KWidgetGapFactor )/col; |
|
198 |
|
199 int index = 0; |
|
200 for(int i=0;i<row;i++) |
|
201 { |
|
202 for(int j=0;j<col;j++) |
|
203 { |
|
204 QPushButton *pushBtn = new QPushButton(); |
|
205 qDebug()<<"name = "<<aNames[index]; |
|
206 int gapFac = KHeadNameHeight+ToolbarIconHeight; |
|
207 pushBtn->setGeometry(i*colSpace,(j*rowSpace + KWidgetGapFactor),colSpace,rowSpace); |
|
208 pushBtn->setIconSize(QSize(colSpace,colSpace)); |
|
209 qDebug()<<"icon = "<<aIconPath[index]; |
|
210 pushBtn->setIcon(QIcon(aIconPath[index])); |
|
211 qDebug()<<"After image display"; |
|
212 GridLayout->addWidget(pushBtn,i,j); |
|
213 |
|
214 index++; |
|
215 if(index == aNames.count()) |
|
216 { |
|
217 qDebug()<<"Count became same so exiting"; |
|
218 break; |
|
219 } |
|
220 } |
|
221 if(index == aNames.count()) |
|
222 { |
|
223 qDebug()<<"Count became same so exiting"; |
|
224 break; |
|
225 } |
|
226 } |
|
227 //Its required please don't remove |
|
228 show(); |
|
229 } |
|
230 |
|
231 |
|
232 QWidget* CustomListWidget::CreateListwidget(SmfContactList* friendsList) |
|
233 { |
|
234 qDebug()<<"Inside CustomListWidget::CreateListwidget() for friends"; |
|
235 qDebug()<<"Friends count = "<<friendsList->count(); |
|
236 |
|
237 QListWidget* customlist = new QListWidget(); |
|
238 |
|
239 // Todo:- Display something when no friends are available |
|
240 foreach(SmfContact contact, *friendsList) |
|
241 { |
|
242 QString name(contact.value("Name").value<QContactName>().firstName()); |
|
243 QString status(contact.value("Presence").value<QContactPresence>().customMessage()); |
|
244 if(!status.size()) |
|
245 status.append("Not available"); |
|
246 //QUrl url(contact.value("Avatar").value<QContactAvatar>().imageUrl()); |
|
247 QString url("C:\\data\\sample.bmp"); // ToDo:- should be the profile image path |
|
248 |
|
249 QWidget* widgetItem = new QWidget(); |
|
250 QHBoxLayout* HMainlayout = new QHBoxLayout(widgetItem); |
|
251 QLabel *lab =new QLabel(); |
|
252 lab->setPixmap(QPixmap(url)); |
|
253 lab->setFixedSize(60,60); |
|
254 HMainlayout->addWidget(lab); |
|
255 |
|
256 //To add First & second row horizontal layouts |
|
257 QVBoxLayout* VTextlayout = new QVBoxLayout; |
|
258 |
|
259 QHBoxLayout* HFirstrowLayout = new QHBoxLayout; |
|
260 |
|
261 //Add FirstLine label |
|
262 QLabel *lab1 = new QLabel(name); |
|
263 lab1->setStyleSheet("font: bold 16px;"); |
|
264 HFirstrowLayout->addWidget(lab1); |
|
265 |
|
266 //Add Images to |
|
267 QLabel *Img1lab =new QLabel(); |
|
268 Img1lab->setPixmap(QPixmap(url)); |
|
269 Img1lab->setFixedSize(10,10); |
|
270 QLabel *Img2lab =new QLabel(); |
|
271 Img2lab->setPixmap(QPixmap(url)); |
|
272 Img2lab->setFixedSize(10,10); |
|
273 QLabel *Img3lab =new QLabel(); |
|
274 Img3lab->setPixmap(QPixmap(url)); |
|
275 Img3lab->setFixedSize(10,10); |
|
276 |
|
277 HFirstrowLayout->addWidget(Img1lab); |
|
278 HFirstrowLayout->addWidget(Img2lab); |
|
279 HFirstrowLayout->addWidget(Img3lab); |
|
280 |
|
281 // HFirstrowLayout->setAlignment(Img3lab,Qt::AlignRight); |
|
282 // HFirstrowLayout->setAlignment(Img2lab,Qt::AlignRight); |
|
283 // HFirstrowLayout->setAlignment(Img1lab,Qt::AlignRight); |
|
284 |
|
285 VTextlayout->addLayout(HFirstrowLayout); |
|
286 |
|
287 |
|
288 QHBoxLayout* HSecondrowLayout = new QHBoxLayout; |
|
289 QLabel *lab2 =new QLabel(status); |
|
290 lab2->setStyleSheet("font: 8px;"); |
|
291 HSecondrowLayout->addWidget(lab2); |
|
292 |
|
293 QLabel *Timestamplabel =new QLabel(""); |
|
294 Timestamplabel->setStyleSheet("font: 7px;"); |
|
295 HSecondrowLayout->addWidget(Timestamplabel); |
|
296 |
|
297 HSecondrowLayout->setAlignment(Timestamplabel,Qt::AlignRight); |
|
298 |
|
299 VTextlayout->addLayout(HSecondrowLayout); |
|
300 |
|
301 |
|
302 HMainlayout->addLayout(VTextlayout); |
|
303 widgetItem->setLayout(HMainlayout); |
|
304 QListWidgetItem *item=new QListWidgetItem; |
|
305 |
|
306 //customlist->adjustSize(); |
|
307 //customlist->adjustSize(); |
|
308 item->setSizeHint(QSize(60,60)); |
|
309 |
|
310 customlist->addItem(item); |
|
311 customlist->setItemWidget(item,widgetItem); |
|
312 } |
|
313 customlist->setStyleSheet("selection-color: yellow;" |
|
314 "selection-background-color: grey;"); |
|
315 return customlist; |
|
316 } |
|
317 |
|
318 |
|
319 QWidget* CustomListWidget::CreateListwidget(SmfPostList *postsList) |
|
320 { |
|
321 qDebug()<<"Inside CustomListWidget::CreateListwidget() for posts"; |
|
322 qDebug()<<"Posts count = "<<postsList->count(); |
|
323 |
|
324 QListWidget* customlist = new QListWidget(); |
|
325 |
|
326 // Todo:- Display something when no posts are available |
|
327 foreach(SmfPost post, *postsList) |
|
328 { |
|
329 QString text(post.description()); |
|
330 QString ownerName(post.owner().value("Name").value<QContactName>().firstName()); |
|
331 |
|
332 //QUrl url(contact.value("Avatar").value<QContactAvatar>().imageUrl()); |
|
333 QString url("C:\\data\\sample.bmp"); // ToDo:- should be the profile image path |
|
334 |
|
335 QWidget* widgetItem = new QWidget(); |
|
336 QHBoxLayout* HMainlayout = new QHBoxLayout(widgetItem); |
|
337 QLabel *lab =new QLabel(); |
|
338 lab->setPixmap(QPixmap(url)); |
|
339 lab->setFixedSize(60,60); |
|
340 HMainlayout->addWidget(lab); |
|
341 |
|
342 //To add First & second row horizontal layouts |
|
343 QVBoxLayout* VTextlayout = new QVBoxLayout; |
|
344 |
|
345 QHBoxLayout* HFirstrowLayout = new QHBoxLayout; |
|
346 |
|
347 //Add FirstLine label |
|
348 QLabel *lab1 = new QLabel(ownerName); |
|
349 lab1->setStyleSheet("font: bold 16px;"); |
|
350 HFirstrowLayout->addWidget(lab1); |
|
351 |
|
352 //Add Images to |
|
353 QLabel *Img1lab =new QLabel(); |
|
354 Img1lab->setPixmap(QPixmap(url)); |
|
355 Img1lab->setFixedSize(10,10); |
|
356 QLabel *Img2lab =new QLabel(); |
|
357 Img2lab->setPixmap(QPixmap(url)); |
|
358 Img2lab->setFixedSize(10,10); |
|
359 QLabel *Img3lab =new QLabel(); |
|
360 Img3lab->setPixmap(QPixmap(url)); |
|
361 Img3lab->setFixedSize(10,10); |
|
362 |
|
363 HFirstrowLayout->addWidget(Img1lab); |
|
364 HFirstrowLayout->addWidget(Img2lab); |
|
365 HFirstrowLayout->addWidget(Img3lab); |
|
366 |
|
367 // HFirstrowLayout->setAlignment(Img3lab,Qt::AlignRight); |
|
368 // HFirstrowLayout->setAlignment(Img2lab,Qt::AlignRight); |
|
369 // HFirstrowLayout->setAlignment(Img1lab,Qt::AlignRight); |
|
370 |
|
371 VTextlayout->addLayout(HFirstrowLayout); |
|
372 |
|
373 |
|
374 QHBoxLayout* HSecondrowLayout = new QHBoxLayout; |
|
375 QLabel *lab2 =new QLabel(text); |
|
376 lab2->setStyleSheet("font: 8px;"); |
|
377 HSecondrowLayout->addWidget(lab2); |
|
378 |
|
379 QLabel *Timestamplabel =new QLabel(""); |
|
380 Timestamplabel->setStyleSheet("font: 7px;"); |
|
381 HSecondrowLayout->addWidget(Timestamplabel); |
|
382 |
|
383 HSecondrowLayout->setAlignment(Timestamplabel,Qt::AlignRight); |
|
384 |
|
385 VTextlayout->addLayout(HSecondrowLayout); |
|
386 |
|
387 |
|
388 HMainlayout->addLayout(VTextlayout); |
|
389 widgetItem->setLayout(HMainlayout); |
|
390 QListWidgetItem *item=new QListWidgetItem; |
|
391 |
|
392 //customlist->adjustSize(); |
|
393 //customlist->adjustSize(); |
|
394 item->setSizeHint(QSize(60,60)); |
|
395 |
|
396 customlist->addItem(item); |
|
397 customlist->setItemWidget(item,widgetItem); |
|
398 } |
|
399 customlist->setStyleSheet("selection-color: yellow;" |
|
400 "selection-background-color: grey;"); |
|
401 return customlist; |
|
402 |
|
403 } |
|
404 QWidget* CreateListwidget(SmfActivityEntryList *activityList) |
|
405 { |
|
406 |
|
407 } |
|
408 QWidget* CustomListWidget::CreateListwidget(SmfPlaylistList *playList) |
|
409 { |
|
410 QListWidget* customlist = new QListWidget(); |
|
411 |
|
412 // Todo:- Display something when no posts are available |
|
413 foreach(SmfPlaylist playlist, *playList) |
|
414 { |
|
415 QString playlistTitle(playlist.playListTitle()); |
|
416 // QString ownerName(post.owner().value("Name").value<QContactName>().firstName()); |
|
417 |
|
418 //QUrl url(contact.value("Avatar").value<QContactAvatar>().imageUrl()); |
|
419 //QString url("C:\\data\\sample.bmp"); // ToDo:- should be the profile image path |
|
420 |
|
421 QWidget* widgetItem = new QWidget(); |
|
422 QHBoxLayout* HMainlayout = new QHBoxLayout(widgetItem); |
|
423 QLabel *lab =new QLabel(playlistTitle); |
|
424 //lab->setPixmap(QPixmap(url)); |
|
425 //lab->setFixedSize(60,60); |
|
426 HMainlayout->addWidget(lab); |
|
427 |
|
428 //To add First & second row horizontal layouts |
|
429 //QVBoxLayout* VTextlayout = new QVBoxLayout; |
|
430 |
|
431 // QHBoxLayout* HFirstrowLayout = new QHBoxLayout; |
|
432 |
|
433 //Add FirstLine label |
|
434 // QLabel *lab1 = new QLabel(ownerName); |
|
435 // lab1->setStyleSheet("font: bold 16px;"); |
|
436 // HFirstrowLayout->addWidget(lab1); |
|
437 |
|
438 //Add Images to |
|
439 /* QLabel *Img1lab =new QLabel(); |
|
440 Img1lab->setPixmap(QPixmap(url)); |
|
441 Img1lab->setFixedSize(10,10); |
|
442 QLabel *Img2lab =new QLabel(); |
|
443 Img2lab->setPixmap(QPixmap(url)); |
|
444 Img2lab->setFixedSize(10,10); |
|
445 QLabel *Img3lab =new QLabel(); |
|
446 Img3lab->setPixmap(QPixmap(url)); |
|
447 Img3lab->setFixedSize(10,10); |
|
448 |
|
449 HFirstrowLayout->addWidget(Img1lab); |
|
450 HFirstrowLayout->addWidget(Img2lab); |
|
451 HFirstrowLayout->addWidget(Img3lab);*/ |
|
452 |
|
453 // HFirstrowLayout->setAlignment(Img3lab,Qt::AlignRight); |
|
454 // HFirstrowLayout->setAlignment(Img2lab,Qt::AlignRight); |
|
455 // HFirstrowLayout->setAlignment(Img1lab,Qt::AlignRight); |
|
456 |
|
457 // VTextlayout->addLayout(HFirstrowLayout); |
|
458 |
|
459 |
|
460 /* QHBoxLayout* HSecondrowLayout = new QHBoxLayout; |
|
461 QLabel *lab2 =new QLabel(text); |
|
462 lab2->setStyleSheet("font: 8px;"); |
|
463 HSecondrowLayout->addWidget(lab2); |
|
464 |
|
465 QLabel *Timestamplabel =new QLabel(""); |
|
466 Timestamplabel->setStyleSheet("font: 7px;"); |
|
467 HSecondrowLayout->addWidget(Timestamplabel); |
|
468 |
|
469 HSecondrowLayout->setAlignment(Timestamplabel,Qt::AlignRight); |
|
470 |
|
471 VTextlayout->addLayout(HSecondrowLayout);*/ |
|
472 |
|
473 |
|
474 //HMainlayout->addLayout(VTextlayout); |
|
475 widgetItem->setLayout(HMainlayout); |
|
476 QListWidgetItem *item=new QListWidgetItem; |
|
477 |
|
478 //customlist->adjustSize(); |
|
479 //customlist->adjustSize(); |
|
480 item->setSizeHint(QSize(60,60)); |
|
481 |
|
482 customlist->addItem(item); |
|
483 customlist->setItemWidget(item,widgetItem); |
|
484 } |
|
485 customlist->setStyleSheet("selection-color: yellow;" |
|
486 "selection-background-color: grey;"); |
|
487 return customlist; |
|
488 } |
|
489 |
|
490 /*QWidget* CustomListWidget::CreateListwidget(QString aIconPath,QString aFirstLine,QString aSecondLine) |
|
491 { |
|
492 qDebug()<<"Inside CustomListWidget::CreateListwidget()"; |
|
493 qDebug()<<"Icon path = "<<aIconPath; |
|
494 qDebug()<<"firstline = "<<aFirstLine; |
|
495 qDebug()<<"second line = "<<aSecondLine; |
|
496 QListWidget* customlist = new QListWidget(); |
|
497 //for(int i =0;i<2;i++) |
|
498 //{ |
|
499 QWidget* widgetItem = new QWidget(); |
|
500 QHBoxLayout* HMainlayout = new QHBoxLayout(widgetItem); |
|
501 QLabel *lab =new QLabel(); |
|
502 lab->setPixmap(QPixmap(aIconPath)); |
|
503 lab->setFixedSize(60,60); |
|
504 HMainlayout->addWidget(lab); |
|
505 |
|
506 //To add First & second row horizontal layouts |
|
507 QVBoxLayout* VTextlayout = new QVBoxLayout; |
|
508 |
|
509 QHBoxLayout* HFirstrowLayout = new QHBoxLayout; |
|
510 //Add FirstLine label |
|
511 QLabel *lab1 =new QLabel(aFirstLine); |
|
512 lab1->setStyleSheet("font: bold 16px;"); |
|
513 HFirstrowLayout->addWidget(lab1); |
|
514 //Add Images to |
|
515 QLabel *Img1lab =new QLabel(); |
|
516 Img1lab->setPixmap(QPixmap(aIconPath)); |
|
517 Img1lab->setFixedSize(10,10); |
|
518 QLabel *Img2lab =new QLabel(); |
|
519 Img2lab->setPixmap(QPixmap(aIconPath)); |
|
520 Img2lab->setFixedSize(10,10); |
|
521 QLabel *Img3lab =new QLabel(); |
|
522 Img3lab->setPixmap(QPixmap(aIconPath)); |
|
523 Img3lab->setFixedSize(10,10); |
|
524 |
|
525 HFirstrowLayout->addWidget(Img1lab); |
|
526 HFirstrowLayout->addWidget(Img2lab); |
|
527 HFirstrowLayout->addWidget(Img3lab); |
|
528 |
|
529 // HFirstrowLayout->setAlignment(Img3lab,Qt::AlignRight); |
|
530 // HFirstrowLayout->setAlignment(Img2lab,Qt::AlignRight); |
|
531 // HFirstrowLayout->setAlignment(Img1lab,Qt::AlignRight); |
|
532 |
|
533 VTextlayout->addLayout(HFirstrowLayout); |
|
534 |
|
535 |
|
536 QHBoxLayout* HSecondrowLayout = new QHBoxLayout; |
|
537 QLabel *lab2 =new QLabel(aSecondLine); |
|
538 lab2->setStyleSheet("font: 8px;"); |
|
539 HSecondrowLayout->addWidget(lab2); |
|
540 |
|
541 QLabel *Timestamplabel =new QLabel("00:00 JUN 29"); |
|
542 Timestamplabel->setStyleSheet("font: 7px;"); |
|
543 HSecondrowLayout->addWidget(Timestamplabel); |
|
544 |
|
545 HSecondrowLayout->setAlignment(Timestamplabel,Qt::AlignRight); |
|
546 |
|
547 VTextlayout->addLayout(HSecondrowLayout); |
|
548 |
|
549 |
|
550 HMainlayout->addLayout(VTextlayout); |
|
551 widgetItem->setLayout(HMainlayout); |
|
552 QListWidgetItem *item=new QListWidgetItem; |
|
553 |
|
554 //customlist->adjustSize(); |
|
555 //customlist->adjustSize(); |
|
556 item->setSizeHint(QSize(60,60)); |
|
557 |
|
558 customlist->addItem(item); |
|
559 customlist->setItemWidget(item,widgetItem); |
|
560 //} |
|
561 customlist->setStyleSheet("selection-color: yellow;" |
|
562 "selection-background-color: grey;"); |
|
563 return customlist; |
|
564 }*/ |