Results 1 to 5 of 5

Thread: QWidget Problem !!

  1. #1
    Join Date
    Jun 2008
    Posts
    35
    Thanks
    5
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default QWidget Problem !!

    Now , I'm @ QT Design then I create a normal widget ,add ctrls into it.
    I make the previous step 4 times . So now I've 4 .UIs that have there own ctrls into it .
    To Each UI, I create its (.h + .cpp ) to implement my own slots .
    Well now I open ,using QT Design ,the 1st .ui I 've made & Drag & Drop Widget into it , which is located into Container Section .
    The Problem : is how to make other .UIs open into the widget I created @ the 1st .ui I 've made .


    The standard way that shows each .UI separately, wrks fine by :
    Qt Code:
    1. // CustomSlot2 implements the slots inside the 2nd .UI
    2. CustomSlot2* widget = new CustomSlot2();
    3. widget->setAttribute(Qt::WA_DeleteOnClose);
    4. widget->show();
    To copy to clipboard, switch view to plain text mode 

    CustomSlot2 Constructor's Code is :
    Qt Code:
    1. CustomSlot2::CustomSlot2(QWidget *parent): QWidget(parent)
    2. {
    3. formTwo.setupUi(this);
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

    So far so Good . However , by making this approach there's a flicker when you Open & Hide/Close Windows .

    The MainWindow's header file generated by "make" :

    Qt Code:
    1. class Ui_MainForm
    2. {
    3. public:
    4. QPushButton *btnProcess;
    5. QLineEdit *txtInput;
    6. QLineEdit *txtResult;
    7. QPushButton *btnNext;
    8. QWidget *widget;
    9. //........................ etc
    To copy to clipboard, switch view to plain text mode 

    Thanks .

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget Problem !!

    You must "promote" the QWidget into the main form to the new class.

    1. Drag a new QWidget into the Main Form
    2. Click with the right mouse button on the new Widget
    3. Choiche "Promote to..."

    http://doc.trolltech.com/4.4/designe...m-widgets.html
    Last edited by mcosta; 18th June 2008 at 08:23. Reason: Insert Documentation Link
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Jun 2008
    Posts
    35
    Thanks
    5
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QWidget Problem !!

    First , Thanks mcosta .
    2nd , Actually I've posted this thread after enhancing & clarifying my problem which I posted b4 but no one answerd me .
    However , I found some answers on my 1st thread hours ago .

    My Original Thread : http://www.qtcentre.org/forum/f-qt-p...et--14218.html

    3rd , I've Solved my problem using that way you illustrate But I still face a problem .
    I hope that you take a look at the other thread to help me to find out a proper solution .

    Thanks.

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

    Default Re: QWidget Problem !!

    Quote Originally Posted by Fatla View Post
    2nd , Actually I've posted this thread after enhancing & clarifying my problem which I posted b4 but no one answerd me .
    However , I found some answers on my 1st thread hours ago .

    My Original Thread : http://www.qtcentre.org/forum/f-qt-p...et--14218.html

    I hope that you take a look at the other thread to help me to find out a proper solution.
    This is exactly the reason why one shouldn't open multiple threads on the same subject. People get confused if the same problem is being solved concurrently in multiple threads. Nobody wants to follow cross-references between threads to get an overall picture about the problem. Furthermore, people might end up spending their precious time just to come up with a solution which was actually already proposed in the other thread which happens to discuss about the same problem. Just post more information to the original thread if needed.
    J-P Nurmi

  5. #5
    Join Date
    Jun 2008
    Posts
    35
    Thanks
    5
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QWidget Problem !!

    I think I've a clue about what you feel right now ; Red Face , Boiling Blood , some ...... expressions that you want the world to hear .

    I've got your message .

    Sorry & Thanks .


    “The only real mistake is the one from which we learn nothing.” John Powell

Similar Threads

  1. QWidget Refresh Problem
    By MarkoSan in forum Qt Programming
    Replies: 2
    Last Post: 15th January 2008, 11:24
  2. Problem creating a QWidget using threads
    By tarod in forum Qt Programming
    Replies: 1
    Last Post: 16th November 2007, 12:45
  3. Problem with Parent QWidget and Buttons not working
    By VireX in forum Qt Programming
    Replies: 7
    Last Post: 11th May 2007, 22:24
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 22:59

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.