Seite 1 von 1
Suche Beispiel für whatsthis Tooltip
Verfasst: 6. Mai 2010 19:49
von s.frings
Ich versuche gerade zum ersten mal, ein Programm mit QT zu schreiben. Mit QT-Designer habe ich ein Dialogfenster mit einem Textfeld erstellt, bei dem ein "whatsthis" property gesetzt ist. Dieses Dialogfenster ist das Hauptfenster des Programmes.
Aber weder die Vorschau in QT-Designer, noch mein Testprogramm zeigt diesen Text an. Ich klicke auf den Fragezeichen-Button rechts oben im Fenster-Rahmen, dann auf das Textfeld und erwarte nun einen gelben Kasten mit dem whatsthis-Text, Aber da passiert nichts.
Ich habe viele Tutorials und Beispiele gefunden, aber keins, was diese Funktion vorführt.
Kann mir mal jemand sagen, woraus es ankommt, damit das funktioniert?
Verfasst: 6. Mai 2010 19:58
von upsala
Code?
Verfasst: 7. Mai 2010 09:03
von s.frings
test.pro
test.ui
Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>60</x>
<y>40</y>
<width>113</width>
<height>25</height>
</rect>
</property>
<property name="toolTip">
<string comment="Gibt hier mal etwas ein"/>
</property>
<property name="whatsThis">
<string comment="Das ist ein EIngabefeld, ist doch klar, oder?"/>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
test.cpp
Code: Alles auswählen
#include "ui_test.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDialog *dialog = new QDialog;
Ui::Dialog ui;
ui.setupUi(dialog);
dialog->show();
return app.exec();
}