View previous topic :: View next topic |
Author |
Message |
Linuxpeter Guru
Joined: 28 May 2004 Posts: 403 Location: Dresden, Germany
|
Posted: Fri Jul 02, 2004 5:11 pm Post subject: [OT] Mono 1.0 |
|
|
Tja, Novell hat heute laut zdnet die Verfügbarkeit von Mono 1.0 verkündet, und was soll ich sagen - die Jungs von Gentoo waren schneller als Novell.
Jetzt hoffe ich nur, das die Leute vom QtSharp-Team bald die Version 0.7.2 freigeben. _________________ Regards, Linuxpeter
Wenn "Windows" die Antwort ist, war es eine dumme Frage.
Is "Windows" the answer, then it was a stupid question. |
|
Back to top |
|
|
_hephaistos_ Advocate
Joined: 07 Apr 2004 Posts: 2694 Location: salzburg, austria
|
Posted: Fri Jul 02, 2004 5:19 pm Post subject: |
|
|
ah super
is schon am compilen... auch monodevelop gibts eine neue version (unstable...) |
|
Back to top |
|
|
Linuxpeter Guru
Joined: 28 May 2004 Posts: 403 Location: Dresden, Germany
|
Posted: Fri Jul 02, 2004 5:57 pm Post subject: |
|
|
Ich weiß, aber MonoDevelop ist einfach noch nicht zu gebrauchen.
Außerdem benutze ich nicht GtkSharp, sondern QtSharp, da ich mit Mono unter KDE programmiere. _________________ Regards, Linuxpeter
Wenn "Windows" die Antwort ist, war es eine dumme Frage.
Is "Windows" the answer, then it was a stupid question. |
|
Back to top |
|
|
_hephaistos_ Advocate
Joined: 07 Apr 2004 Posts: 2694 Location: salzburg, austria
|
Posted: Fri Jul 02, 2004 6:01 pm Post subject: |
|
|
zu monodevelop: ja, und ich hoffe doch bei jeder version, dass es besser wird...
qtsharp -> davon hab ich noch nichts gehört... gibts nicht im portage...
mal schauen, ob ich dazu was finde... wär mir lieber, als gtk |
|
Back to top |
|
|
Linuxpeter Guru
Joined: 28 May 2004 Posts: 403 Location: Dresden, Germany
|
Posted: Fri Jul 02, 2004 6:22 pm Post subject: |
|
|
Kleine Anleitung, um QtSharp zu installieren (cvs muß installiert sein ):
Code: |
$ export CVSROOT=:pserver:anonymous@cvs.sf.net:/cvsroot/qtcsharp
$ cvs login
(Bei Passwort-Abfrage Enter drücken!)
$ cvs co -r QTSHARP-0_7_1_BRANCH qtsharp
|
Zusätzlich brauchst Du http://cesnet.dl.sourceforge.net/sourceforge/qtcsharp/qtc-qtsharp-0.7a.tar.bz2
Dieses dann entpacken.
Nun am besten erstmal:
Code: |
$ ln -sf /usr/qt/3/bin/qmake /usr/bin/qmake
|
machen.
Jetzt ins qtc-qtsharp... -Verzeichnis wechseln, dann:
Code: |
$ qmake "INSTALLDIR=/usr/lib" && make && make install
|
Nun in das qtsharp... -Verzeichnis wechseln und:
Code: |
$ qmake "INSTALLDIR=/usr/lib" && make && make install
|
ausführen.
Das war's.
Interessant wär die Api-Doc unter http://qtcsharp.sourceforge.net/apidocs/index.html und die Qt-Docs, weil in den Api-Docs die Dokumentation der Signale fehlt.
Homepage von QtSharp: http://qtcsharp.sf.net
REIHENFOLGE EINHALTEN:
1. qtc-qtsharp
2. qtsharp
MONO MUß VORHER INSTALLIERT SEIN - MIND. VERSION 0.95
(Versionshinweis kommt von mir )
In deine zukünftigen Projekte muß dann folgendes mit rein:
und Aufruf vom Compiler wie folgt:
Code: |
$ mcs -r:Qt <deine Source-Dateien> -out:<Programmname.exe>
|
Übrigens kannst Du mcs auch mit Wildcard aufrufen:
Code: |
$ mcs -r:Qt *.cs -out:<Programmname.exe>
|
Ich hoffe, ich konnte Dir damit etwas helfen. _________________ Regards, Linuxpeter
Wenn "Windows" die Antwort ist, war es eine dumme Frage.
Is "Windows" the answer, then it was a stupid question. |
|
Back to top |
|
|
_hephaistos_ Advocate
Joined: 07 Apr 2004 Posts: 2694 Location: salzburg, austria
|
Posted: Fri Jul 02, 2004 6:23 pm Post subject: |
|
|
wow!! ich werd das probieren
ab in die howto section damit!
danke -> feedback folgt... |
|
Back to top |
|
|
_hephaistos_ Advocate
Joined: 07 Apr 2004 Posts: 2694 Location: salzburg, austria
|
Posted: Fri Jul 02, 2004 7:07 pm Post subject: |
|
|
hallo nochmal,
bin grad am compilen und helloworldqt schreiben...
welchen editor verwendest du?
weil monodevelop ist ja wirklich nicht zu gebrauchen.
danke,
ciao |
|
Back to top |
|
|
Linuxpeter Guru
Joined: 28 May 2004 Posts: 403 Location: Dresden, Germany
|
Posted: Fri Jul 02, 2004 7:34 pm Post subject: |
|
|
Kate! Benutze als Endung für deine Source-Dateien .cs .
Datei cs.xml (Original von Kate plus Erweiterungen/Änderungen von mir:
Code: |
<!DOCTYPE language SYSTEM "language.dtd">
<language name="C#" version="1.09" kateversion="2.1" section="Sources" extensions="*.cs" mimetype="text/x-csharp-src;text/x-csharp-hde">
<highlighting>
<list name="keywords">
<item> abstract</item>
<item> as</item>
<item> base</item>
<item> break</item>
<item> case</item>
<item> catch</item>
<item> class</item>
<item> checked</item>
<item> continue</item>
<item> default</item>
<item> delegate</item>
<item> do</item>
<item> else</item>
<item> enum</item>
<item> event</item>
<item> explicit</item>
<item> extern</item>
<item> false</item>
<item> for</item>
<item> foreach</item>
<item> finally</item>
<item> fixed</item>
<item> goto</item>
<item> if</item>
<item> implicit</item>
<item> in</item>
<item> interface</item>
<item> internal</item>
<item> is</item>
<item> lock</item>
<item> namespace</item>
<item> new</item>
<item> null</item>
<item> operator</item>
<item> out</item>
<item> override</item>
<item> params</item>
<item> private</item>
<item> protected</item>
<item> public</item>
<item> readonly</item>
<item> ref</item>
<item> return</item>
<item> sealed</item>
<item> sizeof</item>
<item> stackalloc</item>
<item> static</item>
<item> struct</item>
<item> switch</item>
<item> this</item>
<item> throw</item>
<item> true</item>
<item> try</item>
<item> typeof</item>
<item> unchecked</item>
<item> unsafe</item>
<item> using</item>
<item> virtual</item>
<item> while</item>
<item> value</item>
</list>
<list name="directives">
<item> #if</item>
<item> #else</item>
<item> #elif</item>
<item> #endif</item>
<item> #define</item>
<item> #undef</item>
<item> #warning</item>
<item> #error</item>
<item> #line</item>
</list>
<list name="types">
<item> bool</item>
<item> byte</item>
<item> char</item>
<item> const</item>
<item> decimal</item>
<item> double</item>
<item> float</item>
<item> int</item>
<item> long</item>
<item> object</item>
<item> uint</item>
<item> ushort</item>
<item> ulong</item>
<item> sbyte</item>
<item> short</item>
<item> string</item>
<item> void</item>
</list>
<list name="extensions">
<item> SIGNAL</item>
<item> SLOT</item>
</list>
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
<keyword attribute="Keyword" context="#stay" String="keywords"/>
<keyword attribute="Data Type" context="#stay" String="types" />
<keyowrd attribute="Directives" context="#stay" String="directives"/>
<keyword attribute="Extensions" context="#stay" String="extensions"/>
<Float attribute="Float" context="#stay">
<AnyChar String="fF" attribute="Float" context="#stay"/>
</Float>
<HlCOct attribute="Octal" context="#stay"/>
<HlCHex attribute="Hex" context="#stay"/>
<Int attribute="Decimal" context="#stay" >
<StringDetect attribute="Decimal" context="#stay" String="ULL" insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LUL" insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LLU" insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="UL" insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LU" insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LL" insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="U" insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="L" insensitive="TRUE"/>
</Int>
<HlCChar attribute="Char" context="#stay"/>
<DetectChar attribute="String" context="String" char="""/>
<Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
<Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*"/>
<DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="block1"/>
<DetectChar attribute="Symbol" context="#stay" char="}" endRegion="block1"/>
<RegExpr attribute="Decimal" context="#stay" String="#region.*$" beginRegion="Region1"/>
<RegExpr attribute="Decimal" context="#stay" String="#endregion.*$" endRegion="Region1"/>
<RegExpr attribute="Function" context="#stay" String="\b[_\w][_\w\d]*(?=[\s]*[(])" />
<RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" />
<AnyChar attribute="Symbol" context="#stay" String=":!%&()+,-/.*<=>?[]|~^;"/>
</context>
<context attribute="String" lineEndContext="#pop" name="String">
<LineContinue attribute="String" context="#pop"/>
<HlCStringChar attribute="String Char" context="#stay"/>
<DetectChar attribute="String" context="#pop" char="""/>
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="Member" fallthrough="true" fallthroughContext="#pop">
<RegExpr attribute="Function" context="#pop" String="\b[_\w][_\w\d]*(?=[\s]*)" />
</context>
<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/>
<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal"/>
<itemData name="Keyword" defStyleNum="dsKeyword" color="#000080" selColor="#ffffff" bold="1" italic="0"/>
<itemData name="Function" defStyleNum="dsKeyword"/>
<itemData name="Directives" defNumStyle="dsKeyword" color="#008080" selColor="#ffffff" bold="1" italic="0"/>
<itemData name="Extensions" defNumStyle="dsKeyword" color="#0094ff" selColor="#ffffff" bold="1" italic="0"/>
<itemData name="Data Type" defStyleNum="dsDataType"/>
<itemData name="Decimal" defStyleNum="dsDecVal"/>
<itemData name="Octal" defStyleNum="dsBaseN"/>
<itemData name="Hex" defStyleNum="dsBaseN"/>
<itemData name="Float" defStyleNum="dsFloat"/>
<itemData name="Char" defStyleNum="dsChar"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="String Char" defStyleNum="dsChar"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Symbol" defStyleNum="dsNormal"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="//" />
<comment name="multiLine" start="/*" end="*/" />
</comments>
<keywords casesensitive="1" />
</general>
</language>
|
Speichere diesen Code-Block unter /usr/kde/3.2/share/apps/katepart/syntax/cs.xml (vorhandene überschreiben). _________________ Regards, Linuxpeter
Wenn "Windows" die Antwort ist, war es eine dumme Frage.
Is "Windows" the answer, then it was a stupid question. |
|
Back to top |
|
|
_hephaistos_ Advocate
Joined: 07 Apr 2004 Posts: 2694 Location: salzburg, austria
|
Posted: Fri Jul 02, 2004 7:42 pm Post subject: |
|
|
hi,
danke, hab eh schon mit kate und C# Highlighting gearbeitet - thx für deine cs.xml file...
ich komm nicht dahinter. hab alles so gemacht, wie von dir beschrieben - hab mir von der qtsharp seite das helloqt abgeschrieben:
Code: | namespace QtSample {
using Qt;
using System;
public class HelloWorld : QMainWindow {
public static int Main (string[] args) {
QApplication a = new QApplication(args.Length, args);
QString s = new QString("hello");
QPushButton hello = new QPushButton(s, null);
hello.resize(200, 60);
QObject.connect(hello, SIGNAL("clicked()"), a, SLOT("quit()"));
a.setMainWidget(hello);
hello.show();
return a.exec();
}
}
} |
und beim compilen mit Code: | mcs -r Qt qttest.cs | (hab natürlich auch dein command ausprobiert)
krieg ich immer
Code: | qttest.cs(9) error CS1502: The best overloaded match for method ' Qt.QApplication..ctor (string[], bool)' has some invalid arguments
qttest.cs(9) error CS1503: Argument 0: Cannot convert from 'int' to 'string[]'
qttest.cs(9) error CS1501: No overload for method `Qt.QApplication' takes `2' arguments
qttest.cs(9) error CS1501: New invocation: Can not find a constructor in `Qt.QApplication' for this argument list
qttest.cs(12) error CS0117: `Qt.QPushButton' does not contain a definition for `resize'
qttest.cs(13) error CS0117: `Qt.QObject' does not contain a definition for `connect'
qttest.cs(14) error CS0117: `Qt.QApplication' does not contain a definition for `setMainWidget'
qttest.cs(15) error CS0117: `Qt.QPushButton' does not contain a definition for `show'
qttest.cs(16) error CS0117: `Qt.QApplication' does not contain a definition for `exec'
Compilation failed: 9 error(s), 0 warnings
|
ich hab natürlich herumprobiert und bin draufgekommen, dass das QtSupport bzw. auch QMainWindow die Probleme machen....
hast du dafür eine idee
danke! |
|
Back to top |
|
|
Linuxpeter Guru
Joined: 28 May 2004 Posts: 403 Location: Dresden, Germany
|
Posted: Fri Jul 02, 2004 7:50 pm Post subject: |
|
|
Simple Hello-App:
main.cs
Code: |
using System;
using Qt;
namespace MyApp
{
public class Application : QApplication
{
private void slotMainWindowClosed()
{
(MainWidget() as MainWindow).Dispose();
}
public Application(string[] args) : base(args)
{
Connect(this, SIGNAL("lastWindowClosed()"), this, SLOT("slotMainWindowClosed()"));
SetMainWidget(new MainWindow());
MainWidget().Show();
}
static int Main(string[] args)
{
Application app = new Application(args);
return app.Exec();
}
}
}
|
MainWindow ist das Hauptfenster der Anwendung, bei mir immer im selben NameSpace, aber extra Datei.
mainwindow.cs
Code: |
using System;
using Qt;
namespace MyApp
{
public class MainWindow : QMainWindow
{
QPushButton helloButton;
private void helloClicked()
{
QMessageBox.Information(this, "Info", "Hello-Button wurde betätigt.");
}
public MainWindow() : base(null)
{
SetCaption("MyApp");
helloButton = new QPushButton("Hello", this);
helloButton.SetGeometry(0, 0, Size().Width(), Size().Height());
Connect(helloButton, SIGNAL("clicked()"), this, SLOT("helloClicked()"));
}
}
}
|
Kompillieren und ausführen:
Code: |
$ mcs -r:Qt *.cs -out:test.exe
$ mono test.exe
|
Der Aufbau der main.cs ist sehr wichtig, vor allem der Connect zwischen dem Signal "lastWindowClosed" und dem Slot "slotMainWindowClosed", da ansonsten oftmals beim Beenden der Anwendung dieselbige von Mono gekillt wird. Das Problem scheint zu sein, das Mono nicht immer in der lage ist, das letzte Fenster der Anwendung VOR dem QApplication-Object freizugeben.
So, wie ich es mache, erreiche ich, das IMMER das letzte Fenster ordnungsgemäß freigegeben wird (bzw der Speicherbereich) und erst als letztes das QApplication-Object.
Zu deinem letzten Posting:
[code]
QApplication a = new QApplication( args );
// nur args - keinen weiteren Parameter!
[code]
$ mcs -r:Qt ......
// Doppelpunkt statt Leerzeichen
// und am besten immer mit .... -out:<programmname.exe> - besser, wenn man mehrere Source-Dateien hat.
# editiert am 10.12.2004 - Schreibfehler korrigiert _________________ Regards, Linuxpeter
Wenn "Windows" die Antwort ist, war es eine dumme Frage.
Is "Windows" the answer, then it was a stupid question.
Last edited by Linuxpeter on Fri Dec 10, 2004 3:57 pm; edited 2 times in total |
|
Back to top |
|
|
_hephaistos_ Advocate
Joined: 07 Apr 2004 Posts: 2694 Location: salzburg, austria
|
Posted: Fri Jul 02, 2004 7:55 pm Post subject: |
|
|
herzlichen dank für dein howto und dein helloworld.cs!!
jetzt weiß ich, dass es funktioniert
danke,
schönen abend noch!
PS: nur zur INFO: bei dir im code steht in der mainwindow.cs
Code: | Connect(helloButton, SIGNAL("clicked()"), this, SLOT("helloLicked()")); |
statt
Code: | Connect(helloButton, SIGNAL("clicked()"), this, SLOT("helloClicked()")); | also Clicked... |
|
Back to top |
|
|
Linuxpeter Guru
Joined: 28 May 2004 Posts: 403 Location: Dresden, Germany
|
Posted: Fri Jul 02, 2004 7:58 pm Post subject: |
|
|
Wer Schreibfehler findet, darf sie behalten! _________________ Regards, Linuxpeter
Wenn "Windows" die Antwort ist, war es eine dumme Frage.
Is "Windows" the answer, then it was a stupid question. |
|
Back to top |
|
|
_hephaistos_ Advocate
Joined: 07 Apr 2004 Posts: 2694 Location: salzburg, austria
|
Posted: Fri Jul 02, 2004 8:01 pm Post subject: |
|
|
ja sorry...
falls das howto mal jemand nachmachen will - dachte ich
aber das sieht normalerweise eh jeder sofort
ciao |
|
Back to top |
|
|
Sas Veteran
Joined: 05 Jul 2003 Posts: 1229 Location: Germany
|
Posted: Fri Jul 02, 2004 10:40 pm Post subject: |
|
|
Wow, QTSharp kannte ich auch noch nicht, aber um ehrlich zu sein habe ich auch noch nicht die Zeit gefunden mich mit Mono zu befassen, die ich gerne hätte. Aber wenn das mal kein neuer Anreiz ist!
Danke für den Tipp und deine ausführlichen Beiträge, da werde ich morgen mal mit rumspielen. _________________ 42 |
|
Back to top |
|
|
meyerm Veteran
Joined: 27 Jun 2002 Posts: 1311 Location: Munich / Germany
|
|
Back to top |
|
|
birnbaumtruhe Apprentice
Joined: 20 Sep 2003 Posts: 281
|
|
Back to top |
|
|
Sas Veteran
Joined: 05 Jul 2003 Posts: 1229 Location: Germany
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|