Poor man's LED in Qt 

Create a square label with fixed size, let's say 24*24px.

Use the following stylesheet:
"background-color: rgb(85, 255, 0); border-radius: 12px;"

Change/clear the stylesheet when the LED is off.
[ hozzászólás ] ( 3 megtekintés ) [ 0 trackbackek ] permalink ( 2.9 / 46 )
A few things what I setup when I create a new Qt Widget project 

1.Add the folowing to pro file:


OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
RCC_DIR=build

DESTDIR = bin

and the binaries won't mess up your sorce code directory

2. Make the following modifications in the main.cpp:


#include <QtGui/QApplication>
#include <QtCore/QTextCodec>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8";));
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8";));

QCoreApplication::setOrganizationName("MM";);
QCoreApplication::setApplicationName("Mikrotik data miner";);
QCoreApplication::setApplicationVersion("0.1";);

QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}


Why?
The QTextCodec trick is neccessary because the sourcecode is UTF-8 encoded, and if I want to put a string from the code to somewhere I would need to use QString::fromUtf8(). If you do not believe check a generated ui_*.h file.

Always give set the name to your application and the application domain. This is useful when you are using QSettings, you do not need to give constructor arguments when creating a settings object. The settings object constructed in this way always use a separate data area specified by the platform. (.config/QCodeApplication::applicationDomain/QCoreApplication:applicationName.ini on Linux and registry on Windows)


[ hozzászólás ] ( 15 megtekintés ) [ 0 trackbackek ] permalink ( 2.9 / 102 )
Daily Qt sapience - Reading ras files from sequential devices not supported  

I have written a library to get JPG files from a webserver continously. It worked fine with Qt 4.6.3 but with the new Qt 4.7.0 I have get the following error for every frame:


Reading ras files from sequential devices not supported


The workaround is the following:

Turn off the automatic format detection, and set the file format explititly:


imageReader->setAutoDetectImageFormat(false);
imageReader->setFormat("JPG";);


And no more warnings :)
[ hozzászólás ] ( 1 megtekintés ) [ 0 trackbackek ] permalink ( 3 / 186 )
Daily Qt sapience - Qt Embedded and tslib 

I have stucked several times with touchscreens and Qt.
My problem's main reason is that I compiled the Qt and tslib outside the openembedded, because I did not liked the Openebmedded's Qt building method. (Build Qt twice once cross compiled, once for the host.)

I have stucked several times in the following situation:
ts_calibrate calibrates, and ts_test works fine, but my Qt app cursor's moves inverse, or it too sensitive or whatever.

Well it seems to be that the various tslibs do not like another,
and their configuration files are not interchangable. And the best one: Qt app likes to work only with the tslib with what it had been compiled.

So if you ran into the similar problem:

Clean up all your existing tslib stuff:

rm -rf /usr/lib/ts
rm -rf /usr/lib/libts*
rm -rf /usr/bin/ts_*


And place your own compiled tslib's binaries, and plugins there.

After then set the following enviroment variables properly of coures:


export TSLIB_TSEVENTTYPE=INPUT
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/touchscreen0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/
export LD_LIBRARY_PATH=/usr/local/tslib/lib


Run ts_calibrate

And finally run your Qt app with -qws option.

[ hozzászólás ] ( 14 megtekintés ) [ 0 trackbackek ] permalink ( 3 / 179 )
Napi Qt okosság, avagy a -fast opció csodákra képes 

Van pár feladat aminek a végrehajtását szeretem elkerülni a számítógépemen. Ilyen például a Qt fordítás. Baromi sokáig tart, és végig üvegeli a a gépet. A gentoos "compile 5 hours to run 5 ns faster" filozófia pedig eddig még nem érintette meg a lelkemet.

Beágyazott szuttyok esetén nem mindig adatik meg az a lehetőség, hogy bináris csomagot használjon az ember. Így volt ez most is, amikor egy Friendlyarmos panelre kellett Qt-t varázsolnom. Az openembedded sajnos csak úgy képes Qt-t fordítani, ha az először lefordítja az x86-osat, majd az embeddedet. Ezt el kívántam kerülni, ezért 2 napig reszeltem a bitbake és az mkspec fájlokat, de végül feladtam.
Képtelen volt desktopon futó qmaket összehozni, így végül ezt a leírást használtam:

http://billforums.station51.net/viewtop ... p;p=44#p44

Illetve megspékeltem az opciókat ezekkel:


./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -little-endian -no-qt3support -opensource -no-accessibility -no-webkit -no-script -no-javascript-jit -no-scripttools -nomake examples -nomake demos -nomake docs -nomake translations -qt-mouse-tslib -DQT_KEYPAD_NAVIGATION -reduce-relocations -fast


A fordítás egy Intel T7400 C2D-n kevesebb mint 20 perc alatt lezajott.

Öröm van a köbön.
[ hozzászólás ] ( 2 megtekintés ) [ 0 trackbackek ] permalink ( 2.9 / 164 )

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Következő> >>

 
számláló