How to Use QPushButton/de: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:German]]<br />[[Category:HowTo_German]]<br />[[Category:HowTo]]
[[Category:German]]
[[Category:HowTo_German]]
[[Category:HowTo]]


'''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|Ελληνικά]]<br />[[How_to_Use_QPushButton_Russian|Русский]] [[How_to_Use_QPushButton_Persian|فارسی]]
'''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|فارسی]]


[toc align_right="yes" depth="3"]
[toc align_right="yes" depth="3"]
Line 41: Line 44:
Ein Beispiel für einen QPushButton:
Ein Beispiel für einen QPushButton:


<code><br />#include <QApplication><br />#include <QPushButton>
<code>
#include <QApplication>
#include <QPushButton>


int main(int argc, char* argv[])<br />{<br /> QApplication app(argc, argv);
int main(int argc, char* argv[])
{
QApplication app(argc, argv);


QPushButton quit;
QPushButton quit;
Line 53: Line 60:
quit.show();
quit.show();


return app.exec();<br />}
return app.exec();
}

Revision as of 11:34, 25 February 2015


German English Български Spanish 简体中文 Ελληνικά Русский فارسی

[toc align_right="yes" depth="3"]

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