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. QWidget with QWidgetPages and how to get QListWidget information from another QWidgetPage
Forum Updated to NodeBB v4.3 + New Features

QWidget with QWidgetPages and how to get QListWidget information from another QWidgetPage

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 4.1k 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.
  • B Offline
    B Offline
    burgerking
    wrote on last edited by
    #1

    Hi cute people.

    I need the information containing in a QListWidget from QWidgetPage1 in the next QWidgetPage (2).

    I register the Field as a mandatory Field.

    @registerField("filesListWidget*", m_pWizardPage->lvFiles);@

    But i do not want to know the current row number, i want every entry in the list.

    How can i do that?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

      you need to access your model item instead of your list object.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        burgerking
        wrote on last edited by
        #3

        Hi mohsen,

        thanks for your reply, but unfortunately i do not understand what you mean with "model item".

        In the list are several QStrings with absolute directories to different files.
        I just want to read this List of Strings in the next WizardPage.

        Thanks.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          It is a bit strange to use fields for something like this. What is the actual information you wish to convey between the pages?

          If you really need access to the list widget itself, I would just give the wizard page that contains the QListWidget a getter function for the pointer to the widget, and give the page where I'd need access a setter function. Then, when you create the pages, you make sure that you call the setter with the value of the getter you just defined.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            burgerking
            wrote on last edited by
            #5

            Hi Andre.
            Thank you for your post.

            Actualy I just need the QStrings in a QList<QString> (or QStringList) in the next QWidgetPage.

            I am really new with Qt and I do not know how do get Informations like these from Page1 to Page2.

            Maybe you can give me an example how to do that?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              OK, I am now guessing you are somehow building up this list of QStrings in your QListWidget at Page1, and you want the resulting list in Page2. In that case, a field does make sense. However, I would make it a field that represents the actual QStringList, instead of the QListWidget. Your other page does not need to know that you have a QListWidget or something else there, right?

              In your case, I would give my Page1 a custom property like this:
              @
              //header for Page1:
              class Page1: public QWizardPage {
              Q_OBJECT
              Q_PROPERTY (QStringList theStringList READ theStringList WRITE setTheStringList NOTIFY theStringListChanged)

              public slots:
              void setTheStringList (QStringList list);

              public:
                 QStringList theStringList() const;
              
              signals:
                 theStringListChanged();
              

              //and all your other stuff already there, of course
              };
              @

              You can implement the setter to update the contents of the QListWidget, and the getter to build up a QStringList out of the contents of the QListWidget on the fly. Of course, you should emit the signal whenever the contents change.

              Then, you can easily define a field like this:
              @
              registerField("theStringList*", this, "theStringList");
              @

              That is: you register a field with the page on the page itself.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                burgerking
                wrote on last edited by
                #7

                Thank you for your big help.

                In effect I solved the task on an other way.
                I just delegate an own Signal from Page1 through the Wizard to an own Slot of Page2.

                @connect(this->page(page1), SIGNAL(changed(QList<QString>)), this->page(page2), SLOT(magic(QList<QString>)));@

                But your solution helped me a lot.

                Thank you verry much.

                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