예제 #1
0
//! [0]
Window::Window()
{
    createIconGroupBox();
    createMessageGroupBox();

    iconLabel->setMinimumWidth(durationLabel->sizeHint().width());

    createActions();
    createTrayIcon();

    connect(showMessageButton, SIGNAL(clicked()), this, SLOT(showMessage()));
    connect(showIconCheckBox, SIGNAL(toggled(bool)), trayIcon, SLOT(setVisible(bool)));
    connect(iconComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setIcon(int)));
    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(iconGroupBox);
    mainLayout->addWidget(messageGroupBox);
    setLayout(mainLayout);

    iconComboBox->setCurrentIndex(1);
    trayIcon->show();

    setWindowTitle(tr("Systray"));
    resize(400, 300);
}
예제 #2
0
파일: window.cpp 프로젝트: gotlium/pinger
Window::Window()
{
    QDialog::setWindowFlags(Qt::WindowStaysOnTopHint| Qt::WindowCloseButtonHint | Qt::Tool);

    stop = false;
    createMessageGroupBox();

    createActions();
    createTrayIcon();

    connect(StartButton, SIGNAL(clicked()), this, SLOT(startPing()));
    connect(StopButton, SIGNAL(clicked()), this, SLOT(stopPing()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
               this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(messageGroupBox);
    setLayout(mainLayout);
    setWindowTitle(tr("Pinger v.1.2"));
    resize(215, 100);

    QIcon icon = QIcon(":/images/trash.svg");
    trayIcon->setIcon(icon);
    setWindowIcon(icon);
    trayIcon->show();
    trayIcon->setToolTip(tr("Pinger v.1.2"));

    setVisible(true);
}
예제 #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //Background image
    QPixmap pix("C:/Kobus/werk/RedUI/images/worldmap_notdone.png");
    //QPixmap scaled = pix.scaled(QSize(1000, 1000));
    ui->backround_image->setPixmap(pix);    //TODO scaling with app

    //System tray
    createIconGroupBox();
    createMessageGroupBox();
    createActions();
    createTrayIcon();
    trayIcon->show();
    showMessage();
}
예제 #4
0
파일: TrayIcon.cpp 프로젝트: woda/desktop
//! \param[in] parent Qobject parent or nothing
//! \brief Constructor
//! \brief Create action, tray icon, signal, popup.
TrayIcon::TrayIcon(QWidget * parent)
  : QWidget(parent) {
  createIconGroupBox();
  createMessageGroupBox();
  createActions();
  createTrayIcon();

  connect(iconComboBox, SIGNAL(currentIndexChanged(int)),
          this, SLOT(setIcon(int)));
  connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
  connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
          this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

  this->setIcon(TrayIcon::Normal);

  // a appeler pour changer l'icone
  iconComboBox->setCurrentIndex(TrayIcon::Normal);
  trayIcon->show();

  _popup = new Popup(220, 150);
}