When greeted by Clint with one single word: “kamelåså“, one has arrived to Debconf.
Unfortunately, with all the normal magic of QML property bindings, getting a property updated in a setup that involves return values from functions isn’t really doable, like this:
1 2 3 |
Text { text: qtobject.calculatedValue() } |
I’m told there is a low priority feature request for a way of signalling that a function now returns a different value and all properties using it should be reevaluated.
I have so far discovered two different workarounds for that that I will be presenting here.
Using an extra property
Appending an extra property to trigger the reevaluation of the function is one way of doing it.
1 2 3 |
Text { text: qtobject.calculatedValue() + qtobject.emptyNotifierThing } |
with the following on the C++ side:
1 2 3 4 |
Q_PROPERTY(QString emptyNotifierThing READ emptyString NOTIFY valueChanged) QString emptyString() const { return QString(); } |
This is a bit more code to write and to remember to use, but it does get the job done.
Intermediate layer
Another way is to inject an intermediate layer, an extra object, that has the function. It can even be simplified by having a pointer to itself.
1 2 3 |
Text { text: qtobject.dataAccess.calculatedValue() } |
with the following on the C++ side:
1 2 3 4 |
Q_PROPERTY(QObject* dataAccess READ dataAccess NOTIFY valueChanged) QObject* dataAccess() { return this; } |
It seems a bit simpler for the reader on the QML side, but also gets the job done.
I am not sure which way is the best one, but the intermediate layer has a nicer feeling to it when more complicated types are involved.
For reasons I don’t know, apparantly a Qt Quick Item that can show a QImage or a QPixmap is kind of missing. The current Image QML item only works with data that can be represented by a URL.
So I wrote one that kind of works. Comments most welcome.
It is found on git.kde.org: http://quickgit.kde.org/?p=scratch/sune/imageitem.git
Oh, and the KDE End of Year fundraiser is still running. https://www.kde.org/fundraisers/yearend2014/. Go support it if you haven’t already.
Occasionally, various quotes from people having an opinion if linux is about choice or not. Even pages like http://www.islinuxaboutchoice.com/ has shown up.
My short answer is “YES”. Linux is about choice. And you get all your choices directly from your f/loss definition of choice (FSF’s 4 freedoms / OSI’s opensource definition / Debian Free Software Guidelines)
It doesn’t mean that you get all the gui configuration bits that you want. It doesn’t mean that you without any problems can switch out any component. But it does mean that you can get it exactly your way. But it might require you to edit some source code and compile some stuff.
Recently I was trying some statistics on the qtbase-module (where QtCore, QtGui, QtWidgets and so on lives) and was wondering who made them.
Not based on their current paid affilation, like Thiago’s graphs, but if each commit was made by a person coming from KDE.
So, I got hold of Thiago’s scripts, a lovely mix of perl and zsh, and a QtBase git repository. First steps was to try to classify people as person coming from KDE or not. Of course, I’m a KDE person. Thiago is a KDE person. David Faure is a KDE person. Olivier Goffart is a KDE person. Lars Knoll is a KDE person.
By the help of the KDE accounts file, and some of the long time KDE contributors, I got after a half day of work a good list of it. Then next steps was trying to put it into Thiago’s perlscripts
All of it kind of succeeded:
So, KDE people makes up for 40-60% of the weekly commits to QtBase. This is again shows that KDE is important to Qt, just as the reverse is. So, let’s keep KDE healthy.
KDE is running a end-of-year fundraiser over here https://www.kde.org/fundraisers/yearend2014/. Go ahead and donate, and help KDE stay healthy. For your own sake. And for Qt’s.
Occasionally, one gets in touch with kind of ‘foreign’ technologies and needs to get stuff working anyways.
Recently, I had to do some various hacking with and around .bat files. Bat files are a kind of script files for Microsoft Windows.
Calling external commands
Imagine need to call some other command, let’s say git diff. So from a cmd thing, you would write
1 |
git diff |
similar to writing shell scripts on unixes. But there is a catch. If the thing you want to call is another bat-script, just calling it ensures it ‘replaces’ the current script and never returns. So you need
1 |
call git diff |
if the command you want to run is a bat file and you want to return to your script.
Calling an external helper next to your script
If you for some reason needs to call some external helper placed next to your script, there is a helpful thing to do that as well. Imagine your helper is called helper.bat
1 |
call %~dp0helper.bat |
is the very self-explanatory way of doing that.
Stopping execution of your script
If you somehow encounter some condition in your script that requires you to stop your script, there is a command ‘exit’ handy. It even takes a argument for what error code there is.
1 |
exit 2 |
stops your script with return code 2. But it also have the nice added feature that if you do it in a script you run by hand in a terminal, it also exits the terminal.
Luckily there is also a fix for that:
1 |
exit /b 2 |
and it doesn’t exit your interactive terminal, and it sets the %ERRORLEVEL% variable to the exit code.
Fortunately, the fun doesn’t stop here.
If the script is run non-interactively, exit /b doesn’t set the exit code for for example perl’s system() call. You need to use exit without /b for that. So now you need two scripts. one for “interactive” use that calls exit /b and a similar one using exit for use by other apps/scripts.
Or, we can combine some of our knowledge and add a extra layer of indirection.
1 2 |
call %~dp0script.bat exit %ERRORLEVEL% |
and then success.
Oh. and on a unrelated note. Windows can’t schedule tasks for users that aren’t logged in and don’t have a password set. The response “Access Denied” is the only clue given.
When writing libraries with CMake, you need to set a couple of properties, especially the VERSION and SOVERSION properties. For library libbar, it could look like:
1 2 |
set_property(TARGET bar PROPERTY VERSION "0.0.0") set_property(TARGET bar PROPERTY SOVERSION 0 ) |
This will give you a libbar.so => libbar.so.0 => libbar.so.0.0.0 symlink chain with a SONAME of libbar.so.0 encoded into the library.
The SOVERSION target property controls the number in the middle part of the symlink chain as well as the numeric part of the SONAME encoded into the library. The VERSION target property controls the last part of the last element of the symlink chain
This also means that the first part of VERSION should match what you put in SOVERSION to avoid surprises for others and for the future you.
Both these properties control “Technical parts” and should be looked at from a technical perspective. They should not be used for the ‘version of the software’, but purely for the technical versioning of the library.
In the kdeexamples git repository, it is handled like this:
1 2 3 4 |
set(BAR_VERSION_MAJOR 1) set(BAR_VERSION_MINOR 2) set(BAR_VERSION_PATCH 3) set(BAR_VERSION ${BAR_VERSION_MAJOR}.${BAR_VERSION_MINOR}.${BAR_VERSION_PATCH} ) |
And a bit later:
1 2 |
set_target_properties(bar PROPERTIES VERSION ${BAR_VERSION} SOVERSION ${BAR_VERSION_MAJOR} ) |
which is a fine way to ensure that things actually matches.
Oh. And these components is not something that should be inherited from other external projects.
So people, please be careful to use these correct.
The almost-yearly large KDE-sprint in Randa, Switzerland is doing a fundraiser to get this year’s event running. See http://www.kde.org/fundraisers/randameetings2014/
This year, it is besides the recurring multimedia topics, a lot about improving the new KDE Frameworks, the related documentation and the development experience with IDE’s and such.
It is also a good way to come full circle, since it was back in 2011 when I was at the Randa Meetings that the KDE Frameworks initiative was started.
So once again: http://www.kde.org/fundraisers/randameetings2014/
My hard-working KDE friend Mario asked me to help him to get Debian people to help him with his thesis. Here is what he writes:
Dear Free Software contributor*
I’m currently in the process of writing my diploma thesis. I’ve worked hard during the last few weeks and months on a questionnaire which shall collect some data for my thesis. Furthermore the data of this survey will be interesting for the Free Software communities as well.
So please take some time or add it to your todo list or, even better, go directly to my questionnaire and help me make a great diploma thesis and improve the Free Software community in some ways.
The questionnaire takes some 20 to 30 minutes. At the end of the questionnaire you’ll find a way to participate in a draw where you can even win something nice.
In a first round I got the feedback that the length of the questionnaire and that some questions (mostly the ones at the beginning of the questionnaire about the 12 different tasks) are quite abstract and difficult. But please try it, try your best and take the time and brain power. The remaining part of the questionnaire [1] (after these two pages with the tasks questions) is quite
easy and quickly done. And you have the possibility to come back to where you
have left filling in the questionnaire after a shorter or longer break.
And if there are any questions, feedback or you need help don’t hesitate a moment to write me an email or ping me on IRC (freenode.net and oftc.net) as unormal.
This survey will be open till Sunday, the 9th of March 2014, 23.59 UTC.
Thanks to all for reading and helping and towards the summer of 2014 you can read here what all the data you gave me showed us and where we can learn and improve.
Thanks in advance and best regards
Mario Fux
* By contributor I mean not just developers but translators, artist, usability
people, documentation writers and many more. Everybody who contributes in one
way or the other to Free Software.
I welcome Debian 9.0 Zurg!
Thanks to Phoronix and to Wikipedia editor at 213.81.201.123 and 149.255.97.132 for their high quality fact checking.
Recent Comments