[SOLVED] QtGlobal about the file



    • ..\qt-everywhere-opensource-src-4.8.3\include\QtCore\QtGlobal --> There are no extensions.
    • ..\qt-everywhere-opensource-src-4.8.3\include\QtCore\QGlobalStatic --> There are no extensions.
    • ..\qt-everywhere-opensource-src-4.8.3\include\QtCore\QGlobalStaticDeleter --> There are no extensions.
    • ..\qt-everywhere-opensource-src-4.8.3\include\QtCore\qglobal.h
    • ..\qt-everywhere-opensource-src-4.8.3\include\Qt\qglobal.h
    • ..\qt-everywhere-opensource-src-4.8.3\src\corelib\global\qglobal.h
    • ..\qt-everywhere-opensource-src-4.8.3\src\corelib\global\qglobal.cpp
    • ..\qt-everywhere-opensource-src-4.8.3\doc\src\snippets\code\src_corelib_global_qglobal.cpp

    What is the difference between these files?

    Files with no extension, what is?

    qglobal.h file is used on its own right? --> ..\src\corelib\global\qglobal.h

    created a gui project, why are automatically Uint8 see, for example?


    qglobal want to create a file into its own. Can you give us just a c + + example.
    to create such a structure.
    I want to know how it works in the background only.


    For the following code which header file must be the most powerful and the most effective?

    <QtGlobal>

    <qglobal.h>

    <QGlobalStatic>

    <QGlobalStaticDeleter>

    @
    #include <iostream>
    using namespace std;

    // <QtGlobal> <qglobal.h> <QGlobalStatic> <QGlobalStaticDeleter> <----- ?

    int main()
    {
    int myValue = 10;
    int minValue = 2;
    int maxValue = 6;

    int boundedValue = qBound(minValue, myValue, maxValue);
    
    cout << boundedValue << endl;
    
    system("PAUSE"&#41;;
    return 0;
    

    }
    @

    qglobal.cpp in which the prototypes was written. ->> for qglobal.h .



  • Hi, ~_compiler!

    Welcome to Qt Developer Network!

    We are really friendly here :-)

    I am sorry, but I can't help you today with an issue you have posted. I've posted this reply to make small announcement.

    I've started "Qt Contribution":http://qt-project.org/groups/qt-contributors group here. It's for the people who wants to hack, contribute, understand Qt code.

    I've send request for Forum. If devnet admins accept it, it will be a good practise to post questions like this there.

    So, DevNet admins, if you see this post - please do smth with my request.

    Sorry for offtop.



  • I understand :-)



  • Include files don't need to have a specific extension.

    They can have any extension you like or no extension at all. In the C standard library, include files used to have a ".h" extension, like in <stdio.h>, but in the C++ standard library most (all?) header files have no extension, like <vector> or <iostream>. And, in C++, we even have new equivalents for the old C headers like <cstdio> instead of <stdio.h>. The "Boost" library, for example, uses the ".hpp" extension for its header files.

    In Qt we have include files like <QtGlobal> (CamelCase and no file extension) in the "include" directory, which do nothing but include the corresponding .h file, like <qglobal.h> (all lower case and .h extension), also located in the "include" directory. And if you look at these file, they do nothing but include the real header file from the "src" directory, like "../../src/corelib/global/qglobal.h". It means <QtGlobal> is a shortcut/alias for the real header file.

    After all, you could just include the real header file from the "src" directory in your code, but the location and/or name of that file might change in the future. So it is better (and more clean) to just include those include files that are provided in the "include" directory. Your application should not need to know or care about the "internals" of Qt. Whether you include <QtGlobal> or <qglobal.h> is probably up to your own personal taste, but in official Qt docs and examples I always see <QtGlobal> and friends, so that's what I use in my code too.



  • thanks MuldeR, beautiful beyond description.


Log in to reply
 

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