<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>qmake &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/qmake/</link>
	<description>Feed of posts on WordPress.com tagged "qmake"</description>
	<pubDate>Wed, 10 Feb 2010 15:11:06 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Kenjiro Taura on Parallel Workflows]]></title>
<link>http://duncan.hull.name/2009/06/10/kenjiro-taura/</link>
<pubDate>Wed, 10 Jun 2009 07:24:38 +0000</pubDate>
<dc:creator>Duncan</dc:creator>
<guid>http://duncan.hull.name/2009/06/10/kenjiro-taura/</guid>
<description><![CDATA[Kenjiro Taura is visting Manchester next week from the Department of Information and Communication E]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><span style="border:medium none;float:right;margin-left:.5em;font-size:10px;font-weight:normal;color:#666666;"><a title="田浦 健次朗（たうららけんじろう）ホームページ" href="http://www.logos.t.u-tokyo.ac.jp/~tau/index_j.html"><img src="http://www.logos.t.u-tokyo.ac.jp/~tau/imgs/picture.jpg" alt="Kenjiro Taura" /></a></span><a href="http://www.logos.t.u-tokyo.ac.jp/~tau/index_j.html">Kenjiro Taura</a> is <a href="http://www.ls.manchester.ac.uk/research/seminars/seminar/?id=SPECIALSEMINARS_39979.46">visting Manchester</a> next week from the Department of Information and Communication Engineering at the University of Tokyo. He will be doing a seminar, the details of which are below:</p>
<blockquote><p><strong>Title</strong>: Large scale text processing made simple by GXP make: A Unixish way to parallel workflow processing</p>
<p><strong>Date-time</strong>: Monday, 15 June 2009 at 11:00 AM</p>
<p><strong>Location</strong>: Room MLG.001, <a href="http://www.mib.ac.uk">mib.ac.uk</a></p>
<p>In the first part of this talk, I will introduce a simple tool called GXP make. GXP is a general purpose parallel shell (a process launcher) for multicore machines, unmanaged clusters accessed via <a title="Secure Shell" href="http://en.wikipedia.org/wiki/Secure_Shell">SSH</a>, clusters or supercomputers managed by batch scheduler, distributed machines, or any mixture thereof. GXP make is a &#8216;<a href="http://en.wikipedia.org/wiki/Make_(software)">make</a>&#8216; execution engine that executes regular UNIX makefiles in parallel. Make, though typically used for software builds, is in fact a general framework to concisely describe workflows constituting sequential commands. Installation of GXP requires no root privileges and needs to be done only on the user&#8217;s home machine. GXP make easily scales to more than 1,000 CPU cores. The net result is that GXP make allows an easy migration of workflows from serial environments to clusters and to distributed environments. In the second part, I will talk about our experiences on running a complex text processing workflow developed by Natural Language Processing (NLP) experts. It is an entire workflow that processes MEDLINE abstracts with deep NLP tools (e.g., Enju parser [1]) to generate search indices of <a href="http://duncan.hull.name/2006/10/27/medie-medline/">MEDIE</a>, a semantic retrieval engine for MEDLINE. It was originally described in Makefile without a particular provision to parallel processing, yet GXP make was able to run it on clusters with almost no changes to the original Makefile. Time for processing abstracts published in a single day was reduced from approximately eight hours (with a single machine) to twenty minutes with a trivial amount of efforts. A larger scale experiment of processing all abstracts published so far and remaining challenges will also be presented.</p></blockquote>
<h3>References</h3>
<ol>
<li><span class="Z3988" title="ctx_ver=Z39.88-2004&#38;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&#38;rft.jtitle=Bioinformatics&#38;rft_id=info%3Adoi%2F10.1093%2Fbioinformatics%2Fbtn631&#38;rfr_id=info%3Asid%2Fresearchblogging.org&#38;rft.atitle=Evaluating+contributions+of+natural+language+parsers+to+protein-protein+interaction+extraction&#38;rft.issn=1367-4803&#38;rft.date=2008&#38;rft.volume=25&#38;rft.issue=3&#38;rft.spage=394&#38;rft.epage=400&#38;rft.artnum=http%3A%2F%2Fwww.bioinformatics.oxfordjournals.org%2Fcgi%2Fdoi%2F10.1093%2Fbioinformatics%2Fbtn631&#38;rft.au=Miyao%2C+Y.&#38;rft.au=Sagae%2C+K.&#38;rft.au=Saetre%2C+R.&#38;rft.au=Matsuzaki%2C+T.&#38;rft.au=Tsujii%2C+J.&#38;rfe_dat=bpr3.included=1;bpr3.tags=Biology%2CChemistry%2CComputer+Science%2CBioinformatics">Miyao, Y., Sagae, K., Saetre, R., Matsuzaki, T., &#38; Tsujii, J. (2008). Evaluating contributions of natural language parsers to protein-protein interaction extraction <span style="font-style:italic;">Bioinformatics, 25</span> (3), 394-400 DOI: <a rev="review" href="http://dx.doi.org/10.1093/bioinformatics/btn631">10.1093/bioinformatics/btn631</a></span></li>
</ol>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[QWT Bibliothek]]></title>
<link>http://fakguen.wordpress.com/2008/08/04/qwt-bibliothek/</link>
<pubDate>Mon, 04 Aug 2008 20:23:23 +0000</pubDate>
<dc:creator>Ferhat Akgün</dc:creator>
<guid>http://fakguen.wordpress.com/2008/08/04/qwt-bibliothek/</guid>
<description><![CDATA[Heute möchte ich euch eine QT Bibliothek bekannt machen, womit ihr z.B Funktionsverläufe plotten kön]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Heute möchte ich euch eine QT Bibliothek bekannt machen, womit ihr z.B Funktionsverläufe plotten könnt. Die Bibliothek bietet uns einige Darstellungsformen an. Hier eine kleine Liste<br />
- Histogramm<br />
- Spektrogramm<br />
- Streudiagramm<br />
- und und und&#8230;</p>
<p>Hierbei setze ich voraus, dass ihr VS 200X und QT installiert und konfiguriert habt.</p>
<p><em><strong><br />
Installation</strong></em><br />
Besorgt euch zuerst die Quelldateien von der <a href="http://qwt.sourceforge.net/">QWT-Seite</a>.<br />
Als nächstes legt ihr euch ein Verzeichnis eurer Wahl an. In diesem Fall verwende ich <strong>C:\qwt</strong> als Pfad.<br />
Entpackt nun die heruntergeladene Datei in dieses Verzeichnis.</p>
<p>Als nächstes wollen wir die <strong>qwtconfig.pri</strong> editieren. Der Grund hierfür ist, dass QWT standardmäßig nur als release erzeugt wird. Wir wollen aber Debug und Release also build_all!<br />
Hierfür öffnet ihr diese Datei mit einem Texteditor.</p>
<p>Z.Z. ist diese stelle aktiv, die wir aber mit einem # auskommentieren werden</p>
<blockquote><p><strong>CONFIG           += release     # release/debug/debug_and_release</strong></p></blockquote>
<p>Stattdessen werden diese Stelle aktiviert, indem wir das # entfernen</p>
<blockquote><p><strong>#CONFIG += release_debug</strong></p></blockquote>
<blockquote><p><strong>#CONFIG           += build_all</strong></p></blockquote>
<p>Nun speichert ihr diese Datei ab und wechselt in die Visual Studio Console, die im Startmenü erreichbar ist. Wechselt in euer soeben angelegtes QWT Verzeichnis. (cd C:\qwt)</p>
<p><strong>Step1: qmake qwt.pro</strong></p>
<p><strong>Step2: nmake</strong></p>
<p>Die oben genannten Befehle führt ihr nacheinander aus. Der zweite kann eine Weile dauern.</p>
<p><em><strong><br />
Umgebungsvariable</strong></em><br />
Auch bei QWT wollen wir in die Umgebungsvariablen. Dies erleichter nachher in VS das Leben.<br />
Erzeugt eine neue Umgebungsvariable mit dem Namen <strong>QWTDIR</strong> und der dazugehörige Wert sollte das vorhin angelegte QWT Verzeichnis sein.</p>
<p><strong>QWTDIR : C:\qwt</strong></p>
<p>Als nächstes ergänzen wir unsere Umgebungsvariable <strong>&#8220;Path&#8221;</strong> indem wir zum Wert folgenden Text hinzufügen <strong>%QWTDIR%\lib </strong>.<strong><br />
</strong></p>
<p><em><strong>Installation fortsetz.</strong></em><br />
Mittlerweile dürfte die Kompilierung fertig sein. Mit QWT werden auch Beispiele mitgeliefert,diese könnt ihr,wenn ihr wollt ebenfalls kompilieren. Dafür wechselt ihr in das Unterverzeichnis <strong>examples</strong> von QWT.</p>
<p><strong>Step1: qmake examples.pro</strong></p>
<p><strong>Step2: nmake</strong></p>
<p><strong>Step3: admin\msvc-qmake.bat vc</strong></p>
<p>Der dritte Schritt ist dafür da um Projektdateien für VS zu erstellen, damit ihr nachher die Beispiel in VS öffnen und kompilieren könnt.</p>
<p><em><strong><br />
QT Designer Plugin</strong></em><br />
Um die QWT widgets im QT Designer benutzen zu können, müssen wir einige Sachen kopieren. Hierzu wechselt ihr in euer QWT Verzeichnis, genauer gesagt in:<strong><br />
C:\qwt\designer\plugins\designer</strong> von hier kopiert ihr nun die folgenden Dateien<br />
<strong>qwt_designer_plugin5.dll<br />
qwt_designer_plugin5.exp<br />
qwt_designer_plugin5.lib<br />
qwt_designer_plugin5.dll.manifest</strong><br />
in euer QT-Verzeichnis, genauer gesagt in <strong>%QTDIR%\plugins\designer</strong></p>
<p><em><strong><br />
QWT</strong></em><br />
Nun müssen wir nur noch die eigentlichen QWT Dateien kopieren. Dafür wechselt ihr in das Verzeichnis <strong>C:\qwt\lib</strong>.<br />
Da wir eben sowohl für Debug also auch für Release Dateien kompiliert habe, müsst ihr hier die beiden vorfinden.<br />
Kopiert nun die beiden DLL&#8217;s <strong>qwt5.dll</strong> und <strong>qwtd5.dl</strong>l in das Verzeichnis <strong>%QTDIR%\bin</strong></p>
<p>Danach kopiert ihr diese restlichen Dateien<br />
<strong>qwt5.exp<br />
qwtd5.exp<br />
qwtd5.ilk<br />
qwt5.lib<br />
qwtd5.lib<br />
qwtd5.pdb</strong> in das Verzeichnis <strong>%QTDIR%\lib</strong></p>
<p>Nun starten sie bitte den QT Designer. Falls sie nun in der Widgetbox auf der linken Seite die QWT widgets nicht entdecken können müssen wir noch etwas erledigen.<br />
Schließen sie den Designer und öffnen sie den Registry Editor (regedit).<br />
Wechseln sie in dem linken Baum zu diesem Schlüssel.<br />
<strong>HKEY_CURRENT_USER\Software\Trolltech</strong><br />
Hier werden sie den Schlüssel <strong>OrganizationDefaults</strong> finden. Löschen sie den gesamten Schlüssel samt Inhalt und schließen sie den Registry Editor. (Vorher ein Backup machen)<br />
Nach einem erneuten Start des QT Designers müssten nun die QWT widgets erscheinen.</p>
<p><em><strong><br />
QT Toolbox (kommerzielle Nutzer)</strong></em><br />
Diejenigen, die das Glück haben und die kommerzielle Version von QT mit der VS Integration nutzen  können, müssen nun noch folgendes machen.<br />
Wie ihr vielleicht gemerkt habt, erscheinen in der QT Toolbox die QWT widgets noch nicht aber im QT Designer schon. Der Grund hierfür ist ganz einfach <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Wir müssen noch eine Runde kopieren.</p>
<p>Ihr müsst die Datei <strong>qwt_designer_plugin5.dll</strong> in euer QT Visual Studio Integration Verzeichnis kopieren.<br />
Es befindet sich entweder in <em>C:\Program Files</em> oder in <em>C:\Programme</em>.<br />
In diesem Ordner muss sich ein Unterverzeichnis für den Designer befinden, wo eventuell noch ein Ordner mit dem Namen plugins vorhanden ist. Da ich gerade die kommerzielle Version nicht zur Verfügung habe, kann ich keine genaueren Angaben machen.<br />
In dieses Verzeichnis müsst ihr diese Datei kopieren, somit werden auch in der QT Toolbox die QWT widgets sichtbar.</p>
<p><em><strong><br />
VS Einstellung</strong></em><br />
Bevor wir nun loslegen können, müssen wir paar Kleinigkeiten in VS anpassen. Dafür öffnen wir VS.<br />
<strong>Extras -&#62; Optionen -&#62; Projekte und Projektmappen -&#62; VC++-Verzeichnisse</strong><br />
Auf der rechten Seite wählt ihr aus der rechten Kombobox &#8220;Includedateien&#8221; aus.<br />
Unten fügt ihr folgendes hinzu: <strong>$(QWTDIR)\src</strong><br />
Danach wählt ihr aus der Kombobox &#8220;Bibliotheksdateien&#8221; aus.<br />
Unten fügt ihr folgendes hinzu: <strong>$(QWTDIR)\lib</strong><br />
Hiermit wird VS auch bei späteren Projekten wissen, wo die LIBS und SOURCES sind.</p>
<p><strong><br />
<em>Beispielprojekt</em></strong></p>
<p>Nun wollen wir nach der, hoffentlich erfolgreichen, Konfiguration ein Beispielprojekt kompilieren.<br />
Dafür wechseln wir in das Unterverzeichnis examples von QWT. (C:\qwt).<br />
Dort wechseln wir z.B. in cpuplot und öffnen die Datei cpuplot.vcproj. Nach der Kompilierung dürftet ihr keine Fehler erhalten und die Datei ohne Probleme ausführen können.</p>
<p>Vergewissert euch, dass in den Präprozessor-Optionen von VS QWT_DLL eingetragen ist.<br />
Zusätzlich sollte berücksichtigt werden, dass die Dateien qwt5d.lib (Debug) und qwt5.lib (Release) dem Linker bekannt gemacht werden müssen. Sonst treten beim linken des Projektes Fehler auf.<br />
<strong><br />
<em>Troubleshoot</em></strong><br />
Falls eure <strong>qwt5.dll</strong> oder <strong>qwtd5.dll</strong> nicht gefunden wird, liegt es sehr wahrscheinlich daran, dass ihr eure Umgebungsvariablen falsch erzeugt habt. Legt sie alle (QTDIR, QWTDIR, usw..) als Systemvariablen an, bei mir wurde das Problem so gelöst.</p>
<p>Mit der kommerziellen Version von QT (+QT Visual Studio Integration) kann es passieren, dass QWT nicht<br />
in der QT-Toolbox erscheint.<br />
Lösung:</p>
<p>- <strong>HKEY_CURRENT_USER\Software\Trolltech\OrganisationDefaults<br />
</strong>- <strong>HKEY_CURRENT_USER\Software\Trolltech\Designer</strong></p>
<p>Diese beiden Schlüssel entfernen nun solltet ihr in Visual Studio QWT sehen können.</p>
<p>Falls irgendetwas unklar oder falsch sein sollte bitte die Kommentarfunktion benutzen.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[QGtkStyle: integrazione perfetta delle applicazione KDE in GNOME. Installazione ed uso]]></title>
<link>http://khole8.wordpress.com/2008/05/24/qgtkstyle-integrazione-perfetta-delle-applicazione-kde-in-gnome-installazione-ed-uso/</link>
<pubDate>Sat, 24 May 2008 10:06:07 +0000</pubDate>
<dc:creator>Ferro</dc:creator>
<guid>http://khole8.wordpress.com/2008/05/24/qgtkstyle-integrazione-perfetta-delle-applicazione-kde-in-gnome-installazione-ed-uso/</guid>
<description><![CDATA[Gli sviluppatori Trolltech hanno sviluppato QGtkStyle, uno strumento che permette di dare uno stile ]]></description>
<content:encoded><![CDATA[Gli sviluppatori Trolltech hanno sviluppato QGtkStyle, uno strumento che permette di dare uno stile ]]></content:encoded>
</item>
<item>
<title><![CDATA[Lezione Qt 2: Impostare un file .pro "ad hoc"]]></title>
<link>http://toastedtech.wordpress.com/2008/04/20/lezione-qt-2-impostare-un-file-pro-ad-hock/</link>
<pubDate>Sun, 20 Apr 2008 17:26:39 +0000</pubDate>
<dc:creator>montoya</dc:creator>
<guid>http://toastedtech.wordpress.com/2008/04/20/lezione-qt-2-impostare-un-file-pro-ad-hock/</guid>
<description><![CDATA[Nella prima lezione, avevamo visto che per la compilazione dei sorgenti, era indispensabile il coman]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Nella prima lezione, avevamo visto che per la compilazione dei sorgenti, era indispensabile il comando &#8220;qmake -project&#8221;. Questo comando crea automaticamente un .pro (del progetto). Se da un lato si ha un vantaggio perché il programmatore non deve prendersi la briga di creare un .pro dedicato, dall&#8217;altro si hanno una serie spropositata di svantaggi.</p>
<p style="text-align:center;"><a href="http://toastedtech.wordpress.com/files/2008/04/qt4.jpg"><img class="aligncenter size-full wp-image-359" src="http://toastedtech.wordpress.com/files/2008/04/qt4.jpg" alt="" width="128" height="128" /></a></p>
<p>Un buon programmatore deve crearsi adeguatamente un proprio file .pro, altrimenti rischia di perdersi all&#8217;interno del progetto. La struttura di un file .pro non è difficile per niente, basta solo seguire i passi che a breve introdurrò.</p>
<p><!--more--></p>
<p>Come prima cosa, un progetto Qt (o in genere un qualsiasi progetto) deve attuare un certo ordine. Non è una legge da rispettare, però seguire un certo &#8220;stile&#8221; aiuterà sicuramente il programmatore nello svolgimento delle operazioni. Ad esempio, è bene disporre i propri sorgenti all&#8217;interno di una directory &#8220;src&#8221;. Così come il file binario dentro &#8220;bin&#8221;, i file di compilazione dentro &#8220;build&#8221; e così via.</p>
<p>Prima di vedere come si crea un file .pro, bisogna introdurre alcuni concetti.</p>
<p><strong>-&#62; File per l&#8217;icona di windows (usato solo in windows)</strong><br />
In ambiente windows, i binari hanno in genere un&#8217;icona standard (quella per i .exe tradizionali). Per associare al binario un&#8217;icona, basta creare un file .rc e posizionarlo nella directory corrente del progetto.</p>
<p>Un esempio di tale file è questo:<br />
<code>IDI_ICON1               ICON    DISCARDABLE     "resources/icons/logo.ico"</code></p>
<p><strong>-&#62; File per le immagini (e in genere altri file)</strong><br />
In genere in un programma GUI sono presenti delle immagini, che vengono utilizzate per i menuitem, bottoni, oppure label. Ci sono 3 metodi per inserire un&#8217;immagine nel nostro programma:</p>
<ol>
<li>usare <em>path assoluti</em>: questo metodo non merita neanche attenzione (scongiurato);</li>
<li>usare <em>path relativi</em>: in questi casi, le immagini hanno un percorso relativo all&#8217;eseguibile, e quindi si ha una certa &#8220;portabilità&#8221;. E&#8217; comunque evidente che spostare il percorso del binario, implica uno sfasamento dei percorsi relativi;</li>
<li>usare <em>path assoluti all&#8217;interno del progetto</em>: questo modo di operare include le immagini nel binario e non si hanno modi di sbagliare.</li>
</ol>
<p>Spiego meglio il 3° punto. Le immagini (o altri file, ad esempio file di testo) vengono convertite in file sorgenti .cpp e nello specifico, in dei vettori pieni zeppi di numeri esadecimali. Questo a noi non ci interessa&#8230; la sostanza è che le immagini verranno incluse nel binario definitivo e il loro uso nelle finestre è completamente privo di rischi.</p>
<p>Un file del genere specifica le &#8220;risorse&#8221; che devono essere incluse nel progetto. In genere io uso una directory &#8220;resources&#8221; e dentro di essa, posiziono il mio file di risorsa che ha un estensione .qrc. Questo file è di tipo XML e di facile utilizzo. Dentro resources, creo un&#8217;altra directory &#8220;icons&#8221; contenente tutte le immagini che userò (preferisco png a jpg). Se ad esempio, dentro &#8220;resources/icons/&#8221; ho un file immagine chiamato &#8220;logo.png&#8221;, in &#8220;resources&#8221; avrò un file .qrc del genere:</p>
<p>&#60;RCC&#62;<br />
&#60;qresource prefix=&#8221;/icons&#8221; &#62;<br />
&#60;file&#62;icons/logo.png&#60;/file&#62;<br />
&#60;/qresource&#62;<br />
&#60;/RCC&#62;</p>
<p>Io considero indispensabili la configurazioni di questi 2 file. Detto questo, procediamo alla creazione del file .pro per il nostro progetto.</p>
<p>Il nostro file .pro si chiamerà Progetto.pro e sarà così composto:</p>
<p># sorgenti<br />
<code>HEADERS += src/finestra.h<br />
FORMS += ui/finestra.ui<br />
SOURCES += src/finestra.cpp src/main.cpp</code></p>
<p># build<br />
<code>OBJECTS_DIR += build/o<br />
MOC_DIR += build/moc<br />
RCC_DIR += build/rcc<br />
UI_DIR += build/ui</code></p>
<p># binario<br />
<code>DESTDIR += bin</code></p>
<p># altro<br />
<code>RC_FILE += Progetto.rc<br />
RESOURCES += resources/Progetto.qrc</code></p>
<ul>
<li>In HEADERS, FORMS e SOURCES abbiamo fissato il percorso fisico dei sorgenti e dei file delle finestre.</li>
<li>In OBJECTS_DIR ci sono i file oggetto delle compilazioni, in MOC_DIR i file sorgenti dovuti alla connessione degli eventi, in RCC_DIR sono presenti i file sorgenti delle risorse e in UI_DIR i file headers delle finestre. Queste 4 variabili prendetele così come sono, e usatele per ogni progetto Qt.</li>
<li>In DESTDIR andrà il binario risultante dalla compilazione totale.</li>
<li>In RC_FILE c&#8217;è il file per l&#8217;icona di windows.</li>
<li>In RESOURCES il file delle risorse.</li>
</ul>
<p>Qua sotto, ecco la situazione attuale: avere impostato un progetto così significa partire ben ordinati!</p>
<p style="text-align:center;"><a href="http://toastedtech.files.wordpress.com/2008/04/tree1.png"><img class="aligncenter size-full wp-image-361" src="http://toastedtech.wordpress.com/files/2008/04/tree1.png" alt="" width="178" height="336" /></a></p>
<p>A questo punto, scordatevi assolutamente il comando &#8220;qmake -project&#8221;. Dovrete da ora in poi, usare solo &#8220;qmake&#8221; e &#8220;make&#8221;.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Lezione Qt 1: Creare un semplice progetto]]></title>
<link>http://toastedtech.wordpress.com/2008/04/18/lezione-qt-1-creare-un-semplice-progetto/</link>
<pubDate>Fri, 18 Apr 2008 15:25:24 +0000</pubDate>
<dc:creator>montoya</dc:creator>
<guid>http://toastedtech.wordpress.com/2008/04/18/lezione-qt-1-creare-un-semplice-progetto/</guid>
<description><![CDATA[Premetto che sono uno dei più scarsi programmatori della Terra e che quindi non voglio insegnare nul]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Premetto che sono uno dei più scarsi programmatori della Terra e che quindi non voglio insegnare nulla a nessuno, però cerco di condividere quelle poche cose che so a tutti voi. Inoltre non è detto che farò altre lezioni, però per eventuali altre lezioni, il titolo sarà del tipo &#8220;Lezione Qt n: &#8230;.&#8221;. Detto questo, vediamo come creare un semplice progettino con le Qt4.</p>
<p style="text-align:center;"><a href="http://toastedtech.files.wordpress.com/2008/04/qt4.jpg"><img class="aligncenter size-full wp-image-359" src="http://toastedtech.wordpress.com/files/2008/04/qt4.jpg" alt="" width="128" height="128" /></a></p>
<p>Come prima cosa, bisogna aver installato le Qt4.x e in questa sede non farò di certo vedere come installare le librerie e impostare tutte le eventuali dipendenze (compilatore c++, make, ecc). Assumo per scontato che le liberie Qt4 (occhio alla versione) siano installate correttamente.</p>
<p><!--more--></p>
<p>Il nostro intento sarà quello di creare una piccola finestra che ha diversi componenti grafici: un&#8217;area testo, un bottone e una label. Lo scopo sarà quello di far visualizzare nella label il testo che scriveremo nell&#8217;area di testo dopo aver premuto l&#8217;apposito bottone.</p>
<p>Chi viene dalla programmazione Java e da diversi IDE come Netbeans, inizialmente si troverà (probabilmente) un pochino a disagio.</p>
<p>La prima cosa da fare, è la creazione di una directory per avere un po&#8217; di pulizia. Metteremo tutto ciò che ci serve, all&#8217;interno di tale cartella.</p>
<p>Per disegnare la finestra, ci baseremo su designer, il magnifico programma che permette di disegnare GUI in maniera veloce e soprattutto facile&#8230; molto meglio del netbeans. Nel video qua sotto, vedremo come creare un file di finestra, che non sarà altro che un banale file XML.</p>
<p style="text-align:center;"><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/zjfQ76-6XFg&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' /><param name='allowfullscreen' value='true' /><param name='wmode' value='transparent' /><embed src='http://www.youtube.com/v/zjfQ76-6XFg&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='transparent'></embed></object></span></p>
<p>Il file della finestra &#8220;finestra.ui&#8221; sarà processato in fase di compilazione in un file sorgente C++ (per l&#8217;esattezza, verrà chiamato &#8220;ui_finestra.h&#8221;).</p>
<p>Per usare la finestra, bisogna crearsi 2 file: &#8220;finestra.h&#8221; che conterrà la definizione della classe Finestra che creeremo, e il file &#8220;finestra.cpp&#8221; che conterrà le relative implementazioni.</p>
<p>La classe Finestra erediterà da 2 altre classi: da QMainWindow (che è la classe per le finestre in generale) e dalla classe Ui::MainWindow (ossia la classe MainWindow all&#8217;interno del namespace Ui che sarà generato dal file finestra.ui).</p>
<p><code>class Finestra : public QMainWindow, public Ui::MainWindow</code></p>
<p>Inoltre la classe conterrà uno &#8220;<strong>slot</strong>&#8220;, ossia un metodo normale che viene eseguito se un particolare &#8220;<strong>signal</strong>&#8221; viene attivato o generato. La macro Q_OBJECT è indispensabile per trattare questo tipo di cose.</p>
<p><code>public slots:<br />
void stampaVideo();</code></p>
<p>Questi 2 concetti sono nuovi rispetto al Java, ma non è così difficile entrare nella logica. Un signal può essere paragonato ad un evento di &#8220;clicked&#8221; del mouse, oppure alla chiusura di una finestra, e così via. C&#8217;è da dire che un metodo slot può essere anche chiamato manualmente all&#8217;interno del codice, ma un signal non può far eseguire un metodo non slot.</p>
<p>Nel file di implementazione, verrà richiamato il metodo di inizializzazione componenti grafici della finestra, mediante la chiamata al metodo setupUi.</p>
<p><code>setupUi(this);</code></p>
<p>Per far si che il metodo venga chiamato al momento della pressione del bottone, è necessario &#8220;connettere&#8221; fisicamente il signal e lo slot, mediante il metodo &#8220;connect&#8221;:</p>
<p><code>connect(pushButtonScrivi, SIGNAL(clicked()), this, SLOT(stampaVideo()));</code></p>
<p>All&#8217;interno del metodo stampaVideo() metteremo il codice per prendere il testo dall&#8217;area di testo e successivamente visualizzarla nella label appena sopra.</p>
<p>Fatto tutto, saremo pronti alla compilazione del progetto. I passi da fare saranno 3:</p>
<ul>
<li><code>qmake -project</code> (Serve per la creazione del file .pro del progetto. Nelle prossime lezioni, useremo file file.pro fatti da noi);</li>
<li><code>qmake</code> (Serve per la generazione del Makefile);</li>
<li><code>make</code> (Genera i file sorgenti dai file.ui, compila i file.src e crea il binario).</li>
</ul>
<p>Alla fine, avremo nella directory corrente, il nostro eseguibile funzionante.</p>
<p style="text-align:center;"><a href="http://toastedtech.wordpress.com/files/2008/08/esempioqttargz.odt">esempioqttargz</a></p>
<p style="text-align:center;">(da rinominare in esempioQt.tar.gz)</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
