Thanks for advice. I choose solution 1. I post it here so somebody else could use it .
mainwindow.h
{
Q_OBJECT
public:
my_table
(int row,
int col,
QWidget *parent
= 0);
~my_table();
private:
private slots:
void selectAll ();
};
class my_table : public QTableWidget
{
Q_OBJECT
public:
my_table(int row, int col, QWidget *parent = 0);
~my_table();
private:
private slots:
void selectAll ();
};
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
MainWindow
::MainWindow(QWidget *parent
){
ui->setupUi(this);
my_table *table = new my_table(2,2,this);
table->setGeometry(10,20,250,190);
}
MainWindow::~MainWindow()
{
delete ui;
}
my_table
::my_table(int row,
int col,
QWidget *parent
){
}
my_table::~my_table()
{
}
void my_table::selectAll(void)
{
qDebug() << "select";
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
my_table *table = new my_table(2,2,this);
table->setGeometry(10,20,250,190);
}
MainWindow::~MainWindow()
{
delete ui;
}
my_table::my_table(int row, int col, QWidget *parent)
: QTableWidget(row, col, parent)
{
}
my_table::~my_table()
{
}
void my_table::selectAll(void)
{
qDebug() << "select";
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks