Results 1 to 2 of 2

Thread: Qt's equivalent of Java's packages?

  1. #1
    Join Date
    Feb 2012
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt's equivalent of Java's packages?

    Hi,

    I have background in Java and I am slowly trying to learn Qt.

    I would like to understand the Qt's equivalent of Java's packages.

    I know that namespaces are the closest to Java's packages, but I would like to
    see a concrete example, for instance, how would I express the code below in Qt:

    Qt Code:
    1. //File my/first/package/MyFirstClass.java
    2. package my.first.package;
    3.  
    4. class MyFirstClass {}
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. //File my/second/package/MySecondClass.java
    2. package my.second.package;
    3.  
    4. class MySecondClass {}
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. //File my/main/package/MyMainClass.java
    2. package my.main.package;
    3.  
    4. import my.first.package.MyFirstClass;
    5. import my.second.package.MySecondClass;
    6.  
    7. class MyMainClass {
    8. //Use MyFirstClass and MySecondClass here
    9. MyFirstClass myFirst = new MyFirstClass();
    10. MySecondClass mySecond = new MySecondClass;
    11. }
    To copy to clipboard, switch view to plain text mode 

    I would like to see how the corresponding Qt headers and classes are stored in the
    directories on the disk, from which they are included.

    If someone could provide my with an example of this, I would be very thankfull.

    Thank you in advance!

    Kind Regards,
    Veroslav

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt's equivalent of Java's packages?

    First this is not a Qt problem but C++ problem. Second in contrast to Java pacakges C++ namespaces are independent of the directory structure on disk.

Similar Threads

  1. creating installation packages
    By ruben.rodrigues in forum Installation and Deployment
    Replies: 1
    Last Post: 17th August 2011, 17:05
  2. Wht packages(Ex:GCC,....) do we require to install qt sdk?
    By qtlinuxnewbie in forum Installation and Deployment
    Replies: 3
    Last Post: 27th September 2010, 06:36
  3. Intergrating Library Packages
    By Baasie in forum Qt Programming
    Replies: 4
    Last Post: 30th September 2009, 11:14
  4. qt >= 4.3 for debian etch packages
    By majorTom in forum Installation and Deployment
    Replies: 1
    Last Post: 15th September 2007, 13:10
  5. Cannot Install KDEdevel packages on linux
    By wirajr in forum KDE Forum
    Replies: 12
    Last Post: 5th February 2006, 21:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.