Example #1
0
GridWidget::GridWidget(QWidget *parent) :
    QWidget(parent),
    markedWidget(nullptr),
    ui(new Ui::GridWidget)
{
    ui->setupUi(this);

    QMenu* menu = new QMenu(ui->selectAll);
    QAction* actCountry = menu->addAction("Country");
    QAction* actNationality = menu->addAction("Nationality");
    ui->selectAll->setMenu(menu);

    connect(actCountry, SIGNAL(triggered()), this, SLOT(selectAllCountry()));
    connect(actNationality, SIGNAL(triggered()), this, SLOT(selectAllNationality()));

    createShortcut(ui->searchField, Qt::CTRL + Qt::Key_F, "setFocus()");
    createShortcut(ui->scrollArea, Qt::CTRL + Qt::Key_G, "setFocus()");
    createShortcut(this, Qt::Key_Right, "markRight()");
    createShortcut(this, Qt::Key_Left, "markLeft()");
    createShortcut(this, Qt::Key_Up, "markUp()");
    createShortcut(this, Qt::Key_Down, "markDown()");
    createShortcut(this, Qt::Key_C, "selectMarkedCountry()");
    createShortcut(this, Qt::Key_N, "selectMarkedNationality()");
    createShortcut(this, Qt::CTRL + Qt::Key_Space, "showSearchDialog()");
}
Example #2
0
void QMenuViewPrivate::aboutToShow()
{
    QMenu* menu = qobject_cast<QMenu*> (sender());

    if(menu)
    {
        QVariant v = menu->menuAction()->data();

        if(v.canConvert<QModelIndex>())
        {
            QModelIndex idx = qvariant_cast<QModelIndex> (v);
            _menu->createMenu(idx, *menu, menu);
            disconnect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
            return;
        }
    }

    _menu->clear();

    if(_menu->prePopulated())
    {
        _menu->addSeparator();
    }

    _menu->createMenu(m_root, *_menu, _menu);

    _menu->postPopulated();
}
Example #3
0
static int l_additem(lua_State* L)
{
	QLuaMenu* cc = lua_toluamenu(L, 1);
	QMenu* c = lua_tomenu(L, 1);
	if(!c) return 0;

	QString text = lua_tostring(L, 2);
	QString icon = lua_tostring(L, 3);

	QAction* a = 0;

	if(text.length())
	{
		if(icon.length())
		{
			a = c->addAction(QIcon(icon), text);
		}
		else
		{
			a = c->addAction(text);
		}
	}

	if(a)
	{
		lua_pushaction(L, a);
		cc->addChild(lua_toluaaction(L, -1));
		return 1;
	}

	return 0;
}
void ChainButton::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
    QMenu myMenu;
    myMenu.addAction("Переименовать элемент");
    myMenu.addAction("Удалить элемент");

    QAction* selectedItem = myMenu.exec(event->screenPos());
    if (selectedItem)
    {
        QString txt = selectedItem->text();

        if(!txt.compare("Переименовать элемент"))
        {
            nameElement = dynamic_cast<Scene*>(this->scene())->SetStringParamElementDialog(nameElement);
            dynamic_cast<Scene*>(this->scene())->update();

        }

        if(!txt.compare("Удалить элемент"))
        {
            dynamic_cast<Scene*>(this->scene())->DeleteElement(this);
        }


    }
}
Example #5
0
void LaunchyWidget::showTrayIcon()
{
	if (!QSystemTrayIcon::isSystemTrayAvailable())
		return;

	if (gSettings->value("GenOps/showtrayicon", true).toBool())
	{
		if (!trayIcon)
			trayIcon = new QSystemTrayIcon(this);
		QKeySequence hotkey = platform->getHotkey();
		trayIcon->setToolTip(tr("Launchy (press %1 to activate)").arg(hotkey.toString()));
		trayIcon->setIcon(QIcon(":/resources/launchy16.png"));
		trayIcon->show();
		connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
			this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));

		QMenu* trayMenu = new QMenu(this);
		trayMenu->addAction(actShow);
		trayMenu->addAction(actRebuild);
		trayMenu->addAction(actOptions);
		trayMenu->addSeparator();
		trayMenu->addAction(actExit);

		trayIcon->setContextMenu(trayMenu);
	}
	else if (trayIcon)
	{
		delete trayIcon;
		trayIcon = NULL;
	}
}
Example #6
0
static QMenu *SetTitle( wxMenu *menu, const wxString &title )
{
    QMenu *qtMenu = menu->GetHandle();
    qtMenu->setTitle( wxQtConvertString( title ));

    return qtMenu;
}
Example #7
0
static void InsertMenuItemAction( const wxMenu *menu, const wxMenuItem *previousItem,
    const wxMenuItem *item, const wxMenuItem *successiveItem )
{
    QMenu *qtMenu = menu->GetHandle();
    QAction *itemAction = item->GetHandle();
    if ( item->GetKind() == wxITEM_RADIO )
    {
        // If the previous menu item is a radio item then add this item to the
        // same action group, otherwise start a new group:

        if ( previousItem != NULL && previousItem->GetKind() == wxITEM_RADIO )
        {
            QAction *previousItemAction = previousItem->GetHandle();
            QActionGroup *previousItemActionGroup = previousItemAction->actionGroup();
            wxASSERT_MSG( previousItemActionGroup != NULL, "An action group should have been setup" );
            previousItemActionGroup->addAction( itemAction );
        }
        else
        {
            QActionGroup *actionGroup = new QActionGroup( qtMenu );
            actionGroup->addAction( itemAction );
            wxASSERT_MSG( itemAction->actionGroup() == actionGroup, "Must be the same action group" );
        }
    }
    // Insert the action into the actual menu:
    QAction *successiveItemAction = ( successiveItem != NULL ) ? successiveItem->GetHandle() : NULL;
    qtMenu->insertAction( successiveItemAction, itemAction );
}
Example #8
0
QMenu *RichTextLineEdit::createColorMenu()
{
    QMenu *colorMenu = new QMenu(this);
    QPixmap pixmap(22, 22);
    typedef QPair<QColor, QString> ColorPair;
    foreach (const ColorPair &pair, QList<ColorPair>()
            << qMakePair(QColor(Qt::black), tr("Black"))
            << qMakePair(QColor(Qt::blue), tr("Blue"))
            << qMakePair(QColor(Qt::darkBlue), tr("Dark Blue"))
            << qMakePair(QColor(Qt::cyan), tr("Cyan"))
            << qMakePair(QColor(Qt::darkCyan), tr("Dark Cyan"))
            << qMakePair(QColor(Qt::green), tr("Green"))
            << qMakePair(QColor(Qt::darkGreen), tr("Dark Green"))
            << qMakePair(QColor(Qt::magenta), tr("Magenta"))
            << qMakePair(QColor(Qt::darkMagenta), tr("Dark Magenta"))
            << qMakePair(QColor(Qt::red), tr("Red"))
            << qMakePair(QColor(Qt::darkRed), tr("Dark Red"))) {
        pixmap.fill(pair.first);
        QAction *action = colorMenu->addAction(pixmap, pair.second);
        action->setData(pair.first);
    }
    connect(colorMenu, SIGNAL(triggered(QAction*)),
            this, SLOT(applyColor(QAction*)));
    AQP::accelerateMenu(colorMenu);
    return colorMenu;
}
Example #9
0
void RSSManager::customContextMenuRequested(const QPoint &position)
{
    TreeWidget* treeWidget = qobject_cast<TreeWidget*>(ui->tabWidget->widget(ui->tabWidget->currentIndex()));
    if (!treeWidget) {
        return;
    }

    if (!treeWidget->itemAt(position)) {
        return;
    }

    QString link = treeWidget->itemAt(position)->toolTip(0);
    if (link.isEmpty()) {
        return;
    }

    QMenu menu;
    menu.addAction(tr("Open link in current tab"), getQupZilla(), SLOT(loadActionUrl()))->setData(link);
    menu.addAction(tr("Open link in new tab"), this, SLOT(loadFeedInNewTab()))->setData(link);
    menu.addAction(tr("Open link in &private window"), mApp, SLOT(startPrivateBrowsing()))->setData(link);

    //Prevent choosing first option with double rightclick
    QPoint pos = treeWidget->viewport()->mapToGlobal(position);
    QPoint p(pos.x(), pos.y() + 1);
    menu.exec(p);
}
Example #10
0
QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)
{
	int channelIndex = model()->effectChannelModel()->value();

	FxChannel *fxChannel = Engine::fxMixer()->effectChannel( channelIndex );

	// If title allows interpolation, pass channel index and name
	if ( title.contains( "%2" ) )
	{
		title = title.arg( channelIndex ).arg( fxChannel->m_name );
	}

	QMenu *fxMenu = new QMenu( title );

	QSignalMapper * fxMenuSignalMapper = new QSignalMapper(fxMenu);

	fxMenu->addAction( newFxLabel, this, SLOT( createFxLine() ) );
	fxMenu->addSeparator();

	for (int i = 0; i < Engine::fxMixer()->numChannels(); ++i)
	{
		FxChannel * currentChannel = Engine::fxMixer()->effectChannel( i );

		if ( currentChannel != fxChannel )
		{
			QString label = tr( "FX %1: %2" ).arg( currentChannel->m_channelIndex ).arg( currentChannel->m_name );
			QAction * action = fxMenu->addAction( label, fxMenuSignalMapper, SLOT( map() ) );
			fxMenuSignalMapper->setMapping(action, currentChannel->m_channelIndex);
		}
	}

	connect(fxMenuSignalMapper, SIGNAL(mapped(int)), this, SLOT(assignFxLine(int)));

	return fxMenu;
}
Example #11
0
MainWindow::MainWindow()
{
    QMenu *fileMenu = new QMenu(tr("&File"));

    QAction *saveAction = fileMenu->addAction(tr("&Save..."));
    saveAction->setShortcut(tr("Ctrl+S"));

    QAction *quitAction = fileMenu->addAction(tr("E&xit"));
    quitAction->setShortcut(tr("Ctrl+Q"));

    QMenu *insertMenu = new QMenu(tr("&Insert"));

    QAction *calendarAction = insertMenu->addAction(tr("&Calendar"));
    calendarAction->setShortcut(tr("Ctrl+I"));

    menuBar()->addMenu(fileMenu);
    menuBar()->addMenu(insertMenu);

//! [0]
    editor = new QTextEdit(this);
//! [0]

    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
    connect(calendarAction, SIGNAL(triggered()), this, SLOT(insertCalendar()));

    setCentralWidget(editor);
    setWindowTitle(tr("Text Document Writer"));
}
Example #12
0
QMenu* FSTableView::createMenu()
{
    QMenu * menu = new QMenu;
    menu->addAction(QIcon(":folder.png"),"Nouveau sous-dosser",this,SLOT(mkdir()));

    return menu;
}
Example #13
0
void MainWindow::initMenu()
{
    QMenu *fileMenu = new QMenu("File", this);

    QAction *saveAction = new QAction("Save", fileMenu);
    QAction *loadAction = new QAction("Load", fileMenu);
    QAction *playAction = new QAction("Play", fileMenu);
    //QAction *logAction = new QAction("Show log", fileMenu);


    saveAction->setShortcut(QKeySequence::Save);
    loadAction->setShortcut(QKeySequence("Ctrl+L"));
    playAction->setShortcut(QKeySequence("Space"));

    fileMenu->addAction(saveAction);
    fileMenu->addAction(loadAction);
    fileMenu->addAction(playAction);
    //fileMenu->addAction(logAction);

    menuBar()->addMenu(fileMenu);

    connect(saveAction, SIGNAL(triggered()), filesList, SLOT(save()));
    connect(loadAction, SIGNAL(triggered()), filesList, SLOT(load()));
    connect(playAction, SIGNAL(triggered()), player, SLOT(togglePause()));
    //connect(logAction, SIGNAL(triggered()), SLOT(showLog()));

    // add "About" item
    QMenu *helpMenu = new QMenu(tr("&Help"), this);
    QAction *aboutAction = helpMenu->addAction(tr("&About"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAbout()));
    menuBar()->addMenu(helpMenu);
}
Example #14
0
void TCommandLine::mousePressEvent( QMouseEvent * event )
{
    if( event->button() == Qt::RightButton )
    {
        QTextCursor c = cursorForPosition( event->pos() );
        c.select(QTextCursor::WordUnderCursor);

        if( ! Hunspell_spell( mpHunspell, c.selectedText().toLatin1().data()) )
        {
            char ** sl;
            mHunspellSuggestionNumber = Hunspell_suggest( mpHunspell, &sl, c.selectedText().toLatin1().data() );
            QMenu * popup = new QMenu( this );
            for( int i=0; i<mHunspellSuggestionNumber; i++ )
            {
                QAction * pA;
                pA = popup->addAction( sl[i] );
                connect( pA, SIGNAL(triggered()), this, SLOT(slot_popupMenu()));
            }
            mpHunspellSuggestionList = sl;
            mPopupPosition = event->pos();
            popup->popup( event->globalPos() );
        }

        event->accept();
        return;
    }
    QPlainTextEdit::mousePressEvent( event );
}
Example #15
0
void Header::contextMenuEvent(QContextMenuEvent *event)
{
	const shared_ptr<ViewItem> r = get_mouse_over_item(mouse_point_);
	if (!r)
		return;

	QMenu *menu = r->create_context_menu(this);
	if (!menu)
		menu = new QMenu(this);

	const vector< shared_ptr<TraceTreeItem> > items(
		view_.list_by_type<TraceTreeItem>());
	if (std::count_if(items.begin(), items.end(), item_selected) > 1)
	{
		menu->addSeparator();

		QAction *const group = new QAction(tr("Group"), this);
		QList<QKeySequence> shortcuts;
		shortcuts.append(QKeySequence(Qt::ControlModifier | Qt::Key_G));
		group->setShortcuts(shortcuts);
		connect(group, SIGNAL(triggered()), this, SLOT(on_group()));
		menu->addAction(group);
	}

	menu->exec(event->globalPos());
}
Example #16
0
CGMainWindow::CGMainWindow(QWidget *parent, Qt::WindowFlags flags)
    : QMainWindow(parent, flags) {
    resize(604, 614);

    // Create a menu
    QMenu *file = new QMenu("&File", this);
    file->addAction("Load polygon", this, SLOT(loadPolygon()), Qt::CTRL + Qt::Key_L);
    file->addAction("Duplicate active polygon", this, SLOT(duplicatePolygon()), Qt::CTRL + Qt::Key_D);
    file->addAction("Quit", qApp, SLOT(quit()), Qt::CTRL + Qt::Key_Q);
    menuBar()->addMenu(file);

    // Create a nice frame to put around the OpenGL widget
    QFrame *f = new QFrame(this);
    f->setFrameStyle(QFrame::Sunken | QFrame::Panel);
    f->setLineWidth(2);

    // Create our OpenGL widget
    ogl = new CGView(this, f);

    // Put the GL widget inside the frame
    QHBoxLayout *layout = new QHBoxLayout();
    layout->addWidget(ogl);
    layout->setMargin(0);
    f->setLayout(layout);

    setCentralWidget(f);

    statusBar()->showMessage("Ready", 1000);
}
Example #17
0
void ProcessView::contextMenuEvent(QContextMenuEvent* event)
{
    Q_UNUSED(event);

    const QModelIndex idx(this->selectionModel()->currentIndex());
    QMenu menu;

    if (isProcessVarItem(idx))
    {
        // QAction* saveCondAction  = menu.addAction("Save FEM Conditions...");
        QAction* removeProcessVarAction =
            menu.addAction("Remove process variable");
        // connect(saveCondAction, SIGNAL(triggered()), this,
        // SLOT(saveConditions()));
        connect(removeProcessVarAction, SIGNAL(triggered()), this,
                SLOT(removeProcessVar()));
    }
    else if (isConditionItem(idx))
    {
        QAction* removeCondAction = menu.addAction("Remove condition");
        connect(removeCondAction, SIGNAL(triggered()), this,
                SLOT(removeCondition()));
        // QAction* editCondAction = menu.addAction("Edit condition");
        // connect(editCondAction, SIGNAL(triggered()), this,
        // SLOT(editCondition()));  else  editCondAction->setEnabled(false);
    }

    menu.exec(event->globalPos());
}
Example #18
0
void DataTable::showContextMenu(const QPoint &pos, QModelIndex index) //pos is in global coordinates
{
    if(!model() || !index.isValid()){
        return;
    }

    QList<QAction*> actions;

    //first add copy actions.
    actions.append(createCopyMenu(false));
    actions.append(createCopyMenu(true));

    actions.append(WidgetHelper::createSeparatorAction());

    int row=index.row();
    actions.append(getActionsForObject(row));

    if(actions.size()==0){
        return;
    }

    QMenu *menu = new QMenu();
    menu->addActions(actions);
    menu->setDefaultAction(WidgetHelper::findDefaultAction(actions));
    connect(menu, SIGNAL(triggered(QAction*)), this, SIGNAL(contextMenuTriggered(QAction*)));
    menu->exec(pos);

    WidgetHelper::deleteMenu(menu);
}
Example #19
0
wxString wxMenuBar::GetMenuLabel(size_t pos) const
{
    QAction *qtAction = GetActionAt( m_qtMenuBar, pos );
    QMenu *qtMenu = qtAction->menu();

    return wxQtConvertString( qtMenu->title() );
}
Example #20
0
void qtDLGNanomite::GenerateMenu(bool isAllEnabled)
{
	int activeProcessCount = 0;
	
	for(int i = 0; i < coreDebugger->PIDs.size(); i++)
	{
		if(coreDebugger->PIDs[i].bRunning)
			activeProcessCount++;
	}

	if(activeProcessCount > 1)
	{
		QAction *qAction;
		QMenu menu;

		for(int i = 0; i < coreDebugger->PIDs.size(); i++)
		{
			if(coreDebugger->PIDs[i].bRunning)
			{
				qAction = new QAction(QString().sprintf("%08X",coreDebugger->PIDs[i].dwPID),this);
				menu.addAction(qAction);
			}
		}
		
		if(isAllEnabled)
		{
			menu.addSeparator();

			qAction = new QAction("All",this);
			menu.addAction(qAction);
		}

		connect(&menu,SIGNAL(triggered(QAction*)),this,SLOT(GenerateMenuCallback(QAction*)));
		menu.exec(QCursor::pos());
	}
Example #21
0
void se_expr_param_t::show_context_menu( const QPoint& p)
{
    QMenu *menu = new QMenu();
    menu->addAction( "Expression editor...", this, SLOT( show_expression_editor()));
    menu->exec( multi_input_->mapToGlobal( p));
    delete menu;
}
Example #22
0
int ScriptToolbox::menuActionCount(QObject * menu)
{
    QMenu * m = qobject_cast<QMenu*>(menu);
    if (m)
        return m->actions().count();
    return 0;
}
Example #23
0
void ThreadsTreeView::contextMenuEvent(QContextMenuEvent *ev)
{
    QMenu menu;
    addBaseContextActions(&menu);
    QAction *act = menu.exec(ev->globalPos());
    handleBaseContextAction(act);
}
Example #24
0
QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup)
{
    QMenu *pageMenu = 0;
    const int count = stackedWidget()->count();
    const bool hasSeveralPages = count > 1;
    m_actionDeletePage->setEnabled(count);
    if (count) {
        const QString pageSubMenuLabel = tr("Page %1 of %2").arg(stackedWidget()->currentIndex() + 1).arg(count);
        pageMenu = popup->addMenu(pageSubMenuLabel);
        pageMenu->addAction(m_actionDeletePage);
        // Set up promotion menu for current widget.
        if (QWidget *page =  stackedWidget()->currentWidget ()) {
            m_pagePromotionTaskMenu->setWidget(page);
            m_pagePromotionTaskMenu->addActions(QDesignerFormWindowInterface::findFormWindow(stackedWidget()),
                                                qdesigner_internal::PromotionTaskMenu::SuppressGlobalEdit,
                                                pageMenu);
        }
        QMenu *insertPageMenu = popup->addMenu(tr("Insert Page"));
        insertPageMenu->addAction(m_actionInsertPageAfter);
        insertPageMenu->addAction(m_actionInsertPage);
    } else {
        QAction *insertPageAction = popup->addAction(tr("Insert Page"));
        connect(insertPageAction, SIGNAL(triggered()), this, SLOT(addPage()));
    }
    popup->addAction(m_actionNextPage);
    m_actionNextPage->setEnabled(hasSeveralPages);
    popup->addAction(m_actionPreviousPage);
    m_actionPreviousPage->setEnabled(hasSeveralPages);
    popup->addAction(m_actionChangePageOrder);
    m_actionChangePageOrder->setEnabled(hasSeveralPages);
    popup->addSeparator();
    return pageMenu;
}
Example #25
0
void MethodsTab::methodContextMenu(const QPoint &pos)
{
  const QModelIndex index = m_ui->methodView->indexAt(pos);
  if (!index.isValid() || !m_interface->hasObject()) {
    return;
  }

  const QMetaMethod::MethodType methodType =
    index.data(ObjectMethodModelRole::MetaMethodType).value<QMetaMethod::MethodType>();
  QMenu contextMenu;
  QAction *invokeAction = 0, *connectToAction = 0;
  if (methodType == QMetaMethod::Slot || methodType == QMetaMethod::Method) {
    invokeAction = contextMenu.addAction(tr("Invoke"));
  } else if (methodType == QMetaMethod::Signal) {
    connectToAction = contextMenu.addAction(tr("Connect to"));
    invokeAction = contextMenu.addAction(tr("Emit"));
  } else {
    return; // Can't do any action, so don't try to show an empty context menu.
  }

  QAction *action = contextMenu.exec(m_ui->methodView->viewport()->mapToGlobal(pos));
  if (action == invokeAction) {
    methodActivated(index);
  } else if (action == connectToAction) {
    m_interface->connectToSignal();
  }
}
Example #26
0
void Main::open(const QPoint& pos)
{
    QMenu m;
    m.addAction(ui.actionView);
    m.addAction(ui.actionOpen);
    m.exec(ui.indexView->mapToGlobal(pos));
}
Example #27
0
void MainWindow::joystickTrayShow()
{
    QMenu *tempmenu = (QMenu*) sender();
    QList<QAction*> menuactions = tempmenu->actions();
    QListIterator<QAction*> listiter (menuactions);
    while (listiter.hasNext())
    {
        QAction *action = listiter.next();
        action->setChecked(false);

        QHash<QString, QVariant> tempmap = action->data().toHash();
        QHashIterator<QString, QVariant> iter(tempmap);
        while (iter.hasNext())
        {
            iter.next();
            int joyindex = iter.key().toInt();
            int configindex = iter.value().toInt();
            JoyTabWidget *widget = (JoyTabWidget*)ui->tabWidget->widget(joyindex);

            if (configindex == widget->getCurrentConfigIndex())
            {
                action->setChecked(true);
            }
        }
    }
}
void GChannelGraphicsItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
//??	todo faire une cascade de partie dans les menus en utilisant GSequenceGraphicsScene::contextMenuEvent() et itemAt()
	QMenu menu;
	Channel()->PopulateContextMenu(&menu);
	menu.exec(event->screenPos());
}
Example #29
0
KisMouseInputEditor::KisMouseInputEditor(QWidget *parent)
    : KPushButton(parent), d(new Private)
{
    QWidget *popup = new QWidget();

    d->ui = new Ui::KisMouseInputEditor;
    d->ui->setupUi(popup);
    d->ui->mouseButton->setType(KisInputButton::MouseType);

    d->ui->clearModifiersButton->setIcon(KisIconUtils::loadIcon("edit-clear"));
    d->ui->clearMouseButton->setIcon(KisIconUtils::loadIcon("edit-clear"));

    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(popup);

    QMenu *menu = new QMenu(this);
    menu->addAction(action);
    setMenu(menu);

    QTimer::singleShot(0, this, SLOT(showMenu()));

    connect(d->ui->mouseButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->modifiersButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->clearMouseButton, SIGNAL(clicked(bool)), d->ui->mouseButton, SLOT(clear()));
    connect(d->ui->clearModifiersButton, SIGNAL(clicked(bool)), d->ui->modifiersButton, SLOT(clear()));
}
void MainWindow::showTrayIcon()
{
    QIcon trayIcon;
    sti = new QSystemTrayIcon(this);
    if (color_icon)
    {
        trayIcon = QIcon(":/res/img/power.svg");
    } else
    {
        trayIcon = QIcon(":/res/img/power-black.svg");
    }
    sti->setIcon(trayIcon);
    sti->setVisible(true);

    QMenu *stiMenu = new QMenu(this);
    sti->setContextMenu(stiMenu);

    ActionList.push_back(new QAction(this));
    ActionList[0]->setText("Toggle Main Window");
    stiMenu->addAction(ActionList[0]);
    ActionList.push_back(new QAction(this));
    ActionList[1]->setText("Exit");
    stiMenu->addAction(ActionList[1]);
    stiMenu->addSeparator();

    for (size_t i = 0; i<DeviceList.size(); i++)
    {
        ActionList.push_back(new QAction(this));
        ActionList[ActionList.size()-1]->setText(QString::fromStdString(DeviceList[i]->getName()));
        stiMenu->addAction(ActionList[ActionList.size()-1]);
    }
    connect(stiMenu, SIGNAL(triggered(QAction*)), this, SLOT(deviceClicked(QAction*)));
}