QT Designer Doppelklick auf Item - geht das bei Euch?
Verfasst: 2. September 2006 23:27
Hi,
ich habe mir die QT Doku mal durchgelesen und an irgendeinem Punkt kommt die Ansage, dass durch ein Doppelklick auf einen Button (bzw. ein Element) der QT Designer im Quellcode einen Eintrag vornimmt, der dann nur noch zu füllen ist.
Ich verwende QT 4.1.2 mit VS2005.
ich habe mir die QT Doku mal durchgelesen und an irgendeinem Punkt kommt die Ansage, dass durch ein Doppelklick auf einen Button (bzw. ein Element) der QT Designer im Quellcode einen Eintrag vornimmt, der dann nur noch zu füllen ist.
Ich kann in dem Designer so viel Doppelklicken wie ich will. Es passiert nichts. Hat einer nen Tipp wie man das einschalten kann. Oder an was das liegen kann, dass das nicht geht.Invoking the "Add Address" Dialog from the Application
Once we're done designing the dialog, we need to invoke it when the user clicks the main dialog's Add button. To achieve this, we must add a slot to the AddressBook class and invoke the AddDialog from the slot.
The Qt Visual Studio Integration makes this very easy. Simply double-click the Add button; this will open the .cpp file associated to the dialog and generate a skeleton slot called on_addButton_clicked(). Type in the following code lines in the slot's body:
AddDialog dialog(this);
dialog.exec();
Forms created using Qt Designer call QMetaObject::connectSlotsByName() to establish connections between signals emitted by the form's child widgets and slots that follow the naming convention on_<sender>_<signal>().
If we wanted to connect to another signal than clicked(), we would have to manually add the slot to the AddressBook class's. This requires editing both the header file (addressbook.h) and the implementation file (addressbook.cpp).
We must also add this line to the top of addressbook.cpp:
#include "adddialog.h"
Build and run the program now. If you click the Add button, the Add Address dialog will pop up. If you click OK, the dialog will go
away.
Ich verwende QT 4.1.2 mit VS2005.