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. #include <QtWidgets/QtWidgets> problem

#include <QtWidgets/QtWidgets> problem

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

    Dear guys,

    I had my program compiling very well but now i dont know what happened ..
    I have now Qt.4.8.6 with mingw

    in my header i had

    @
    #include <QtWidgets/QtWidgets>
    @

    and
    @
    #include <Qtwidgets/QApplication>
    @
    and
    @
    #include <QtPrintSupport/QPrinter>
    #include <QtPrintSupport/QPrintDialog>
    @
    but now it says: no such file or directory

    could any body please describe me the problem in details because i don't understand it?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SherifOmran
      wrote on last edited by
      #2

      I ve this code and there is a mistake, i wonder it used to compile very well before.. Could it be that i used vs2010 compiler and now MinGw?

      In Ui_login.h file , i get the following

      @
      void retranslateUi(QWidget *Login)
      {
      Login->setWindowTitle(QApplication::translate("Login", "Login", 0, 0));
      loginbrowse->setText(QApplication::translate("Login", "...", 0, 0));
      } // retranslateUi
      @

      Error says

      Invalid conversion from int to Qcoreapplication::Encoding

      I know it could be solved with the following, but i want to understand what is the mistake in the above QApplication::translate ..
      @
      QObject::tr("Login"));
      @

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        tanslate() takes different number of arguments in Qt4 and Qt5:
        "Qt 4":http://qt-project.org/doc/qt-4.8/qcoreapplication.html#translate
        "Qt 5":http://qt-project.org/doc/qt-5/qcoreapplication.html#translate
        You need to supply the additional Encoding argument or drop the last 0 entirely if you're not using it anywhere.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SherifOmran
          wrote on last edited by
          #4

          thank you for your reply
          when i drop the last 0, it works .. but i am using Qt4.8 ..
          how come that it inherits the Qt5 stuff?
          this is the proper way to do it
          @
          Login->setWindowTitle(QApplication::translate("Login", "Login", 0, QApplication::UnicodeUTF8));
          @

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SherifOmran
            wrote on last edited by
            #5

            I have now the following issue, it does not find the QInputMethod any more
            and says keyboardinputlocal is not a member of QLocal .. haa !!
            Any idea?
            thanks

            @
            #include <QInputMethod>
            QLocale t= QLocale::keyboardInputLocale ();
            @

            1 Reply Last reply
            0
            • JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              [quote author="SherifOmran" date="1416881475"]but i am using Qt4.8[/quote]How did you check this?

              [quote author="SherifOmran" date="1416882219"]
              @
              QLocale::keyboardInputLocale ();
              @[/quote]That function doesn't exist in Qt 4 or Qt 5. Where did you get it from?

              Anyway, your question was already answered 6 months ago: http://qt-project.org/forums/viewthread/42636

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #7

                bq. how come that it inherits the Qt5 stuff?

                It doesn't inherit anything. What does that even mean?

                This is apparently code written for Qt5 and you are trying to run it with Qt4 so it breaks.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SherifOmran
                  wrote on last edited by
                  #8

                  no it was written for qt4
                  but may be a different version of qt creator

                  any body has a clue for the input keyboard function above ..

                  1 Reply Last reply
                  0
                  • JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #9

                    [quote author="SherifOmran" date="1416965171"]any body has a clue for the input keyboard function above ..[/quote]Read the link in my previous post

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    0
                    • Chris KawaC Offline
                      Chris KawaC Offline
                      Chris Kawa
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      bq. no it was written for qt4
                      but may be a different version of qt creator

                      It's like saying it was written for different version of notepad. Qt Creator is an IDE (a fancy text editor that also runs build tools). It has little to do with whether this code compiles or not.

                      Most of the code that you posted so far was Qt5 specific and needed a backport to Qt4, so get your story straight ;)

                      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