mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
Implement the get_screen_dpi function
This is sadly known to be incorrect on most systems. But it's as incorrect as it was on Gtk so should work equally well to get roughly the right sizes for printing - once we implement printing, that is :-) Also removed a qDebug that snuck in in commit 6fc4d72079dd ("Enable defautl_filename in settings"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bfef1d0219
commit
3e22e388e9
2 changed files with 8 additions and 5 deletions
|
@ -6,15 +6,13 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#define SCALE_SCREEN 1.0
|
||||
#warning "PORT THE get_screen_dpi to Qt"
|
||||
#define SCALE_PRINT 1.0
|
||||
//#define SCALE_PRINT (1.0 / get_screen_dpi())
|
||||
#define SCALE_PRINT (1.0 / get_screen_dpi())
|
||||
|
||||
extern void repaint_dive(void);
|
||||
extern void do_print(void);
|
||||
|
||||
// Commented out because I don't know how to get the dpi on a paint device yet.
|
||||
// extern gdouble get_screen_dpi(void);
|
||||
extern double get_screen_dpi(void);
|
||||
|
||||
/* Plot info with smoothing, velocity indication
|
||||
* and one-, two- and three-minute minimums and maximums */
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <QTextCodec>
|
||||
#include <QTranslator>
|
||||
#include <QSettings>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
class Translator: public QTranslator
|
||||
{
|
||||
|
@ -83,7 +84,6 @@ void init_ui(int *argcp, char ***argvp)
|
|||
if (v.isValid()) {
|
||||
QString name = v.toString();
|
||||
prefs.default_filename = strdup(name.toUtf8());
|
||||
qDebug("default filename %s", prefs.default_filename);
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
|
@ -200,4 +200,9 @@ QString get_pressure_string(pressure_t pressure, bool showunit)
|
|||
}
|
||||
}
|
||||
|
||||
double get_screen_dpi()
|
||||
{
|
||||
QDesktopWidget *mydesk = application->desktop();
|
||||
return mydesk->physicalDpiX();
|
||||
}
|
||||
#include "qt-gui.moc"
|
||||
|
|
Loading…
Add table
Reference in a new issue