#include <QtGui>
#include "flowlayout.h"
#include "window.h"
#include "dropsitewidget.h"
Window::Window()
{
// setting up the debig textbox
// setting up the flow layout
this->flowLayout = new FlowLayout;
this
->flowLayout
->setSizeConstraint
(QLayout::SetMinimumSize);
scrollArea->setLayout(this->flowLayout);
// adding the 20 labels for images
for (int i=0; i<20; i++) {
//this->flowLayout->addWidget(new QLabel(tr("its a label")));
label->setFixedSize(100,100);
this->labelList.append(label);
this->flowLayout->addWidget(this->labelList.at(i));
}
// adding the widget to do the drag and drop
dropSiteWidget = new DropSiteWidget;
connect(dropSiteWidget,
SIGNAL(sendLog
(QString)),
log,
SLOT(append
(QString)));
connect(dropSiteWidget,
SIGNAL(sendImage
(QString)),
this,
SLOT(newImage
(QString)));
layout->addWidget(dropSiteWidget);
layout->addWidget(scrollArea);
layout->addWidget(log);
setLayout(layout);
this->count = 0;
setWindowTitle(tr("Flow Layout"));
}
void Window
::newImage(QString str
) { // loading the new image
// checking if its a valid image
if (!img->isNull()) {
// scaling the image now
smallImg = img->scaledToWidth(100);
this->labelList.at(this->count)->setPixmap(smallImg);
this->count++;
}
}