Results 1 to 5 of 5

Thread: Using placeholders in MainWindow - How to define their content?

  1. #1
    Join Date
    Jun 2008
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Using placeholders in MainWindow - How to define their content?

    Hallo,

    As absolut newbee I ask you for help. (QT 4.4 with QT designer)

    My QT MainWindow is seperated into four different areas, regarding different jobs, the user needed to do.
    Three of them to input some informations. The last one just to display graphics.

    I´m searching for an mechanism to put four placeholders in my MainWindow or MainWidget. What one placeholder should offer to the user, i want to define in an extra ui-File. Here you can find an widget or object or what ever, that is displayed in the area of one placeholder.

    How can i tell the placeholders, where they can find their contents.
    Or
    How can i tell on ui-File/Widget/Object to get displayed in one placeholders area.

    Thanx a lot in advance

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

    Default Re: Using placeholders in MainWindow - How to define their content?

    What you want is already there - simply insert a widget of your choice into a specific place of a layout. If you want to "reserve" space for such a widget, simply place an empty widget there in Designer and later you can apply a layout to it and change its contents the way you want.

  3. #3
    Join Date
    Jun 2008
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using placeholders in MainWindow - How to define their content?

    Thanks for you answer.

    OK - So i did it.
    I´ve used the designer to layout my application and put a placeholder, empty widget in the place, i needed it.
    In the main.cpp the app an my_mainwindow is initialized.

    my_mainwindow.h declares
    my_mainwindow : public QMainWindow class.

    But all the informations about the layout is automatically put into the
    private:
    Ui::MainWindowClass ui;

    and written in automatically generated
    ui_MainWindow.h

    When i try to set view and a scene to the empty widget, i get the message:
    "ui.widget is private".
    Because this is set up automatically, i thought, i did not understand the principle to combine designer code an my own stuff.

    Best confused newbees regards and thanx for your help.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using placeholders in MainWindow - How to define their content?

    That's not Qt but basic C++ specific issue. You cannot access a private member of a class outside the class. In your case, "ui" is a private member of my_mainwindow. Only my_mainwindow itself can access it.
    J-P Nurmi

  5. #5
    Join Date
    Jun 2008
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using placeholders in MainWindow - How to define their content?

    Sure - i totally agree with this ;-) Just read "http://doc.trolltech.com/4.4/designer-using-a-component.html", and learnd a lot about the "private" issue. But unfortunately nothing about "Chanceing the content of a widget".

    Any hints are welcome about how to design my classes, to get excess to change the contents of a placeholding empty widget, if this widget was set automatically by qt designer.

    Is there any explanation in the QT designer manual or an tutorial? I don´t even know a word ore an issue, i have to search for.

    Thanx again in advance.

Similar Threads

  1. odd double widgets
    By jhearon in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2008, 18:18

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.