1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #include "mainwindow.h"
#include <QSystemTrayIcon>
#include <QWidget>
#include <QMenu>
#include <QtGui>
#include <QApplication>
#include <QInputDialog>
MainWindow::MainWindow()
{
sticon = new QSystemTrayIcon(this);
QIcon icon(":/music.png");
sticon->setIcon(icon);
QMenu* stmenu = new QMenu(NULL);
actTexte1 = new QAction("test",NULL);
actTexte3 = new QAction("exit",NULL);
stmenu->addAction(actTexte1);
stmenu->addAction(actTexte3);
sticon->setContextMenu(stmenu);
sticon->show();
connect(actTexte1, SIGNAL(triggered()), this, SLOT(changeTexte1()));
connect(actTexte3, SIGNAL(triggered()), this, SLOT(changeTexte3()));
}
MainWindow::~MainWindow()
{
}
void MainWindow::changeTexte1()
{
bool dialogResult;
QString result = QInputDialog::getText(this, "Echonest API Key", "Enter your API key:", QLineEdit::Normal,
"key", &dialogResult);
}
void MainWindow::changeTexte3()
{
QApplication::quit();
exit(1);
} |
Partager