Monday 26 March 2012

Beats By Dre HeadphonesQtQTableView offbeat printing solutions on book said Qt model / view

QtQTableView offbeat printing solutions on book said Qt model / view ,I had a demo is used to display the contents of the database .Did not think of the tableview printing has become a problem .
I am confused ,isn should provide a print function to the tableview ?This is the most commonly used functions .Google for a long time, no useful result .See the Qt labs has a blog ,called &ldquo All You Need is a ;little Polish&rdquo ;,which gives a new spreadsheet demo tableview print code .
Also very happy, it can solve the .Later tried, found nothing of the sort ,Running Shoes,this example only print tableview current display area ,for the header ,footer ,page ,and so not supported .
Originally wrote this demo is not the real developers ,just support team .As a 10 yearold MFCer, I have a cheeky DIY spirit ( no way, it too many times ,each time only can oneself to ) .
I believe in my writing in MFC Doc / View printing experience ,Coach Bag,take Qt print or no problem .But in the jump into the sea before the code ,Beats By Dre Headphones,I spent a few hours carefully studied the QTableView code ,I can choose the following scheme .
1 ostrich program studied the operating system Tx knew what it meant what kind of plan .The above mentioned that the Blog method can calculate a .If you print table every time is in 1 pageswithin words ,can use this solution .
But as the 10 yearsbrilliant old MFCer, really have no face to do so .2 model scheme this scheme is model obtained from all of the table data ,and then use the 2 for circulation tothe data in the row and column print .
On the qt-app website has given this solution ( http: / / qt-apps.org / content / show.php / TableView+Printer ?Content = 76616 ).I read the code ,the print page from model fetching data in memory ,and then generates a graphicview ,then graphicview print .
Also realize the paging function .But the printing effect is not good, increased border feel awkward .It is also suggested to model data into QTextDocument, then the QTextDocument slightly strong point printing function .
In short ,all of these programs to achieve more trouble, but only from the model data ,ignoring the view ( delegate ) display related factors ( such as text in render format ,is selected .
) .Another point is that the paging is always a problem .Even if the longitudinal to transverse paging ,paging or not to see the realization of the corresponding .( everyone noted in Excel in a horizontal playing not will not print content to print to the next page .
) 3 delegateprogram in QTableView code ,real render each item ,or use delegate .So it is suggested to use delegate in a 2 for cycle,Coach Outlet Online,the data in the row and column print .This seems to be the best solution .
If I was a Qt developer ,I would have preferred this scheme .4 my plan but I am not a Qt developer ( Nokia not the enterprise atmosphere how) .Personal feeling Qt steady ,plus a smart .
So my scheme may not be the Qt developers like .Even though I think this program to be put in good taste .Just in time and energy is limited, with the Qt Q a little bit, want out of a very tricky approach .
In fact, my plan is :ostrich scheme upgrade edition .The ...My inspiration comes from the above Bolg ostrich plan 4 Code:setVerticalScrollBarPolicy ( Qt: :ScrollBarAlwaysOff ) ;setHorizontalScrollBarPolicy ( Qt: :ScrollBarAlwaysOff ) ;resize ( printer-> ;printer-> ;height width ( ) ,( ) ) ;render ( printer ) ;in front of 2 with hiddenscrollbars ,third ,UGG Sale UK,view and print paper size is the same ,the most crucial fourth ,directly to the view render to printer .
As a 10 year old MFCer ,I firmly believe that the Qt in the code reuse should be better .Since view can be directly render to printer ( thanks to Qt painter and printer design) ,why to still need to write delegate paint ?So ,my plan is the starting point from how to reuse render function to solve the print problem .
The success of the project ?Impatient Tx please see below .Print preview ,transverse ,longitudinal paging paging ,background color ,header ,footer ,check mark ......The others have .From a single page to hundreds of pages I have tested .
Then I ostrich upgrade program is how to achieve ?Actually very simple ,is based on view render function ,since the view current display content can be directly render to printer, then I will give it turning simulation ,then the render page on the list .
The first approach is to use the QScrollBar setValue on the horizontal and vertical flip .Is over first pages later ,turn to page second ,and then print ,and so on .But the last page is very difficult, if the last page with only a few lines of words ,is unable to continue downward turn ,is the result of the second last page many print guild was again out of print .
Is no way .Be nonplussed over sth. occasion, can only continue to double the Qt document ,when tableview setRowHidden and setColumnHidden these 2 functions ,I a moment was Carmack .( my idol ) soul .
This is not solved? What? Don ?Print end of page first, will print this page for the row ,and then print the next page .Print finished longitudinal paging ,will be printed by colum .
Print again longitudinal paging ( so as to realize the horizontal page ) .The rest is math ...Most of the problems were solved .I wrote a QTableView derived class MyTableView ,some printed code used in the David Johnson david@usermode.
org textprinter some of the code ,thanks to the open source community .My MyTableView class can achieve the following functions: 1 WYSIWYG print/ print preview, which means that each item background color ,text color ,display properties ,selection ,header ,frame .
.....All that you see tableview display ,can be directly printed wholly intact ;2 longitudinalpaging ,when in a row can not print all pages ,automatically on the next page to print again ;3 transversepage ,when the page on the right side of a column is not printed full time ,automatically at the next cross paging print again ;4print headerfooter 5print6print7print PDFfile code finishing, will be in the next patch release ,please look forward to .
Related articles:

No comments:

Post a Comment