[Qt-interest] Problems when using Models in aconsole application

Scott Aron Bloom Scott.Bloom at onshorecs.com
Fri Oct 15 19:53:15 CEST 2010


And...

What is the problem?

This code works for me..

#include <QCoreApplication>
#include <QStringListModel>

int main( int argc , char ** argv )
{
	QCoreApplication appl( argc, argv );

	QStringListModel model;
	model.setStringList( QStringList() << "foo" << "bar" );

	qDebug() << model.stringList();

	return appl.exec();
}

Qt += GUI is set, and I have the console turned on.

Scott

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of NoRulez
Sent: Thursday, October 14, 2010 11:16 PM
To: Qt Interest MailingList
Subject: Re: [Qt-interest] Problems when using Models in aconsole
application

I have a QCoreApplication instance and I want to use std::cout for the
output of the model data

Am 14.10.2010 um 16:38 schrieb Scott Aron Bloom
<Scott.Bloom at onshorecs.com>:

> If you are only using the model and not the view based system, IIRC
you
> should be able to use QCoreApplication 
> 
> Scott
> 
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of NoRulez
> Sent: Thursday, October 14, 2010 12:04 AM
> To: Qt Interest MailingList
> Subject: [Qt-interest] Problems when using Models in a console
> application
> 
> Hello,
> 
> I have problems to use QStandardItemModel and QSortFilterProxyModel in
a
> console application.
> 
> I have a headless server, on this I get the following error when I'm
try
> to start the application: "cannot connect to X server"
> 
> Can anybody help me to use models in a console application?
> 
> Thanks in advance
> 
> Best Regards
> NoRulez
> _______________________________________________
> 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
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list