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. [SOLVED]Passing a signal to an other dialog.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Passing a signal to an other dialog.

Scheduled Pinned Locked Moved General and Desktop
13 Posts 3 Posters 3.8k 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.
  • D Offline
    D Offline
    DerManu
    wrote on last edited by
    #4

    I've tried it, both exec() and show() work.
    what does initilize() do? Is there anyhting special about the dialog itself?

    1 Reply Last reply
    0
    • W Offline
      W Offline
      Woody
      wrote on last edited by
      #5

      I don't think there is anything special about it.

      This is what's in initialize:
      @HelperWindow::setWindowFlags(Qt::WindowStaysOnTopHint);
      QDesktopWidget* desktopWidget = QApplication::desktop();
      unsigned int xpos = desktopWidget->width() - (HelperWindow::width() + 15);
      unsigned int ypos = desktopWidget->height() - (HelperWindow::height() + 35);
      QPoint* pos = new QPoint(xpos, ypos);
      HelperWindow::move(*pos);

      m_helpEngine = new QHelpEngine(QApplication::applicationDirPath() + "/mycollection.qhc", this);
      m_helpEngine->setupData();@
      

      contructor of the dialog:
      @HelperWindow::HelperWindow(QWidget *parent) :
      QDialog(parent),
      ui(new Ui::HelperWindow)
      {
      m_helpEngine = NULL;
      m_process = NULL;
      ui->setupUi(this);
      }@

      File not found. Nobody leave the room!

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fluca1978
        wrote on last edited by
        #6

        [quote author="Woody" date="1336481343"]@void HelperWindow::onHelpNeeded(QUrl url)
        {
        this->setModal(true);
        this->initialize();

        QString myHtmlContent = QString(m_helpEngine->fileData(url));
        QUrl myBaseUrl = QUrl("myapplication");
        
        if(!myHtmlContent.isEmpty())
        {
            ui->webView->setHtml(myHtmlContent, myBaseUrl);
        }
        
        HelperWindow::exec();
        

        }@

        For some reason it doesn't start. I debugged it, and went into the function, but when it hits this->exec or HelperWindow::exec() it does nothing. When I put a breakpoint after that line, it stops there if I close my whole application.

        [/quote]

        So it seems the dialog is actually displaying even if you don't know where. Any chances that the size you set up in initialize is wrong? I would also try to make the dialog not modal just to see if you can play around and find it. And use show() as direct call (i.e., this->show()). Sorry, these are just guesses....

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Woody
          wrote on last edited by
          #7

          I now made a little sideproject so I can test it, but no succes. I removed the positions, sizes, etc.

          Do you have to do something before you call this->show()? Cause here it is just showing my dialog, but it disappears immediately. It does so when I do setModel(true), or don't even call that.

          [EDIT] show problem is solved, show with F1 pressed is not

          File not found. Nobody leave the room!

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fluca1978
            wrote on last edited by
            #8

            [quote author="Woody" date="1336546040"]

            Do you have to do something before you call this->show()? Cause here it is just showing my dialog, but it disappears immediately. It does so when I do setModel(true), or don't even call that.

            [/quote]

            I'm not aware of anything you have to do before calling show. However if the window is disappearing it sounds to me as the dialog has some form of "closing" action somewhere that is executed in the dialog lifecycle. Do you have a dispose or hide somewhere?

            1 Reply Last reply
            0
            • W Offline
              W Offline
              Woody
              wrote on last edited by
              #9

              I solved the issue, I created the dialog on the stack:
              @QDialog dialog;@
              instead of
              @QDialog *dialog = new QDialog(this);@

              So that problem is solved. But i still can't get it working with pressing the F1-key

              File not found. Nobody leave the room!

              1 Reply Last reply
              0
              • F Offline
                F Offline
                fluca1978
                wrote on last edited by
                #10

                [quote author="Woody" date="1336548876"]I solved the issue, I created the dialog on the stack:
                @QDialog dialog;@
                instead of
                @QDialog *dialog = new QDialog(this);@

                So that problem is solved. But i still can't get it working with pressing the F1-key[/quote]

                Despite a possible dangling pointer, that would have crashed your program (and this does not seem the case) I don't think this was the problem.

                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  Woody
                  wrote on last edited by
                  #11

                  It is working.

                  I removed the positioning and the Qt::WindowStaysOnTopHint and it works fine now.

                  The problem with calling Qt::WindowStaysOnTopHint is that the helpwindow will be called in the dialog you pressed F1 in.
                  So it was called, but not properly.

                  I all thank you for your help!

                  File not found. Nobody leave the room!

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DerManu
                    wrote on last edited by
                    #12

                    [quote author="fluca1978" date="1336550319"]that would have crashed your program[/quote]Why do you think so? I currently can't see why that would crash.

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      Woody
                      wrote on last edited by
                      #13

                      Indeed, my application hasn't crashed when using that. Only the dialog wasn't showing properly (popping up, but disappearing immediately).

                      But the issue is solved, so I add a [SOLVED]-tag.

                      File not found. Nobody leave the room!

                      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