Re: [Interest] QtWayland and window decorations on Raspberry Pi
2015-04-01 1:32 GMT+03:00 Guido Seifert warg...@gmx.de: Hi, when I start a test program (actually analogclock from the examples) under wayland using the brcm plugin, it works, but I don't have any window decorations. Ok, I read that brcm does not support those. Only wayland-egl provides window decorations atm. Not always easy to see which info is out of date. I found that at least at one point wayland-egl was not working on RPi. Does anyone know if this is still true? Yes, it is. I played a bit around with the Qt configuration and was able to build libqwayland-egl.so. Seems even to work. I get the alarmclock with window decorations. However, when I start the program in a weston terminal I get: Using Wayland-EGL EGL not available I'm not very up to date with the status of EGL and RPi, but the last thing i heard is that it doesn't really work yet. This irritates me a bit. Of course, the analogclock is not the most complicated program. Anyone an idea if this terminal message is only a glitch, or if there is somewhere a disaster in waiting? How are you starting analogclock? Being a QtWidgets example it doesn't need OpenGL to run, so it should work ok, with decorations. Are you using the wayland-egl platform, or wayland-brcm? If so use just 'wayland'. -- Giulio Guido ___ 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] Entity sub-tree opacity in Quick3D 2.0
Hi, On Wednesday 01 Apr 2015 00:14:28 Unai IRIGOYEN wrote: Hi, I have been playing with the upcoming Qt3D those days and especially the QML APIs. I was wondering if there is a means of changing the opacity of an entity and all children at the same time (same behavior as in QtQuick). At the moment I must change the opacity in the material color of each entity in the tree which results in verbose code. I have been trying to see if I can apply an effect to the sub-tree using alpha composition or shaders but I'm out of luck. At present, property changes do not recurse down to children as there is no promise that children will even have the same properties. In Qt Quick this works because opacity is a property of the base Item element. With Qt3D's Entity it has no such default properties. However, what you can do is to make your own custom QEntity subclass and use that in your QML scene such that when you set a property it recurses down to it's children and also sets their opacities too. The alternative would be to have the renderer on the backend do this automatically but then the hierarchy is conflating transformation composition and opacity composition. This assumption would likely break in other cases. E.g. if somebody wants to have some opaque objects flying around a transparent object. As a side note, I'm also interested in particles for Qt3D. I understand it's not priority number 1 but just take this as a vote for the feature. Once the new Buffer/Attribute API lands this should be possible in an indirect way using a custom set of shaders and framegraph to perform the particle updates on the GPU. Out of the box support for particles will come later. Please file a JIRA request if you need this. Cheers, Sean -- Dr Sean Harmer | sean.har...@kdab.com | Managing Director UK KDAB (UK) Ltd, a KDAB Group company Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090 Mobile: +44 (0)7545 140604 KDAB - Qt Experts ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] qml flickable on wince does no longer flick in qt 5.5 git
Hello, up to qt 5.4.1 i could rather nicely flick a flickable on our single touch device. but using recent qt 5.5 no flicking but just move is possible anymore. Anybody got a clue what happening here? I readhttp://www.kdab.com/current-state-windows-embedded-compactwec-platform-support-qt/ and there was a mentiniong of multitouch support added for wince but that was already made for qt 5.4. Regards, Gunnar ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QOpenGLWidget and text
I've been working on porting a Qt4 GL application to Qt5, using the new QOpenGL classes instead of the old and deprecated QGL classes. Some of it was really easy. Some of it is requiring MASSIVE amounts of work. I refer specifically to the removal of the text rendering methods. Since these are removed, what is the easiest way to go about drawing non-scaled, billboarded text in a GL scene? (Note: I am on Qt 5.4 at present; no Qt3D.) If I go the route of pre-rendering the text into a QImage, what is the easiest way, using only the modern QOpenGL classes (since there is no longer bindTexture either), to get that into an OpenGL texture? Actually using this stuff in anger, I am finding myself less than convinced that the new class is an improvement... implicit context sharing is nice, but the loss of convenience methods is really, really painful. (And I'll include qgl[Clear]Color in that list...) -- Matthew ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] Error from .obj/release-shared-emb-arm/qfutureinterface.o when crosscompiling QT4.4.3 for arm
Hello, I am working on a sc6000x board (at91sam9261 micro, linux 2.6.24) and i am trying to compile qt use it with qt creator to make application for my board. When configuring qt i have no error but when i make it i have the error : g++ -c -include .pch/release-shared-emb-arm/QtCore -pipe -pipe -pipe -fno-exceptions -O2 -O2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fvisibility=hidden -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -Wall -W -Wall -W -D_REENTRANT -D_REENTRANT -D_REENTRANT -fPIC -fPIC -fPIC -DQT_SHARED -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/qws/linux-arm-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared-emb-arm -Iconcurrent -Iglobal -I../3rdparty/harfbuzz/src -I.moc/release-shared-emb-arm -I.uic/release-shared-emb-arm -I/home/spi/installQt/tslib-arm/include -o .obj/release-shared-emb-arm/qfutureinterface.o concurrent/qfutureinterface.cpp ../../include/QtCore/../../src/corelib/arch/qatomic_arm.h: Assembler messages: ../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:111: Error: no such instruction: `swpb %cl,%dl,[%ebp]' ../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:111: Error: no such instruction: `swpb %dl,%sil,[%ebp]' ../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:111: Error: no such instruction: `swpb %sil,%cl,[%ebp]' ../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:111: Error: no such instruction: `swpb %cl,%dl,[%ebp]' repeating this until make[1]: *** [.obj/release-shared-emb-arm/qfutureinterface.o] Error 1 make[1]: Leaving directory `/home/spi/installQt/qt-embedded-linux-opensource-src-4.4.3/src/corelib' make: *** [sub-corelib-make_default-ordered] Error 2 Because i know finding the cause of an error is not always easy i will explain the steps i used to get to this point : I use : qt-embedded-linux-opensource-src-4.4.3 as source arm-linux-gcc-3.4.5-glibc-2.3.6-linux as toolchain and tslib-1.0 because i need to work with a touchscreen (needed for the configuration of qt) First i created symlink for my compiler : sudo ln -s /home/spi/installQt/arm-linux/bin/arm-linux-gcc /usr/bin/arm-linux-gcc sudo ln -s /home/spi/installQt/arm-linux/bin/arm-linux-g++ /usr/bin/arm-linux-g++ sudo ln -s /home/spi/installQt/arm-linux/bin/arm-linux-strip /usr/bin/arm-linux-strip sudo ln -s /home/spi/installQt/arm-linux/bin/arm-linux-ar /usr/bin/arm-linux-ar then i configured tslib : ./configure --prefix=/home/spi/installQt/tslib-arm --host=arm-linux --enable-shared=yes --enable-static=yes 'make it and make install it with no error. After this i modify the qmake.conf file in the qt source (linux-arm-g++) by adding this : include(../../common/g++.conf) include(../../common/linux.conf) include(../../common/qws.conf) QMAKE_INCDIR += /home/spi/installQt/tslib-arm/include QMAKE_LIBDIR += /home/spi/installQt/tslib-arm/lib And then i configure the qt source like this : ./configure -embedded arm -little-endian -no-armfpa -qt-gfx-transformed -qt-gfx-linuxfb -nomake demos -nomake examples -no-svg -no-phonon -no-qt3support -lrt -no-feature-CURSOR -qt-mouse-tslib -xplatform qws/linux-arm-g++ The configure generate no error/warning it seems. But when i want to make the qt source i have the error message. Thank you for your future answers ! If you have any questions or would like that i use a command to have more information about something don't hesitate ! ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] share opengl resource
On 2015-03-31 11:16, Alessio Mochi wrote: Actually I have two or three different rendering context (create multiple QGLWidget). Your solution for qt 4.7 is right for share resource (I would like share vbo between different rendering context)? Can you link a qt example or documentation? http://doc.qt.io/qt-4.8/qglwidget.html#QGLWidget My bad, depending on how you create your QGLWidget's, you can also tell them to share with each other. (I wasn't using this technique, and so wasn't recalling it offhand.) OTOH, depending on how you create your widgets, this may not be possible. (For example, if your widgets are defined in a .ui file, you'll need to invoke some cleverness in your subclass ctor to either use a global sharing context you have previously created, or else arrange for the first one created to set itself as the share widget for the others.) -- Matthew ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] [Development] share opengl resource
Hello Matthew, thanks for reply. Actually I have two or three different rendering context (create multiple QGLWidget). Your solution for qt 4.7 is right for share resource (I would like share vbo between different rendering context)? Can you link a qt example or documentation? Thanks in advance. Ale. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] FW: Need help in generating ActiveQt Libraries...
hi Friedemann, Thanks for the information, adding QT += axcontainer to my .pro solved the issue and I can use the ActiveQt interfaces for Example: SetControl without any issues. I was just wondering, if above trick solves the problem, then why Qt documentation suggests to build ActiveQt static libraries manually? Thanks for your help... Warm Regards, Mahesh Kammar From: Kammar, Mahesh Sent: Friday, March 20, 2015 5:01 PM To: 'interest@qt-project.org' Subject: Need help in generating ActiveQt Libraries... Hi All, I am new to Qt, am trying to use SetControl of QAxWidget class to host some Wpf control in Qt which is exported as COM. I am getting the following linking error, understand that I need to provide ActiveQt library, but am not able to generate one I do not find QAxBase.lib file or any other ActiveQt libraries. I really don't know how to change this QTDIR path to generate ActiveQt libraries, please help. It is not clear to me what to do when I refer it in http://doc.qt.io/qt-5/activeqt-index.html#activeqt-framework mainwindow.obj:-1: error: LNK2019: unresolved external symbol public: bool __thiscall QAxBase::setControl(class QString const ) (?setControl@QAxBase@@QAE_NABVQString@@@Z) referenced in function private: void __thiscall MainWindow::on_pushButton_clicked(void) (?on_pushButton_clicked@MainWindow@@AAEXXZ) mainwindow.obj:-1: error: LNK2019: unresolved external symbol public: __thiscall QAxWidget::QAxWidget(struct IUnknown *,class QWidget *,class QFlagsenum Qt::WindowType) (??0QAxWidget@@QAE@PAUIUnknown@@PAVQWidget@@V?$QFlags@W4WindowType@Qt@Z) referenced in function private: void __thiscall MainWindow::on_pushButton_clicked(void) (?on_pushButton_clicked@MainWindow@@AAEXXZ) debug\QtWinApp32bit.exe:-1: error: LNK1120: 2 unresolved externals Here is my simple code: QAxWidget *axObj = new QAxWidget(0,0); axObj-setControl(QString::fromUtf8({BF71CE63-0A2E-419D-B7DE-41BE2CE6})); Thanks in Advance Warm Regards, Mahesh Kammar The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QT QML Page Navigation
Hi Can somehow help me with the right way of navigation between screens. Screen1--- Screen 2 --- Screen3 and so on Are there any samples available? ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QHexView - widget for display hex data
Hey! I am pleased to announce my custom widget for displaying binary data in traditional hex-editor style. QHexView can be useful if you want to show hex data in human-friendly form. Build instructions, widget screenshot and example are available on project homepage. Comments and questions are welcome. Homepage: https://github.com/virinext/QHexView Licensy: MIT ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] The calling thread must be STA, because many UI components require this.
hi, I wanted to host a WPF user control in my QT application. So I created a CLI dll that returns the HWND of the user control. It creates an HwndSource for the WPF control and returns the handle of that HWND source. I added reference to this CLI dll from my QT application and tried to get the HWND. But I am getting an error as given below. Unhandled Exception: System.InvalidOperationException: The calling thread must be STA, because many UI components require this. at System.Windows.Input.InputManager..ctor() at System.Windows.Input.InputManager.GetCurrentInputManagerImpl() at System.Windows.Interop.HwndMouseInputProvider..ctor(HwndSource source) at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters) at System.Windows.Interop.HwndSource..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent) at GetWPFHwnd(HWND__* parent, Int32 x, Int32 y, Int32 width, Int32 height) in c:\users\ing08746\desktop\qt\staticclilib\staticclilib\staticclilib.cpp:line 42 at WinMainCRTStartup() I think we need to set the ApartmentState of QT application as STA. How can set the apartment state to STA for QT application? with regards, prasad ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QOpenGLWidget and text
Il 01/04/2015 15:42, Matthew Woehlke ha scritto: If I go the route of pre-rendering the text into a QImage, what is the easiest way, using only the modern QOpenGL classes (since there is no longer bindTexture either), to get that into an OpenGL texture? A rough game plan is this: * Create a QImage of a suitable size (depending on your needs) * Fill it with color or trasparency * Use QPainter to draw on it (using a font of a suitable size) * Create/upload it into a QOpenGLTexture * Create a suitable set of VBOs using QOpenGLBuffer containing vertex coordinates as well as texture coordinates for a rectangle (you'll need to triangulate it!) * Optionally create an IBO using QOpenGLBuffer containing indexes for your vertexes * Create a suitable shader program by combining a vertex shader (which may optionally do the billboarding, unless you generated vertex coordinates in the right positions) and a fragment shader (which samples from the texture using the interpolated texture coordinates which are emitted by the vertex shader) and bind it * Create a QOpenGLVertexArrayObject and bind it * Enable and configure the attribute arrays on your shader program by binding the VBOs and specifying their format * Optionally bind the IBO into the VAO (setup complete) To draw: * Bind the VAO * Bind (use) the shader program * Get the texture into the program, f.i. by binding the texture + setting the texture unit index as a uniform value on the right uniform sampler2D object in your program * Draw the quad via glDrawArrays / glDrawElements (depending if you used an IBO or not) Depending on your needs you may need alpha blending enabled, alpha-discard in your fragment shader, as well as alpha-to-coverage to smooth antialiased edges. Isn't Modern OpenGL lovely? ;) Cheers, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - The Qt Experts smime.p7s Description: Firma crittografica S/MIME ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QOpenGLWidget and text
-Original Message- Sent: Wednesday, April 01, 2015 3:42 PM To: interest@qt-project.org Subject: [Interest] QOpenGLWidget and text I've been working on porting a Qt4 GL application to Qt5, using the new QOpenGL classes instead of the old and deprecated QGL classes. Some of it was really easy. Some of it is requiring MASSIVE amounts of work. I refer specifically to the removal of the text rendering methods. Since these are removed, what is the easiest way to go about drawing non-scaled, billboarded text in a GL scene? (Note: I am on Qt 5.4 at present; no Qt3D.) You can use a QPainter to draw on a QOpenGLWidget. You can even create a QLabel having the QOpenGLWidget as parent. This is if you need to draw the text over the 3D scene. Hope this helps. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Error from .obj/release-shared-emb-arm/qfutureinterface.o when crosscompiling QT4.4.3 for arm
On Tuesday 31 March 2015 12:13:19 Alexis Guilloteau wrote: I am working on a sc6000x board (at91sam9261 micro, linux 2.6.24) and i am trying to compile qt use it with qt creator to make application for my board. Qt 4.4.3 is way, way too old. Upgrade. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QT QML Page Navigation
I think StackView is what you are looking for http://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html On Thu, Mar 26, 2015 at 3:11 PM, Chandralatha Harish chandralath...@gmail.com wrote: Hi Can somehow help me with the right way of navigation between screens. Screen1--- Screen 2 --- Screen3 and so on Are there any samples available? ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest -- Shantanu Tushar(UTC +0530) shantanu.io ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QOpenGLWidget and text
On 2015-04-01 10:28, Giuseppe D'Angelo wrote: Il 01/04/2015 15:42, Matthew Woehlke ha scritto: If I go the route of pre-rendering the text into a QImage, what is the easiest way, using only the modern QOpenGL classes (since there is no longer bindTexture either), to get that into an OpenGL texture? A rough game plan is this: [snip really lengthy process] Isn't Modern OpenGL lovely? ;) Can someone please explain to me how this is an improvement over having a renderText() method? (Being serious... see also previous comment; I don't see how losing the convenience functions of QGLWidget is an improvement...) I have another application that needs to support Qt 5.3 that is currently using QGLWidget. After my experiences with QOpenGLWidget it is clear that I would be rather insane to try to port it. -- Matthew ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QML bindings and redundant property changes
Hi all I want to understand how redundant QML property binding evaluations are mitigated. Does anyone have a high level idea of how this might be done? Consider the following case of properties describing a triangle: Item { property real a: 2; property real b: 3; property real c: Math.sqrt(a*a + b*b); property real perimeter: a+b+c; onPerimeterChanged: { console.log(perimeter changed); } } If you update either 'a' or 'b', onPerimeterChanged will only be called once. But if you think about the dependencies between the properties, the perimeter depends on a, b and c: change a - change perimeter change a - change c - change perimeter I would have expected two invocations of onPerimeterChanged, but it gets called only once. The QML engine avoids the redundant change and I'm curious as to how this is done. If you add enough dependencies though, you'll start getting multiple updates: Item { property real a: 2; property real b: 3; property real c: Math.sqrt(a*a + b*b); property real alt0: a+1; property real alt1: alt0+1; property real perimeter: a+b+c+alt1; onPerimeterChanged: { console.log(perimeter changed); } } This will result in onPerimeterChanged being called twice. Preet ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] Error: Gradle version 1.10 is required. Current version is 2.2.1
I'm not sure what is going on. I just connected a Nexus 6 and tried to deploy to it. This is an existing project that worked on my Note 2. I'm not sure if this is Qt, Creator, androiddeployqt or what. Help? Error follows Downloading https://services.gradle.org/distributions/gradle-2.2.1-all.zip .. . ... Unzipping /home/jason/.gradle/wrapper/dists/gradle-2.2.1-all/6dibv5rcnnqlfbq9klf8imrndn/gradle-2.2.1-all.zip to /home/jason/.gradle/wrapper/dists/gradle-2.2.1-all/6dibv5rcnnqlfbq9klf8imrndn Set executable permissions for: /home/jason/.gradle/wrapper/dists/gradle-2.2.1-all/6dibv5rcnnqlfbq9klf8imrndn/gradle-2.2.1/bin/gradle FAILURE: Build failed with an exception. * Where: Build file '/home/jason/Projects/p4/mobile/build-wound-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_0-Debug/android-build/build.gradle' line: 11 * What went wrong: A problem occurred evaluating root project 'android-build'. Failed to apply plugin [id 'android'] Gradle version 1.10 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in /home/jason/Projects/p4/mobile/build-wound-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_0-Debug/android-build/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 42.832 secs Building the android package failed! -- For more information, run this command with --verbose. 15:38:30: The process /home/jason/Qt/5.4/android_armv7/bin/androiddeployqt exited with code 14. Error while building/deploying project wound (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.4.0)) When executing step Build Android APK 15:38:30: Elapsed time: 00:45. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Code Review For Correcting Encoding Errors
On Wednesday 01 April 2015 17:07:55 Kyle Neal wrote: Here is the implementation of my valid utf8 checker bool Parser::isUTF8( std::string string ) { QString utf8str = QString::fromUtf8( string.c_str() ); for ( int i = 0; i utf8str.length(); i++ ) { if ( utf8str.at( i ) == -3 ) { return false; } return true; } This is wrong. Technically speaking, the source could have the UTF-8 version of the U+FFFD character, in which case it's valid UTF-8 but you'd return false. Instead, use QTextCodec with a stateful decoder and check if the number of invalid characters is non-zero. That is: QTextCodec::ConverterState state; QTextCodec *utf8Codec = QTextCodec::codecForMib(106); QString result = utf8Codec-toUnicode(string.c_str(), string.length(), state); return state.invalidChars; I would also recommend that you: - don't discard that QString result. Reuse it. - don't use std::string to represent an encoding. A QTextCodec pointer is the right way. - use the code above to check any encoding, not just UTF-8 - stop using ifstream -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QML bindings and redundant property changes
On Wed, Apr 1, 2015 at 4:57 PM, Daniel França daniel.fra...@gmail.com wrote: For me even your second example calls onPerimeterChanged only once. It seems that Qt is smart enough to only notify once when it's evalating an expression (that's actually a js function). That's strange. For me it results in onPerimeterChanged being called twice! ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QML bindings and redundant property changes
Qt 5.4? Em qui, 2 de abr de 2015 às 00:03, Preet prismatic.proj...@gmail.com escreveu: On Wed, Apr 1, 2015 at 4:57 PM, Daniel França daniel.fra...@gmail.com wrote: For me even your second example calls onPerimeterChanged only once. It seems that Qt is smart enough to only notify once when it's evalating an expression (that's actually a js function). That's strange. For me it results in onPerimeterChanged being called twice! ___ 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] QVariantMap: constEnd() not equal to end()?
On Wed, Apr 01, 2015 at 10:35:20AM +1100, Hamish Moffatt wrote: On 25/03/15 05:16, Thiago Macieira wrote: On Tuesday 24 March 2015 17:29:39 Gunnar Roth wrote: Does anybody know why QT_STRICT_ITERATORS is not standard? First, because it breaks existing, legitimate code that mixes const and non- const iterators properly (yes, there are legitimate ways to do it). Second, because it's binary incompatible in QVector. The iterator for non- strict QVector is a pointer; in strict mode, it's a class. So if you have the iterator in your function parameters or template parameters, it will not be compatible if you turn it on or off. However, I do recommend you turn it on in your own code, along with QT_NO_CAST_FROM_ASCII and QT_NO_CAST_TO_ASCII. Thanks for the tip. I just enabled QT_STRICT_ITERATORS and fixed a few bugs. I was bitten by comparison a const_iterator with a non-const end after upgrading to Qt 5.4 (the same code worked in 4.8). What's the benefit of QT_NO_CAST_FROM_ASCII though? I tried, but gave up after I saw the first million compile errors. Note there's also QT_RESTRICTED_CAST_FROM_ASCII that catches less errors but is also less intrusive on your sources. Given a choice, I'd prefer QT_NO_CAST_FROM_ASCII, though. Andre' ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QML bindings and redundant property changes
For me even your second example calls onPerimeterChanged only once. It seems that Qt is smart enough to only notify once when it's evalating an expression (that's actually a js function). Em qua, 1 de abr de 2015 às 19:12, Preet prismatic.proj...@gmail.com escreveu: Hi all I want to understand how redundant QML property binding evaluations are mitigated. Does anyone have a high level idea of how this might be done? Consider the following case of properties describing a triangle: Item { property real a: 2; property real b: 3; property real c: Math.sqrt(a*a + b*b); property real perimeter: a+b+c; onPerimeterChanged: { console.log(perimeter changed); } } If you update either 'a' or 'b', onPerimeterChanged will only be called once. But if you think about the dependencies between the properties, the perimeter depends on a, b and c: change a - change perimeter change a - change c - change perimeter I would have expected two invocations of onPerimeterChanged, but it gets called only once. The QML engine avoids the redundant change and I'm curious as to how this is done. If you add enough dependencies though, you'll start getting multiple updates: Item { property real a: 2; property real b: 3; property real c: Math.sqrt(a*a + b*b); property real alt0: a+1; property real alt1: alt0+1; property real perimeter: a+b+c+alt1; onPerimeterChanged: { console.log(perimeter changed); } } This will result in onPerimeterChanged being called twice. Preet ___ 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
[Interest] Code Review For Correcting Encoding Errors
Hey guys, first of all, I've been an active member in #qt and I appreciate all the help I've received from the guys in there. I started Qt a couple of months ago for a new project and I could not have got this far without everyone's help. I am very grateful. I'm hoping for a little bit of a code review to ensure I am doing UTF-8 right. I am developing a csv fixer that allows a user to select the encoding of the file so we can correctly handle encoding errors. Also, there is a choice to skip this, in which case I am just removing the fields that have encoding errors. So what I need is a bit of a review just to be absolutely sure that I am doing this right. I know encoding is almost an impossible problem but hopefully I can be told otherwise. My logic is as follows. At the beginning, I read the source CSV file counting the number of rows with invalid UTF8 characters using my bool isUTF8() shown below. I collect either 200 rows with encoding errors, or all encoding errors of the file. Whichever comes first. These rows are then shown to the user, and they are given a screen that allows them to pick the encoding of the file, showing the data as the choose. Once this is done, the file is read from the beginning as the selected encoding. Meaning, I read the row from the csv file, then encode the string as the selected encoding the user specified, and attempt to write them to the output file. Any encoding errors (non-UTF8 data) that were encountered as the selected encoding are written to an encoding errors file. At the end of parsing, the user can choose the encoding of those items until all items are written to the output file. Now this implementation seems to correctly ensure only valid UTF8 is written to the file, but it seems that a majority of the data with encoding errors just gets replaced by a replacement character that is valid UTF8 defeating the purpose. And if I just skip this step and choose to remove all fields with encoding errors, it seems to work perfect, except for Windows in which case badly encoded characters are being replaced with '?'. Anyways, here is the implementation of my string encoder. This function gets the std::string row of the .csv file. inline QString encode_string( std::string str, std::string encoding ) { QByteArray encoded; if ( encoding == UTF8 ) { encoded = QString::fromStdString( str ).toUtf8(); } else if ( encoding == ISO88591 ) { QTextCodec *codec = QTextCodec::codecForName( ISO88591 ); QByteArray enc( str.c_str(), str.length() ); return QString( codec-toUnicode( enc ) ); } else if ( encoding == ISO88592 ) { QTextCodec *codec = QTextCodec::codecForName( ISO88592 ); QByteArray enc( str.c_str(), str.length() ); return QString( codec-toUnicode( enc ) ); } else if ( encoding == WINDOWS1251 ) { QTextCodec *codec = QTextCodec::codecForName( WINDOWS1251 ); QByteArray enc( str.c_str(), str.length() ); return QString( codec-toUnicode( enc ) ); } else if ( encoding == WINDOWS1252 ) { QTextCodec *codec = QTextCodec::codecForName( WINDOWS1252 ); QByteArray enc( str.c_str(), str.length() ); return QString( codec-toUnicode( enc ) ); } else if ( encoding == SHIFTJIS ) { QTextCodec *codec = QTextCodec::codecForName( SHIFTJIS ); QByteArray enc( str.c_str(), str.length() ); return QString( codec-toUnicode( enc ) ); } else if ( encoding == EUCKR ) { QTextCodec *codec = QTextCodec::codecForName( EUCKR ); QByteArray enc( str.c_str(), str.length() ); return QString( codec-toUnicode( enc ) ); } else if ( encoding == EUCJP ) { QTextCodec *codec = QTextCodec::codecForName( EUCJP ); QByteArray enc( str.c_str(), str.length() ); return QString( codec-toUnicode( enc ) ); } else { qDebug() Q_FUNC_INFO Hit bad encoding case.; return QString( encoded ); } } Here is the implementation of my valid utf8 checker bool Parser::isUTF8( std::string string ) { QString utf8str = QString::fromUtf8( string.c_str() ); for ( int i = 0; i utf8str.length(); i++ ) { if ( utf8str.at( i ) == -3 ) { return false; } return true; } And here is my call point: //Write utf8 version of the string QString encoded = util::encode_string( joined, this-encoding ); //If the encoded string has UTF8 errors, write it to the encode error file if ( !isUTF8( encoded.toStdString() ) ) { QFile encode( this-encodeErrFileName ); encode.open( QIODevice::ReadWrite | QIODevice::Append ); QTextStream encodeOut( encode ); encodeOut encoded \r\n; encode.close(); } else { emit cleanRow(); tmpFileWriter encoded \r\n; } output.close(); My function calls go like this: Read file as standard (C++ ifstream, no encoding done) - encode the string (using util::encode_string) - check
Re: [Interest] QML bindings and redundant property changes
On 1 April 2015 at 19:11, Preet prismatic.proj...@gmail.com wrote: I would have expected two invocations of onPerimeterChanged, but it gets called only once. The QML engine avoids the redundant change and I'm curious as to how this is done. http://en.wikipedia.org/wiki/Topological_sorting -- Giuseppe D'Angelo ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QML bindings and redundant property changes
Sorry, email sent accidentally. Elaborating: if a changes, the engine *might* do a topological sorting of a's dependencies to minimize the number of reevaluations. But I would never ever rely on such a thing being present and consider it an implementation detail. On 2 April 2015 at 00:21, Giuseppe D'Angelo dange...@gmail.com wrote: On 1 April 2015 at 19:11, Preet prismatic.proj...@gmail.com wrote: I would have expected two invocations of onPerimeterChanged, but it gets called only once. The QML engine avoids the redundant change and I'm curious as to how this is done. http://en.wikipedia.org/wiki/Topological_sorting -- Giuseppe D'Angelo -- Giuseppe D'Angelo ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest