PDA

View Full Version : Error when playing exercises



lima_will
24th September 2013, 22:00
Guys,
I'm trying to reproduce this example:

http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=140&key=QTableWidgetDetectHeaderClick

I'm using QT5, only returns me the error:

/home/will/Qt - Projetos/Telas/Variaveis.h:15: error: 'setClickable' was not declared in this scope

My current class is as follows:


#include <QMessageBox>
#include <QHeaderView>
#include <iostream>
#include <QtGui>

class myHeaderView : public QHeaderView
{
Q_OBJECT
public:
myHeaderView():QHeaderView(Qt::Horizontal)
{
he
setClickable(true);
connect(this,SIGNAL(sectionClicked(int)),this,SLOT (sectionClicked(int)));
}
~myHeaderView(){}

public slots:
void sectionClicked(int index)
{
QMessageBox::about(this,"Hi! Header Click Detected!","Index:"+QString::number(index));
}

};

toufic.dbouk
24th September 2013, 22:21
Hello,
just look at the link you sent its not the same code... Syntax Errors.
you missed a couple of ; and you added he by mistake etc... fix the errors.
is it your first day of programming ?
good luck.