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. Question about qobject signals and slots
Forum Updated to NodeBB v4.3 + New Features

Question about qobject signals and slots

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.4k 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
    developer
    wrote on last edited by
    #1

    hi all i have a pointer varibale named webpage i havt to update that pointer frequently and its a must the problem is that i have created some connections of it in the constructor of class Mainwinodw but later i change the value of pointer using slots and signals
    when i do that it does not works the connections still work for first one any good way?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Yes. Use punctuation and proper spelling. Right now reading your post is not a nice experience.

      As far as I understand it: you have a pointer. You change the object that the pointer POINTS TO a lot. Signals and slots remain connected to "old" objects. Correct?

      If yes, then this is simply expected behaviour - that is how C++ works. If you want to update sign/slot connections, you have to do it manually every time you change the underlying object. Or, I think that QSignalMapper can make your life easier here - but I have not used it myself, so I am not sure. In any case, you can just make a method like "updateConnections()" that would reapply connections.

      (Z(:^

      1 Reply Last reply
      0
      • D Offline
        D Offline
        developer
        wrote on last edited by
        #3

        thanks man this solves my one problem:
        i have few questions:
        before creating new signals do i have to disconnect previous signals will not disconnecting will effect memory.
        i have added some actions and a widget to Mainwindow tool bar but the objects still point to the old webpage
        @ ui->mainToolBar->addAction(webpage->pageAction(QWebPage::Back));
        ui->mainToolBar->addAction(webpage->pageAction(QWebPage::Forward));
        ui->mainToolBar->addAction(webpage->pageAction(QWebPage::Reload));
        ui->mainToolBar->addAction(webpage->pageAction(QWebPage::Stop));@
        should i add them again when changing value of webpage how do i update them

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Oh, so you are using WebKit? I have almost no experience there. From your description I gather that most probably your design is wrong. Maybe the webpage object should not change, only it's contents? That wold make your life much easier.

          Disconnecting is probably necessary (see disconnect() docs, there is a nice compact syntax for mass disconnections), as MOC will still try to send signals to all connected slots.

          I don't remember the API for toolbars, take a look at docs. Most probably, you can get the pointer to all actions there, and then modify connections for those pointers.

          (Z(:^

          1 Reply Last reply
          0
          • D Offline
            D Offline
            developer
            wrote on last edited by
            #5

            hey man let me tell you my design
            i think you are thinking that i am updating webpage to update its content i know that i dont need to update its content here us my structure:
            i have a variable called tabs which a QTabWidget
            then when i add a new tab i use a subclassed QWebView class named webview
            when the current tab is changed i just update the value of pointer webpage to the new tabs webview
            here webpage is just a pointer so in tool bar actions i need to update them too i ts important for me too keep the current tab in a pointer know i think you can help me

            1 Reply Last reply
            0
            • D Offline
              D Offline
              developer
              wrote on last edited by
              #6

              can i do this:
              clear the toolbar and then re add the actiopns very problem as currently there are very rare actions but more will come and even plugins will be allowed to do so so there is a problem in that case
              will a double pointer workdoes not work right now and casues many problems

              1 Reply Last reply
              0
              • K Offline
                K Offline
                KA51O
                wrote on last edited by
                #7

                Are you trying to add tabs to "this":http://qt-project.org/doc/qt-4.8/webkit-fancybrowser.html example?

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  developer
                  wrote on last edited by
                  #8

                  many many many times i have even looked at simple web browser qt quick example and arora too
                  i have learnt many hings from arora and these too
                  first up this web browser is very simple and not complex as my and i have seen it but my problem does not gets solve

                  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