Hi I'm new to this but I'm trying to use QTableWidgetItem in relation to opening an image with it I would like it to once clicked on the file in the table you press open and opens the image on a different window.
So far I have to it to open a blank new window when you press open file but how do you get it to read the image file and display it?

This is for displaying the files in the folder its looking in
{
for (int i = 0; i < files.size(); ++i) {
QFile file(directory.
absoluteFilePath(files
[i
]));
int row = filesTable->rowCount();
filesTable->insertRow(row);
filesTable->setItem(row, 0, fileNameItem);
filesTable->setItem(row, 1, sizeItem);
}
}
void Window::showFiles(const QDir &directory, const QStringList &files)
{
for (int i = 0; i < files.size(); ++i) {
QFile file(directory.absoluteFilePath(files[i]));
qint64 size = QFileInfo(file).size();
QTableWidgetItem *fileNameItem = new QTableWidgetItem(files[i]);
QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB") .arg(int((size + 1023) / 1024)));
int row = filesTable->rowCount();
filesTable->insertRow(row);
filesTable->setItem(row, 0, fileNameItem);
filesTable->setItem(row, 1, sizeItem);
}
}
To copy to clipboard, switch view to plain text mode
This is what I've got for the open button for the monent
void Window::open()
{
img->show();
}
void Window::open()
{
QWidget* img = new QWidget;
img->show();
}
To copy to clipboard, switch view to plain text mode
Any help is appreciated I've been going nuts trying to do this
Thanks in advance
P.S
Also I've been looking at these
QTableWidgetItem::isSelected ()
QTableWidgetItem::write ( QDataStream & out )
QTableWidgetItem::read ( QDataStream & in )
Bookmarks