Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using directory of an .exe dialog box to display image in graphicview of other window
Forum Updated to NodeBB v4.3 + New Features

Using directory of an .exe dialog box to display image in graphicview of other window

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jk_mk
    wrote on last edited by
    #1

    Hello,

    I have created a mainWindow consisted of a button_1 and one graphicsview. When I press the button, I run another window.exe (it is a dialog box in order to find the directory of a png file.) On the dialog box there is a another button_2, and when I press it I want to take the directory and open the png file in the graphics view of my mainWindow. I know how to display an image in a graphics view, but I do not know how to take the directory from the dialog box (window.exe) and open the png image in the graphics view of my mainwindow.
    I hope someone could help me
    Thanks

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Why do you use two different binaries for it? Maybe it will be better to run them in one application?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jk_mk
        wrote on last edited by
        #3

        I am beginner in using Qt. I created the window.exe first and then the MainWindow application and I included the window.exe with the press of one button.I thought it would be easier. I do not really know how to pass my directory from the directory dialog box, to my MainWindow in order to display the image in a graphicsview. Is it possible?
        Now I am reading something about hyperlinks in Qt. Would it be a solution? What would you suggest?

        Thanks for your reply

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jk_mk
          wrote on last edited by
          #4

          I think that I understood what do you mean. I created a function like this:
          Did you refer to this?

          @void my_mainwindow::push_button_File(void)
          {

           QString fileName = QFileDialog::getOpenFileName(this,
                                           tr("Open File"), QDir::currentPath());
           if (!fileName.isEmpty()) {
              QGraphicsScene * scene = new QGraphicsScene();
          scene->addPixmap(QPixmap(fileName, 0, Qt::AutoColor));
               graphicsView_inputImage->setScene(scene);
          
           }
          

          return ;
          }@

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved