All You Need is a little Polish
When you write documentation on a daily basis, with very little link to the outside world* beyond the tasks created by our esteemed Support department, you can get lost in your own little world, thinking your documentation is perfect ;)
So if the documentation is perfect, then Qt is perfect, no?
But, I digress (before I get into trouble for making overly optimistic conclusions). To obtain a different perspective, I moonlighted in Support for almost 6 months and realized "There is always room for improvement".
Now one of these improvements came in the form of a question asked by a nice customer: How do you print with Item Views?
This got me thinking. I looked through most of Qt's examples thinking "Surely we have an example that does this." but there was no example with this feature. Digging a little deeper, I realized that Qt did not provide this solution directly. In a perfect world, there would be a big, red, blinky "print()" function in the API. Alas, we do not live in a perfect world.
But, here's a solution I have in mind. It is now part of the Spreadsheet demo, in the next release.
Below is the code I used.
class PrintView : public QTableView
void print(QPrinter *printer);
There is a special PrintView class that inherits QTableView, and here is its implementation:
void PrintView::print(QPrinter *printer)
And here's the output.
I do plan to find ways to improve this though. So, feedback/other ideas are definitely welcome ;) No brickbats please, I am only human.
You will notice, the Spreadsheet demo's code got a bit of polish, in the process. Nice shiny headers and cpp files were used to make it feel young, hot, and sexy again ;) Can you believe it was shipped in a "main.cpp" file all this while? Shame on us!
P/s - A shout out to Simon and MBM for pushing my clean, innocent *cough* mind in the right direction!
* Last I heard, there were no conferences for poor technical writers.
Subscribe to our newsletter
Try Qt 6.4 Now!
Download the latest release here: www.qt.io/download.
Qt 6 is the productivity platform for the future, with next-gen 2D & 3D UX and limitless scalability.
Explore Qt World
Check our Qt demos and case studies in the virtual Qt World
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don't want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu