forked from GIBIS-UNIFESP/BIAL-GUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththumbswidget.cpp
More file actions
43 lines (37 loc) · 1.19 KB
/
thumbswidget.cpp
File metadata and controls
43 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "controller.h"
#include "thumbswidget.h"
#include "ui_thumbswidget.h"
ThumbsWidget::ThumbsWidget( QWidget *parent ) : QWidget( parent ), ui( new Ui::ThumbsWidget ) {
ui->setupUi( this );
}
ThumbsWidget::~ThumbsWidget( ) {
delete ui;
}
void ThumbsWidget::clear( ) {
COMMENT( "Reseting thumbnails.", 1 );
qDeleteAll( thumbs );
thumbs.clear( );
}
void ThumbsWidget::addThumbnail( GuiImage *image ) {
COMMENT( "Loading new thumbnail", 1 );
int num = thumbs.size( );
int size = width( ) - 40;
Thumbnail *thumbnail = new Thumbnail( image, num, size );
thumbs.append( thumbnail );
ui->thumbsLayout->addWidget( thumbnail, num, 0, Qt::AlignHCenter );
ui->thumbsLayout->setMargin(0);
ui->thumbsLayout->setVerticalSpacing(1);
/* thumbnail->show(); */
connect( thumbnail, &Thumbnail::changeImage, controller, &Controller::setCurrentImagePos );
}
void ThumbsWidget::setController( Controller *value ) {
controller = value;
}
void ThumbsWidget::removeAt( int pos ) {
COMMENT( "Removing thumbnail at " << pos << ".", 1 );
delete thumbs[ pos ];
thumbs.removeAt( pos );
for( int i = 0; i < thumbs.size( ); ++i ) {
thumbs[ i ]->setObjectName( QString::number( i ) );
}
}