Results 1 to 4 of 4

Thread: new class -> probs

  1. #1
    Join Date
    Nov 2009
    Location
    Austria
    Posts
    30
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default new class -> probs

    hi guys,

    it's me again, i have some troubles with a new class i tried to create but i actually won't work out.

    see once here:
    Qt Code:
    1. #ifndef ACTING_CLASS_H
    2. #define ACTING_CLASS_H
    3.  
    4. #include <QObject>
    5. #include "ui_d_job.h"
    6. #include "ui_d_package.h"
    7. #include "ui_d_stack.h"
    8.  
    9.  
    10. class acting_class : public QObject
    11. {
    12. Q_OBJECT
    13.  
    14. public:
    15.  
    16. acting_class(QObject* =0);
    17. ~acting_class();
    18.  
    19. protected:
    20. QDialog dia_job;
    21. QDialog dia_stack;
    22. QDialog dia_package;
    23.  
    24. Ui::d_job ui_job;
    25. Ui::d_package ui_package;
    26. Ui::d_stack ui_stack;
    27.  
    28.  
    29.  
    30. public slots:
    31.  
    32. void open_package();
    33. void open_stack();
    34.  
    35. void save_package();
    36. void save_stack();
    37. void save_job();
    38.  
    39. void load_package();
    40. void load_stack();
    41. void load_job();
    42.  
    43.  
    44. }
    45.  
    46. #endif // ACTING_CLASS_H
    To copy to clipboard, switch view to plain text mode 

    and here the cpp:

    Qt Code:
    1. acting_class::acting_class(QObject* parent):
    2. QObject(parent)
    3. {
    4.  
    5.  
    6. ui_job.setupUi(&dia_job);
    7.  
    8.  
    9. ui_stack.setupUi(&dia_stack);
    10.  
    11.  
    12. ui_package.setupUi(&dia_package);
    13.  
    14. ui_job.le_model_name->setText("Muahahha");
    15.  
    16. dia_job.setAttribute(Qt::WA_QuitOnClose);
    17. dia_job.show();
    18.  
    19.  
    20.  
    21.  
    22.  
    23. }
    24.  
    25. void acting_class::save_job(){
    26.  
    27. }
    28.  
    29. void acting_class::save_package(){
    30.  
    31. }
    32. void acting_class::save_stack(){
    33.  
    34. }
    35. void acting_class::load_job(){
    36.  
    37. }
    38. void acting_class::load_package(){
    39.  
    40. }
    41.  
    42. void acting_class::load_stack(){
    43.  
    44. }
    45.  
    46. void acting_class::open_package(){
    47.  
    48. }
    49.  
    50. void acting_class::open_stack(){
    51.  
    52. }
    To copy to clipboard, switch view to plain text mode 

    my problem is ->

    C:/Users/Tobias/Desktop/Schule/AINF/Diplomarbeit/New01/acting_class.h:10: error: new types may not be defined in a return type

    C:/Users/Tobias/Desktop/Schule/AINF/Diplomarbeit/New01/main.cpp:15: error: two or more data types in declaration of 'qMain'

    and i can't make a rime out of that, anyone can find charlie? ah....the mistake?

    best regards
    tobi

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: new class -> probs

    You forgot a semicolon after class declaration.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2009
    Location
    Austria
    Posts
    30
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: new class -> probs

    thx, was a little blind

    stupid question but how do i create an object of my class and then call the constructor?

    i tried:
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3.  
    4. QApplication a(argc, argv);
    5.  
    6. acting_class ac = new acting_class();
    7.  
    8.  
    9. return a.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    but that actually won't work, and what's about the * is it like in #c a pointer?

    best regards
    tobi
    Last edited by T0bi4s; 26th November 2009 at 17:13.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: new class -> probs

    acting_class *ac = new acting_class();

  5. The following user says thank you to squidge for this useful post:

    T0bi4s (26th November 2009)

Similar Threads

  1. QT Class GUI Interactions??
    By mikey33 in forum Newbie
    Replies: 3
    Last Post: 19th November 2009, 02:01
  2. Joomla 1.5 password hash Class 1.0 for QT using C++
    By RajabNatshah in forum Qt Programming
    Replies: 0
    Last Post: 6th October 2009, 15:49
  3. Extending two class "the same way"
    By caduel in forum General Programming
    Replies: 3
    Last Post: 22nd July 2009, 22:55
  4. class QHBoxLayout
    By csvivek in forum Installation and Deployment
    Replies: 2
    Last Post: 10th April 2008, 07:57
  5. Replies: 2
    Last Post: 4th May 2006, 19: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.