I am trying to implement a customized QTableView integrated to the clipboard:
#include <QTableView>
#include <QAction>
{
Q_OBJECT
public:
explicit GeneralTableView
(QWidget *parent
= 0);
public slots:
void copy();
protected:
};
GeneralTableView
::GeneralTableView(QWidget *parent
) :{
connect(copyAction_, SIGNAL(triggered()),
this, SLOT(copy()));
}
#include <QTableView>
#include <QAction>
class GeneralTableView : public QTableView
{
Q_OBJECT
public:
explicit GeneralTableView(QWidget *parent = 0);
public slots:
void copy();
protected:
QAction* copyAction_;
};
GeneralTableView::GeneralTableView(QWidget *parent) :
QTableView(parent)
{
copyAction_ = new QAction(this);
copyAction_->setShortcut(QKeySequence::Copy);
connect(copyAction_, SIGNAL(triggered()),
this, SLOT(copy()));
}
To copy to clipboard, switch view to plain text mode
But copy() does not get executed when I hit ctrl+c. Only some default version of copy gets called. This copies only one cell in the clipboard and doesn't call my copy(). How can I fix this?
Bookmarks