M
M
Mercury132015-10-08 12:58:32
Qt
Mercury13, 2015-10-08 12:58:32

Qt: how to adjust high DPI in QTableView?

I continue to use Qt and QTableView. The following was found: on a large DPI, the text in the table is cut off.
What is the best way to adjust line height to monitor DPI?
UPD. I tried to adjust the automatic installation of sizes - it did not help. Large amounts of data are brutally slow. I try further.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2015-10-08
@Mercury13

I got the font through QFontMetrics and set its size, it seems to work.

E
EXL, 2015-10-09
@EXL

Regarding DPI, the following information may be very useful to you: doc.qt.io/qt-5.5/highdpi.html .
Try playing around with the QT_DEVICE_PIXEL_RATIO environment variable , maybe your application will look nice on your high DPI monitor.

qputenv("QT_DEVICE_PIXEL_RATIO", "auto");
// or
qputenv("QT_DEVICE_PIXEL_RATIO", "2");

In general, now Qt is actively rewriting cross-platform support for HighDPI, so there is information in the mailing list that QT_DEVICE_PIXEL_RATIO will soon become deprecated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question