PDA

View Full Version : How can I invoke the member funcions of QTableViewPrivate?



plainzw
15th February 2011, 01:41
Hi
I want to inherit QTableView and invoke some QTableViewPrivate member functions.

.h file


#include <QTableView>
#include <QTableView>
class SpreadsheetPrivate;
class Spreadsheet : public QTableView
{
Q_OBJECT
public:
Spreadsheet();
void test();
protected:
private:
Q_DECLARE_PRIVATE(Spreadsheet)
};

.cpp file


#include <QtGui>
#include <private/qtableview_p.h>
#include "Spreadsheet.h"
class SpreadsheetPrivate: public QTableViewPrivate
{
};
Spreadsheet::Spreadsheet()
{
}
void Spreadsheet::test()
{
Q_D(Spreadsheet);
//The problem come here
}


The Problem is that when I use fields or inline functions of QTableViewPrivate,it works fine.When I try to invoke the member functions(not inline functions) of QTableViewPrivate,I can compile the code,however,it will show a error while linking like this:
undefined reference to 'QTableViewPrivate::xxxxx'
Can anyone tell me what's wrong with it?How can I do to invoke the member functions of QTableViewPrivate?
thanks.

mcosta
18th February 2011, 16:14
IMHO the problem is conceptual. you cannot use xxxPrivate members.

When you installs Qt the <*_p.h> includes are not available