Qt-interest Archive, February 2007
Questions about QAbstractFileEngineHandler
Message 1 in thread
I am triyng to use exeternal library for non-standard file system. So, I
subclassing and using QAbstractFileEngineHandler:
class MyFSHandler: QAbstractFileEngineHandler {
public:
MyFSHandler(const char *appName);
QAbstractFileEngine *create(const QString &fileName) const;
~MyFSHandler();
bool setupFS(int settingId, QString &somedata);
QString getFSSetting(int settingId);
}
I need to load actual FS library only once in application lifetime and have
some global settings forwarded into this external library, so I put all this
settings into QAbstractFileEngineHandler descendant...
And use it as suggested in main():
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
MyFSHandler myFS(argv[0]);
myFS.setupFS(....);
... etc
Everything works fine, I can read/write files, make directories and
everything.
But how can I get pointer to this handler later in the application, to
modify it's settings from some window?
--
[ signature omitted ]
Message 2 in thread
Hi,
you could change your MainForm's constructor so that it also takes a pointer
to MyFSHandler and saves it as class variable. Another, less elegant (in my
eyes) approach would be to save it in a global variable and export this
variable in every unit where it is needed.
Regards,
Ralf
Am Montag, 12. Februar 2007 19:58:52 schrieb George Brink:
> I am triyng to use exeternal library for non-standard file system. So, I
> subclassing and using QAbstractFileEngineHandler:
> class MyFSHandler: QAbstractFileEngineHandler {
> public:
> MyFSHandler(const char *appName);
> QAbstractFileEngine *create(const QString &fileName) const;
> ~MyFSHandler();
> bool setupFS(int settingId, QString &somedata);
> QString getFSSetting(int settingId);
> }
> I need to load actual FS library only once in application lifetime and have
> some global settings forwarded into this external library, so I put all
> this settings into QAbstractFileEngineHandler descendant...
>
> And use it as suggested in main():
> int main(int argc, char * argv[])
> {
> QApplication app(argc, argv);
> MyFSHandler myFS(argv[0]);
> myFS.setupFS(....);
> ... etc
> Everything works fine, I can read/write files, make directories and
> everything.
> But how can I get pointer to this handler later in the application, to
> modify it's settings from some window?
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 3 in thread
Well, both ways are not very pretty.... I expected to have something like
MyFS *fs = QAbstractFileEngineHandlerList::getHandler("MyFS")
But if there is no such static function, global pointer shoud do it...
"Ralf Jung" <ralfjung-qt@xxxxxxxxxxxxxx> wrote in message
news:200702122024.14734.ralfjung-qt@xxxxxxxxxxxxxxxxx
> Hi,
>
> you could change your MainForm's constructor so that it also takes a
pointer
> to MyFSHandler and saves it as class variable. Another, less elegant (in
my
> eyes) approach would be to save it in a global variable and export this
> variable in every unit where it is needed.
>
> Regards,
> Ralf
>
> Am Montag, 12. Februar 2007 19:58:52 schrieb George Brink:
> > I am triyng to use exeternal library for non-standard file system. So, I
> > subclassing and using QAbstractFileEngineHandler:
> > class MyFSHandler: QAbstractFileEngineHandler {
> > public:
> > MyFSHandler(const char *appName);
> > QAbstractFileEngine *create(const QString &fileName) const;
> > ~MyFSHandler();
> > bool setupFS(int settingId, QString &somedata);
> > QString getFSSetting(int settingId);
> > }
> > I need to load actual FS library only once in application lifetime and
have
> > some global settings forwarded into this external library, so I put all
> > this settings into QAbstractFileEngineHandler descendant...
> >
> > And use it as suggested in main():
> > int main(int argc, char * argv[])
> > {
> > QApplication app(argc, argv);
> > MyFSHandler myFS(argv[0]);
> > myFS.setupFS(....);
> > ... etc
> > Everything works fine, I can read/write files, make directories and
> > everything.
> > But how can I get pointer to this handler later in the application, to
> > modify it's settings from some window?
> >
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> > "unsubscribe" in the subject or the body. List archive and information:
> > http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]