[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Applying font changes to popupmenus.
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2000-08-02 3:01:52
[Download RAW message or body]

Well, I changed KComboBox and KLineEdit to use KPopupMenu ; so now it is used
in everything that uses KToolBar...

Regards,
Dawit A.

On Tue, 01 Aug 2000, David Faure wrote:
> I have fixed KMenuBar so that it dynamically reacts to font changes
> (i.e. when changing the font in kcontrol).
> Problem: standalone QPopupMenus don't react to font changes.
> Qt has an internal notification for changing the standard QApp font,
> (generalFont()), but not for widget-specific fonts such as the menu font.
> 
> I have implemented support for dynamically reacting to font changes
> in KPopupMenu... but this means, all KDE apps should create
> KPopupMenus instead of QPopupMenus when creating standalone
> popup menus, especially when creating them once and for all
> (such as kdesktop's, kicker's, etc.). 
> OTOH, konqueror creates it on demand, so no problem there.
> 
> Note: currently KPopupMenu was only used for optionnally setting a title on top
> of the menu. Reacting to font changes makes it a lot more mandatory to use it...
> 
> Below is the patch to KPopupMenu. If I then make kdesktop create KPopupMenus
> for the desktopMenu and the windowListMenu, it works.
> 
> 
> Is this the way to go, or am I overlooking something ?
> 
> 
> --- kpopupmenu.cpp      2000/07/05 17:04:43     1.4
> +++ kpopupmenu.cpp      2000/08/01 20:23:38
> @@ -174,8 +174,17 @@ QSize KPopupTitle::sizeHint() const
>  }
>  
>  KPopupMenu::KPopupMenu(QWidget *parent, const char *name)
> -    : QPopupMenu(parent, name) {}
> +    : QPopupMenu(parent, name) {
>  
> +    connect( kapp, SIGNAL(kdisplayFontChanged()), this, SLOT(kdisplayFontChanged()));
> +    kdisplayFontChanged();
> +}
> +
> +void KPopupMenu::kdisplayFontChanged()
> +{
> +    setFont(KGlobalSettings::menuFont());
> +}
> +
>  int KPopupMenu::insertTitle(const QString &text, int id, int index)
>  {
>      KPopupTitle *titleItem = new KPopupTitle();
> Index: kpopupmenu.h
> ===================================================================
> RCS file: /home/kde/kdelibs/kdeui/kpopupmenu.h,v
> retrieving revision 1.3
> diff -u -p -b -r1.3 kpopupmenu.h
> --- kpopupmenu.h        2000/06/26 12:31:15     1.3
> +++ kpopupmenu.h        2000/08/01 20:23:39
> @@ -140,6 +140,9 @@ public:
>       */
>      void setTitle(const QString &title);
>  
> +protected slots:
> +    void kdisplayFontChanged();
> +
>  private:
>      // For backwards compatibility
>      QString lastTitle;  
> 
> 
> -- 
> David FAURE, david@mandrakesoft.com, faure@kde.org
> http://home.clara.net/faure/, http://www.konqueror.org/
> KDE, Making The Future of Computing Available Today
> See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic