Suche Beispiel für whatsthis Tooltip

Alles rund um die Programmierung mit Qt
Antworten
s.frings
Beiträge: 2
Registriert: 6. Mai 2010 14:58

Suche Beispiel für whatsthis Tooltip

Beitrag 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?
upsala
Beiträge: 3946
Registriert: 5. Februar 2006 20:52
Wohnort: Landshut
Kontaktdaten:

Beitrag von upsala »

Code?
s.frings
Beiträge: 2
Registriert: 6. Mai 2010 14:58

Beitrag von s.frings »

test.pro

Code: Alles auswählen

TEMPLATE  = app
FORMS       = test.ui
SOURCES   = test.cpp


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();
 }
Antworten