PDA

View Full Version : QWidget Problem !!



Fatla
17th June 2008, 18:30
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 :



// CustomSlot2 implements the slots inside the 2nd .UI
CustomSlot2* widget = new CustomSlot2();
widget->setAttribute(Qt::WA_DeleteOnClose);
widget->show();


CustomSlot2 Constructor's Code is :


CustomSlot2::CustomSlot2(QWidget *parent): QWidget(parent)
{
formTwo.setupUi(this);

}


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" :



class Ui_MainForm
{
public:
QPushButton *btnProcess;
QLineEdit *txtInput;
QLineEdit *txtResult;
QPushButton *btnNext;
QWidget *widget;
//........................ etc


Thanks .

mcosta
18th June 2008, 09:21
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/designer-using-custom-widgets.html

Fatla
18th June 2008, 09:32
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-programming-2/t-allow-many-qwidgets-to-be-shown-into-one-qwidget--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.

jpn
18th June 2008, 15:45
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-programming-2/t-allow-many-qwidgets-to-be-shown-into-one-qwidget--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. :)

Fatla
19th June 2008, 15:29
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