Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
Is there a function which can tell name of the platform at runtime?


Message 1 in thread

Hi,

I wonder if there is a function which can tell name of the current 
platform at runtime, just like qVersion() tells the version of Qt.

Thanks,
Lingfa


--
 [ signature omitted ] 

Message 2 in thread

Von: Lingfa Yang
> Hi,
> 
> I wonder if there is a function which can tell name of the current 
> platform at runtime, just like qVersion() tells the version of Qt.
> 
Yes.
Just take a short look into the Qt documentation to find out how you get system informations... is it to complicated to look if there's a usable class before asking on the list?

Christian
-- 
 [ signature omitted ] 

Message 3 in thread

Hi

No need to be flaming people, look inside the QSysInfo class,
http://doc.trolltech.com/qtopia4.2/qsysinfo.html, you will find it
there.

// anders

On 8/9/07, Christian Ehrlicher <Ch.Ehrlicher@xxxxxx> wrote:
> Von: Lingfa Yang
> > Hi,
> >
> > I wonder if there is a function which can tell name of the current
> > platform at runtime, just like qVersion() tells the version of Qt.
> >
> Yes.
> Just take a short look into the Qt documentation to find out how you get system informations... is it to complicated to look if there's a usable class before asking on the list?
>
> Christian
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
>
> --
> 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 4 in thread

Le Thursday 09 August 2007 02:01:55 am Anders Sandholm, vous avez écrit :
> No need to be flaming people, look inside the QSysInfo class,
> http://doc.trolltech.com/qtopia4.2/qsysinfo.html, you will find it
> there.

Also while not an answer to the question (but it's related), but you can test 
the OS at compile time by checking for the Q_OS_* preprocessor symbols. See 
http://doc.trolltech.com/4.3/qtglobal.html#Q_OS_AIX for a list of them. One 
thing not explained in the list, though, is that more than one may be 
defined. For example on a Linux system Q_OS_LINUX and Q_OS_UNIX are both 
defined and on Mac OS X, Q_OS_UNIX, Q_OS_DARWIN, Q_OS_BSD4, Q_OS_MAC, 
Q_OS_MACX, and either (Q_OS_DARWIN32 and Q_OS_MAC32) or (Q_OS_DARWIN64 and 
Q_OS_MAC64) are all defined.

Katrina Niolet

--
 [ signature omitted ] 

Message 5 in thread

Katrina Niolet wrote:

>Le Thursday 09 August 2007 02:01:55 am Anders Sandholm, vous avez écrit :
>  
>
>>No need to be flaming people, look inside the QSysInfo class,
>>http://doc.trolltech.com/qtopia4.2/qsysinfo.html, you will find it
>>there.
>>    
>>
>
>Also while not an answer to the question (but it's related), but you can test 
>the OS at compile time by checking for the Q_OS_* preprocessor symbols. See 
>http://doc.trolltech.com/4.3/qtglobal.html#Q_OS_AIX for a list of them. One 
>thing not explained in the list, though, is that more than one may be 
>defined. For example on a Linux system Q_OS_LINUX and Q_OS_UNIX are both 
>defined and on Mac OS X, Q_OS_UNIX, Q_OS_DARWIN, Q_OS_BSD4, Q_OS_MAC, 
>Q_OS_MACX, and either (Q_OS_DARWIN32 and Q_OS_MAC32) or (Q_OS_DARWIN64 and 
>Q_OS_MAC64) are all defined.
>
>Katrina Niolet
>
>--
>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/
>
>  
>

Katrina and Anders,

I use what I just learned from both of you to title a query, which gives 
a nice output.

void MainWindow::supported()
{
#ifdef WINNT
    QString platform( tr("%1").arg(winName(QSysInfo::WindowsVersion)));
#else if Q_OS_LINUX
    QString platform("X11");
#endif
    QString msg( tr("Qt %1 on %2 supports\n").arg(qVersion 
()).arg(platform) );

    msg += "QImageReader::supportedImageFormats()\n";
    QList< QByteArray > readerList = QImageReader::supportedImageFormats ();
    int count = 1;
    foreach(QByteArray item, readerList)
    {
        msg += tr("%1:\t%2\n").arg(count).arg(QString(item));
        count ++;
    }


Qt 4.3.0 on Windows XP supports
QImageReader::supportedImageFormats()
1:    bmp
2:    gif
3:    jpeg
4:    jpg
5:    mng
...

Thank you both for helpful replies.

To Christian Ehrlicher at de meaning "down from, off, concerning." Used 
as a prefix in Eng., as in defrost (1895), defuse (1943), decaffeination 
(1927), etc. Usually felt as meaning "down" :-)

Your answer turns to be more helpful is you could write "QSysInfo" 
instead of "system informations".
To your question, I did search for platform info, and not found 
QSysInfo, that's why I ask. Do you think there is anything wrong to ask 
such a question?
Thank you anyway.

Lingfa


--
 [ signature omitted ]