How to Use QPushButton/de: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Restructure categories)
(Use LangSwitch instead of manual links to other languages)
 
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
[[Category:HowTo/de]]
[[Category:HowTo/de]]
 
{{LangSwitch}}
'''German''' [[How_to_Use_QPushButton|English]] [[How_to_Use_QPushButton_Bulgarian|Български]] [[How_to_Use_QPushButton_Spanish|Spanish]] [[How_to_Use_QPushButton_SimplifiedChinese|简体中文]] [[How_to_Use_QPushButton_Greek|Ελληνικά]]
[[How_to_Use_QPushButton_Russian|Русский]] [[How_to_Use_QPushButton_Persian|فارسی]]
 


= Verwendung von QPushButton =
= Verwendung von QPushButton =

Latest revision as of 16:48, 22 November 2016

This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

Verwendung von QPushButton

Überblick

Mit der Klasse QPushButton kann man Knöpfe erstellen und handhaben.

Signale

Folgende Signale können von einem QPushButton-Objekt ausgelöst werden:

Signale der Klasse QAbstractButton

  • void clicked(bool checked = false)
  • void pressed()
  • void released()
  • void toggled(bool checked)

Sonstige Signale

  • void customContextMenuRequested(const QPoint & pos) (aus QWidget)
  • void destroyed(QObject * obj = 0) (aus QObject)

Verwendung

Text

Den Text, der aus dem Knopf angezeigt werden soll, kann man mit setText() festlegen. Den aktuell angezeigten Text bekommt man mit text().

Icon

Ein Icon kann man mit setIcon() spezifizieren, während man das aktuelle Icon mit icon() bekommt.

Beispiel

Ein Beispiel für einen QPushButton:

  1. include <QApplication>
  2. include <QPushButton>

int main(int argc, char* argv[]) {

QApplication app(argc, argv);

QPushButton quit;

quit.setText("Beenden…");

QObject::connect(&quit, SIGNAL (clicked()), &app, SLOT (quit()));

quit.show();

return app.exec(); }