Results 1 to 3 of 3

Thread: Having Trouble Creating Classes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    14
    Thanks
    3
    Thanked 4 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Having Trouble Creating Classes

    Currently, I am trying to learn how to write more robust code that is more easily extendable. For this, I am trying to create a class that opens up TIFF images and performs some basic Image processing process ( find Max pixel etc...). I am using QT 3.1 (I know later versions support TIFF, but I am trying to learn here). I am using a open source library called libtiff. My basic layout is set up like this

    TIFFImage.h
    Qt Code:
    1. #ifndef TIFFIMAGE_H
    2. #define TIFFIMAGE_H
    3.  
    4. #include<stdio.h>
    5. #include<tiffio.h>
    6. #include<tiff.h>
    7. #include<tiffvers.h>
    8.  
    9. class QVariant;
    10. class QString;
    11.  
    12. class TIFFImage
    13. {
    14. public:
    15. TIFFImage();
    16. ~TIFFImage(); {}
    17.  
    18. private:
    19. bool loadTIFF ( const QString fileNameTIFF, const char readWriteOption);
    20. }
    21. endif
    To copy to clipboard, switch view to plain text mode 

    TIFFImage.cpp
    Qt Code:
    1. #include "tiffimage.h"
    2. #include<stdio.h>
    3. #include<tiffio.h>
    4. #include<tiff.h>
    5. #include<tiffvers.h>
    6.  
    7. TIFFImage::TIFFImage()
    8.  
    9. bool TIFFImage::loadTIFF(const QString fileNameTIFF, const char readWriteOption)
    10. {
    11. TIFF * tif = TIFFOpen(fileNameTIFF, readWriteOption);
    12. if (tif==Null)
    13. {
    14. return false;
    15. }
    16. return true;
    17. }
    18. }
    To copy to clipboard, switch view to plain text mode 

    I then have a form I created with QT Designer that I want to call this class from. However when I try to compile I get a error in tiffimage.cpp
    "error expected initializer before bool" from the line that loadTIFF function is implemented. I am sure I am making some simple mistake, but I haven't been able to figure it out. Any help would be appreciated.

  2. The following 2 users say thank you to jstippey for this useful post:


Similar Threads

  1. Replies: 2
    Last Post: 2nd November 2011, 03:08
  2. Trouble with creating custom class
    By jstippey in forum Qt Programming
    Replies: 9
    Last Post: 12th January 2011, 14:08
  3. construction of classes within classes
    By mobucl in forum Newbie
    Replies: 8
    Last Post: 10th January 2011, 13:51
  4. Replies: 0
    Last Post: 4th November 2010, 14:51
  5. creating a dylib for a plugin with external classes
    By themolecule in forum Qt Programming
    Replies: 4
    Last Post: 23rd July 2008, 14:22

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
  •  
Qt is a trademark of The Qt Company.