Results 1 to 2 of 2

Thread: cannot open a subwindow!

  1. #1
    Join Date
    Aug 2008
    Posts
    52
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default cannot open a subwindow!

    Hi all,

    I have created a class called parathiro which is a form. I need to display that form in the mdiArea of my central window (kentriko class). I nearly copied every line of an example taken from the book c++GUI programming with qt.
    The problem is that the code below doesnt work althoush i think it should.

    the main window where the mdiArea is placed (kentriko class). the implementation:
    Qt Code:
    1. #include "kentriko.h"
    2. #include <iostream>
    3. #include <QString>
    4. #include "../diafores_sinartisis/sinartisis.h"
    5. #include <QMdiArea>
    6.  
    7. using namespace std;
    8. kentriko::kentriko(QWidget *parent)
    9. : QMainWindow(parent)
    10. {
    11. ui.setupUi(this);
    12. connect(ui.sindesi, SIGNAL(triggered()), this, SLOT(anixe()));
    13. }
    14. void kentriko::anixe(){
    15. // setCentralWidget(ui.mdiArea);
    16. // para->show();
    17. QMdiSubWindow *subwindow = ui.mdiArea->addSubWindow(&para);
    18. subwindow->show(); // invalid use of incomplete type 'struct QMdiSubWindow'??????
    19. //para.show();
    20. }
    To copy to clipboard, switch view to plain text mode 

    the header file:

    Qt Code:
    1. #ifndef KENTRIKO_H
    2. #define KENTRIKO_H
    3.  
    4. #include <QtGui/QMainWindow>
    5. #include "ui_kentriko.h"
    6. #include "../database/database.h"
    7. #include "../kentriko/parathiro/parathiro.h"
    8.  
    9. class kentriko : public QMainWindow
    10. {
    11. Q_OBJECT
    12. public:
    13. kentriko(QWidget *parent = 0);
    14. ~kentriko();
    15. private slots:
    16. void anixe();
    17. void pare();
    18. void alagi();
    19. private:
    20. Ui::kentrikoClass ui;
    21. database d;
    22. QString proto;
    23. QString deytero;
    24. QVariant variant;
    25. parathiro para;
    26.  
    27. };
    To copy to clipboard, switch view to plain text mode 

    the class tha I want to make as a subwindow is the following(parathiro). The header file:

    Qt Code:
    1. #ifndef PARATHIRO_H
    2. #define PARATHIRO_H
    3.  
    4. #include <QtGui/QMainWindow>
    5. #include "ui_parathiro.h"
    6. #include "../database/database.h"
    7.  
    8. class parathiro : public QMainWindow
    9. {
    10. Q_OBJECT
    11. public:
    12. parathiro(QWidget *parent = 0);
    13. ~parathiro();
    14. private slots:
    15. void anixe();
    16. void pare();
    17. void alagi();
    18. private:
    19. Ui::parathiroClass ui;
    20. database d;
    21. QString proto;
    22. QString deytero;
    23. QVariant variant;
    24. };
    25.  
    26. #endif // PARATHIRO_H
    To copy to clipboard, switch view to plain text mode 

    Many thanks in advance

  2. #2
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cannot open a subwindow!

    This is how I do the mdiArea subwindow.

    Qt Code:
    1. void MainWindowImpl::newEntry()
    2. {
    3. entryForm *newEntry = new entryForm;
    4. QMdiSubWindow *swNewEntry = new QMdiSubWindow;
    5. swNewEntry->setWidget(newEntry);
    6. MDIArea->addSubWindow(swNewEntry);
    7. swNewEntry->setAttribute(Qt::WA_DeleteOnClose);
    8. swNewEntry->setWindowFlags(Qt::WindowTitleHint);
    9. swNewEntry->show();
    10. swNewEntry->resize(300, 460);
    11. connect(newEntry, SIGNAL(destroyed()), MDIArea, SLOT(closeActiveSubWindow()));
    12. }
    To copy to clipboard, switch view to plain text mode 
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

Similar Threads

  1. Replies: 3
    Last Post: 7th October 2015, 20:43
  2. QTextBrowser: Cannot open
    By veda in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2007, 13:05
  3. How to open a Pdf file from Qt
    By vishal.chauhan in forum Newbie
    Replies: 2
    Last Post: 28th March 2007, 09:24
  4. again Open Cascade + Qt 4.2.2 but detailed...
    By Shuchi Agrawal in forum Qt Programming
    Replies: 11
    Last Post: 1st February 2007, 08:03
  5. again Open Cascade + Qt 4.2.2 but detailed...
    By Shuchi Agrawal in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2007, 07:50

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.