maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Need assistance from QT programmer (https://talk.maemo.org/showthread.php?t=58569)

Venemo 2010-07-16 10:31

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by D-Iivil (Post 753738)
For me it does not seem to create the connect() when right-clicking the button in UI and choosing -> Go to slot...

Yes.
It is auto-generated by the ui file and initalized with that.
(Eg. it doesn't pollute your own code, but it will be taken care of in the background.)

You can open the .ui file with an XML editor and see how it deals with the stuff.
Note that Qt will generate real C++ code from the .ui, and compile it along with the rest of the app.

Venemo 2010-07-16 10:35

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by Diph (Post 753740)
If you just want to get text from drop down menu when button is clicked (put this in hello() slot):
Code:

ui->myComboBox->currentText(); //This property holds the text of the current item.

Indeed, this is the best way to read the current text from a combo box!

http://doc.qt.nokia.com/4.6/qcombobo...rrentText-prop

d-iivil 2010-07-16 10:36

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by Venemo (Post 753743)
Yes.
It is auto-generated by the ui file and initalized with that.
(Eg. it doesn't pollute your own code, but it will be taken care of in the background.)

You can open the .ui file with an XML editor and see how it deals with the stuff.
Note that Qt will generate real C++ code from the .ui, and compile it along with the rest of the app.

Well, the apply-button stopped working after trying to let the designer take care of it all.
Edit: re-did it and it's working again (I mean the let the designer take care of connecting)

d-iivil 2010-07-16 10:45

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by Diph (Post 753740)
If you just want to get text from drop down menu when button is clicked (put this in hello() slot):
Code:

ui->myComboBox->currentText(); //This property holds the text of the current item.
Or if you want to do something when user changes selection in drop down menu (put this in constructor and create new slot):
Code:

connect(ui->myComboBox, SIGNAL(currentIndexChanged(QString),
this,
SLOT(comboBoxCurrentIndexChanged(QString));

Code:

void MainWindow::comboBoxCurrentIndexChanged(const QString &text) {
  //Do something
}

E: Bit late. :)

Hmm... m'kay... still cannot figure out how to use this.

I mean with php I would do it like this:
$variable1 = $_GET[drop_down_transitions]
$variable2 = $_GET[drop_down_font]
$variable3 = $_GET[drop_down_color]

And then just include it like this:
Code:

    QStringList arguments;
    arguments << "$variable1" << "$variable2" << "$variable3";
    QProcess::execute("/sbin/myscript", arguments);

Thanks for you guys for the help. I know it's frustrading to teach someone who has no_idea_at_all what's happening :D

Diph 2010-07-16 10:49

Re: Need assistance from QT / Python programmer
 
Something like this:
Code:

QStringList arguments;
arguments << ui->dropDownTransition->currentText() << ui->dropDownFont->currentText() << ui->dropDownColor->currentText();
QProcess::execute("/sbin/myscript", arguments);

E: It's a good practise to check if variables are empty:
Code:

QString transition = ui->dropDownTransition->currentText();
//Not empty
if (!transition.isEmpty()) {
  //Do something
}


d-iivil 2010-07-16 11:05

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by Diph (Post 753761)
Something like this:
Code:

QStringList arguments;
arguments << ui->dropDownTransition->currentText() << ui->dropDownFont->currentText() << ui->dropDownColor->currentText();
QProcess::execute("/sbin/myscript", arguments);

E: It's a good practise to check if variables are empty:
Code:

QString transition = ui->dropDownTransition->currentText();
//Not empty
if (!transition.isEmpty()) {
  //Do something
}


Just a minute before you replied I figured it out by reading your previous post few times over and over :)

So it's working now!

Next step: how to build / compile a binary out of this or how to include the source with my excisting package and make autobuilder to build / compile it?

Diph 2010-07-16 11:09

Re: Need assistance from QT / Python programmer
 
You can try the binary in the phone by following instructions from NokiaQtSDK_PATH/readme/index.html.

To create source package for autobuilder you need scratchbox.

d-iivil 2010-07-16 11:25

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by Diph (Post 753775)
You can try the binary in the phone by following instructions from NokiaQtSDK_PATH/readme/index.html.

To create source package for autobuilder you need scratchbox.

Okay, will read it. I have scratchbox already for making sources of my themes.

Diph 2010-07-16 11:32

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by D-Iivil (Post 753785)
Okay, will read it. I have scratchbox already for making sources of my themes.

http://wiki.maemo.org/Packaging_a_Qt_application

Venemo 2010-07-16 11:40

Re: Need assistance from QT / Python programmer
 
Quote:

Originally Posted by D-Iivil (Post 753755)
Hmm... m'kay... still cannot figure out how to use this.

I mean with php I would do it like this:
$variable1 = $_GET[drop_down_transitions]
$variable2 = $_GET[drop_down_font]
$variable3 = $_GET[drop_down_color]

And then just include it like this:
Code:

    QStringList arguments;
    arguments << "$variable1" << "$variable2" << "$variable3";
    QProcess::execute("/sbin/myscript", arguments);


Code:

QString variable1("string1");
QString variable2("string2");
QString variable3("string3");

QStringList myStringList;
myStringList.append(variable1);
myStringList.append(variable2);
myStringList.append(variable3);

Quote:

Originally Posted by D-Iivil (Post 753773)
Next step: how to build / compile a binary out of this or how to include the source with my excisting package and make autobuilder to build / compile it?

If you already tested it using Qt Creator, here is how to make an installable package:

Quote:

Originally Posted by Venemo (Post 753632)
If you want to make a .deb package, you can use Qt Creator's option to do so (but it is quite limited at the moment), or use MADDE and type "mad dpkg-buildpackage" into the command line (in your app's root folder)

If you would like to upload it to Extras-devel, here is a good description:
http://wiki.maemo.org/Uploading_to_Extras

I prefer to use the Assistant, it works like a charm.
https://garage.maemo.org/extras-assistant/index.php


All times are GMT. The time now is 23:21.

vBulletin® Version 3.8.8