示例#1
0
Action::Action( QWidget *pParent, const char *pName, const QString &pDisplayName,
                QObject *pTarget, const char *pActivateSlot,
                QWidget *pAddTo, bool pEnabled,
                const QPixmap &pIcon, QWidget *pToolBar,
                const QString &pToolTip ) :
 QAction(pDisplayName, pParent)
{
  setObjectName(pName);
  _name = pName;
  _displayName = pDisplayName;
  _toolTip = pToolTip;

  QString hotkey = _preferences->parent(pName);
  if (!hotkey.isNull() && !_hotkeyList.contains(hotkey))
  {
    _hotkeyList << hotkey;
    setShortcutContext(Qt::ApplicationShortcut);
    if (hotkey.left(1) == "C")
      setShortcut(QString("Ctrl+%1").arg(hotkey.right(1)));

    else if (hotkey.left(1) == "F")
      setShortcut(hotkey);
  }

  connect(this, SIGNAL(activated()), pTarget, pActivateSlot);
  setEnabled(pEnabled);
  pAddTo->addAction(this);
  setIconSet(QIcon(pIcon));
  addTo(pToolBar);
  setToolTip(_toolTip);
}
示例#2
0
	OperationsTab::OperationsTab (const TabClassInfo& tc, QObject *plugin)
	: OpsManager_ (Core::Instance ().GetOpsManager ())
	, TC_ (tc)
	, ParentPlugin_ (plugin)
	, Toolbar_ (new QToolBar (tr ("Poleemery")))
	{
		Ui_.setupUi (this);
		Ui_.OpsView_->setItemDelegate (new EntriesDelegate);
		Ui_.OpsView_->setModel (OpsManager_->GetModel ());

		const auto& fm = fontMetrics ();
		auto setColWidth = [&fm, this] (EntriesModel::Columns col, const QString& str)
			{ Ui_.OpsView_->setColumnWidth (col, fm.width (str) * 1.1); };

		setColWidth (EntriesModel::Columns::Date,
				QDateTime::currentDateTime ().toString ());
		setColWidth (EntriesModel::Columns::Account, "some account name");
		setColWidth (EntriesModel::Columns::Name, "some typical very long product name");
		setColWidth (EntriesModel::Columns::Price, " 9999.00 USD ");
		setColWidth (EntriesModel::Columns::Count, " 0.999 ");
		setColWidth (EntriesModel::Columns::Shop, "some typical shop name");
		setColWidth (EntriesModel::Columns::AccBalance, " 99999.00 USD ");
		setColWidth (EntriesModel::Columns::SumBalance, " 99999.00 USD ");

		auto addAction = Toolbar_->addAction (tr ("Add..."),
				this, SLOT (add ()));
		addAction->setShortcut (Qt::Key_Insert);
		addAction->setProperty ("ActionIcon", "list-add");

		auto removeAction = Toolbar_->addAction (tr ("Remove"),
				this, SLOT (remove ()));
		removeAction->setShortcut (Qt::Key_Delete);
		removeAction->setProperty ("ActionIcon", "list-remove");
	}
示例#3
0
void SimplePartWidget::buildContextMenu(const QPoint &point, QMenu &menu) const
{
    menu.addAction(m_findAction);
    auto a = pageAction(QWebPage::Copy);
    a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
    menu.addAction(a);
    a = pageAction(QWebPage::SelectAll);
    a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-select-all")));
    menu.addAction(a);
    if (!page()->mainFrame()->hitTestContent(point).linkUrl().isEmpty()) {
        menu.addSeparator();
        a = pageAction(QWebPage::CopyLinkToClipboard);
        a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
        menu.addAction(a);
    }
    menu.addSeparator();
    menu.addAction(m_savePart);
    menu.addAction(m_saveMessage);
    if (!page()->mainFrame()->hitTestContent(point).imageUrl().isEmpty()) {
        a = pageAction(QWebPage::DownloadImageToDisk);
        a->setIcon(UiUtils::loadIcon(QStringLiteral("download")));
        menu.addAction(a);
    }
    menu.addSeparator();
    QMenu *colorSchemeMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("colorneg")), tr("Color scheme"));
    QActionGroup *ag = new QActionGroup(colorSchemeMenu);
    for (auto item: supportedColorSchemes()) {
        QAction *a = colorSchemeMenu->addAction(item.second);
        connect(a, &QAction::triggered, this, [this, item](){
           const_cast<SimplePartWidget*>(this)->setColorScheme(item.first);
        });
        a->setCheckable(true);
        if (item.first == m_colorScheme) {
            a->setChecked(true);
        }
        a->setActionGroup(ag);
    }

    auto zoomMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("zoom")), tr("Zoom"));
    if (m_messageView) {
        zoomMenu->addAction(m_messageView->m_zoomIn);
        zoomMenu->addAction(m_messageView->m_zoomOut);
        zoomMenu->addAction(m_messageView->m_zoomOriginal);
    } else {
        auto zoomIn = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-in")), tr("Zoom In"));
        zoomIn->setShortcut(QKeySequence::ZoomIn);
        connect(zoomIn, &QAction::triggered, this, &SimplePartWidget::zoomIn);

        auto zoomOut = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-out")), tr("Zoom Out"));
        zoomOut->setShortcut(QKeySequence::ZoomOut);
        connect(zoomOut, &QAction::triggered, this, &SimplePartWidget::zoomOut);

        auto zoomOriginal = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-original")), tr("Original Size"));
        connect(zoomOriginal, &QAction::triggered, this, &SimplePartWidget::zoomOriginal);
    }
}
示例#4
0
//-----------------------------------------------------------------------------
void UndoRedoGuiCommand::init ()
{
    setShortcut (UNDO_, QKeySequence::Undo);
    setShortcut (REDO_, QKeySequence::Redo);
    setIcon (UNDO_, QIcon (":/images/ic_undo_black_24dp.png"));
    setIcon (REDO_, QIcon (":/images/ic_redo_black_24dp.png"));

    resetActionTriggerSlot (UNDO_, SLOT(undo()));
    resetActionTriggerSlot (REDO_, SLOT(redo()));
}
示例#5
0
void ShortcutManager::loadSettings()
{
    _shortcutSettings->beginGroup(QStringLiteral("LocalShortcuts"));
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_NEW, DEF_SHORTCUT_NEW).toString(),
                Config::shortcutNew, Config::localShortcut);
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_SAVE, DEF_SHORTCUT_SAVE).toString(),
                Config::shortcutSave, Config::localShortcut);
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_COPY, DEF_SHORTCUT_COPY).toString(),
                Config::shortcutCopy, Config::localShortcut);
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_OPT, DEF_SHORTCUT_OPT).toString(),
                Config::shortcutOptions, Config::localShortcut);
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_HELP, DEF_SHORTCUT_HELP).toString(),
                Config::shortcutHelp, Config::localShortcut);
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_CLOSE, DEF_SHORTCUT_CLOSE).toString(),
                Config::shortcutClose, Config::localShortcut);
    _shortcutSettings->endGroup();

    _shortcutSettings->beginGroup(QStringLiteral("GlobalShortcuts"));
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_FULL, DEF_SHORTCUT_FULL).toString(),
                Config::shortcutFullScreen, Config::globalShortcut);
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_ACTW, DEF_SHORTCUT_ACTW).toString(),
                Config::shortcutActiveWnd, Config::globalShortcut);
    setShortcut(_shortcutSettings->value(KEY_SHORTCUT_AREA, DEF_SHORTCUT_AREA).toString(),
                Config::shortcutAreaSelect, Config::globalShortcut);
    _shortcutSettings->endGroup();
}
 UIActionSimpleNetworkAccessManager(QObject *pParent)
     : UIActionSimple(pParent, ":/nw_16px.png", ":/nw_disabled_16px.png")
 {
     switch (gActionPool->type())
     {
         case UIActionPoolType_Selector:
             setShortcut(gSS->keySequence(UISelectorShortcuts::NetworkAccessManager));
             break;
         case UIActionPoolType_Runtime:
             setShortcut(gMS->keySequence(UIMachineShortcuts::NetworkAccessManager));
             break;
     }
     retranslateUi();
 }
 UIActionSimpleContents(QObject *pParent)
     : UIActionSimple(pParent, UIIconPool::defaultIcon(UIIconPool::DialogHelpIcon))
 {
     switch (gActionPool->type())
     {
         case UIActionPoolType_Selector:
             setShortcut(gSS->keySequence(UISelectorShortcuts::HelpShortcut));
             break;
         case UIActionPoolType_Runtime:
             setShortcut(gMS->keySequence(UIMachineShortcuts::HelpShortcut));
             break;
     }
     retranslateUi();
 }
示例#8
0
 ShowWebAction(QObject *pParent)
     : UISimpleAction(pParent, ":/site_16px.png")
 {
     switch (gActionPool->type())
     {
         case UIActionPoolType_Offline:
             setShortcut(gSS->keySequence(UISelectorShortcuts::WebShortcut));
             break;
         case UIActionPoolType_Runtime:
             setShortcut(gMS->keySequence(UIMachineShortcuts::WebShortcut));
             break;
     }
     retranslateUi();
 }
 UIActionSimpleResetWarnings(QObject *pParent)
     : UIActionSimple(pParent, ":/reset_16px.png")
 {
     switch (gActionPool->type())
     {
         case UIActionPoolType_Selector:
             setShortcut(gSS->keySequence(UISelectorShortcuts::ResetWarningsShortcut));
             break;
         case UIActionPoolType_Runtime:
             setShortcut(gMS->keySequence(UIMachineShortcuts::ResetWarningsShortcut));
             break;
     }
     retranslateUi();
 }
 UIActionSimpleCheckForUpdates(QObject *pParent)
     : UIActionSimple(pParent, ":/refresh_16px.png", ":/refresh_disabled_16px.png")
 {
     setMenuRole(QAction::ApplicationSpecificRole);
     switch (gActionPool->type())
     {
         case UIActionPoolType_Selector:
             setShortcut(gSS->keySequence(UISelectorShortcuts::UpdateShortcut));
             break;
         case UIActionPoolType_Runtime:
             setShortcut(gMS->keySequence(UIMachineShortcuts::UpdateShortcut));
             break;
     }
     retranslateUi();
 }
 UIActionSimpleAbout(QObject *pParent)
     : UIActionSimple(pParent, ":/about_16px.png")
 {
     setMenuRole(QAction::AboutRole);
     switch (gActionPool->type())
     {
         case UIActionPoolType_Selector:
             setShortcut(gSS->keySequence(UISelectorShortcuts::AboutShortcut));
             break;
         case UIActionPoolType_Runtime:
             setShortcut(gMS->keySequence(UIMachineShortcuts::AboutShortcut));
             break;
     }
     retranslateUi();
 }
示例#12
0
QVistaBackButton::QVistaBackButton(QWidget *widget)
    : QAbstractButton(widget)
{
    setFocusPolicy(Qt::NoFocus);
    // Native dialogs use ALT-Left even in RTL mode, so do the same, even if it might be counter-intuitive.
    setShortcut(QKeySequence(Qt::ALT | Qt::Key_Left));
}
示例#13
0
	void Plugin::handleUnclose ()
	{
		auto action = qobject_cast<QAction*> (sender ());
		if (!action)
		{
			qWarning () << Q_FUNC_INFO
					<< "sender is not an action:"
					<< sender ();
			return;
		}

		if (!UncloseAct2Data_.contains (action))
			return;

		action->deleteLater ();

		auto data = UncloseAct2Data_.take (action);
		if (UncloseMenu_->defaultAction () == action)
		{
			auto nextAct = UncloseMenu_->actions ().value (1);
			if (nextAct)
			{
				UncloseMenu_->setDefaultAction (nextAct);
				nextAct->setShortcut (QString ("Ctrl+Shift+T"));
			}
		}
		UncloseMenu_->removeAction (action);

		data.Plugin_->RecoverTabs (QList<TabRecoverInfo> () << data.RecInfo_);
	}
示例#14
0
ContextMenuAction::ContextMenuAction(const QString &label, const QString &id, const QKeySequence &shortcut,
                                     QObject *parent)
    : QAction(label, parent),
      m_id(id)
{
    setShortcut(shortcut);
}
示例#15
0
void VcsEventWidgetPrivate::diffRevisions()
{
    QModelIndexList l = m_ui->eventView->selectionModel()->selectedRows();
    KDevelop::VcsEvent ev1 = m_logModel->eventForIndex( l.first() );
    KDevelop::VcsEvent ev2 = m_logModel->eventForIndex( l.last() );
    KDevelop::VcsJob* job = m_iface->diff( m_url, ev1.revision(), ev2.revision() );

    VcsDiffWidget* widget = new VcsDiffWidget( job );
    widget->setRevisions( ev1.revision(), ev2.revision() );

    auto dlg = new QDialog( q );
    dlg->setWindowTitle( i18n("Difference between Revisions") );

    widget->connect(widget, &VcsDiffWidget::destroyed, dlg, &QDialog::deleteLater);

    auto mainLayout = new QVBoxLayout(dlg);
    auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
    auto okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    dlg->connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
    dlg->connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
    mainLayout->addWidget(buttonBox);
    mainLayout->addWidget(widget);
    dlg->show();
}
示例#16
0
 QAction* MainWindow::createAction(QMenu* menu, const QKeySequence &shortcut)
 {
     auto action = new QAction(this);
     menu->addAction(action);
     action->setShortcut(shortcut);
     return action;
 }
KisHSVAdjustmentFilter::KisHSVAdjustmentFilter()
        : KisColorTransformationFilter(id(), categoryAdjust(), i18n("&HSV Adjustment..."))
{
    setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)));
    setSupportsPainting(true);
    setSupportsIncrementalPainting(false);
}
示例#18
0
void KKeyChooser::slotDefaultKey()
{
    // return if no key is selected
    KKeyChooserItem *pItem = dynamic_cast< KKeyChooserItem * >(d->pList->currentItem());
    if(pItem) // don't set it directly, check for conflicts
        setShortcut(pItem->shortcutDefault());
}
示例#19
0
ApplyChangesWidget::ApplyChangesWidget(QWidget* parent)
    : QDialog(parent), d(new ApplyChangesWidgetPrivate(this))
{
    setSizeGripEnabled(true);

    auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    auto mainLayout = new QVBoxLayout(this);
    auto okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::accepted, this, &ApplyChangesWidget::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &ApplyChangesWidget::reject);

    QWidget* w=new QWidget(this);
    d->m_info=new QLabel(w);
    d->m_documentTabs = new QTabWidget(w);
    connect(d->m_documentTabs, &QTabWidget::currentChanged,
            this, &ApplyChangesWidget::indexChanged);

    QVBoxLayout* l = new QVBoxLayout(w);
    l->addWidget(d->m_info);
    l->addWidget(d->m_documentTabs);

    mainLayout->addWidget(w);
    mainLayout->addWidget(buttonBox);

    resize(QSize(800, 400));
}
示例#20
0
ShortcutEditor::ShortcutEditor(QMLPlugin * plugin, 
                               QWidget * parent) : QWidget(parent),
    layout_(this), 
    labelShortcut_(this),
    plugin_(plugin),
    activable_(true)
{
    layout_.addWidget(&labelShortcut_);
    layout_.addWidget(&iconView_);

    editTimer_.setSingleShot(true);
    editTimer_.setInterval(SHORTCUT_EDITOR_EDIT_INTERVAL);

    if(plugin_->clipboard()) setShortcut(plugin_->clipboard()->shortcut());

    QObject::connect(&KeyLogger::instance(), 
                     &KeyLogger::sequence, 
                     this, &ShortcutEditor::onKeyDown);

    QObject::connect(&editTimer_, &QTimer::timeout,
                     this, &ShortcutEditor::onEditTimeout);

    QObject::connect(plugin, &QMLPlugin::activableChanged,
                     this, &ShortcutEditor::onActivableChanged);
    onActivableChanged(plugin->activable());

#ifdef GLASS_EFFECT
    setStyleSheet(fromResource(":/Transparent/Widget"));
#endif
}
示例#21
0
 PerformRegisterAction(QObject *pParent)
     : UISimpleAction(pParent, ":/register_16px.png", ":/register_disabled_16px.png")
 {
     setEnabled(vboxGlobal().virtualBox().
                GetExtraData(VBoxDefs::GUI_RegistrationDlgWinID).isEmpty());
     switch (gActionPool->type())
     {
         case UIActionPoolType_Offline:
             setShortcut(gSS->keySequence(UISelectorShortcuts::RegisterShortcut));
             break;
         case UIActionPoolType_Runtime:
             setShortcut(gMS->keySequence(UIMachineShortcuts::RegisterShortcut));
             break;
     }
     retranslateUi();
 }
示例#22
0
KisLevelFilter::KisLevelFilter()
        : KisColorTransformationFilter(id(), categoryAdjust(), i18n("&Levels..."))
{
    setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
    setSupportsPainting(false);
    setColorSpaceIndependence(TO_LAB16);
}
示例#23
0
文件: Viewer.cpp 项目: lrineau/cgal
void Viewer::init()
{
  // Restore previous viewer state.
  restoreStateFromFile();
  initializeOpenGLFunctions();
  // Define 'Control+Q' as the new exit shortcut (default was 'Escape')
  setShortcut(CGAL::qglviewer::EXIT_VIEWER, Qt::CTRL+Qt::Key_Q);

  // Add custom key description (see keyPressEvent).
  setKeyDescription(Qt::Key_W, "Toggles wire frame display");
  setKeyDescription(Qt::Key_F, "Toggles flat shading display");
  setKeyDescription(Qt::Key_E, "Toggles edges display");
  setKeyDescription(Qt::Key_V, "Toggles vertices display");
  setKeyDescription(Qt::Key_N, "Inverse direction of normals");
  setKeyDescription(Qt::Key_Plus, "Increase size of edges");
  setKeyDescription(Qt::Key_Minus, "Decrease size of edges");
  setKeyDescription(Qt::Key_Plus+Qt::ShiftModifier, "Increase size of vertices");
  setKeyDescription(Qt::Key_Minus+Qt::ShiftModifier, "Decrease size of vertices");
  setKeyDescription(Qt::Key_PageDown, "Increase light (all colors, use shift/alt/ctrl for one rgb component)");
  setKeyDescription(Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)");

  // Light default parameters
  glLineWidth(size_edges);
  glEnable(GL_POLYGON_OFFSET_FILL);
  glPolygonOffset(1.0f,1.0f);
  glClearColor(1.0f,1.0f,1.0f,0.0f);

  glDisable(GL_BLEND);
  glDisable(GL_LINE_SMOOTH);
  glDisable(GL_POLYGON_SMOOTH_HINT);
  glBlendFunc(GL_ONE, GL_ZERO);
  glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
  compile_shaders();
}
示例#24
0
void KKeyChooser::capturedShortcut(const KShortcut &cut)
{
    if(cut.isNull())
        slotNoKey();
    else
        setShortcut(cut);
}
示例#25
0
MessageHeadersWidget::MessageHeadersWidget(QWidget *parent, const QModelIndex &messageIndex)
    : QWidget(parent)
    , FindBarMixin(this)
    , m_widget(new QWebView(this))

{
    setWindowIcon(UiUtils::loadIcon(QStringLiteral("text-x-hex")));
    //: Translators: %1 is the UID of a message (a number) and %2 is the name of a mailbox.
    setWindowTitle(tr("Message headers of UID %1 in %2").arg(
                       QString::number(messageIndex.data(Imap::Mailbox::RoleMessageUid).toUInt()),
                       messageIndex.parent().parent().data(Imap::Mailbox::RoleMailboxName).toString()
                       ));
    Q_ASSERT(messageIndex.isValid());

    auto netAccess = new Imap::Network::MsgPartNetAccessManager(this);
    netAccess->setModelMessage(messageIndex);
    m_widget->page()->setNetworkAccessManager(netAccess);
    m_widget->setUrl(QUrl(QStringLiteral("trojita-imap://msg/HEADER")));

    auto find = new QAction(UiUtils::loadIcon(QStringLiteral("edit-find")), tr("Search..."), this);
    find->setShortcut(tr("Ctrl+F"));
    connect(find, &QAction::triggered, this, [this]() {
        searchRequestedBy(m_widget);
    });
    addAction(find);

    auto layout = new QVBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(m_widget, 1);
    layout->addWidget(m_findBar);
    setLayout(layout);
}
示例#26
0
文件: Viewer.cpp 项目: kriolog/cgal
void Viewer::init()
{
  // Restore previous viewer state.
  restoreStateFromFile();
  initializeOpenGLFunctions();
  // Define 'Control+Q' as the new exit shortcut (default was 'Escape')
  setShortcut(EXIT_VIEWER, Qt::CTRL+Qt::Key_Q);

  // Add custom key description (see keyPressEvent).
  setKeyDescription(Qt::Key_W, "Toggles wire frame display");
  setKeyDescription(Qt::Key_F, "Toggles flat shading display");
  setKeyDescription(Qt::Key_E, "Toggles edges display");
  setKeyDescription(Qt::Key_V, "Toggles vertices display");

  // Light default parameters
  ::glLineWidth(1.4f);
  ::glPointSize(4.f);
  ::glEnable(GL_POLYGON_OFFSET_FILL);
  ::glPolygonOffset(1.0f,1.0f);
  ::glClearColor(1.0f,1.0f,1.0f,0.0f);
  ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);

  ::glEnable(GL_LIGHTING);

  ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);

  ::glShadeModel(GL_FLAT);
  ::glDisable(GL_BLEND);
  ::glDisable(GL_LINE_SMOOTH);
  ::glDisable(GL_POLYGON_SMOOTH_HINT);
  ::glBlendFunc(GL_ONE, GL_ZERO);
  ::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
  compile_shaders();
}
示例#27
0
ActionWithShortcut::ActionWithShortcut(const std::string & group,
                                       const std::list<std::string> & actionIDs,
                                       const std::string & actionDescription,
                                       QObject* parent,
                                       bool setShortcutOnAction)
    : QAction(parent)
    , _group( QString::fromUtf8( group.c_str() ) )
    , _shortcuts()
{
    QKeySequence seq0;

    for (std::list<std::string>::const_iterator it = actionIDs.begin(); it != actionIDs.end(); ++it) {
        QString actionIDStr = QString::fromUtf8( it->c_str() );
        std::list<QKeySequence> seq = getKeybind(_group, actionIDStr);
        if ( seq.empty() ) {
            seq.push_back( QKeySequence() );
        }
        _shortcuts.push_back( std::make_pair( actionIDStr, seq.front() ) );
        if ( it == actionIDs.begin() ) {
            seq0 = seq.front();
        }
        appPTR->addShortcutAction(_group, actionIDStr, this);
    }
    assert ( !_group.isEmpty() && !actionIDs.empty() );
    if (setShortcutOnAction) {
        setShortcut(seq0);
    }

    setShortcutContext(Qt::WindowShortcut);
    setText( tr( actionDescription.c_str() ) );
}
示例#28
0
void Scene::init()
{
	// Options
	this->viewMode = VIEW;
	this->selectMode = SELECT_NONE;

	// Background
	setBackgroundColor(backColor = QColor(50,50,60));

	// Lights
	setupLights();

	// Camera
	setupCamera();

	// Material
	float mat_ambient[] = {0.1745f, 0.01175f, 0.01175f, 1.0f};
	float mat_diffuse[] = {0.65f, 0.045f, 0.045f, 1.0f};
	float mat_specular[] = {0.09f, 0.09f, 0.09f, 1.0f};
	float high_shininess = 100;

	glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	glMaterialf(GL_FRONT, GL_SHININESS, high_shininess);

	// Redirect keyboard
	setShortcut( HELP, Qt::CTRL+Qt::Key_H);
}
示例#29
0
	void QglviewerRenderer::init()
	{
		glInfo* info = glInfo::getInstance();
		info->initAllOpenGL();
		setMouseTracking(true);
		setFocusPolicy(Qt::StrongFocus);
		setShortcut(DISPLAY_FPS,Qt::CTRL+Qt::Key_F);

		glEnable(GL_DEPTH_TEST);
		glDepthFunc(GL_LEQUAL);
		glCullFace(GL_BACK);
		glEnable(GL_CULL_FACE);
		glPolygonMode(GL_FRONT,GL_FILL);
		//glFrontFace(GL_CW);
		glClearColor(0.0,0.0,0.0,1);
		glEnable(GL_LINE_SMOOTH);
		glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
		glShadeModel(GL_SMOOTH);
		this->setSceneRadius(20);
		showEntireScene();
		glDisable(GL_COLOR_MATERIAL);
		//glEnable(GL_MULTISAMPLE);	
		setAnimationPeriod(15);
		startAnimation();

		initBackgroundTexture();
	}
示例#30
0
void ShortcutManager::setDefaultSettings()
{
    setShortcut(DEF_SHORTCUT_NEW,Config::shortcutNew, Config::localShortcut);
    setShortcut(DEF_SHORTCUT_SAVE,Config::shortcutSave, Config::localShortcut);
    setShortcut(DEF_SHORTCUT_COPY,Config::shortcutCopy, Config::localShortcut);
    setShortcut(DEF_SHORTCUT_OPT,Config::shortcutOptions, Config::localShortcut);
    setShortcut(DEF_SHORTCUT_HELP,Config::shortcutHelp, Config::localShortcut);
    setShortcut(DEF_SHORTCUT_CLOSE,Config::shortcutClose, Config::localShortcut);

    setShortcut(DEF_SHORTCUT_FULL,Config::shortcutFullScreen, Config::globalShortcut);
    setShortcut(DEF_SHORTCUT_ACTW,Config::shortcutActiveWnd, Config::globalShortcut);
    setShortcut(DEF_SHORTCUT_AREA,Config::shortcutAreaSelect, Config::globalShortcut);
}