[Qt-interest] QFileDialog::getOpenFileName Directory name
yogesh upreti
yogesh.upreti at gmail.com
Tue Jun 8 13:35:59 CEST 2010
Hallo Oliver,
I was aware about the fact that its a static method, so I first wrote the
code without an instance. But my problem is this. If I write:
QString filePath = QFileDialog::getOpenFileName(this, "Caption",
"/foo/bar/baz/", "*.D"); (this is what I mean giving dir path explicitly);
it opens the dialog box in "/foo/bar/baz/" dir.
But if I write it
QString directoryPath = "/foo/bar/baz/";
QString filePath = QFileDialog::getOpenFileName(this, "Caption",
directoryPath, "*.D");
it dosen't open it in "/foo/bar/baz/" instead it opens it in current working
dir. I am using Nokia Qt SDK 2010 for compiling my programme.
I will try in the way you said (example with fd.exec()) and give the
feedback.
Thanks
Yogesh
Date: Tue, 8 Jun 2010 10:39:14 +0200
From: <Oliver.Knoll at comit.ch>
Subject: Re: [Qt-interest] QFileDialog::getOpenFileName Directory name
To: <qt-interest at trolltech.com>
Message-ID:
<C10F29AB06447B4881FC0DE1E302E2F206A5D1AEA6 at sg000036.corproot.net>
Content-Type: text/plain; charset="us-ascii"
yogesh upreti wrote on Tuesday, June 08, 2010 8:41 AM:
> Hallo Alex,
> No there is no specific reason to make the instance of the class, but
> this code is also ignoring the directory if I use QString var and
> works if I specify dir explicitly. :(
What do you mean with "it does not work when using QStrinv var, but it works
when you specify the directory explicitly?" - how do you explicitly specify
the directory?
I think there is still some confusion on your side with regards to the
static getOpenFileName() method: there is NO NON-static method
getOpenFileName() in the class QFileDialog!
So the following is actually WRONG (even though it actually compiles - in
Java/Eclipse and the proper tools installed you get a warning though in such
a case):
QFileDialog fd;
String filePath = fd.getOpenFileName(...); // WRONG!!! This method is
STATIC!
Once you realise this and since I strongly assume you know the restrictions
of static methods ("no access to member variables") you must also instantly
realise that a call to
fd.setDirectory(directoryPath);
can't possibly have an effect on the result of the call to the STATIC method
getOpenFileName()! This is a very basic OO-concept (in any OO-language).
So as already described in another post use the static method correctly,
e.g.
QString directoryPath = "/foo/bar/baz/";
QString filePath = QFileDialog::getOpenFileName(this, "Caption",
directoryPath);
or use an INSTANCE of QFileDialog (can be useful if you want to set
extra-options such as file filters):
QString directoryPath = "/foo/bar/baz/";
QFileDialog fd;
fd.setDirectory(directoryPath);
QStringList selectedFiles;
if (fd.exec())
selectedFiles = dialog.selectedFiles();
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
On Tue, Jun 8, 2010 at 11:27 AM, <qt-interest-request at trolltech.com> wrote:
> Send Qt-interest mailing list submissions to
> qt-interest at trolltech.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> or, via email, send a message with subject or body 'help' to
> qt-interest-request at trolltech.com
>
> You can reach the person managing the list at
> qt-interest-owner at trolltech.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Qt-interest digest..."
>
>
> Today's Topics:
>
> 1. Re: Showing a "Please wait" dialog during sql query (Linos)
> 2. QWebView don't refresh bottom page while scrolling (Agung Bayu)
> 3. Re: QFileDialog::getOpenFileName Directory name
> (Oliver.Knoll at comit.ch)
> 4. Re: Showing a "Please wait" dialog during sql query (Jan)
> 5. Qt 4.6.3 Released (jason.mcdonald at nokia.com)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 08 Jun 2010 10:16:32 +0200
> From: Linos <info at linos.es>
> Subject: Re: [Qt-interest] Showing a "Please wait" dialog during sql
> query
> To: Scott Bloom <scott.bloom at onshorecs.com>
> Cc: Qt-Interest <qt-interest at trolltech.com>
> Message-ID: <4C0DFC60.8000707 at linos.es>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> I am using something like this with pyqt, the only difference it is that i
> emit
> the QSqlQuery in a signal when the query has finished instead of return it
> from
> a method, but when later i execute other query in the same sql QThread with
> a
> new created QSqlQuery in the same QSqlDatabase connection of the thread,
> the
> first model get corrupted and gets the values of the last query.
>
> Miguel Angel
>
> El 08/06/10 07:53, Scott Bloom escribi?:
> > It got stripped.. My sent items has it attached...
> >
> > It was/is a zip file...
> >
> > Scott
> >
> >
> > On 6/7/10 10:23 PM, "Andre Somers"<andre at familiesomers.nl> wrote:
> >
> >> Op 8-6-2010 0:22, Scott Aron Bloom schreef:
> >>> I have attached a working solution. Its not fully vetted, so bugs
> >>> probably exist :) but it works in the case shown...
> >>>
> >>>
> >> Unfortunately, you have attached nothing...
> >>
> >> Andr?
> >>
> >> _______________________________________________
> >> Qt-interest mailing list
> >> Qt-interest at trolltech.com
> >> http://lists.trolltech.com/mailman/listinfo/qt-interest
> >
> >
> >
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 8 Jun 2010 01:30:12 -0700 (PDT)
> From: Agung Bayu <jeg_baguse at yahoo.com>
> Subject: [Qt-interest] QWebView don't refresh bottom page while
> scrolling
> To: qt-interest at trolltech.com
> Message-ID: <758812.511.qm at web113812.mail.gq1.yahoo.com>
> Content-Type: text/plain; charset=utf-8
>
> Hi everybody,
>
> I have encounter a problem with QWebView. the QT won't refresh the bottom
> page while the page scrolling.
> i try to call repaint slot of web view widget every second, but nothing
> change.
> than i try another trick, to hide and show the widget, i can fix the page
> with this way.
> have ever anyone get the same problem with me? and find better way to fix
> the problem.
>
> for more detail of the problem, please see this attachment :
> 1. before scroll : http://img175.imageshack.us/img175/4127/76609455.png
> 2. after scroll : http://img97.imageshack.us/img97/8130/68361818.png
> 3. another page after scroll :
> http://img19.imageshack.us/img19/1269/96439561.png
> thanks.
>
>
>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 8 Jun 2010 10:39:14 +0200
> From: <Oliver.Knoll at comit.ch>
> Subject: Re: [Qt-interest] QFileDialog::getOpenFileName Directory name
> To: <qt-interest at trolltech.com>
> Message-ID:
> <C10F29AB06447B4881FC0DE1E302E2F206A5D1AEA6 at sg000036.corproot.net>
> Content-Type: text/plain; charset="us-ascii"
>
> yogesh upreti wrote on Tuesday, June 08, 2010 8:41 AM:
>
> > Hallo Alex,
> > No there is no specific reason to make the instance of the class, but
> > this code is also ignoring the directory if I use QString var and
> > works if I specify dir explicitly. :(
>
> What do you mean with "it does not work when using QStrinv var, but it
> works when you specify the directory explicitly?" - how do you explicitly
> specify the directory?
>
> I think there is still some confusion on your side with regards to the
> static getOpenFileName() method: there is NO NON-static method
> getOpenFileName() in the class QFileDialog!
>
> So the following is actually WRONG (even though it actually compiles - in
> Java/Eclipse and the proper tools installed you get a warning though in such
> a case):
>
> QFileDialog fd;
> String filePath = fd.getOpenFileName(...); // WRONG!!! This method is
> STATIC!
>
> Once you realise this and since I strongly assume you know the restrictions
> of static methods ("no access to member variables") you must also instantly
> realise that a call to
>
> fd.setDirectory(directoryPath);
>
> can't possibly have an effect on the result of the call to the STATIC
> method getOpenFileName()! This is a very basic OO-concept (in any
> OO-language).
>
> So as already described in another post use the static method correctly,
> e.g.
>
> QString directoryPath = "/foo/bar/baz/";
> QString filePath = QFileDialog::getOpenFileName(this, "Caption",
> directoryPath);
>
> or use an INSTANCE of QFileDialog (can be useful if you want to set
> extra-options such as file filters):
>
> QString directoryPath = "/foo/bar/baz/";
> QFileDialog fd;
> fd.setDirectory(directoryPath);
> QStringList selectedFiles;
> if (fd.exec())
> selectedFiles = dialog.selectedFiles();
>
> Cheers, Oliver
> --
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79 520 95 22
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 08 Jun 2010 10:49:19 +0200
> From: Jan <janusius at gmx.net>
> Subject: Re: [Qt-interest] Showing a "Please wait" dialog during sql
> query
> To: qt-interest at trolltech.com
> Message-ID: <4C0E040F.70407 at gmx.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Just guessing ...
> Maybe it is also possible (and easier) to call
> QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents)
> during the population of the model in order to display a progressdialog.
> Haven't tried it but I suppose you need a timer in a separate thread then.
>
> Jan
>
> Am 07.06.2010 19:31, schrieb Gillen Daniel:
> > Hi @all
> >
> > I have a massive problem here and don't seem to find a solution for it.
> >
> > I'm developping a database application based on a MySQL database and I
> > would need to display a "Please wait" dialog while
> > populating a QSqlQueryModel. The data from QSqlQueryModel gets displayed
> > in a widget in my main window, so I have to exec the query in my main
> > thread. The problem is that any dialog I open before querying the data
> > hangs as my query blocks the main thread.
> >
> > Does anyone has an idea on how I could solve this? I would need some
> > sort of 2nd thread which displays the dialog with his own event loop but
> > as far as I understand, Qt does not support GUI interaction in a second
> > thread. Or is it perhaps possible to exec the query in a second thread
> > and then move the whole QSqlQueryModel and database connection to my
> > main thread?
> >
> > Thx in advance
> >
>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 8 Jun 2010 11:15:29 +0200
> From: <jason.mcdonald at nokia.com>
> Subject: [Qt-interest] Qt 4.6.3 Released
> To: <qt-interest at trolltech.com>, <qt-announce at trolltech.com>
> Message-ID:
> <
> 43209CC755D3AD4AA4F6E17E1B8B3A0E570CC3BC8B at NOK-EUMSG-01.mgdnok.nokia.com>
>
> Content-Type: text/plain; charset="us-ascii"
>
> We're pleased to announce the release of Qt 4.6.3. The release brings
> bugfixes and optimizations made based on feedback received from Qt users
> since the release of Qt 4.6.2. Also released are updates to the Qt Visual
> Studio Add-in and a new build of the Qt SDK.
>
> Customers will find the releases in their download areas. All Qt releases
> are also available for download from http://qt.nokia.com/downloads.
>
> For detailed information, please consult the changes-4.6.3 file found in
> the packages, or browse the information contained in the Developer Zone at:
> http://qt.nokia.com/developer/changes/changes-4.6.3.
>
>
> DOWNLOAD THE RELEASES
> ---------------------
> All Qt releases are available for download from
> http://qt.nokia.com/downloads.
>
>
> HOW TO REPORT BUGS
> ------------------
> Any problems encountered can be reported via the Qt Bug Tracker at
> http://bugreports.qt.nokia.com. If you are a commercial customer and
> require support, please log in to the customer portal at
> https://qt.nokia.com/customerportal.
>
> We hope you enjoy the releases!
>
> --
> The Qt Team
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.trolltech.com/pipermail/qt-interest/attachments/20100608/d32f7dd1/attachment.html
>
> ------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
> End of Qt-interest Digest, Vol 19, Issue 62
> *******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100608/912bec11/attachment.html
More information about the Qt-interest-old
mailing list