Results 1 to 3 of 3

Thread: open a second window error!!!

  1. #1
    Join Date
    Feb 2012
    Posts
    19
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default open a second window error!!!

    Hello
    i have a problem.
    What i try to do is to open a dialog when i click a button.
    But i get a error when i compile can someone help me pls.

    mainwindowimpl.cpp
    #include "mainwindowimpl.h"
    #include "dialogimpl.h"
    //
    MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
    : QMainWindow(parent, f)
    {
    setupUi(this);
    }
    //

    void MainWindowImpl:n_start_clicked()
    {
    DialogImpl * dia = new DialogImpl(this);
    dia->show();
    }

    Error message!!
    error.jpg

    Thanks already!!

  2. #2
    Join Date
    Apr 2012
    Location
    Georgia/Rustavi
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: open a second window error!!!

    1) I found some "mistakes" in your code like:

    You dont have to declare every parent class member like this: public blablabla, public she, public he...

    it just can be like this: public blablabla, she, he
    2) in private member of class declare:
    Qt Code:
    1. Ui::DialogImpl * ui;
    To copy to clipboard, switch view to plain text mode 
    and than construct your DialogImpl 's .cpp file like this:
    Qt Code:
    1. DialogImpl::DialogImpl(QWidget * parent,Qt::WFlags *f) : QDialog(parent,f),
    2. ui(new Ui::DialogImpl)
    3. {
    4. ui->setupUi(this);
    5. }
    To copy to clipboard, switch view to plain text mode 

    maybe there is some "little" errors too, but I cant see it on picture...

    Best regards programmer251
    I'm not here, not in this world. I'm in the astral part of my mind.
    I'm half dead.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: open a second window error!!!

    arninio123 is choosing to inherit the generated UI class rather than incorporating it by composition as is more often the case. This is not of itself an error.

    The error message indicates that that generated ui_dialog.h does not define a class Dialog in the namespace Ui. This name comes from the name of the top-most widget in the Designer so chances are that is not named "Dialog".


    @arninio123: Please use [code]...[/code] tags around your code. You can also copy an paste the text of the error messages: smaller, faster, and easier to read.
    Last edited by ChrisW67; 23rd April 2012 at 05:47.

Similar Threads

  1. Replies: 3
    Last Post: 23rd December 2010, 06:55
  2. Replies: 0
    Last Post: 10th September 2010, 13:23
  3. Open a window inside another window
    By passerb in forum Qt Programming
    Replies: 6
    Last Post: 18th October 2009, 13:24
  4. Best way to open a Qt window from web page?
    By montylee in forum Qt Programming
    Replies: 9
    Last Post: 19th January 2009, 08:04
  5. right way to open a new window
    By wind in forum Newbie
    Replies: 1
    Last Post: 1st November 2006, 11: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.