No, I'm talking about this:
//Header file connection.h
#ifndef CONNECTION_H
#define CONNECTION_H
#include <QTcpSocket>
{
Q_OBJECT
Q_ENUMS( Listing )
Q_PROPERTY( Listing listing READ listing WRITE setListing )
public:
Connection( const QString&, const quint16& );
~Connection();
enum Listing{ NOT_LISTING = 0, LISTING_ARTICLES = 1, LISTING_GROUPS = 2 };
Listing listing() const;
void setListing( Listing l);
private:
Listing lst;
};
#endif //CONNECTION_H
//Header file connection.h
#ifndef CONNECTION_H
#define CONNECTION_H
#include <QTcpSocket>
class Connection() : public QTcpSocket
{
Q_OBJECT
Q_ENUMS( Listing )
Q_PROPERTY( Listing listing READ listing WRITE setListing )
public:
Connection( const QString&, const quint16& );
~Connection();
enum Listing{ NOT_LISTING = 0, LISTING_ARTICLES = 1, LISTING_GROUPS = 2 };
Listing listing() const;
void setListing( Listing l);
private:
Listing lst;
};
#endif //CONNECTION_H
To copy to clipboard, switch view to plain text mode
//connection.cpp
#include "connection.h"
...
Connection::Listing Connection::listing() const
{
return lst;
}
void Connection::setListing( Listing l )
{
lst = l;
}
...
//connection.cpp
#include "connection.h"
...
Connection::Listing Connection::listing() const
{
return lst;
}
void Connection::setListing( Listing l )
{
lst = l;
}
...
To copy to clipboard, switch view to plain text mode
I find it illogical that the return value of the function listing() has to be written as Connection::Listing when you are accessing it from the class implementation. Maybe it's just a gcc quirk, I don't know. But it doesn't bitch about accessing it as "Listing" anwhere else (as seen in the header file). Just when returning it from the function.
Maybe it's just some ANSI c++ rule I've never encountered since I don't normally use enums to do things. But I thought it was wierd when I ran into it a few days ago.
Bookmarks