this class extends the QTableView
More...
#include <jkqtpenhancedtableview.h>
|
| void | copySelectionToCSV (int copyrole=Qt::EditRole, bool storeHead=true, const QString &separator=", ", const QChar &decimalpoint='.') |
| | copy the selected cells' contents to the clipboard as comma separated text
|
| void | copySelectionToCSVNoHead (int copyrole=Qt::EditRole, const QString &separator=", ", const QChar &decimalpoint='.') |
| | copy the selected cells' contents to the clipboard as comma separated text, without the header
|
| void | copySelectionToExcel (int copyrole=Qt::EditRole, bool storeHead=true) |
| | copy the selected cells' contents to the clipboard, so it can be pasted into Excel
|
| void | copySelectionToExcelNoHead (int copyrole=Qt::EditRole) |
| | copy the selected cells' contents to the clipboard, so it can be pasted into Excel, without header
|
| void | print () |
| | print the table contents
|
|
| void | keyPressed (int key, Qt::KeyboardModifiers modifiers, const QString &text) |
| | emitted when a key is pressed in the context of this widget
|
|
| | JKQTPEnhancedTableView (QWidget *parent=nullptr) |
| virtual | ~JKQTPEnhancedTableView () |
| QAction * | getActionPrint () |
| | return a QAction that prints the table using the methode print()
|
| QSizeF | getTotalSize () const |
| | returns the totoal size of the table-view
|
| void | paint (QPainter &painter, QRect pageRec=QRect()) |
| | draw the contents of the table-view into the given pageRect, using the given painter
|
| void | print (QPrinter *printer, bool onePageWide=false, bool onePageHigh=false) |
| | print the contents of the table view
|
| QString | toHtml (int borderWidth=1, bool non_breaking=false, int fontSizePt=-1) const |
| | return the contents of the table view as HTML fragment
|
|
| QPrinter * | getPrinter (QPrinter *printerIn=nullptr, bool *localPrinter=nullptr) |
| | select a printer, using a print-selection dialog if necessary
|
| virtual void | keyPressEvent (QKeyEvent *event) |
| | handles key presses and reacts to some standard keys
|
| void | paint (QPainter &painter, double scale, int page, double hhh, double vhw, const QList< int > &pageCols, const QList< int > &pageRows, QPrinter *p=nullptr) |
| | internal paintig method
|
this class extends the QTableView
This enhanced table view adds some functionality to the Qt class:
- return HTML code that describes the table (see toHtml() )
- contains methods to draw the table onto a QPainter: paint()
- the selected cells may be copied to Excel using the clipboard (Excel will recognize number !) see copySelectionToExcel() and copySelectionToCSV()
- copySelectionToExcel() is called when the user presses the default copy key combination for your system (e.g. Ctrl+C)
- print() is called when the user presses the default print key combination for your system (e.g. Ctrl+P)
- the signal keyPressed() is emitted, when the suer pressed a key
◆ JKQTPEnhancedTableView()
| JKQTPEnhancedTableView::JKQTPEnhancedTableView |
( |
QWidget * | parent = nullptr | ) |
|
◆ ~JKQTPEnhancedTableView()
| virtual JKQTPEnhancedTableView::~JKQTPEnhancedTableView |
( |
| ) |
|
|
virtual |
◆ copySelectionToCSV
| void JKQTPEnhancedTableView::copySelectionToCSV |
( |
int | copyrole = Qt::EditRole, |
|
|
bool | storeHead = true, |
|
|
const QString & | separator = ", ", |
|
|
const QChar & | decimalpoint = '.' ) |
|
slot |
copy the selected cells' contents to the clipboard as comma separated text
- Parameters
-
| copyrole | specifies how the values for copying are extracted (see Qt::ItemDataRole). During the export, this parameter is supplied to function data() of the underlying model. |
| storeHead | en-/disable storage of the table header |
- See also
- copySelectionToCSVNoHead()
- Parameters
-
| separator | separator between two values (default is a comma) |
| decimalpoint | decimal separator for values (default is a dot) |
- See also
- copySelectionToCSVNoHead()
◆ copySelectionToCSVNoHead
| void JKQTPEnhancedTableView::copySelectionToCSVNoHead |
( |
int | copyrole = Qt::EditRole, |
|
|
const QString & | separator = ", ", |
|
|
const QChar & | decimalpoint = '.' ) |
|
slot |
copy the selected cells' contents to the clipboard as comma separated text, without the header
- Parameters
-
| copyrole | specifies how the values for copying are extracted (see Qt::ItemDataRole). During the export, this parameter is supplied to function data() of the underlying model. |
| separator | separator between two values (default is a comma) |
| decimalpoint | decimal separator for values (default is a dot) |
- See also
- copySelectionToCSV()
◆ copySelectionToExcel
| void JKQTPEnhancedTableView::copySelectionToExcel |
( |
int | copyrole = Qt::EditRole, |
|
|
bool | storeHead = true ) |
|
slot |
copy the selected cells' contents to the clipboard, so it can be pasted into Excel
◆ copySelectionToExcelNoHead
| void JKQTPEnhancedTableView::copySelectionToExcelNoHead |
( |
int | copyrole = Qt::EditRole | ) |
|
|
slot |
copy the selected cells' contents to the clipboard, so it can be pasted into Excel, without header
◆ getActionPrint()
| QAction * JKQTPEnhancedTableView::getActionPrint |
( |
| ) |
|
|
inline |
return a QAction that prints the table using the methode print()
- See also
- print()
◆ getPrinter()
| QPrinter * JKQTPEnhancedTableView::getPrinter |
( |
QPrinter * | printerIn = nullptr, |
|
|
bool * | localPrinter = nullptr ) |
|
protected |
select a printer, using a print-selection dialog if necessary
◆ getTotalSize()
| QSizeF JKQTPEnhancedTableView::getTotalSize |
( |
| ) |
const |
returns the totoal size of the table-view
- See also
- paint()
◆ keyPressed
| void JKQTPEnhancedTableView::keyPressed |
( |
int | key, |
|
|
Qt::KeyboardModifiers | modifiers, |
|
|
const QString & | text ) |
|
signal |
emitted when a key is pressed in the context of this widget
◆ keyPressEvent()
| virtual void JKQTPEnhancedTableView::keyPressEvent |
( |
QKeyEvent * | event | ) |
|
|
protectedvirtual |
handles key presses and reacts to some standard keys
◆ paint() [1/2]
| void JKQTPEnhancedTableView::paint |
( |
QPainter & | painter, |
|
|
double | scale, |
|
|
int | page, |
|
|
double | hhh, |
|
|
double | vhw, |
|
|
const QList< int > & | pageCols, |
|
|
const QList< int > & | pageRows, |
|
|
QPrinter * | p = nullptr ) |
|
protected |
◆ paint() [2/2]
| void JKQTPEnhancedTableView::paint |
( |
QPainter & | painter, |
|
|
QRect | pageRec = QRect() ) |
draw the contents of the table-view into the given pageRect, using the given painter
The output look like this:
- See also
- print()
◆ print [1/2]
| void JKQTPEnhancedTableView::print |
( |
| ) |
|
|
slot |
print the table contents
Before printing this function opens a QPrintDialog to select a printer and then opens a second dialog that allows to set different options for the printout:
The printouts look like this:
Depending on the options set in the dialog above, the printout is split over several pages, or not:
Split over pages (onePageWide=false onePageHigh=false)
Print on one page (onePageWide=true onePageHigh=true)
◆ print() [2/2]
| void JKQTPEnhancedTableView::print |
( |
QPrinter * | printer, |
|
|
bool | onePageWide = false, |
|
|
bool | onePageHigh = false ) |
print the contents of the table view
- Parameters
-
| printer | the QPrinter to use for printing the table view |
| onePageWide | limit the width of the table to a single page, if not set the printout may span several pages |
| onePageHigh | limit the height of the table to a single page, if not set the printout may span several pages |
The printouts look like this:
Depending on the options set in the dialog above, the printout is split over several pages, or not:
Split over pages (onePageWide=false onePageHigh=false)
Print on one page (onePageWide=true onePageHigh=true)
◆ toHtml()
| QString JKQTPEnhancedTableView::toHtml |
( |
int | borderWidth = 1, |
|
|
bool | non_breaking = false, |
|
|
int | fontSizePt = -1 ) const |
return the contents of the table view as HTML fragment
◆ printAction
| QAction* JKQTPEnhancedTableView::printAction |
|
protected |
The documentation for this class was generated from the following file: