Hi everybody,
i want to insert a row in QTableWidget with a buttonclick.
{
Q_OBJECT
public:
CoordinateTable
(QWidget *parent
=0);
private slots :
void addrow();
};
CoordinateTable
::CoordinateTable(QWidget *parent
){ setColumnCount(2);
setRowCount(2);
};
void CoordinateTable::addrow()
{
int row = CoordinateTable::rowCount();
CoordinateTable:: insertRow(row);
};
class CoordinateTable:public QTableWidget
{
Q_OBJECT
public:
CoordinateTable(QWidget *parent=0);
private slots :
void addrow();
};
CoordinateTable::CoordinateTable(QWidget *parent)
: QTableWidget(parent)
{ setColumnCount(2);
setRowCount(2);
};
void CoordinateTable::addrow()
{
int row = CoordinateTable::rowCount();
CoordinateTable:: insertRow(row);
};
To copy to clipboard, switch view to plain text mode
In main
....
CoordinateTable *tableWidget = new CoordinateTable;
QObject::connect(okbutton,
SIGNAL(clicked
()),
tableWidget ,SLOT(addrow()));
....
CoordinateTable *tableWidget = new CoordinateTable;
QObject::connect(okbutton, SIGNAL(clicked()),
tableWidget ,SLOT(addrow()));
To copy to clipboard, switch view to plain text mode
okbutton is a QT4 QPushButton.
Nothing happens when i click the button and i dont understand why.
Bookmarks