QDir currentImageDir
(LibPath
+"/"+dir
);
currentImageDir.
setFilter(QDir::Files |
QDir::NoSymLinks |
QDir::NoDotAndDotDot);
QStringList ImageEntries
= currentImageDir.
entryList();
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(contentsWidget);
contentsWidget->setLayout(gridEPG);
contentsWidget->setMinimumSize(scrollArea->width(), scrollArea->height());
ui->imageLayout->addWidget(scrollArea, 1, 0, 2, 3);
QString filename
[ImageEntries.
count()];
for (int x = 0; x < ImageEntries.count(); x++)
{
// int row = x;
//int col = i%3;
filename[x]= ImageEntries.at(x);
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button
->setIcon
(QIcon(LibPath
+ "/" + dir
+ "/" + filename
[x
]));
button
->setFixedSize
(QSize(96,
76));
button
->setIconSize
(QSize(96,
76));
connect(button, SIGNAL(clicked()), singalImageMapper, SLOT(map()));
singalImageMapper->setMapping(button, filename[x]);
for(int i=0; i<3; i++)
gridEPG->addWidget(button, x, i%3);
}
ui
->fileImgUsing
->setText
(QString(imgPath
+ "/" + dir
));
connect(singalImageMapper,
SIGNAL(mapped
(QString)),
this,
SIGNAL(clicked
(QString)));
connect(this,
SIGNAL(clicked
(QString)),
this,
SLOT(onButtonClicked
(QString)));
QDir currentImageDir(LibPath+"/"+dir);
currentImageDir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
QStringList ImageEntries = currentImageDir.entryList();
singalImageMapper = new QSignalMapper(this);
QGridLayout* gridEPG;
QScrollArea *scrollArea = new QScrollArea();
QWidget *contentsWidget = new QWidget(scrollArea);
gridEPG = new QGridLayout(contentsWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(contentsWidget);
contentsWidget->setLayout(gridEPG);
contentsWidget->setMinimumSize(scrollArea->width(), scrollArea->height());
ui->imageLayout->addWidget(scrollArea, 1, 0, 2, 3);
QString filename[ImageEntries.count()];
for (int x = 0; x < ImageEntries.count(); x++)
{
// int row = x;
//int col = i%3;
filename[x]= ImageEntries.at(x);
QToolButton* button = new QToolButton();
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button->setIcon(QIcon(LibPath + "/" + dir + "/" + filename[x]));
button->setFixedSize(QSize(96,76));
button->setIconSize(QSize(96,76));
connect(button, SIGNAL(clicked()), singalImageMapper, SLOT(map()));
singalImageMapper->setMapping(button, filename[x]);
for(int i=0; i<3; i++)
gridEPG->addWidget(button, x, i%3);
}
ui->fileImgUsing->setText(QString(imgPath + "/" + dir));
connect(singalImageMapper, SIGNAL(mapped(QString)),this, SIGNAL(clicked(QString)));
connect(this, SIGNAL(clicked(QString)),this, SLOT(onButtonClicked(QString)));
To copy to clipboard, switch view to plain text mode
Bookmarks