Hi,
I'll answer your question, and also the question you asked
when you thought
you were answering your question, below.
On Thursday 17 April 2008 1:16:19 pm LECONTE Frédéric
wrote:
> Hello,
> I am new french programmer with kommander.
>
> I have understand how to use signals and slots in
studying qt documentation
> but i don't know how to create a new slots in
kommander. I know how to use
> signals and slots that already exists in kommander.
>
> In my program I want to connect an activated signal
from a combobox to a
> new slot in a textbrowser widget , to have a text in
the textbrowser wich
> is composed from the text of the combobox and an other
text.
>
> if I connect activated signals from combobox to settext
slot of textBrowser
> I set only text with text in combobox.
Sounds right.
>
> I want to have something with a certain sentence plus
the combobox text(
> plus perhaps an other sentence).
>
> I think i must create a new slot. With C language i
suppose it will be
Slots would be created in C++ and of course they are native
to Qt, created my
the met abject compier from the QOBJECT macro.
> something like:
> class Browser: public Qwidget
> {
> Qstring text;
> ...
> public slot:
> void setText( Qstring t)
> {
> text="Hello, the text is now:" +t;
> }
> ...
> }
>
> and in the main something like:
> ...
> c=new ComboBox;
> b=new Browser;
> connect( &c, activated(), &b, setText());
> ...
Whoa, you're creating new widgets there too. ;)
>
> ( Sorry but I very new to KDE, kommander and C
programming, and sorry for
> my verbose message)
> Perhaps i must create a new slot in the kommander text
window. Please help
> me, I don't find any tutorial about this.
>
> Email: fred.leconte2 wanadoo.fr
>
There are plenty of examples of tutorials in the new package
in the menu
Tools>Editor>examples.
Anyway there is a much easier answer than hacking Kommander
with new slots,
which BTW would be problematic as your application was
specific and would
mean a clutter of new slots...
1) Create a new script object
2) Connect your combo signal widgetTextChanged(QString&)
to the script
object's execute(QString&)
3) In your script object you can get the current selection
of the combo, or
use Self.item(0) for the first passed paramter to make up
your string
4) Use TextBrowser.setText(string) or if you are appending
or using some other
edit slot call the slot directly with
TextBrowser.append(string)
You do need version 1.3 that shipped with KDE 3.5.9 to do
things like directly
call the slot from a script.
If you're interested in helping me to hack Kommander please
contact me off
list or on the kommander-devel list.
--
Eric Laffoon
Project Lead - kdewebdev module
_______________________________________________
Kommander mailing list
Kommander kdewebdev.org
http://mail.kdewebdev.org/mailman/listinfo/kommander
|