Results 1 to 20 of 32

Thread: How to create custom slot in Qt Designer 4.1?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by jamadagni
    Ouch. I am totally new to Qt and C++ programming. (I knew a little C, but that was a long time ago. Isn't Qt 4 so friendly to start learning Qt?) I have submitted a bug to Trolltech asking them to give me us a Quick Start guide to Designer in Qt 4, but till then how do I learn Qt?
    Like you are trying to do, I learned both QT4 and C++ at the same time.
    It's not that hard.
    For example, you declare a slot in your app.h file:
    Qt Code:
    1. private slots:
    2. ...
    3. void searchAll();
    To copy to clipboard, switch view to plain text mode 
    Then you put a connection in the constructor of your app class, in app.cpp:
    Qt Code:
    1. connect(ui.btnSearch, SIGNAL(clicked()), this, SLOT(searchAll()));
    To copy to clipboard, switch view to plain text mode 
    and, you put the function in app.cpp, outside the constuctor:
    Qt Code:
    1. void app::searchAll() {
    2. // user enters value to search for in search text box
    3. ....
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    For example, you declare a slot in your app.h file:
    Qt Code:
    1. private slots:
    2. ...
    3. void searchAll();
    To copy to clipboard, switch view to plain text mode 
    That's exactly what I am trying to avoid.
    If I change the app.h that is generated by the designer and afterwards add some new widgets to my dialog, all my private slots will be lost.

    Am I missing something?
    If there weren't noobs there would be no experts

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    If I change the app.h that is generated by the designer and afterwards add some new widgets to my dialog, all my private slots will be lost.
    Don't touch those files and instead create another class. You can find the exact instructions here, but in short you need something like this:
    Qt Code:
    1. #include <QDialog>
    2. #include "ui_somedialog.h" // this file was made from somedialog.ui by uic
    3.  
    4. class SomeDialog : public QDialog
    5. {
    6. Q_OBJECT
    7. public:
    8. SomeDialog( QWidget *parent = 0 );
    9.  
    10. private slots:
    11. void searchAll();
    12.  
    13. private:
    14. Ui::SomeDialog _ui;
    15. };
    16.  
    17. // .cpp file:
    18.  
    19. void SomeDialog( QWidget *parent ) : QDialog( parent )
    20. {
    21. _ui.setupUi( this );
    22. // ...
    23. }
    24.  
    25. void SomeDialog::searchAll()
    26. {
    27. // ...
    28. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    OK, here are some excepts of my Homestead app that do what I believe you want to do. This code throws up a dialog which contains a list of wholenames selected from a SQL select of type form "LIKE partialname%". Clicking on the proprty_id column and/or the ssn column selects that property or that individual. Clicking the OK or Cancel button closes the dialog.

    Here is the wholenamedlg.h header file:
    Qt Code:
    1. #ifndef WHOLENAMEDLG_H
    2. #define WHOLENAMEDLG_H
    3. .... snip includes ..........
    4.  
    5. #include "ui_wholenamedlg.h"
    6.  
    7.  
    8. class wholenamedlg : public QDialog
    9. {
    10. Q_OBJECT
    11.  
    12. public:
    13. wholenamedlg(QWidget *parent = 0, QString partName = "", QString strYear = "2006", QString strSpouseFlag = "F");
    14. QString resultSSN;
    15. QString resultPropID;
    16. QTableView wholeNameView;
    17.  
    18. private:
    19. Ui::wholeNameDlgUI wnui;
    20.  
    21. private slots:
    22. void copyVALUES(const QModelIndex &);
    23.  
    24. };
    25.  
    26. #endif
    To copy to clipboard, switch view to plain text mode 
    "wholeNameDlgUI" is the name given to the dialog during the Designer session.


    Here is the wholenamedlg.cpp file which displays the dialog grid:
    Qt Code:
    1. /*
    2. Program: wholenamedlg.cpp
    3. Description: A dialog class for picking an SSN and/or a name out of
    4. a query created by the SQL LIKE % syntax.
    5. Author: Jerry L Kreps
    6. Date: 11/10/05 - ff
    7. */
    8.  
    9. #include "wholenamedlg.h"
    10. ... snip includes ......
    11.  
    12. wholenamedlg::wholenamedlg(QWidget *parent, QString partName, QString strYear, QString strSpouseFlag)
    13. : QDialog(parent)
    14. {
    15. wnui.setupUi(this);
    16.  
    17. connect(this->wnui.wholeNameView, SIGNAL(clicked(QModelIndex)), this, SLOT(copyVALUES( QModelIndex )));
    18.  
    19. partName.prepend("'");
    20. partName.append("'");
    21. QString queryStr = "SELECT proprty_id,ssn,wholename,sssn,sname,city,address FROM persinfo_";
    22. queryStr.append(strYear);
    23. if (strSpouseFlag == "F") {
    24. queryStr.append(" WHERE wholename LIKE ");
    25. queryStr.append(partName);
    26. queryStr.append(" ORDER BY wholename");
    27. } else {
    28. queryStr.append(" WHERE sname LIKE ");
    29. queryStr.append(partName);
    30. queryStr.append(" ORDER BY sname");
    31. }
    32. QSqlQueryModel *viewModel = new QSqlQueryModel(wnui.wholeNameView);
    33. viewModel->setHeaderData(0, Qt::Horizontal, "ID");
    34. viewModel->setHeaderData(1, Qt::Horizontal, "SSN");
    35. viewModel->setHeaderData(2, Qt::Horizontal, "WholeName");
    36. viewModel->setHeaderData(3, Qt::Horizontal, "SSSN");
    37. viewModel->setHeaderData(4, Qt::Horizontal, "SName");
    38. viewModel->setHeaderData(5, Qt::Horizontal, "City");
    39. viewModel->setHeaderData(6, Qt::Horizontal, "Address");
    40.  
    41. viewModel->setQuery(queryStr);
    42. if (viewModel->lastError().type() == QSqlError::NoError){
    43. wnui.wholeNameView->setModel(viewModel);
    44. if (viewModel->rowCount() > 0){
    45. for (int i = 0; i < viewModel->rowCount(); ++i)
    46. this->wnui.wholeNameView->verticalHeader()->resizeSection(i,20);
    47. for (int i = 0; i < 7; ++i)
    48. wnui.wholeNameView->resizeColumnToContents(i);
    49. }
    50. }
    51. }
    52.  
    53. void wholenamedlg::copyVALUES(const QModelIndex &QMI) {
    54. QVariant value = this->wnui.wholeNameView->model()->data(QMI,0);
    55. if (value.isValid()) {
    56. if (QMI.column() == 0)
    57. this->resultPropID = value.toString();
    58. if (QMI.column() == 1)
    59. this->resultSSN = value.toString();
    60. }
    61. }
    To copy to clipboard, switch view to plain text mode 
    "wholeNameView" is the name given in the Designer to the tableview grid containing the data being displayed.

    Here is the main class for the homestead application. The segment shown displays that part of the searchALL() function which calls the wholenamedlg dialog.
    Qt Code:
    1. /*
    2. Program: homestead.cpp
    3. Description: Homestead Application Program (HAP)
    4. Author: Jerry L Kreps
    5. Date: 11/1/2005
    6. */
    7. #include "homestead.h"
    8. #include "wholenamedlg.h"
    9. ...
    10. homestead::homestead(QWidget *parent) : QMainWindow(parent) {
    11. // homestead constructor method
    12. ui.setupUi(this); // draw the gui interface
    13. this->Year65 = 1940; // set birth year for 65 year olds
    14. this->dbYear = "2006";
    15. ...
    16.  
    17. connect(ui.btnSearch, SIGNAL(clicked()), this, SLOT(searchAll()));
    18. ...
    19. ...
    20. } // end of the homestead constructor
    21.  
    22. void homestead::searchAll() {
    23. // user enters value to search for in search text box
    24. // and clicks the radio button indicating its data type
    25. // then clicks the search button
    26. bool foundProp = false;
    27. bool foundPers = false;
    28. QString queryStr = "";
    29. QString seekWN = "'"; // set up for possible wholename search
    30. QString requestString;
    31. requestString = "Searching for: ";
    32. requestString.append(ui.leSearch->text()); // echo search request
    33. if (ui.rbWholeName->isChecked()) {
    34. QString partialName = ui.leSearch->text().trimmed();
    35. if (partialName.contains('%')){
    36. //select proprty_id,ssn,wholename,sssn,sname,city,address from persinfo_2006
    37. //WHERE wholename LIKE 'MILLER/E%' ORDER BY wholename
    38. wholenamedlg dlg(this, partialName, this->dbYear, "F");
    39. if( dlg.exec() == QDialog::Accepted ){
    40. QString strSSN = dlg.resultSSN.trimmed();
    41. QString strPropID = dlg.resultPropID.trimmed();
    42. // was ssn returned from dialog ?
    43. .....
    44. ..... snip lot's of code .....
    45. .....
    To copy to clipboard, switch view to plain text mode 
    Here is what the dialog looks like in action:
    wholenamedlg_shown.jpg
    Last edited by GreyGeek; 13th January 2006 at 15:11.

  5. #5
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by jacek
    Don't touch those files and instead create another class. You can find the exact instructions here, but in short you need something like this:
    Qt Code:
    1. #include <QDialog>
    2. #include "ui_somedialog.h" // this file was made from somedialog.ui by uic
    3.  
    4. class SomeDialog : public QDialog
    5. {
    6. Q_OBJECT
    7. public:
    8. SomeDialog( QWidget *parent = 0 );
    9.  
    10. private slots:
    11. void searchAll();
    12. etc. etc etc
    13. }
    To copy to clipboard, switch view to plain text mode 

    Ok , it's obvious that I am stupid and noob at the same time (in c++ & qt), so I can't be more embarassed.

    here is my code:

    Qt Code:
    1. #include <qapplication.h>
    2. #include "ui_bullshit.h"
    3.  
    4. class bullshit : public QDialog
    5. {
    6. Q_OBJECT
    7.  
    8. public:
    9. bullshit(QWidget *parent = 0);
    10.  
    11. private:
    12. Ui::bullshit ui;
    13. };
    14.  
    15.  
    16. bullshit::bullshit( QWidget *parent )
    17. {
    18.  
    19. ui.setupUi( this );
    20.  
    21. // ...
    22. }
    23.  
    24.  
    25. int main(int argc, char **argv)
    26. {
    27. QApplication app(argc, argv);
    28.  
    29. QDialog *window = new QDialog;
    30. Ui::bullshit _ui;
    31. _ui.setupUi(window);
    32.  
    33. window->show();
    34. return app.exec();
    35. }
    To copy to clipboard, switch view to plain text mode 

    If i compile main.cpp it's ok , but linker gives me a nice error:

    main.cpp undefined reference to `vtable for bullshit'

    I should not paste the errors I get when I use a separate .h and .cpp for the class constructor and functions.
    If there weren't noobs there would be no experts

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    main.cpp undefined reference to `vtable for bullshit'
    Add:
    Qt Code:
    1. #include "main.moc"
    To copy to clipboard, switch view to plain text mode 
    at the end of main.cpp and run "qmake && make".

  7. #7
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: How to create custom slot in Qt Designer 4.1?

    Thanks a lot , it compiled && linked now, but still not working

    Qt Code:
    1. #include <qapplication.h>
    2. #include <qmessagebox.h>
    3.  
    4. #include "ui_bullshit.h"
    5.  
    6. class bullshit : public QDialog, private Ui::bullshit
    7. {
    8. Q_OBJECT
    9. public:
    10. bullshit(QWidget *parent = 0);
    11. // private:
    12. // Ui::bullshit ui;
    13.  
    14. private slots:
    15. void msgbox();
    16. void on_helloButton_clicked();
    17. };
    18.  
    19.  
    20.  
    21. bullshit::bullshit( QWidget *parent ): QDialog(parent)
    22. {
    23. setupUi(this);
    24.  
    25. connect(helloButton,SIGNAL(clicked()),this,SLOT(msgbox()));
    26.  
    27. }
    28.  
    29. void bullshit::msgbox()
    30. {
    31. QMessageBox::information(this, "Application name","The factory default will be used instead.");
    32. }
    33.  
    34.  
    35.  
    36. void bullshit::on_helloButton_clicked()
    37. {
    38. QMessageBox::information(this, "Application name","The factory default will be used instead.");
    39. }
    To copy to clipboard, switch view to plain text mode 


    Can you please explain why we included the .moc file?

    Txs
    Last edited by cioannou; 15th January 2006 at 19:32.
    If there weren't noobs there would be no experts

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    Thanks a lot , it compiled && linked now, but still not working
    What do you mean by "not working"? How does your main() function look like?

    Can you please explain why we included the .moc file?
    Because you have placed definition of a class with Q_OBJECT macro in .cpp file. You wouldn't have to do it, if that class definition wes in a header.

  9. #9
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by jacek
    What do you mean by "not working"? How does your main() function look like?
    Qt Code:
    1. int main(int argc, char **argv)
    2. {
    3. QApplication app(argc, argv);
    4.  
    5. QDialog *window = new QDialog;
    6. Ui::bullshit _ui;
    7. _ui.setupUi(window);
    8.  
    9. window->show();
    10. QMessageBox::information(window, "startup msgbox",
    11. "The factory default will be used instead.");
    12. return app.exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    I mean that I press my helloButton but no QMessageBox appears.

    Quote Originally Posted by jacek
    Because you have placed definition of a class with Q_OBJECT macro in .cpp file. You wouldn't have to do it, if that class definition wes in a header.
    Got it, thanks a lot.
    If there weren't noobs there would be no experts

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    I mean that I press my helloButton but no QMessageBox appears.
    You don't instatiate your class anywhere.

    Try:
    Qt Code:
    1. int main( int argc, char **argv )
    2. {
    3. QApplication app(argc, argv);
    4.  
    5. bullshit *window = new bullshit();
    6. window->show();
    7.  
    8. QMessageBox::information( window, "startup msgbox", "The factory default will be used instead." );
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    PS. Please, next time choose a different name for your class.

  11. #11
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by jacek
    You don't instatiate your class anywhere.

    Try:
    Qt Code:
    1. int main( int argc, char **argv )
    2. {
    3. QApplication app(argc, argv);
    4.  
    5. mydialogclass *window = new mydialogclass();
    6. window->show();
    7.  
    8. QMessageBox::information( window, "startup msgbox", "The factory default will be used instead." );
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    PS. Please, next time choose a different name for your class.

    Ooops. This was really noob.

    Sorry for the class name, it just came out from my dissapointment.

    Already 'renamed' it.
    Last edited by cioannou; 16th January 2006 at 19:18.
    If there weren't noobs there would be no experts

  12. #12
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    I am sorry but it still doesn't work.

    If I connect the button to an existing slot e.g. accept() then the button works.


    Qt Code:
    1. #include <qapplication.h>
    2. #include <qdialog.h>
    3. #include <qmessagebox.h>
    4. #include "ui_MyDialog.h"
    5.  
    6. class MyDialog : public QDialog
    7. {
    8. public:
    9. MyDialog(QWidget *parent = 0);
    10. private:
    11. Ui::MyDialog ui;
    12. private slots:
    13. void msgbox();
    14. };
    15.  
    16. MyDialog::MyDialog( QWidget *parent )
    17. {
    18. ui.setupUi(this);
    19.  
    20. connect(ui.helloButton,SIGNAL(clicked()),this,SLOT(msgbox()));
    21. connect(ui.pressMe,SIGNAL(clicked()),this,SLOT(accept()));
    22. }
    23.  
    24. void MyDialog::msgbox()
    25. {
    26. QMessageBox::information(0, "test","message");
    27. }
    28.  
    29. int main(int argc, char **argv)
    30. {
    31. QApplication app(argc, argv);
    32. MyDialog *window=new MyDialog;
    33.  
    34. window->show();
    35. return app.exec();
    36. }
    To copy to clipboard, switch view to plain text mode 
    If there weren't noobs there would be no experts

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    I am sorry but it still doesn't work.
    Because there is no Q_OBJECT macro, you need it if you define new signals or slots in your class.

    Qt Code:
    1. class MyDialog : public QDialog
    2. {
    3. Q_OBJECT
    4. public:
    5. ...
    6. };
    To copy to clipboard, switch view to plain text mode 

  14. #14
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: How to create custom slot in Qt Designer 4.1?

    OK guys , I got it!!!!

    here it is:

    mydialog.h
    Qt Code:
    1. #include <qapplication.h>
    2. #include <qdialog.h>
    3. #include <qmessagebox.h>
    4. #include "ui_MyDialog.h" //This is the header generated by uic Mydialog.ui > ui_MyDialog.h
    5.  
    6. class MyDialog : public QDialog
    7. {
    8. Q_OBJECT
    9.  
    10. public:
    11. MyDialog(QWidget *parent = 0);
    12. private:
    13. Ui::MyDialog ui;
    14. private slots:
    15. void msgbox();
    16. };
    To copy to clipboard, switch view to plain text mode 

    mydialog.cpp
    Qt Code:
    1. #include "mydialog.h"
    2.  
    3. MyDialog::MyDialog( QWidget *parent )
    4. {
    5. ui.setupUi(this);
    6.  
    7. connect(ui.helloButton,SIGNAL(clicked()),this,SLOT(msgbox()));
    8. connect(ui.pressMe,SIGNAL(clicked()),this,SLOT(accept()));
    9. }
    10.  
    11. void MyDialog::msgbox()
    12. {
    13. QMessageBox::information(0, "test","message");
    14. }
    To copy to clipboard, switch view to plain text mode 

    main.cpp
    Qt Code:
    1. #include <qapplication.h>
    2. #include <qdialog.h>
    3. #include <qmessagebox.h>
    4. #include "mydialog.h"
    5.  
    6. int main(int argc, char **argv)
    7. {
    8. QApplication app(argc, argv);
    9. MyDialog *window=new MyDialog;
    10.  
    11. window->show();
    12. return app.exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    I still get an error concerning 'undefined reference to vtable for MyDialog' if I build inside Code::Blocks.

    If I use:

    qmake
    mingw32-make

    It works (finally!!!)
    If there weren't noobs there would be no experts

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    I still get an error concerning 'undefined reference to vtable for MyDialog' if I build inside Code::Blocks.

    If I use:

    qmake
    mingw32-make

    It works (finally!!!)
    Every time you add or remove Q_OBJECT macro, you have to rerun qmake.

  16. #16
    Join Date
    Jan 2006
    Location
    Athens - Greece
    Posts
    219
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    I still get an error concerning 'undefined reference to vtable for MyDialog' if I build inside Code::Blocks.
    Create a custom tool that runs qmake in your project and on the project options select "Using a custom makefile". Then you only have to run your tool every time you add a new file to the project and then just build with the outputed makefile. It's the same as typing it but you get it with a couple of clicks

  17. #17
    Join Date
    Jan 2006
    Location
    Athens-Greece
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Thanks for the info, I will try it.

    I have now added a listbox to my dialog.

    Can you point me to some docs about how to get a reference to that listbox and e.g. add some items?

    Txs
    If there weren't noobs there would be no experts

  18. #18
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create custom slot in Qt Designer 4.1?

    Quote Originally Posted by cioannou
    That's exactly what I am trying to avoid.
    If I change the app.h that is generated by the designer and afterwards add some new widgets to my dialog, all my private slots will be lost.

    Am I missing something?
    Yes. I am refering to app.h ... NOT app.ui or the ui_app.h file which the MOC creates.

    The app.h file ISN'T generated by the designer. It's created by you!

    In QT4 all the designer program does is create your ui interfaces. Any signal/slot connections you create with it apply only to the form itself or those objects that you placed on the form as you design your gui. You cannot use the designer to connect to a signal or slot which is not among those the designer adds itself to your ui. Ergo, you must create your own classes and add your external signals and slots to compliment the ui you design.

    When I first switched to QT4 and left the QT3 Designer behind I was, at first, bewildered because I had learned how to make connections between objects, in the ui or out, strictly with the designer. It actually crippled me as far as learning how to OOP program using C++. Jacek was right. I am glad I hadn't burned the QT3 Designer habits as deeply into my 65 year old brain as long use of it would have done.

Similar Threads

  1. Custom signal in qt designer
    By txandi in forum Qt Tools
    Replies: 1
    Last Post: 4th December 2008, 20:25
  2. create a custom slot, hints?
    By pledians in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2008, 14:26
  3. How to create Custom Slot upon widgets
    By ashukla in forum Qt Programming
    Replies: 6
    Last Post: 8th September 2007, 14:07
  4. Replies: 2
    Last Post: 12th July 2007, 09:55
  5. custom slot + Designer
    By bashamehboob in forum Qt Tools
    Replies: 1
    Last Post: 28th April 2006, 15:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.