Re: [Interest] Updating a model re-add everything in QML. How can i prevent that?

2012-11-08 Thread Bo Thorsen
Den 08-11-2012 01:33, Mark skrev:
 Hi,

 I have a models in C++ (a QStringList actually). In QML i'm displaying
 it using a repeater. Now when i remove some items from the end of the
 list (which happens quite a few times) then the entire list seems to
 go through the QML repeater again.

 What i want to do is put a QStringList in a QML Repeater (works), but
 when i remove items from the end i would like QML to be smart and
 also remove the items from the end and leave those that haven't
 changed. Thus not re-inserting all the items in the repeater when not
 needed.

 Is there some option to get that?

To do this you need a better model than a QStringList in Repeater. Take 
a look at QStringListModel instead. But if you just call setStringList() 
you won't see any improvement. You have to use insertRows and removeRows 
instead.

Bo Thorsen.

Come by my DevDays talk in Berlin - Designing for testability. Learn how to 
build and run your unit tests with the Qt application.

Fionia Software - Qt experts for hire.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QTreeView width with scroll bar

2012-11-08 Thread Tony Rietwyk

 Sent: Thursday, 8 November 2012 6:40 PM
 
 On 2012/11/08 09:23 AM, Alex Strickland wrote:
 
  However, when the QTreeView gets long enough to automatically add a
  scroll bar - my calculations don't work and one of the check box
  columns is obscured by the scrollbar. How can I check if the scroll
  bar is activated and, if so, obtain it's width to factor into my
calculation?
 
 I should write the message and just not send it... :
 
 class CrossTabTreeView : public QTreeView {
 public:
  CrossTabTreeView(QWidget* parent = 0) : QTreeView(parent) {}
  void resizeEvent(QResizeEvent* /*event - suppress unused warning*/)
  {
  if (model()-columnCount() == CrossTabView::ColumnCount) {
  int scrollBarWidth = 0;
  QScrollBar* scrollBar = verticalScrollBar();
  if (scrollBar) {
  if (scrollBar-isVisible())
  scrollBarWidth = scrollBar-width();
  }
  resizeColumnToContents(CrossTabView::RowColumn);
  resizeColumnToContents(CrossTabView::ColumnColumn);
  setColumnWidth(CrossTabView::QuestionColumn,
 width() - columnWidth(CrossTabView::RowColumn)
 - columnWidth(CrossTabView::ColumnColumn) -
 scrollBarWidth);
  }
  }
 };
 
 --
 Regards
 Alex

Hi Alex, 

The QAbstractScrollArea  docs are a bit vague.  Many of the standard event
handlers are overloaded to be called when the viewport (sub) widget gets the
events.  The docs don't say what happens to the normal events for
QAbstractScrollArea.  When a resize occurs, does resizeEvent only get called
once for the viewport, or twice?  If twice, how do we know which widget the
event is for?  

Instead of width() - scrollBarWidth, I suggest to use viewport()-width(),
which should already exclude the vertical scroll bar.  

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt 4.8.3 MinGW 4.4.0 undefined reference to WinMain@16 with TEMPLATE = lib

2012-11-08 Thread andy fillebrown
Hi,

I'm getting undefined references to WinMain@16 when building my
libraries with Qt 4.8.3 using the provided MinGW 4.4.0 toolchain.  I
did some searching but all I could find was QTBUG-27227, which isn't
very helpful since I don't want to build in the source tree.  I don't
mind hacking on the mkspecs if that's the issue, but I can't find any
info on how to fix this issue locally.  Is it a qmake issue?  How can
I fix it?

Cheers,
~ andy.f
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] compiling qt with eglfs

2012-11-08 Thread Samuel Rødal
On 11/08/2012 01:55 PM, pritam.ghang...@gmail.com wrote:
 I am still stuck with qt 4.8.3 with qpa. It always compiles, but I never
 got it to work.
 Now when i try the application its failing at load time itself
 # ./hellogl_es2 -qpa -platform egl
 Failed to load platform plugin egl. Available platforms are:
 Minimal

 if I try Minimal, I get a segfault.
 ./hellogl_es2 -qpa -platform Minimal
 Segmentation fault

 backtrace from gdb shows that it crashes in
 QGLContext::chooseContext(QGLContext const*) ()

The minimal plugin doesn't support OpenGL.

 I have no idea what to do next. why didn't I get eglfs plugin when I had
 specified -egl in configure.

Try specifying -eglfs and -opengl es2 when running configure and see 
what the configure output says.

--
Samuel
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] compiling qt with eglfs

2012-11-08 Thread pritam.ghang...@gmail.com
On Thu, Nov 8, 2012 at 8:00 PM, Samuel Rødal samuel.ro...@digia.com wrote:

 On 11/08/2012 01:55 PM, pritam.ghang...@gmail.com wrote:
  I am still stuck with qt 4.8.3 with qpa. It always compiles, but I never
  got it to work.
  Now when i try the application its failing at load time itself
  # ./hellogl_es2 -qpa -platform egl
  Failed to load platform plugin egl. Available platforms are:
  Minimal
 
  if I try Minimal, I get a segfault.
  ./hellogl_es2 -qpa -platform Minimal
  Segmentation fault
 
  backtrace from gdb shows that it crashes in
  QGLContext::chooseContext(QGLContext const*) ()

 The minimal plugin doesn't support OpenGL.

  I have no idea what to do next. why didn't I get eglfs plugin when I had
  specified -egl in configure.

 Try specifying -eglfs and -opengl es2 when running configure and see
 what the configure output says.

 I will try that tomorrow. I had tried specifying -qpa eglfs. But that
didnt help.
I compiled by actually going to  src/plugins/platforms/eglfs. Surprisingly
makefile was there. The build system ran qmake on it, but somehow never ran
make.
Right now I dont have board to test it. I will get board again tomorrow. I
will test it and let you know.

 --
 Samuel
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest




-- 
cheers,
pritam
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] debug QtService

2012-11-08 Thread BRM
 From: Sergey sh0...@gmail.com

Hello, all

I'm developing windows web service using QtService.
To debug it, I launch program in VS2005 debugger with -e argument.
It starts in console mode and handles requests.
How can I emulate stopping the service, so that all code, which is 
working usually when windows stops the service?

I want to make web service method, requesing which I would tell service 
to stop.

void RequestMapper::service(HttpRequest request, HttpResponse response) {
     QByteArray path=request.getPath();

#ifdef _DEBUG
     if (path.startsWith(/stop)) {
         //QCoreApplication::instance()-exit(); // this leads to error 
in  HttpConnectionHandler::run() in line: 
moveToThread(QCoreApplication::instance()-thread());

How to emulate stopping the service here, so that program, running with 
-e argument would stop normally, as it stops when running as windows 
service?

     }
#endif
}


You'll have to look up the Windows headers you'll need, but you want to use the 
Debug() Win32 function.
It triggers the Debugger to run.
The best way to use it is to call it early in the life of the service so you 
can connect the service with VS in a controlled manner, and then set the break 
point where you want it and continue to run it.


Ben

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Updating a model re-add everything in QML. How can i prevent that?

2012-11-08 Thread Nicolás Ulrich
Are you really using this?
qRegisterMetaTypePathModel*(PathModel*);(with the * in
the string)

I guess it should be
qRegisterMetaTypePathModel*(PathModel);



On Thu, Nov 8, 2012 at 10:36 AM, Mark mark...@gmail.com wrote:
 On Thu, Nov 8, 2012 at 10:34 AM, Bo Thorsen b...@fioniasoftware.dk wrote:
 Den 08-11-2012 01:33, Mark skrev:
 Hi,

 I have a models in C++ (a QStringList actually). In QML i'm displaying
 it using a repeater. Now when i remove some items from the end of the
 list (which happens quite a few times) then the entire list seems to
 go through the QML repeater again.

 What i want to do is put a QStringList in a QML Repeater (works), but
 when i remove items from the end i would like QML to be smart and
 also remove the items from the end and leave those that haven't
 changed. Thus not re-inserting all the items in the repeater when not
 needed.

 Is there some option to get that?

 To do this you need a better model than a QStringList in Repeater. Take
 a look at QStringListModel instead. But if you just call setStringList()
 you won't see any improvement. You have to use insertRows and removeRows
 instead.

 Bo Thorsen.

 Come by my DevDays talk in Berlin - Designing for testability. Learn how 
 to build and run your unit tests with the Qt application.

 Fionia Software - Qt experts for hire.

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

 Thanks a lot for that, that will probably work.
 However, i'm hitting another issue when trying to make a custom
 StringListModel (only due to setRoleNames...) This is how it looks:

 // pathmodel.h
 #ifndef PATHMODEL_H
 #define PATHMODEL_H

 #include QStringListModel

 class PathModel : public QStringListModel
 {
 public:
 PathModel();
 };

 Q_DECLARE_METATYPE(PathModel*)

 #endif // PATHMODEL_H


 // pathmodel.cpp
 #include pathmodel.h

 PathModel::PathModel()
 {
 QHashint,QByteArray roleNames;
 roleNames.insert(Qt::DisplayRole, modelData);
 setRoleNames(roleNames);
 }

 Now if i want to register the new meta type using:
 qRegisterMetaTypePathModel*(PathModel*);

 The app instantly crashes when i run it.. It must be something very
 obvious that i'm missing, but i don't see it.

 Any idea what i'm doing wrong?
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Updating a model re-add everything in QML. How can i prevent that?

2012-11-08 Thread Mark
On Thu, Nov 8, 2012 at 6:43 PM, Nicolás Ulrich nikola...@gmail.com wrote:
 Are you really using this?
 qRegisterMetaTypePathModel*(PathModel*);(with the * in
 the string)

 I guess it should be
 qRegisterMetaTypePathModel*(PathModel);



 On Thu, Nov 8, 2012 at 10:36 AM, Mark mark...@gmail.com wrote:
 On Thu, Nov 8, 2012 at 10:34 AM, Bo Thorsen b...@fioniasoftware.dk wrote:
 Den 08-11-2012 01:33, Mark skrev:
 Hi,

 I have a models in C++ (a QStringList actually). In QML i'm displaying
 it using a repeater. Now when i remove some items from the end of the
 list (which happens quite a few times) then the entire list seems to
 go through the QML repeater again.

 What i want to do is put a QStringList in a QML Repeater (works), but
 when i remove items from the end i would like QML to be smart and
 also remove the items from the end and leave those that haven't
 changed. Thus not re-inserting all the items in the repeater when not
 needed.

 Is there some option to get that?

 To do this you need a better model than a QStringList in Repeater. Take
 a look at QStringListModel instead. But if you just call setStringList()
 you won't see any improvement. You have to use insertRows and removeRows
 instead.

 Bo Thorsen.

 Come by my DevDays talk in Berlin - Designing for testability. Learn how 
 to build and run your unit tests with the Qt application.

 Fionia Software - Qt experts for hire.

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

 Thanks a lot for that, that will probably work.
 However, i'm hitting another issue when trying to make a custom
 StringListModel (only due to setRoleNames...) This is how it looks:

 // pathmodel.h
 #ifndef PATHMODEL_H
 #define PATHMODEL_H

 #include QStringListModel

 class PathModel : public QStringListModel
 {
 public:
 PathModel();
 };

 Q_DECLARE_METATYPE(PathModel*)

 #endif // PATHMODEL_H


 // pathmodel.cpp
 #include pathmodel.h

 PathModel::PathModel()
 {
 QHashint,QByteArray roleNames;
 roleNames.insert(Qt::DisplayRole, modelData);
 setRoleNames(roleNames);
 }

 Now if i want to register the new meta type using:
 qRegisterMetaTypePathModel*(PathModel*);

 The app instantly crashes when i run it.. It must be something very
 obvious that i'm missing, but i don't see it.

 Any idea what i'm doing wrong?
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

Yes.

But even if i change it to your suggestion it doesn't work. It's all
in the private copy ctor...
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] How to force a repaint?

2012-11-08 Thread Eric Clark
Hello All,

I am sorry if this sounds like a dumb question, but right now my company has 
locked us out of getting to the Qt documentation via our ridiculous proxy. 
Anyway, can anyone tell me of a function or an easy way (other than resizing 
the widget) to force a Widget to repaint?

Thank You,
Eric Clark

To be fond of something is better than merely to know it, and to find joy in it 
is better than merely to be fond of it. -- The Analects, Confucius

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] How to force a repaint?

2012-11-08 Thread Bo Thorsen

Den 08-11-2012 20:59, Eric Clark skrev:


Hello All,

I am sorry if this sounds like a dumb question, but right now my 
company has locked us out of getting to the Qt documentation via our 
ridiculous proxy. Anyway, can anyone tell me of a function or an easy 
way (other than resizing the widget) to force a Widget to repaint?


Thank You,

Eric Clark



widget-update(); // Repaint when the event system feels like it

widget-repaint(); // Repaint right now

99.9% of the times, you want to use the first one.

Bo Thorsen.

Come by my DevDays talk in Berlin - Designing for testability. Learn how to 
build and run your unit tests with the Qt application.

Fionia Software - Qt experts for hire.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Dependency Injection

2012-11-08 Thread Yunior Bauta Pentón
Hello.
What is Dependency Injection Framework more used actually to Qt and C++ ? Any 
sample ?
Thank

--




Ing. Yunior Bauta Pentón
Dpto: PostgreSQL/DATEC
Universidad de las Ciencias Informáticas
http://postgresql.uci.cu



10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS 
INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] How to force a repaint?

2012-11-08 Thread Eric Clark
Thank you Bo!

From: interest-bounces+eclark=ara@qt-project.org 
[mailto:interest-bounces+eclark=ara@qt-project.org] On Behalf Of Bo Thorsen
Sent: Thursday, November 08, 2012 2:09 PM
To: interest@qt-project.org
Subject: Re: [Interest] How to force a repaint?

Den 08-11-2012 20:59, Eric Clark skrev:
Hello All,

I am sorry if this sounds like a dumb question, but right now my company has 
locked us out of getting to the Qt documentation via our ridiculous proxy. 
Anyway, can anyone tell me of a function or an easy way (other than resizing 
the widget) to force a Widget to repaint?

Thank You,
Eric Clark

widget-update(); // Repaint when the event system feels like it

widget-repaint(); // Repaint right now

99.9% of the times, you want to use the first one.




Bo Thorsen.



Come by my DevDays talk in Berlin - Designing for testability. Learn how to 
build and run your unit tests with the Qt application.



Fionia Software - Qt experts for hire.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Updating a model re-add everything in QML. How can i prevent that?

2012-11-08 Thread Nicolás Ulrich
I got this and it seems to work fine (Qt 4.8), but it's not a model. I
remember a similar problem with the constructor but I think it was
because I was using Q_DECLARE_METATYPE(MyClass) instead of
Q_DECLARE_METATYPE(MyClass*).

--
MyClass.h
--
#ifndef MYCLASS_H
#define MYCLASS_H

#include QObject
#include QVariant // needed for Q_DECLARE_METATYPE

class MyClass : public QObject
{
Q_OBJECT
public:
explicit MyClass(QObject *parent = 0);
~MyClass();

signals:

public slots:

private:

};
Q_DECLARE_METATYPE(MyClass*)
#endif // MYCLASS_H



main.cpp

#include QtDeclarative // needed for qmlRegisterType

int main(int argc, char** argv)
{
QApplication app(argc, argv);
qmlRegisterTypeMyClass(MyClass, 1, 0, MyClass);
...

-
QML
-

import MyClass 1.0

...
MyClass {}





On Thu, Nov 8, 2012 at 3:09 PM, Mark mark...@gmail.com wrote:
 On Thu, Nov 8, 2012 at 6:43 PM, Nicolás Ulrich nikola...@gmail.com wrote:
 Are you really using this?
 qRegisterMetaTypePathModel*(PathModel*);(with the * in
 the string)

 I guess it should be
 qRegisterMetaTypePathModel*(PathModel);



 On Thu, Nov 8, 2012 at 10:36 AM, Mark mark...@gmail.com wrote:
 On Thu, Nov 8, 2012 at 10:34 AM, Bo Thorsen b...@fioniasoftware.dk wrote:
 Den 08-11-2012 01:33, Mark skrev:
 Hi,

 I have a models in C++ (a QStringList actually). In QML i'm displaying
 it using a repeater. Now when i remove some items from the end of the
 list (which happens quite a few times) then the entire list seems to
 go through the QML repeater again.

 What i want to do is put a QStringList in a QML Repeater (works), but
 when i remove items from the end i would like QML to be smart and
 also remove the items from the end and leave those that haven't
 changed. Thus not re-inserting all the items in the repeater when not
 needed.

 Is there some option to get that?

 To do this you need a better model than a QStringList in Repeater. Take
 a look at QStringListModel instead. But if you just call setStringList()
 you won't see any improvement. You have to use insertRows and removeRows
 instead.

 Bo Thorsen.

 Come by my DevDays talk in Berlin - Designing for testability. Learn how 
 to build and run your unit tests with the Qt application.

 Fionia Software - Qt experts for hire.

 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

 Thanks a lot for that, that will probably work.
 However, i'm hitting another issue when trying to make a custom
 StringListModel (only due to setRoleNames...) This is how it looks:

 // pathmodel.h
 #ifndef PATHMODEL_H
 #define PATHMODEL_H

 #include QStringListModel

 class PathModel : public QStringListModel
 {
 public:
 PathModel();
 };

 Q_DECLARE_METATYPE(PathModel*)

 #endif // PATHMODEL_H


 // pathmodel.cpp
 #include pathmodel.h

 PathModel::PathModel()
 {
 QHashint,QByteArray roleNames;
 roleNames.insert(Qt::DisplayRole, modelData);
 setRoleNames(roleNames);
 }

 Now if i want to register the new meta type using:
 qRegisterMetaTypePathModel*(PathModel*);

 The app instantly crashes when i run it.. It must be something very
 obvious that i'm missing, but i don't see it.

 Any idea what i'm doing wrong?
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

 Yes.

 But even if i change it to your suggestion it doesn't work. It's all
 in the private copy ctor...
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Carbon/Cocoa - browserplugin

2012-11-08 Thread Alexander Carôt
  I am working on updating the qtbrowserplugin in order to make it running
 with current Qt versions. Regarding the MAC version that requires a Cocoa
 version besides the current Carbon solution. In order to get started:
 
  When trying to compile the current version I get these errors:
 
  ../src/qtbrowserplugin_mac.cpp: In constructor
 ‘QMacBrowserRoot::QMacBrowserRoot(OpaqueControlRef*)’:
  ../src/qtbrowserplugin_mac.cpp:55: error: ‘HIViewGetWindow’ was not
 declared in this scope
 
 You are using Cocoa Qt instead of Carbon.

Of course I do and as mentioned previously I now want to get this example 
working for Cocoa, which obviously requires a number of changes. So - actually 
the questions is what are the Cocoa-equivalet calls ?

Any idea ?

Thanks

Alex

-- 
http://www.carot.de
http://www.triologue.de
Email : alexan...@carot.de
Tel.: +49 (0)177 5719797



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Dependency Injection

2012-11-08 Thread Alex Malyushytskyy
http://en.wikipedia.org/wiki/Dependency_injection


On Thu, Nov 8, 2012 at 12:44 PM, Yunior Bauta Pentón ypen...@uci.cu wrote:

 Hello.
 What is Dependency Injection Framework more used actually to Qt and C++  ?
 Any sample ?
 Thank

 --
 Ing. Yunior Bauta Pentón
 Dpto: PostgreSQL/DATEC
 Universidad de las Ciencias Informáticas
 http://postgresql.uci.cu


   http://www.uci.cu/


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Why is this not working? Assign direct to QML (through setContextProperty) works, as function doesn't.

2012-11-08 Thread Alan Ezust
On Thu, Nov 8, 2012 at 1:19 PM, Mark mark...@gmail.com wrote:


 Note: i cannot do qRegisterMetaType on the PathModel since it's class
 that inherits from a class that forbids copying the data (copy
 constructor stuff).


qmlRegisterType can register classes derived from QObject. Although you're
actually going to register a pointer to that type, rather than the class
itself.
From http://qt-project.org/doc/qt-4.8/qml-extending.html

Custom C++ types are registered using a template function:

 templatetypename T
 int qmlRegisterType
http://qt-project.org/doc/qt-4.8/qdeclarativeengine.html#qmlRegisterType(const
char *uri, int versionMajor, int versionMinor, const char *qmlName)

Calling 
qmlRegisterTypehttp://qt-project.org/doc/qt-4.8/qdeclarativeengine.html#qmlRegisterType()
registers the C++ type *T* with the QML system, and makes it available in
QML under the name *qmlName* in library *uri* version *
versionMajor.versionMinor*. The *qmlName* can be the same as the C++ type
name.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Why is this not working? Assign direct to QML (through setContextProperty) works, as function doesn't.

2012-11-08 Thread Mark
On Fri, Nov 9, 2012 at 1:01 AM, Alan Ezust alan.ez...@gmail.com wrote:


 On Thu, Nov 8, 2012 at 1:19 PM, Mark mark...@gmail.com wrote:


 Note: i cannot do qRegisterMetaType on the PathModel since it's class
 that inherits from a class that forbids copying the data (copy
 constructor stuff).


 qmlRegisterType can register classes derived from QObject. Although you're
 actually going to register a pointer to that type, rather than the class
 itself.

 From http://qt-project.org/doc/qt-4.8/qml-extending.html

 Custom C++ types are registered using a template function:

  templatetypename T
  int qmlRegisterType(const char *uri, int versionMajor, int versionMinor,
 const char *qmlName)

 Calling qmlRegisterType() registers the C++ type T with the QML system, and
 makes it available in QML under the name qmlName in library uri version
 versionMajor.versionMinor. The qmlName can be the same as the C++ type name.

Hi Alan,

Thank you for your reply.
I do wonder though, isn't qmlRegisterType for registering custom QML
elements? Since that's not what i'm trying to do. I only try to make
an object usable in QML. Something that works if i send it to QML
directly using setContextProperty but doesn't work if i send a class
and call a function with the object i want (the function pathModel()
in the example from my first post.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Why is this not working? Assign direct to QML (through setContextProperty) works, as function doesn't.

2012-11-08 Thread Tony Rietwyk

 Sent: Friday, 9 November 2012 8:19 AM
 
 Hi,
 
 Lets take this (pseudo code) as example.
 I made a custom QStringListModel class and calles it PathModel:
 
 pathmodel.h
 class PathModel : public QStringListModel {
 public:
 explicit PathModel(QObject *parent = 0); };
 
 Then i made a custom utils class where i just make some random
 functionality available. Like so:
 
 util.h
 class Util : public QObject
 {
 Q_OBJECT
 public:
 
 Q_INVOKABLE PathModel* pathModel();
 Q_INVOKABLE QString testString() { return some_test_text; } 
 };
 
 Then i have the main file where i create the QML context and load a QML
file.
 Just the default stuff when you make a QML application through QtCreator.
 It looks like this:
 
 Q_DECL_EXPORT int main(int argc, char *argv[]) {
 QScopedPointerQApplication app(createApplication(argc, argv));
 
 QmlApplicationViewer viewer;
 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
 viewer.setMainQmlFile(QLatin1String(qml/Porpoise/main.qml));
 viewer.showExpanded();
 
 return app-exec();
 }
 
 The above helps understanding the context. In the above you can already
 see that i want to send the Util class to QML. I do that like
 so:
 
 Util util;
 viewer.rootContext()-setContextProperty(Util, util);
 
 Now in QML i call:
 Util.testString()
 Reply: some_test_text
 
 That is es expected. Nothing wrong.
 
 Now if i call:
 Util.pathModel()
 Reply: undefined
 
 UNDEFINED..! Why?
 
 If i do this:
 viewer.rootContext()-setContextProperty(PathModel, Util.pathModel());
 
 and then call it in QML like so:
 PathModel
 Reply: QStringListModel(0x2072430)
 
 QStringListModel is OK since PathModel inherits from that. So assigning it
 directly to QML works, but assigning it through some other class doesn't.
Can
 anyone tell me why that's the case? And more importantly, how can i fix
this?
 
 Note: i cannot do qRegisterMetaType on the PathModel since it's class that
 inherits from a class that forbids copying the data (copy constructor
stuff).
 
 Cheers,
 Mark

Hi Mark, 

Try adding Q_OBJECT to your PathModel - maybe the function doesn't work
because the returned value does not have its own moc object. 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Why is this not working? Assign direct to QML (through setContextProperty) works, as function doesn't.

2012-11-08 Thread Mark
On Fri, Nov 9, 2012 at 3:36 AM, Tony Rietwyk t...@rightsoft.com.au wrote:

 Sent: Friday, 9 November 2012 8:19 AM

 Hi,

 Lets take this (pseudo code) as example.
 I made a custom QStringListModel class and calles it PathModel:

 pathmodel.h
 class PathModel : public QStringListModel {
 public:
 explicit PathModel(QObject *parent = 0); };

 Then i made a custom utils class where i just make some random
 functionality available. Like so:

 util.h
 class Util : public QObject
 {
 Q_OBJECT
 public:
 
 Q_INVOKABLE PathModel* pathModel();
 Q_INVOKABLE QString testString() { return some_test_text; } 
 };

 Then i have the main file where i create the QML context and load a QML
 file.
 Just the default stuff when you make a QML application through QtCreator.
 It looks like this:

 Q_DECL_EXPORT int main(int argc, char *argv[]) {
 QScopedPointerQApplication app(createApplication(argc, argv));

 QmlApplicationViewer viewer;
 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
 viewer.setMainQmlFile(QLatin1String(qml/Porpoise/main.qml));
 viewer.showExpanded();

 return app-exec();
 }

 The above helps understanding the context. In the above you can already
 see that i want to send the Util class to QML. I do that like
 so:

 Util util;
 viewer.rootContext()-setContextProperty(Util, util);

 Now in QML i call:
 Util.testString()
 Reply: some_test_text

 That is es expected. Nothing wrong.

 Now if i call:
 Util.pathModel()
 Reply: undefined

 UNDEFINED..! Why?

 If i do this:
 viewer.rootContext()-setContextProperty(PathModel, Util.pathModel());

 and then call it in QML like so:
 PathModel
 Reply: QStringListModel(0x2072430)

 QStringListModel is OK since PathModel inherits from that. So assigning it
 directly to QML works, but assigning it through some other class doesn't.
 Can
 anyone tell me why that's the case? And more importantly, how can i fix
 this?

 Note: i cannot do qRegisterMetaType on the PathModel since it's class that
 inherits from a class that forbids copying the data (copy constructor
 stuff).

 Cheers,
 Mark

 Hi Mark,

 Try adding Q_OBJECT to your PathModel - maybe the function doesn't work
 because the returned value does not have its own moc object.

 Tony.


 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

Hi Tony,

Ahh, i was really hoping for that to work! Sadly i was welcomed with
this compiler error:

pathmodel.o: In function `PathModel::PathModel(QObject*)':
pathmodel.cpp:(.text+0x14): undefined reference to `vtable for PathModel'

class PathModel : public QStringListModel

Cheers,
Mark
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Why is this not working? Assign direct to QML (through setContextProperty) works, as function doesn't.

2012-11-08 Thread Lincoln Ramsay
On 09/11/12 12:56, Mark wrote:
 Ahh, i was really hoping for that to work! Sadly i was welcomed with
 this compiler error:

 pathmodel.o: In function `PathModel::PathModel(QObject*)':
 pathmodel.cpp:(.text+0x14): undefined reference to `vtable for PathModel'

You need to run qmake to regenerate the Makefile because moc didn't run 
(because the last time qmake ran, the Q_OBJECT macro wasn't there).

-- 
Link

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Fwd: compiling qt with eglfs

2012-11-08 Thread pritam.ghang...@gmail.com
sorry, missed the list in reply.

On Thu, Nov 8, 2012 at 8:06 PM, pritam.ghang...@gmail.com 
pritam.ghang...@gmail.com wrote:



 On Thu, Nov 8, 2012 at 8:00 PM, Samuel Rødal samuel.ro...@digia.comwrote:

 On 11/08/2012 01:55 PM, pritam.ghang...@gmail.com wrote:
  I am still stuck with qt 4.8.3 with qpa. It always compiles, but I never
  got it to work.
  Now when i try the application its failing at load time itself
  # ./hellogl_es2 -qpa -platform egl
  Failed to load platform plugin egl. Available platforms are:
  Minimal
 
  if I try Minimal, I get a segfault.
  ./hellogl_es2 -qpa -platform Minimal
  Segmentation fault
 
  backtrace from gdb shows that it crashes in
  QGLContext::chooseContext(QGLContext const*) ()

 The minimal plugin doesn't support OpenGL.

  I have no idea what to do next. why didn't I get eglfs plugin when I had
  specified -egl in configure.

 Try specifying -eglfs and -opengl es2 when running configure and see
 what the configure output says.

 -eglfs was not recognized by configure as a valid option.

 I will try that tomorrow. I had tried specifying -qpa eglfs. But that
 didnt help.
 I compiled by actually going to  src/plugins/platforms/eglfs. Surprisingly
 makefile was there. The build system ran qmake on it, but somehow never ran
 make.
 Right now I dont have board to test it. I will get board again tomorrow. I
 will test it and let you know.

I have the plugin manually compiled. It loads but fails to create surface.
 Could not create the egl surface: error = 0x300b
I think I need to do some platform specific patching in plugin. I am
looking into that now.

  --
 Samuel
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest




 --
 cheers,
 pritam




-- 
pritam



-- 
pritam
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] How to force a repaint?

2012-11-08 Thread André Somers

Op 8-11-2012 20:59, Eric Clark schreef:


Hello All,

I am sorry if this sounds like a dumb question, but right now my 
company has locked us out of getting to the Qt documentation via our 
ridiculous proxy.



I hate those companies, but did they even block hitting F1 in Creator?
Usually, the documentation is installed with your Qt version too, so you 
should be able to read it that way if not online.


André

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest