From ab8e67c2cc598454798fcc99a7d24505fd4ccdd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 17 Aug 2009 07:42:06 +0000 Subject: [PATCH] [GB.QT4] * BUG: Fix the Dialog.Font property. git-svn-id: svn://localhost/gambas/trunk@2238 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.qt4/src/CDialog.cpp | 35 +++++++++++++++++------------------ gb.qt4/src/CFont.cpp | 1 - 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/gb.qt4/src/CDialog.cpp b/gb.qt4/src/CDialog.cpp index 8231aecd0..4e3a1e786 100644 --- a/gb.qt4/src/CDialog.cpp +++ b/gb.qt4/src/CDialog.cpp @@ -38,7 +38,7 @@ static QString dialog_title; static GB_ARRAY dialog_filter = NULL; static QString dialog_path; static GB_ARRAY dialog_paths = NULL; -static QFont *dialog_font; +static CFONT *dialog_font = NULL; static unsigned int dialog_color = 0; @@ -72,18 +72,11 @@ static QString get_filter(void) } -BEGIN_METHOD_VOID(CDIALOG_init) - - //dialog_font = new QFont(); - -END_METHOD - BEGIN_METHOD_VOID(CDIALOG_exit) - GB.StoreObject(NULL, POINTER(&dialog_filter)); - GB.StoreObject(NULL, POINTER(&dialog_paths)); - if (dialog_font) - delete dialog_font; + GB.StoreObject(NULL, POINTER(&dialog_filter)); + GB.StoreObject(NULL, POINTER(&dialog_paths)); + GB.StoreObject(NULL, POINTER(&dialog_font)); END_METHOD @@ -128,12 +121,14 @@ END_PROPERTY BEGIN_PROPERTY(CDIALOG_font) if (READ_PROPERTY) - GB.ReturnObject(CFONT_create(*dialog_font)); + GB.ReturnObject(dialog_font); else { - if (GB.CheckObject(VPROP(GB_OBJECT))) - return; - *dialog_font = *(((CFONT *)VPROP(GB_OBJECT))->font); + CFONT *font = (CFONT *)VPROP(GB_OBJECT); + + GB.StoreObject(NULL, POINTER(&dialog_font)); + if (font) + dialog_font = CFONT_create(*font->font); } END_PROPERTY @@ -260,7 +255,10 @@ BEGIN_METHOD_VOID(CDIALOG_select_font) int dpiX, dpiY; #endif - qfont = *dialog_font; + if (dialog_font) + qfont = *dialog_font->font; + else + qfont = QApplication::font(); //qDebug("AVANT: %g --> %g", qfont.pointSizeFloat(), SIZE_REAL_TO_VIRTUAL(qfont.pointSizeFloat())); qfont.setPointSizeF(SIZE_REAL_TO_VIRTUAL(qfont.pointSizeF())); @@ -285,7 +283,8 @@ BEGIN_METHOD_VOID(CDIALOG_select_font) GB.ReturnBoolean(true); else { - *dialog_font = qfont; + GB.StoreObject(NULL, POINTER(&dialog_font)); + dialog_font = CFONT_create(qfont); GB.ReturnBoolean(false); } @@ -295,7 +294,7 @@ GB_DESC CDialogDesc[] = { GB_DECLARE("Dialog", 0), GB_VIRTUAL_CLASS(), - GB_STATIC_METHOD("_init", NULL, CDIALOG_init, NULL), + //GB_STATIC_METHOD("_init", NULL, CDIALOG_init, NULL), GB_STATIC_METHOD("_exit", NULL, CDIALOG_exit, NULL), GB_STATIC_METHOD("OpenFile", "b", CDIALOG_open_file, "[(Multi)b]"), diff --git a/gb.qt4/src/CFont.cpp b/gb.qt4/src/CFont.cpp index c1bc2c8cc..86f1ef41b 100644 --- a/gb.qt4/src/CFont.cpp +++ b/gb.qt4/src/CFont.cpp @@ -22,7 +22,6 @@ #define __CFONT_CPP - #include "gambas.h" #include "main.h"