Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-03-02 Thread Abdelrazak Younes
On 03/02/2010 04:09 PM, John McCabe-Dansted wrote: On Tue, Mar 2, 2010 at 1:30 AM, Abdelrazak Younes wrote: Problem is you are returning a pointer for a local variable... This is wrong as the model should be persistent of course. So you need to somewhat cache the buffer language model:

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-03-02 Thread John McCabe-Dansted
On Tue, Mar 2, 2010 at 1:30 AM, Abdelrazak Younes wrote: > Problem is you are returning a pointer for a local variable... This is wrong > as the model should be persistent of course. So you need to somewhat cache > the buffer language model: Thanks. > +QAbstractItemModel * GuiApplication::lang

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-03-01 Thread Abdelrazak Younes
On 03/01/2010 11:22 AM, John McCabe-Dansted wrote: On Mon, Mar 1, 2010 at 4:18 PM, Abdelrazak Younes wrote: No, the submenu would just have to call 'setModel(guiApp->languageModel(buffer))'. The conversion from std::set<...> would be automatically done in GuiApplication::languageModel().

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-03-01 Thread John McCabe-Dansted
On Mon, Mar 1, 2010 at 4:18 PM, Abdelrazak Younes wrote: > No, the submenu would just have to call > 'setModel(guiApp->languageModel(buffer))'. The conversion from std::set<...> > would be automatically done in GuiApplication::languageModel(). Thats what I meant :). > Yes :-) > > And something s

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-03-01 Thread Abdelrazak Younes
On 03/01/2010 09:08 AM, John McCabe-Dansted wrote: On Mon, Mar 1, 2010 at 3:44 PM, Abdelrazak Younes wrote: Menu is QMenu underneath; this indeed does not support QAbstractItemModel, which is IMHO a hole in Qt's API. I could extract the data from the QAbstractItemModel and pump it

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-03-01 Thread John McCabe-Dansted
On Mon, Mar 1, 2010 at 3:44 PM, Abdelrazak Younes wrote: > Menu is QMenu underneath; this indeed does not support QAbstractItemModel, > which is IMHO a hole in Qt's API. > >>  I could extract the data from the >> QAbstractItemModel and pump it into MenuItems, but would this >> eliminate any elegan

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread Abdelrazak Younes
On 03/01/2010 07:07 AM, John McCabe-Dansted wrote: On Sun, Feb 28, 2010 at 6:51 PM, John McCabe-Dansted wrote: On Sun, Feb 28, 2010 at 6:46 PM, Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Hum, I'd prefer that you create a new Language model for the Buffer; accessible

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread John McCabe-Dansted
On Sun, Feb 28, 2010 at 6:51 PM, John McCabe-Dansted wrote: > On Sun, Feb 28, 2010 at 6:46 PM, Jürgen Spitzmüller wrote: >> Abdelrazak Younes wrote: >>> Hum, I'd prefer that you create a new Language model for the Buffer; >>> accessible through GuiWorkArea::languageModel() or even better through

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread Jürgen Spitzmüller
John McCabe-Dansted wrote: > OK, I'm a little confused. We seem to use three types of language lists: > > 1) ./Language.h:typedef std::map > LanguageList; 2) ./LaTeXFeatures.h: typedef std::set > LanguageList; 3) void Buffer::getLanguages(std::set & > languages) const > > 2 and 3 are ba

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread John McCabe-Dansted
On Sun, Feb 28, 2010 at 6:36 PM, Abdelrazak Younes wrote: > Hum, I'd prefer that you create a new Language model for the Buffer; > accessible through GuiWorkArea::languageModel() or even better through > GuiApplication::languageModel(Buffer * buf). > Then sorting would be a matter of using QAbstra

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread Abdelrazak Younes
On 28/02/2010 11:51, John McCabe-Dansted wrote: On Sun, Feb 28, 2010 at 6:46 PM, Jürgen Spitzmüller wrote: Abdelrazak Younes wrote: Hum, I'd prefer that you create a new Language model for the Buffer; accessible through GuiWorkArea::languageModel() or even better through GuiApplicati

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread John McCabe-Dansted
On Sun, Feb 28, 2010 at 6:46 PM, Jürgen Spitzmüller wrote: > Abdelrazak Younes wrote: >> Hum, I'd prefer that you create a new Language model for the Buffer; >> accessible through GuiWorkArea::languageModel() or even better through >> GuiApplication::languageModel(Buffer * buf). >> Then sorting wo

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread Jürgen Spitzmüller
Abdelrazak Younes wrote: > Hum, I'd prefer that you create a new Language model for the Buffer; > accessible through GuiWorkArea::languageModel() or even better through > GuiApplication::languageModel(Buffer * buf). > Then sorting would be a matter of using QAbstractItemModel::sort() and > this

Re: r33590 - lyx-devel/trunk/src/frontends/qt4

2010-02-28 Thread Abdelrazak Younes
On 28/02/2010 11:06, sp...@lyx.org wrote: Author: spitz Date: Sun Feb 28 11:06:05 2010 New Revision: 33590 URL: http://www.lyx.org/trac/changeset/33590 Log: " Menus.cpp: sort languages. Based on a patch by John McCabe-Dansted. Modified: lyx-devel/trunk/src/frontends/qt4/Menus.cpp Modified: