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. Arguments for function addTab()
QtWS25 Last Chance

Arguments for function addTab()

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 3.1k Views
  • 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
    BKBK
    wrote on last edited by
    #1

    In our qml.main we have some code that is repeated multiple times with variations of course:

    [CODE]videoTab=makeTab("videoTab","Video", "video.qml",tabView.count)
    tabView.addTab(videoTab.name,videoTab.tab)[/CODE]

    I have searched for function makeTab() to no avail. Where can I find a description? Specifically I wish to see a description of property: videoTab.name.

    I have found that addTab() is an overloaded function and both of them have the same first argument. Here is one of the descriptions:

    [CODE\int QTabWidget::addTab(QWidget *page, const QIcon &icon, const QString &label)[/CODE]

    As I read that, the first argument is a pointer to a widget. In the working code, the example provided above, it looks like the name of the tab is being provided. To me, the name of the argument provided implies a string. If so then the argument provided does not match required argument type.
    What am I missing here?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      [CODE] is ```
      and same for the end

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        The QML tabView seems to accept a string
        http://doc.qt.io/qt-5/qml-qtquick-controls-tabview.html#addTab-method

        B 1 Reply Last reply
        0
        • B Offline
          B Offline
          BKBK
          wrote on last edited by
          #4

          Hello mrjj,
          so that page shows the first arg as a string. This page:
          http://doc.qt.io/qt-5/qtabwidget.html
          is the one I get when I search from here:
          http://doc.qt.io/qt-5/search-results.html?q=addtab
          Under the section Public Functions I find this line:
          int addTab(QWidget *page, const QString &label)
          I will go with your page but ask for a suggestion as to how to find it with a search.

          On my Internet Explorer the CODE markers look like three apostrophies but that does not work. I used copy paste for this post. How might I type in those characters?

          mrjjM 1 Reply Last reply
          0
          • B BKBK

            Hello mrjj,
            so that page shows the first arg as a string. This page:
            http://doc.qt.io/qt-5/qtabwidget.html
            is the one I get when I search from here:
            http://doc.qt.io/qt-5/search-results.html?q=addtab
            Under the section Public Functions I find this line:
            int addTab(QWidget *page, const QString &label)
            I will go with your page but ask for a suggestion as to how to find it with a search.

            On my Internet Explorer the CODE markers look like three apostrophies but that does not work. I used copy paste for this post. How might I type in those characters?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @BKBK

            Hi you seems to have found
            tabWidget but the QML sample you talk about is using TabView so its other class :)
            ( i just searched for tabview)

            I never type them. i just use button :)
            alt text

            JonBJ 1 Reply Last reply
            1
            • mrjjM mrjj

              @BKBK

              Hi you seems to have found
              tabWidget but the QML sample you talk about is using TabView so its other class :)
              ( i just searched for tabview)

              I never type them. i just use button :)
              alt text

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @mrjj
              Never, ever noticed the button --- I always type the backticks in! :)

              @BKBK
              The characters are not "apostrophe"s (or "single-quote"s), they are "backtick"s! Depending on keyboard locale, the backtick (at least here in UK!) is on the key at the very top-left of the keyboard.

              mrjjM 1 Reply Last reply
              0
              • JonBJ JonB

                @mrjj
                Never, ever noticed the button --- I always type the backticks in! :)

                @BKBK
                The characters are not "apostrophe"s (or "single-quote"s), they are "backtick"s! Depending on keyboard locale, the backtick (at least here in UK!) is on the key at the very top-left of the keyboard.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @JonB
                hehe well i was like 2 years to discover that
                right click on class or variables in Creator and choose the
                refactor menu, have tons of features for adding virtual members,
                sync parameters change and generate get/setters for variables.
                :)

                JonBJ 1 Reply Last reply
                0
                • mrjjM mrjj

                  @JonB
                  hehe well i was like 2 years to discover that
                  right click on class or variables in Creator and choose the
                  refactor menu, have tons of features for adding virtual members,
                  sync parameters change and generate get/setters for variables.
                  :)

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #8

                  @mrjj
                  I'm not a Qt Creator user, I'm a PyCharm (Python, PyQt) user. And yes that has all the refactoring stuff you mention. But I never use them --- I only ever use the "Rename"!

                  1 Reply Last reply
                  0
                  • mrjjM mrjj

                    Hi
                    The QML tabView seems to accept a string
                    http://doc.qt.io/qt-5/qml-qtquick-controls-tabview.html#addTab-method

                    B Offline
                    B Offline
                    BKBK
                    wrote on last edited by
                    #9

                    @mrjj
                    Trying the backtick marker to delineate code in the next line
                    const int MAX_SIZE = 480;
                    Does that work as expected.
                    I think this question is answered so am marking it as such. Just taking the opportunity to test that backtick thing.
                    In the preview window it looks ok.

                    mrjjM 1 Reply Last reply
                    0
                    • B BKBK

                      @mrjj
                      Trying the backtick marker to delineate code in the next line
                      const int MAX_SIZE = 480;
                      Does that work as expected.
                      I think this question is answered so am marking it as such. Just taking the opportunity to test that backtick thing.
                      In the preview window it looks ok.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #10

                      @BKBK
                      Almost correct, but you need to use 3 of them in start and end.

                      const int MAX_SIZE = 480;
                      

                      IMAGE
                      (image)

                      B 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @BKBK
                        Almost correct, but you need to use 3 of them in start and end.

                        const int MAX_SIZE = 480;
                        

                        IMAGE
                        (image)

                        B Offline
                        B Offline
                        BKBK
                        wrote on last edited by
                        #11

                        @mrjj Interesting, one looks good in the editor. Lets try one backtick on each end in the next line:
                        const int MAX_SIZE = 480;
                        and then three on each end in the next line:
                        const int MAX_SIZE = 480;
                        and see how that looks. I cannot see any difference in the preview pane. Maybe a difference will show up in the final post.

                        mrjjM 1 Reply Last reply
                        0
                        • B BKBK

                          @mrjj Interesting, one looks good in the editor. Lets try one backtick on each end in the next line:
                          const int MAX_SIZE = 480;
                          and then three on each end in the next line:
                          const int MAX_SIZE = 480;
                          and see how that looks. I cannot see any difference in the preview pane. Maybe a difference will show up in the final post.

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by mrjj
                          #12

                          @BKBK
                          Hi
                          you put them too close to the text. the code should be in between.

                          const int MAX_SIZE = 480;
                          

                          alt text

                          B 1 Reply Last reply
                          0
                          • mrjjM mrjj

                            @BKBK
                            Hi
                            you put them too close to the text. the code should be in between.

                            const int MAX_SIZE = 480;
                            

                            alt text

                            B Offline
                            B Offline
                            BKBK
                            wrote on last edited by
                            #13

                            @mrjj Too close to the text??? I do not understand your intent. When I typed each of the code lines I pressed the backtick key 1 or 3 times then immediately followed it with letters "const" that began the line of code. From my view, using Internet Explorer through a government firewall, both lines look exactly the same and both are nicely highlighted with red font to indicate they are lines of code.

                            mrjjM 1 Reply Last reply
                            0
                            • B BKBK

                              @mrjj Too close to the text??? I do not understand your intent. When I typed each of the code lines I pressed the backtick key 1 or 3 times then immediately followed it with letters "const" that began the line of code. From my view, using Internet Explorer through a government firewall, both lines look exactly the same and both are nicely highlighted with red font to indicate they are lines of code.

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @BKBK
                              But code is NOT red. that is other form of highlighting.

                              Please try the </> button and you will see what i mean.

                              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