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. Error in using MultiPageWidget from QtDesigner
Qt 6.11 is out! See what's new in the release blog

Error in using MultiPageWidget from QtDesigner

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 3 Posters 4.0k Views 2 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.
  • M MostafaEzzat

    @JonB
    Actually it gives an errors in multipagewidget.h itself which downloaded with Qt5 Files
    and the errors are :
    1-/usr/lib64/qt5/examples/designer/containerextension/multipagewidget.cpp:62: error: ‘QStringLiteral’ was not declared in this scope
    comboBox->setObjectName(QStringLiteral("__qt__passive_comboBox"));
    ^~~~~~~~~~~~~~
    2-/usr/lib64/qt5/examples/designer/containerextension/multipagewidget.cpp:64: error: ‘QOverload’ was not declared in this scope
    connect(comboBox, QOverload<int>::of(&QComboBox::activated),
    ^~~~~~~~~
    3-/usr/lib64/qt5/examples/designer/containerextension/multipagewidget.cpp:64: error: expected primary-expression before ‘int’
    connect(comboBox, QOverload<int>::of(&QComboBox::activated),
    ^~~
    4-/usr/lib64/qt5/examples/designer/containerextension/multipagewidget.cpp:111: error: ‘windowTitleChanged’ is not a member of ‘QWidget’
    connect(page, &QWidget::windowTitleChanged,
    ^~~~~~~~~~~~~~~~~~
    and this the image of multipagewidget.cpp 's errors
    url : https://ibb.co/cDzBZ6K

    this is multiwidget.h file

    /****************************************************************************
    **
    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact: https://www.qt.io/licensing/
    **
    ** This file is part of the examples of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:BSD$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** BSD License Usage
    ** Alternatively, you may use this file under the terms of the BSD license
    ** as follows:
    **
    ** "Redistribution and use in source and binary forms, with or without
    ** modification, are permitted provided that the following conditions are
    ** met:
    **   * Redistributions of source code must retain the above copyright
    **     notice, this list of conditions and the following disclaimer.
    **   * Redistributions in binary form must reproduce the above copyright
    **     notice, this list of conditions and the following disclaimer in
    **     the documentation and/or other materials provided with the
    **     distribution.
    **   * Neither the name of The Qt Company Ltd nor the names of its
    **     contributors may be used to endorse or promote products derived
    **     from this software without specific prior written permission.
    **
    **
    ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/
    
    #ifndef MULTIPAGEWIDGET_H
    #define MULTIPAGEWIDGET_H
    
    #include <QWidget>
    
    QT_BEGIN_NAMESPACE
    class QComboBox;
    class QStackedWidget;
    QT_END_NAMESPACE
    
    //! [0]
    class MultiPageWidget : public QWidget
    {
        Q_OBJECT
        Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
        Q_PROPERTY(QString pageTitle READ pageTitle WRITE setPageTitle STORED false)
    
    public:
        explicit MultiPageWidget(QWidget *parent = nullptr);
    
        QSize sizeHint() const override;
    
        int count() const;
        int currentIndex() const;
        QWidget *widget(int index);
        QString pageTitle() const;
    
    public slots:
        void addPage(QWidget *page);
        void insertPage(int index, QWidget *page);
        void removePage(int index);
        void setPageTitle(QString const &newTitle);
        void setCurrentIndex(int index);
    
    private slots:
        void pageWindowTitleChanged();
    
    signals:
        void currentIndexChanged(int index);
        void pageTitleChanged(const QString &title);
    
    private:
        QStackedWidget *stackWidget;
        QComboBox *comboBox;
    };
    //! [0]
    
    #endif
    
    
    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #4

    @MostafaEzzat
    The image link you show, just like before, just shows "cannot find multipagewidget.h" from your source file. If it can't find it then it can't give errors from inside it. I'll leave it someone else, you need to sort how you are building.

    M 1 Reply Last reply
    0
    • JonBJ JonB

      @MostafaEzzat
      The image link you show, just like before, just shows "cannot find multipagewidget.h" from your source file. If it can't find it then it can't give errors from inside it. I'll leave it someone else, you need to sort how you are building.

      M Offline
      M Offline
      MostafaEzzat
      wrote on last edited by MostafaEzzat
      #5

      @JonB
      OOPS , Sorry i missed

      this is the image of error and the errors it self in the previous reply
      url : "https://ibb.co/CMFk540"

      and this image for including multipagewidget in ui_profile.h
      url :"https://ibb.co/gRJ8kCL"

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

        Hi
        Just as a note.
        There is also QStackedWidget which is a multi page widget.
        https://doc.qt.io/qt-5/qstackedwidget.html#details

        M 1 Reply Last reply
        1
        • mrjjM mrjj

          Hi
          Just as a note.
          There is also QStackedWidget which is a multi page widget.
          https://doc.qt.io/qt-5/qstackedwidget.html#details

          M Offline
          M Offline
          MostafaEzzat
          wrote on last edited by
          #7

          @mrjj
          Yeah , i know QStackedWidget and used it in this Design but i've many stuff so i need multipagewidget to container these stuff in it and MultiPageWidget similar to QToolBox in containg the stuff and MultiPageWidget the Perfect solution here

          mrjjM 1 Reply Last reply
          0
          • M MostafaEzzat

            @mrjj
            Yeah , i know QStackedWidget and used it in this Design but i've many stuff so i need multipagewidget to container these stuff in it and MultiPageWidget similar to QToolBox in containg the stuff and MultiPageWidget the Perfect solution here

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

            @MostafaEzzat
            Ok. fair enough.
            You are using the Qt5 version ? (seems so)
            C:\Qt\Examples\Qt-5.12.0\designer\containerextension
            I just tried open it in Creator and it just compiled and generated the .DLL ( the plugin)

            So are you trying to use this in Qt4 ?

            Im wondering why you get error as it just compiles here.

            Also it seems that you are adding the sources to your app ?
            And not create the SO file ( the plugin ) and copy it to designers plugin dir for it to load
            when run.
            So do you mean you want to use as a true plugin or simply use the Widget via promotion ?

            M 1 Reply Last reply
            1
            • mrjjM mrjj

              @MostafaEzzat
              Ok. fair enough.
              You are using the Qt5 version ? (seems so)
              C:\Qt\Examples\Qt-5.12.0\designer\containerextension
              I just tried open it in Creator and it just compiled and generated the .DLL ( the plugin)

              So are you trying to use this in Qt4 ?

              Im wondering why you get error as it just compiles here.

              Also it seems that you are adding the sources to your app ?
              And not create the SO file ( the plugin ) and copy it to designers plugin dir for it to load
              when run.
              So do you mean you want to use as a true plugin or simply use the Widget via promotion ?

              M Offline
              M Offline
              MostafaEzzat
              wrote on last edited by MostafaEzzat
              #9

              @mrjj
              Thank you alot it works now , but just for curiosity why didn't it work with qt-qmake4 ?
              i've both qt4-qmake and qt5-qmake and compiled this widget with qt-qmake5 and worked and the errors was on qt-qmake4 .. so if i wanna compile it with qt-qmake4 what should i do?
              the widget after displaying : "https://ibb.co/wSZ9S7V"

              mrjjM JonBJ 2 Replies Last reply
              0
              • M MostafaEzzat

                @mrjj
                Thank you alot it works now , but just for curiosity why didn't it work with qt-qmake4 ?
                i've both qt4-qmake and qt5-qmake and compiled this widget with qt-qmake5 and worked and the errors was on qt-qmake4 .. so if i wanna compile it with qt-qmake4 what should i do?
                the widget after displaying : "https://ibb.co/wSZ9S7V"

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

                Hi
                Congrats, you fist Designer plugin :)
                Well with qt-qmake4 it would use Qt4 headers and stuff like QStringLiteral ( from Qt5.0) and QOverload (from Qt 5.7.)
                is not defined there.
                You can replace QStringLiteral with nothing and QOverload with static_cast
                with SIGNAL/SLOT macros.
                However, you could also just find the same sample in Qt4 samples.
                (it seems to have existed back there)

                Anyway, if you build and use the actual Designer plugin, im not sure Creator will load it (if compiled with Qt4)
                as Creator Qt5 based (unless its old version).

                You also need at Qt4 version besides the Qt5 version or why, if i may ask?

                M 1 Reply Last reply
                4
                • M MostafaEzzat

                  @mrjj
                  Thank you alot it works now , but just for curiosity why didn't it work with qt-qmake4 ?
                  i've both qt4-qmake and qt5-qmake and compiled this widget with qt-qmake5 and worked and the errors was on qt-qmake4 .. so if i wanna compile it with qt-qmake4 what should i do?
                  the widget after displaying : "https://ibb.co/wSZ9S7V"

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

                  @MostafaEzzat

                  Thank you alot it works now , but just for curiosity why didn't it work with qt-qmake4 ?

                  • When you build with qt4-qmake you are compiling for Qt 4; when you build with qt5-qmake you are compiling for Qt 5.
                  • There are changes in the Qt functions between Qt 4 and Qt 5.
                  • Code written for one of these may not compile in the other.
                  • You are using an example supplied with Qt 5 (-/usr/lib64/qt5/examples/designer/containerextension).
                  • For example, I saw one of your error messages was 'windowTitleChanged' is not a member of 'QWidget'. Qt 5 documentation shows https://doc.qt.io/qt-5/qwidget.html#windowTitleChanged, and says "This function was introduced in Qt 5.2.". Qt 4 documentation https://doc.qt.io/archives/qt-4.8/qwidget.html shows it did not exist back then.
                  • This means that line of code must have been added just for Qt 5.
                  • If you try to compile that for Qt 4 it will error as you have seen.
                  • You would need the code of that example as it was supplied in Qt 4 if you want to build for Qt 4. Or you have to make all necessary edits yourself.
                  M 1 Reply Last reply
                  4
                  • mrjjM mrjj

                    Hi
                    Congrats, you fist Designer plugin :)
                    Well with qt-qmake4 it would use Qt4 headers and stuff like QStringLiteral ( from Qt5.0) and QOverload (from Qt 5.7.)
                    is not defined there.
                    You can replace QStringLiteral with nothing and QOverload with static_cast
                    with SIGNAL/SLOT macros.
                    However, you could also just find the same sample in Qt4 samples.
                    (it seems to have existed back there)

                    Anyway, if you build and use the actual Designer plugin, im not sure Creator will load it (if compiled with Qt4)
                    as Creator Qt5 based (unless its old version).

                    You also need at Qt4 version besides the Qt5 version or why, if i may ask?

                    M Offline
                    M Offline
                    MostafaEzzat
                    wrote on last edited by
                    #12

                    @mrjj

                    @mrjj said in Error in using MultiPageWidget from QtDesigner:

                    Hi
                    Congrats, you fist Designer plugin :)
                    Well with qt-qmake4 it would use Qt4 headers and stuff like QStringLiteral ( from Qt5.0) and QOverload (from Qt 5.7.)
                    is not defined there.
                    You can replace QStringLiteral with nothing and QOverload with static_cast
                    with SIGNAL/SLOT macros.
                    However, you could also just find the same sample in Qt4 samples.
                    (it seems to have existed back there)

                    Anyway, if you build and use the actual Designer plugin, im not sure Creator will load it (if compiled with Qt4)
                    as Creator Qt5 based (unless its old version).

                    You also need at Qt4 version besides the Qt5 version or why, if i may ask?

                    Sure , First of all thank you for your help

                    in the first i had only qt4 then my OS (which is fedora 29) lost his grub and also Windows but i was owning my project when installed a new Systems , i faced many problems in connecting the database and so on so i downloaded qt4 then qt5 coz qt5 downloaded with all .so files of mysql but qt5 consumes too much memory while compiling and make the system freezing Especially with GNOME but the final project will be compiled in Qt5 (and i guess i've to sober in using Qt5 Libraries For Performance .. right ? or it included the main Libraries ? )

                    mrjjM 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @MostafaEzzat

                      Thank you alot it works now , but just for curiosity why didn't it work with qt-qmake4 ?

                      • When you build with qt4-qmake you are compiling for Qt 4; when you build with qt5-qmake you are compiling for Qt 5.
                      • There are changes in the Qt functions between Qt 4 and Qt 5.
                      • Code written for one of these may not compile in the other.
                      • You are using an example supplied with Qt 5 (-/usr/lib64/qt5/examples/designer/containerextension).
                      • For example, I saw one of your error messages was 'windowTitleChanged' is not a member of 'QWidget'. Qt 5 documentation shows https://doc.qt.io/qt-5/qwidget.html#windowTitleChanged, and says "This function was introduced in Qt 5.2.". Qt 4 documentation https://doc.qt.io/archives/qt-4.8/qwidget.html shows it did not exist back then.
                      • This means that line of code must have been added just for Qt 5.
                      • If you try to compile that for Qt 4 it will error as you have seen.
                      • You would need the code of that example as it was supplied in Qt 4 if you want to build for Qt 4. Or you have to make all necessary edits yourself.
                      M Offline
                      M Offline
                      MostafaEzzat
                      wrote on last edited by
                      #13

                      @JonB said in Error in using MultiPageWidget from QtDesigner:

                      Thank you maybe i'll give it a try in someday ..

                      1 Reply Last reply
                      0
                      • M MostafaEzzat

                        @mrjj

                        @mrjj said in Error in using MultiPageWidget from QtDesigner:

                        Hi
                        Congrats, you fist Designer plugin :)
                        Well with qt-qmake4 it would use Qt4 headers and stuff like QStringLiteral ( from Qt5.0) and QOverload (from Qt 5.7.)
                        is not defined there.
                        You can replace QStringLiteral with nothing and QOverload with static_cast
                        with SIGNAL/SLOT macros.
                        However, you could also just find the same sample in Qt4 samples.
                        (it seems to have existed back there)

                        Anyway, if you build and use the actual Designer plugin, im not sure Creator will load it (if compiled with Qt4)
                        as Creator Qt5 based (unless its old version).

                        You also need at Qt4 version besides the Qt5 version or why, if i may ask?

                        Sure , First of all thank you for your help

                        in the first i had only qt4 then my OS (which is fedora 29) lost his grub and also Windows but i was owning my project when installed a new Systems , i faced many problems in connecting the database and so on so i downloaded qt4 then qt5 coz qt5 downloaded with all .so files of mysql but qt5 consumes too much memory while compiling and make the system freezing Especially with GNOME but the final project will be compiled in Qt5 (and i guess i've to sober in using Qt5 Libraries For Performance .. right ? or it included the main Libraries ? )

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

                        @MostafaEzzat
                        Hi
                        Qt4 is really old so new development is best to do on Qt5.
                        And all the new stuff comes in Qt5+. So yes, much more fun to use.

                        How much memory do you have?

                        M 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @MostafaEzzat
                          Hi
                          Qt4 is really old so new development is best to do on Qt5.
                          And all the new stuff comes in Qt5+. So yes, much more fun to use.

                          How much memory do you have?

                          M Offline
                          M Offline
                          MostafaEzzat
                          wrote on last edited by
                          #15

                          @mrjj
                          i've 4 gb Ram when i use Qt5 and compile the code the memory usage reaches about 2.9 GB maybe more but i ain't know why only Qt5 make the system freezing (but i'll try the new upgrade of the system and see it again )

                          1 Reply Last reply
                          1

                          • Login

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