#include <QtWidgets/QtWidgets> problem



  • 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?



  • 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"));
    @


  • Moderators

    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.



  • 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));
    @



  • 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 ();
    @


  • Moderators

    [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


  • Moderators

    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.



  • 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 ..


  • Moderators

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


  • Moderators

    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 ;)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.