I want to show image in new window as soon as image is clicked in mainwindow qt

Viewed 14

I want to display my image in a new window . So i am trying to pass the path of the image as value through constructor

void DicomWidget::mouseDoubleClickEvent(QMouseEvent *event){
    qDebug() << ui->diWidget->whatsThis();
    QString path = ui->diWidget->whatsThis();
    EditWindow * editWindow = new EditWindow(this);
    editWindow->setWindowTitle(path);
    editWindow->setWhatsThis(path);
    editWindow->show();
}

I want to pass the path in constructor but if I do the UI of the editwindow is not rendering

my editwindow.cpp

#include "editwindow.h"
#include "ui_editwindow.h"

EditWindow::EditWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::EditWindow)
{
    ui->setupUi(this);

}

EditWindow::~EditWindow()
{
    delete ui;
}

//Here i need to have refernce to this how shoul i give it
EditWindow::EditWindow(QString& filepath){
    QFile file (filepath);
    QFileInfo fileInfo(file.fileName());
    QString filename(fileInfo.fileName());
    QString name = filename;
    currentDicomPath = filepath;
}

void EditWindow::on_pushButton_clicked()
{
    currentDicomPath =  EditWindow::windowTitle();
    qDebug() <<"Hello9" << currentDicomPath;
}
0 Answers
Related