Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Need assistance from QT programmer

    Reply
    Page 8 of 18 | Prev |   6     7   8   9     10   | Next | Last
    d-iivil | # 71 | 2010-07-18, 17:56 | Report

    Application output window in QT Creator says this:
    Object::connect: No such slot MainWindow:rocessFinished() in mainwindow.cpp:29
    Object::connect: (receiver name: 'MainWindow')

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Diph | # 72 | 2010-07-18, 18:44 | Report

    It should be connect(..., this, SLOT(processFinished(int) or you can define the method void processFinished() if you don't need the exit code.

    In header file (*.h) you declare methods and in source file (*.cpp) you write the implementation. Method declarations and implementations have to be in same form, like

    Header:
    Code:
    class MainWindow
    {
    ...
    private:
       void processFinished(int code);
    Cpp:
    Code:
    void MainWindow::processFinished(int code)
    {
    }
    Actually you can make the connect without less attributes:
    Code:
    connect(progress, SIGNAL(finished(int, QString), this, SLOT(progressFinisshed(int));
    and it should work.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by Diph; 2010-07-18 at 18:54.

     
    d-iivil | # 73 | 2010-07-18, 19:06 | Report

    Originally Posted by Diph View Post
    It should be connect(..., this, SLOT(processFinished(int) or you can define the method void processFinished() if you don't need the exit code.

    In header file (*.h) you declare methods and in source file (*.cpp) you write the implementation. Method declarations and implementations have to be in same form, like

    Header:
    Code:
    class MainWindow
    {
    ...
    private:
       void processFinished(int code);
    Cpp:
    Code:
    void MainWindow::processFinished(int code)
    {
    }
    Actually you can make the connect without less attributes:
    Code:
    connect(progress, SIGNAL(finished(int, QString), this, SLOT(progressFinisshed(int));
    and it should work.
    Yeah, got it connecting by adding the int.

    But about the script not running issue; it looks like there's something wrong with this:
    Code:
            QProcess *process = new QProcess(this);
            process->start("/sbin/launchblack", arguments);
    since it starts fine with this:
    Code:
    QProcess::execute("/sbin/launchblack", arguments);

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 74 | 2010-07-18, 20:00 | Report

    Okay, it's working now. And I am a complete idiot. I didn't realize I should not test the binary on the device with root login instead of developer :-/

    The exitCode -thing isn't still working, the progress dialog is left running even the script finishes. Need to figure that out tomorrow Thanks for the help so far again!

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 75 | 2010-07-19, 06:30 | Report

    Okay, after debugging I'm sure my scipt ends correctly and singnal finished(int) is sent to the slot and slot receives it. The damn progress-dialog won't just close with command progress.close()

    Any other ways to make sure the progress-dialog will get killed?

    Edit. Seems like progress.cancel(); did the trick

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by d-iivil; 2010-07-19 at 06:38.
    The Following User Says Thank You to d-iivil For This Useful Post:
    Diph

     
    d-iivil | # 76 | 2010-07-19, 08:05 | Report

    Okay, one last question: what should I put the binary to depend on @ control -file?

    Edit: nevermind, got it already

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by d-iivil; 2010-07-19 at 08:09.

     
    Diph | # 77 | 2010-07-19, 14:32 | Report

    Originally Posted by D-Iivil View Post
    Okay, after debugging I'm sure my scipt ends correctly and singnal finished(int) is sent to the slot and slot receives it. The damn progress-dialog won't just close with command progress.close()

    Any other ways to make sure the progress-dialog will get killed?

    Edit. Seems like progress.cancel(); did the trick
    I was being lazy there and tried it on desktop only, not scratchbox. :P

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 78 | 2010-07-19, 15:56 | Report

    Originally Posted by Diph View Post
    I was being lazy there and tried it on desktop only, not scratchbox. :P
    Heh
    You have been extremely non-lazy while helping out qt-super-noob like me with all the issues I've had with this extremely simple program

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 79 | 2010-07-20, 15:01 | Report

    Okay folks Now that I have the app up and running it's time to start adding some features to it and first is this:
    - I wan't to save the state of selections user has made using the drop down menus when my shell script has been executed and progress dialog is closed. And then load this state when user launches the program next time.

    What would be the best way to approach this? Some flat-file "database" where I store the selections and then read those when program is launched? Can you guys once again point me into right direction and I'll promise I'll try to figure it out myself as much as possible :-D

    Edit | Forward | Quote | Quick Reply | Thanks

     
    TNiga | # 80 | 2010-07-20, 15:09 | Report

    You can use QSettings class for that. Just add following functions to your MainWindow class:
    Code:
    void MainWindow::saveSettings() const {
        QSettings sett("blackplastic-theme/config");
        sett.setValue("font", text_of_combobox /* you now how to get that already */);
        // Other values like that also
    }
    void MainWindow::loadSettings() {
        QSettings sett("blackplastic-theme/config");
        bool bOK;
        QString font = sett.value("font", QVariant("")).toString();
        // Other values likewise and set comboboxes to show values
    }
    Then call loadSettings at the end of MainWindow's constructor and saveSettings in MainWindows's destructor (~MainWindow).

    EDIT: QSettings saves config files under ~/.config so in this case config file would be ~/.config/blackplastic-theme/config

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to TNiga For This Useful Post:
    d-iivil

     
    Page 8 of 18 | Prev |   6     7   8   9     10   | Next | Last
vBulletin® Version 3.8.8
Normal Logout