Exemplo n.º 1
0
void NotepadForm::setupUi()
{
    resize(680, 450);

    QVBoxLayout* lay = new QVBoxLayout(this);
    lay->setSpacing(5);
    lay->setContentsMargins(5, 5, 5, 5);

    m_board = new QPlainTextEdit(this);
    m_board->setAcceptDrops(false);
    m_board->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_board->setTabChangesFocus(false);
    m_board->setUndoRedoEnabled(true);
    m_board->setTextInteractionFlags(Qt::TextEditorInteraction);

    lay->addWidget(m_board);

	setWindowTitle(tr("Notepad"));

    QMetaObject::connectSlotsByName(this);

	QShortcut* n = new QShortcut(QKeySequence(Qt::Key_Tab+Qt::CTRL), this);
	QShortcut* l = new QShortcut(QKeySequence(Qt::Key_Tab+Qt::CTRL+Qt::SHIFT), this);
	n->setObjectName("n");
	l->setObjectName("l");

	connect(n, SIGNAL(activated()), this, SLOT(jumptab()));
	connect(l, SIGNAL(activated()), this, SLOT(jumptab()));
}
Cleps_VidPlayer::Cleps_VidPlayer(QWidget *parent)
    : QWidget(parent)

{
    videoWidget = new QVideoWidget(this);
    videoWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    videoWidget->setAspectRatioMode(Qt::IgnoreAspectRatio);
    
    QBoxLayout *mreLayout = new QHBoxLayout;
    mreLayout->setMargin(0);
    mreLayout->setSpacing(0);

    QBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(videoWidget);
    layout->addLayout(mreLayout);

       setLayout(layout);

      QShortcut *fll = new QShortcut(QKeySequence(Qt::Key_F11), videoWidget);
      fll->setContext(Qt::ApplicationShortcut);

      QShortcut *fllve = new QShortcut(QKeySequence(Qt::Key_Escape), videoWidget);
      fllve->setContext(Qt::ApplicationShortcut);


       connect(fll,SIGNAL(activated()),this,SLOT(fullScreen()));
       connect(fllve,SIGNAL(activated()),this,SLOT(exitFullScreen()));
       connect(videoWidget, SIGNAL(customContextMenuRequested(QPoint)),this, SLOT(context(QPoint)));
   
}
static PyObject *meth_QShortcut_setKey(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QKeySequence* a0;
        int a0State = 0;
        QShortcut *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QShortcut, &sipCpp, sipType_QKeySequence, &a0, &a0State))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->setKey(*a0);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<QKeySequence *>(a0),sipType_QKeySequence,a0State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QShortcut, sipName_setKey, doc_QShortcut_setKey);

    return NULL;
}
Exemplo n.º 4
0
ImportsWidget::ImportsWidget(MainWindow *main, QAction *action) :
    CutterDockWidget(main, action),
    ui(new Ui::ImportsWidget),
    importsModel(new ImportsModel(&imports, this)),
    importsProxyModel(new ImportsProxyModel(importsModel, this))
{
    ui->setupUi(this);

    ui->importsTreeView->setModel(importsProxyModel);
    ui->importsTreeView->sortByColumn(ImportsModel::NameColumn, Qt::AscendingOrder);

    // Ctrl-F to show/hide the filter entry
    QShortcut *searchShortcut = new QShortcut(QKeySequence::Find, this);
    connect(searchShortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::showFilter);
    searchShortcut->setContext(Qt::WidgetWithChildrenShortcut);

    // Esc to clear the filter entry
    QShortcut *clearShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    connect(clearShortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::clearFilter);
    clearShortcut->setContext(Qt::WidgetWithChildrenShortcut);

    connect(ui->quickFilterView, SIGNAL(filterTextChanged(const QString &)),
            importsProxyModel, SLOT(setFilterWildcard(const QString &)));
    connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->importsTreeView, SLOT(setFocus()));

    setScrollMode();

    connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshImports()));
}
Exemplo n.º 5
0
void Window::shortcut(QKeySequence key, const char * execThis)
{
    QShortcut *shortcut = new QShortcut(key, this);
    shortcut->setContext(Qt::ApplicationShortcut);
    connect(shortcut, SIGNAL(activated()), this, execThis);
    wxyz[0] = wxyz[1] = wxyz[2] = wxyz[3] = 0;
}
Exemplo n.º 6
0
PropertiesDialog::PropertiesDialog(const QString &kind,
                                   Object *object,
                                   QUndoStack *undoStack,
                                   QWidget *parent):
    QDialog(parent),
    mUndoStack(undoStack),
    mObject(object),
    mKind(kind)
{
    mUi = new Ui::PropertiesDialog;
    mUi->setupUi(this);

    mModel = new PropertiesModel(this);
    mModel->setProperties(mObject->properties());
    mUi->propertiesView->setModel(mModel);

    // Delete selected properties when the delete key is pressed
    QShortcut *deleteShortcut = new QShortcut(QKeySequence::Delete,
                                              mUi->propertiesView);
    deleteShortcut->setContext(Qt::WidgetShortcut);
    connect(deleteShortcut, SIGNAL(activated()),
            this, SLOT(deleteSelectedProperties()));

    setWindowTitle(tr("%1 Properties").arg(mKind));
}
Exemplo n.º 7
0
void MainWindow::addTeam()
{
    int tc = teams.count();
    if (tc) {
        teams.last()->button->disconnect();
        teams.last()->button->setIcon(QIcon(":/images/images/remove.png"));
        connect(teams.last()->button, SIGNAL(clicked()),
                this, SLOT(removeTeam()));
    }
    team *n = new team;
    n->number = new QLabel;
    n->number->setText(QString::number(teams.count() + 1) + ")");
    n->name = new QLineEdit;
    n->button = new QToolButton;
    teams.append(n);
    QGridLayout *layout = static_cast <QGridLayout *> (ui->list->layout());
    layout->addWidget(n->number, lli, 0);
    connect(n->name, SIGNAL(returnPressed()), this, SLOT(drawCouples()));
    QShortcut *sh = new QShortcut(QKeySequence("Ctrl+Return"), n->name);
    sh->setContext(Qt::WidgetShortcut);
    connect(sh, SIGNAL(activated()), this, SLOT(ctrlEnterPressed()));
    QShortcut *sh1 = new QShortcut(QKeySequence("Tab"), n->name);
    sh1->setContext(Qt::WidgetShortcut);
    connect(sh1, SIGNAL(activated()), this, SLOT(tabPressed()));
    QShortcut *sh2 = new QShortcut(QKeySequence("Shift+Tab"), n->name);
    sh2->setContext(Qt::WidgetShortcut);
    connect(sh2, SIGNAL(activated()), this, SLOT(shiftTabPressed()));
    layout->addWidget(n->name, lli, 1);
    n->button->setIcon(QIcon(":/images/images/add.png"));
    connect(n->button, SIGNAL(clicked()), this, SLOT(addTeam()));
    layout->addWidget(n->button, lli, 2);
    ++lli;
    n->name->setFocus();
}
Exemplo n.º 8
0
message_view::message_view(QWidget* parent, msg_list_window* sub_parent) : QWidget(parent)
{
  m_pmsg=NULL;
  m_content_type_shown = 0;
  m_zoom_factor=1.0;
  m_parent = sub_parent;
  setAutoFillBackground(true);
  QPalette pal = palette();
  pal.setColor(QPalette::Active, QPalette::Background, Qt::white);
  pal.setColor(QPalette::Inactive, QPalette::Background, Qt::white);
  setPalette(pal);

  enable_page_nav(false, false);
  m_bodyv = new body_view();
  QVBoxLayout* top_layout=new QVBoxLayout(this);
  top_layout->setContentsMargins(0,0,0,0);
  top_layout->setSpacing(0);

  top_layout->addWidget(m_bodyv);

  connect(m_bodyv, SIGNAL(loadFinished(bool)), this, SLOT(load_finished(bool)));
  connect(m_bodyv, SIGNAL(external_contents_requested()), this,
	  SLOT(ask_for_external_contents()));
  connect(m_bodyv, SIGNAL(popup_body_context_menu()), SIGNAL(popup_body_context_menu()));
  if (m_parent) {
    connect(m_bodyv->page(),
	    SIGNAL(linkHovered(const QString&,const QString, const QString&)),
	    this, SLOT(display_link(const QString&)));
  }
  connect(m_bodyv, SIGNAL(linkClicked(const QUrl&)), this, SLOT(link_clicked(const QUrl&)));

  QShortcut* t = new QShortcut(QKeySequence(tr("Ctrl+A", "Select all")), this);
  t->setContext(Qt::WidgetWithChildrenShortcut);
  connect(t, SIGNAL(activated()), this, SLOT(select_all_text()));
}
Exemplo n.º 9
0
void ModeManager::objectAdded(QObject *obj)
{
    IMode *mode = Aggregation::query<IMode>(obj);
    if (!mode)
        return;

    m_mainWindow->addContextObject(mode);

    // Count the number of modes with a higher priority
    int index = 0;
    foreach (const IMode *m, m_modes)
        if (m->priority() > mode->priority())
            ++index;

    m_modes.insert(index, mode);
    m_modeStack->insertTab(index, mode->widget(), mode->icon(), mode->name());

    // Register mode shortcut
    ActionManager *am = m_mainWindow->actionManager();
    const QString shortcutId = QLatin1String("GCS.Mode.") + mode->uniqueModeName();
    QShortcut *shortcut = new QShortcut(m_mainWindow);
    shortcut->setWhatsThis(tr("Switch to %1 mode").arg(mode->name()));
    Command *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID);

    m_modeShortcuts.insert(index, cmd);
    connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip()));

    setDefaultKeyshortcuts();

    m_signalMapper->setMapping(shortcut, mode->uniqueModeName());
    connect(shortcut, SIGNAL(activated()), m_signalMapper, SLOT(map()));
}
Exemplo n.º 10
0
void BaseForm::bindSelect(QComboBox* b, qint32 i, qint32 k)
{
    QShortcut* s = new QShortcut(QKeySequence(k), this);
    s->setProperty(PROP_TARG, qVariantFromValue((void*)b));
    s->setObjectName(QString::number(i));

    connect(s, SIGNAL(activated()), this, SLOT(select()));
}
Exemplo n.º 11
0
void MainWindow::setupShortcuts()
{
    QShortcut *focusSearch = new QShortcut(QKeySequence("Ctrl+K"), this);
    focusSearch->setContext(Qt::ApplicationShortcut);
    connect(focusSearch, &QShortcut::activated, [=]() {
        ui->lineEdit->setFocus();
    });
}
Exemplo n.º 12
0
OverwriteWidget::OverwriteWidget(QWidget *parent)
    : QLabel(parent)
{
    QShortcut *s = new QShortcut(Qt::Key_Insert, this);
    s->setContext(Qt::ApplicationShortcut);
    connect(s, SIGNAL(activated()), SLOT(changeOverwriteMode()));

    setText(tr("OVR"));
    setEnabled(false);
}
Exemplo n.º 13
0
void WebkitShow::setupInspector()
{
    QWebPage* webpage = view->page();
    webpage->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    webInspector->setPage(webpage);

    QShortcut* shortCut = new QShortcut(this);
    shortCut->setKey(Qt::Key_F12);
    connect(shortCut, SIGNAL(activated()), this, SLOT(toggleInspector()));
}
Exemplo n.º 14
0
QShortcut *ConvertAccelerator( wxAcceleratorEntry *e, QWidget *parent )
{
    // TODO: Not all keys have the same string representation in wx and qt
    QShortcut *s = new QShortcut( wxQtConvertString( e->ToString() ), parent );
    
    // Set a property to save wx Command to send when activated
    s->setProperty( "wxQt_Command", e->GetCommand() );

    return s;
}
Exemplo n.º 15
0
GreeterWindow::GreeterWindow(QWidget *parent)
    : QDeclarativeView(parent),
      m_greeter(new GreeterWrapper(this))
{
    setResizeMode(QDeclarativeView::SizeRootObjectToView);
    
    KDeclarative kdeclarative;
    kdeclarative.setDeclarativeEngine(engine());
    kdeclarative.initialize();
    //binds things like kconfig and icons
    kdeclarative.setupBindings();

    KConfig config(LIGHTDM_CONFIG_DIR "/lightdm-kde-greeter.conf");
    KConfigGroup configGroup = config.group("greeter");

    QString theme = configGroup.readEntry("theme-name", "userbar");

    QStringList dirs = KGlobal::dirs()->findDirs("appdata", "themes/");

    Plasma::PackageStructure::Ptr packageStructure(new LightDMPackageStructure(this));

    Plasma::Package package(dirs.last() + "/" + theme, packageStructure);

    if (!package.isValid()) {
        kError() << theme << " is not a valid theme. Falling back to \"userbar\" theme.";
        package = Plasma::Package(dirs.last() + "/" + "userbar", packageStructure);
    }
    if (!package.isValid()) {
        kFatal() << "Cannot find QML file for \"userbar\" theme. Something is wrong with this installation. Aborting.";
    }

    KGlobal::locale()->insertCatalog("lightdm_theme_" + theme);
    
    rootContext()->setContextProperty("config", new ConfigWrapper(package.filePath("configfile"), this));
    rootContext()->setContextProperty("greeter", m_greeter);

    setSource(package.filePath("mainscript"));
    // Prevent screen flickering when the greeter starts up. This really needs to be sorted out in QML/Qt...
    setAttribute(Qt::WA_OpaquePaintEvent);
    setAttribute(Qt::WA_NoSystemBackground);

    // Shortcut to take a screenshot of the screen. Handy because it is not
    // possible to take a screenshot of the greeter in test mode without
    // including the cursor.
    QShortcut* cut = new QShortcut(this);
    cut->setKey(Qt::CTRL + Qt::ALT + Qt::Key_S);
    connect(cut, SIGNAL(activated()), SLOT(screenshot()));

    connect(m_greeter, SIGNAL(aboutToLogin()), SLOT(setRootImage()));

    QRect screen = QApplication::desktop()->rect();
    setGeometry(screen);

    new PowerManagement(this);
}
Exemplo n.º 16
0
void Toerstein::createShortcuts(void)
{
    QShortcut *shortcut;

    /* In QMenuBar shortcuts won't work if menuBar is not visible,
     * so we'll add them separately here
     */

    /* Shortcuts to File-menu */
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+T", "File|New Tab")),this,SLOT(createNewTab()));
    shortcut->setAutoRepeat(false);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+N", "File|New File")),this,SLOT(createNewFile()));
    shortcut->setAutoRepeat(false);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open File")),this,SLOT(open()));
    shortcut->setAutoRepeat(false);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+P", "File|Enter File Path") ),this,SLOT(search()));
    shortcut->setAutoRepeat(false);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+S", "File|Save File") ),this,SLOT(save()));
    shortcut->setAutoRepeat(false);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+W", "File|Close File") ),this,SLOT(closeFile()));
    shortcut->setAutoRepeat(false);
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+Q", "File|Quit")),this,SLOT(close()));
    shortcut->setAutoRepeat(false);

    /* Shortcuts to View-menu */
    shortcut = new QShortcut(QKeySequence(tr("Ctrl+D", "Toggle Diff View|Quit")),this,SLOT(toggleViewMode()));
    shortcut->setAutoRepeat(false);
}
Exemplo n.º 17
0
void KviMainWindow::freeAccelleratorKeySequence(QString & key)
{
	QKeySequence kS(key);
	for(QShortcut * pS = m_pAccellerators->first(); pS; pS = m_pAccellerators->next())
	{
		if(pS->key() == kS)
		{
			m_pAccellerators->removeRef(pS);
			return;
		}
	}
}
Exemplo n.º 18
0
BufferView::BufferView(QWidget* parent) : QWidget(parent)
{
    d.buffer = 0;

    d.titleBar = new TitleBar(this);
    d.listView = new ListView(this);
    d.textInput = new TextInput(this);
    d.textBrowser = new TextBrowser(this);
    d.textBrowser->setBuddy(d.textInput);

    d.textBrowser->setFocusPolicy(Qt::ClickFocus);
    d.textBrowser->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, false);

    d.splitter = new QSplitter(this);
    d.splitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);

    QShortcut* zoomIn = new QShortcut(QKeySequence::ZoomIn, this);
    zoomIn->setContext(Qt::WidgetWithChildrenShortcut);
    connect(zoomIn, SIGNAL(activated()), d.textBrowser, SLOT(zoomIn()));

    QShortcut* zoomOut = new QShortcut(QKeySequence::ZoomOut, this);
    zoomOut->setContext(Qt::WidgetWithChildrenShortcut);
    connect(zoomOut, SIGNAL(activated()), d.textBrowser, SLOT(zoomOut()));

    QShortcut* resetZoom = new QShortcut(QKeySequence("Ctrl+0"), this);
    resetZoom->setContext(Qt::WidgetWithChildrenShortcut);
    connect(resetZoom, SIGNAL(activated()), d.textBrowser, SLOT(resetZoom()));

    QShortcut* pageDown = new QShortcut(QKeySequence::MoveToNextPage, this);
    pageDown->setContext(Qt::WidgetWithChildrenShortcut);
    connect(pageDown, SIGNAL(activated()), d.textBrowser, SLOT(scrollToNextPage()));

    QShortcut* pageUp = new QShortcut(QKeySequence::MoveToPreviousPage, this);
    pageUp->setContext(Qt::WidgetWithChildrenShortcut);
    connect(pageUp, SIGNAL(activated()), d.textBrowser, SLOT(scrollToPreviousPage()));

    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->setSpacing(0);
    layout->setMargin(0);
    layout->addWidget(d.splitter);
    layout->addWidget(d.textInput);
    layout->setStretchFactor(d.splitter, 1);

    connect(d.titleBar, SIGNAL(offsetChanged(int)), d.textBrowser, SLOT(moveShadow(int)));
    d.titleBar->raise();

    d.splitter->addWidget(d.textBrowser);
    d.splitter->addWidget(d.listView);
    d.splitter->setStretchFactor(0, 1);

    connect(d.listView, SIGNAL(queried(QString)), this, SLOT(query(QString)));
    connect(d.textBrowser, SIGNAL(queried(QString)), this, SLOT(query(QString)));
}
Exemplo n.º 19
0
void MainWindow::tabPressed()
{
    QShortcut *sh = static_cast <QShortcut *> (sender());
    QLineEdit *le = static_cast <QLineEdit *> (sh->parent());
    int tc = teams.count();
    for (int i = 0; i < (tc - 1); ++i) {
        if (teams.at(i)->name == le) {
            teams.at(i + 1)->name->setFocus();
            return;
        }
    }
    teams.last()->button->setFocus();
}
Exemplo n.º 20
0
void MainWindow::shiftTabPressed()
{
    QShortcut *sh = static_cast <QShortcut *> (sender());
    QLineEdit *le = static_cast <QLineEdit *> (sh->parent());
    int tc = teams.count();
    for (int i = 0; i < tc; ++i) {
        if (teams.at(i)->name == le) {
            if (i)
                teams.at(i - 1)->name->setFocus();
            return;
        }
    }
}
Exemplo n.º 21
0
void RichTextLineEdit::createShortcuts()
{
    QShortcut *boldShortcut = new QShortcut(QKeySequence::Bold,
            this, SLOT(toggleBold()));
    QShortcut *italicShortcut = new QShortcut(QKeySequence::Italic,
            this, SLOT(toggleItalic()));

    setToolTip(tr("<p>Use %1 to toggle bold, %2 to toggle italic, "
                  "and the context menu for color and other effects.")
            .arg(boldShortcut->key().toString(
                 QKeySequence::NativeText))
            .arg(italicShortcut->key().toString(
                 QKeySequence::NativeText)));
}
Exemplo n.º 22
0
	UserFilters::UserFilters (UserFiltersModel *model, QWidget *parent)
	: QWidget { parent }
	, Model_ { model }
	{
		Ui_.setupUi (this);
		Ui_.View_->setModel (model);

		QShortcut *sh = new QShortcut (Qt::Key_Delete, Ui_.View_);
		connect (sh,
				SIGNAL (activated ()),
				this,
				SLOT (on_Remove__released ()));
		sh->setContext (Qt::WidgetWithChildrenShortcut);
	}
ATopLevelWindowsContainer::ATopLevelWindowsContainer(QWidget *parent):
  SelfSizingMainWindow(parent)
{
  QShortcut *shortcutNext = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab), this);
  shortcutNext->setContext(Qt::ApplicationShortcut);
  connect(shortcutNext, &QShortcut::activated, this, &ATopLevelWindowsContainer::onNextWindow);

  QShortcut *shortcutPrev = new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab), this);
  shortcutPrev->setContext(Qt::ApplicationShortcut);
  connect(shortcutPrev, &QShortcut::activated, this, &ATopLevelWindowsContainer::onPrevWindow);

  menuGroup = new QActionGroup(this);

  currentWindowIndex = 0;
}
Exemplo n.º 24
0
EditDialog::EditDialog(EditWidgetInterface *editWidget, QWidget *parent) :
    QDialog(parent),
    m_editWidget(editWidget),
    m_closeAfterSave(true),
    m_saved(false)
{
    setFont(QFont("Tahoma",10));
    setWindowTitle(editWidget->windowTitle());

    m_btnSave = new QPushButton(tr("Save"),this);
    m_btnCancel = new QPushButton(tr("Cancel"),this);
    m_btnSave->setMinimumHeight(MIN_HEIGHT_BTN);
    m_btnCancel->setMinimumHeight(MIN_HEIGHT_BTN);

    QHBoxLayout *objectActionsLay = new QHBoxLayout();
    objectActionsLay->addStretch();
    objectActionsLay->addWidget(m_btnSave);
    objectActionsLay->addWidget(m_btnCancel);

    m_btnSave->setAutoDefault(false);
    m_btnCancel->setAutoDefault(false);
    m_btnSave->setDefault(false);
    m_btnCancel->setDefault(false);

    QVBoxLayout *centrLay = new QVBoxLayout(this);
    centrLay->addWidget(editWidget);

    QShortcut *scSave = new QShortcut(this);
    scSave->setKey(QKeySequence::Save);
    connect(scSave, SIGNAL(activated()), m_editWidget, SLOT(save()));

    QShortcut *scAccept = new QShortcut(this);
    scAccept->setKey(Qt::CTRL + Qt::Key_Return);
    connect(scAccept, SIGNAL(activated()), SLOT(accept()));


    centrLay->addLayout(objectActionsLay);
    centrLay->setMargin(4);
    setLayout(centrLay);

    setFocusProxy(editWidget);


    connect(m_btnCancel,SIGNAL(clicked()),SLOT(reject()));
    connect(editWidget,SIGNAL(windowTitleChanged(QString)),
            SLOT(setWindowTitle(QString)));
    connect(editWidget, SIGNAL(saved()), SLOT(onEditWidgetSaved()));
}
Exemplo n.º 25
0
void ModeManager::objectAdded(QObject *obj)
{
    IMode *mode = Aggregation::query<IMode>(obj);
    if (!mode)
        return;

    d->m_mainWindow->addContextObject(mode);

    // Count the number of modes with a higher priority
    int index = 0;
    foreach (const IMode *m, d->m_modes)
        if (m->priority() > mode->priority())
            ++index;

    d->m_modes.insert(index, mode);
    d->m_modeStack->insertTab(index, mode->widget(), mode->icon(), mode->displayName());
    d->m_modeStack->setTabEnabled(index, mode->isEnabled());

    // Register mode shortcut
    ActionManager *am = d->m_mainWindow->actionManager();
    const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->id();
    QShortcut *shortcut = new QShortcut(d->m_mainWindow);
    shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName()));
    Command *cmd = am->registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL));

    d->m_modeShortcuts.insert(index, cmd);
    connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip()));
    for (int i = 0; i < d->m_modeShortcuts.size(); ++i) {
        Command *currentCmd = d->m_modeShortcuts.at(i);
        // we need this hack with currentlyHasDefaultSequence
        // because we call setDefaultShortcut multiple times on the same cmd
        // and still expect the current shortcut to change with it
        bool currentlyHasDefaultSequence = (currentCmd->keySequence()
                                            == currentCmd->defaultKeySequence());
#ifdef Q_WS_MAC
        currentCmd->setDefaultKeySequence(QKeySequence(QString("Meta+%1").arg(i+1)));
#else
        currentCmd->setDefaultKeySequence(QKeySequence(QString("Ctrl+%1").arg(i+1)));
#endif
        if (currentlyHasDefaultSequence)
            currentCmd->setKeySequence(currentCmd->defaultKeySequence());
    }

    d->m_signalMapper->setMapping(shortcut, mode->id());
    connect(shortcut, SIGNAL(activated()), d->m_signalMapper, SLOT(map()));
    connect(mode, SIGNAL(enabledStateChanged(bool)),
            this, SLOT(enabledStateChanged()));
}
Exemplo n.º 26
0
void MainWindow::connectSlots()
{
	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionGroup_Members, SIGNAL(triggered()), this, SLOT(slot_editGroupMembers()));
	connect(ui.actionReceipt, SIGNAL(triggered()), this, SLOT(slot_addReceipt()));
	connect(ui.actionLoad_Group, SIGNAL(triggered()), this, SLOT(slot_OpenGroup()));
	connect(ui.actionSave_Group, SIGNAL(triggered()), this, SLOT(slot_SaveGroup()));
	connect(ui.actionCollection, SIGNAL(triggered()), this, SLOT(slot_addCollection()));
	connect(ui.actionPayees, SIGNAL(triggered()), this, SLOT(slot_EditPayees()));

	QShortcut *shortcut = new QShortcut(this);
	shortcut->setKey( Qt::Key_Delete );
	connect( shortcut, SIGNAL(activated()), this, SLOT(slot_DeletePressed()) );
	connect(ui.treeView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slot_MakeContextMenu(const QPoint &)));

}
Exemplo n.º 27
0
void BaseMainPage::initShotCut()
{
	QShortcut *pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_UP);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(focusNextUpChild()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_DOWN);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(focusNextDownChild()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_LEFT);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(focusNextLeftChild()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_RIGHT);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(focusNextRightChild()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_BACKSPACE);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(backToPage()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_PUMPSTOP);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(shortCutPumpStop()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_STARTHOLD);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(shortCutStartHold()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_PURGE);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(shortCutPurge()));
	shortCutList.append(pShortCut);

	pShortCut = new QShortcut(this);
	pShortCut->setKey(KEY_SUPER);
	connect(pShortCut, SIGNAL(activated()), this, SLOT(shortCutSuper()));
	shortCutList.append(pShortCut);
}
Exemplo n.º 28
0
QcHelpBrowser::QcHelpBrowser()
{

    // content display
    helpFileView = new HelpFileView;

    // top controls
    QToolBar *toolbar = new QToolBar;
    QAction *actHome = toolbar->addAction( style()->standardIcon( QStyle::SP_DirHomeIcon ),
                                           "Go To Start Page" );
    toolbar->addAction( helpFileView->pageAction( QWebPage::Back ) );
    toolbar->addAction( helpFileView->pageAction( QWebPage::Forward ) );

    findTool = new SimpleFindTool;
    findTool->setMaximumWidth( 200 );

    QHBoxLayout *topLayout = new QHBoxLayout;
    topLayout->addWidget( toolbar );
    topLayout->addStretch();
    topLayout->addWidget( new QLabel( "Find:" ) );
    topLayout->addWidget( findTool );
    topLayout->setContentsMargins(0,0,0,0);

    // bottom controls
    // QToolBar *bottomToolbar = new QToolBar;

    // main layout
    QVBoxLayout *l = new QVBoxLayout;
    // l->setContentsMargins(10,10,10,0);
    l->addLayout( topLayout );
    l->addWidget( helpFileView );
    // l->addWidget( bottomToolbar );

    setLayout( l );
    setWindowTitle( "SuperCollider Help" );

    QShortcut *copyScut = new QShortcut( QKeySequence::Copy, helpFileView );
    copyScut->setContext( Qt::WidgetWithChildrenShortcut );

    connect( helpFileView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)) );
    connect( copyScut, SIGNAL(activated()),
             helpFileView->pageAction( QWebPage::Copy ), SLOT(trigger()) );
    connect( findTool, SIGNAL(activated(const QString&,bool)),
             helpFileView, SLOT(findText(const QString&,bool)) );
    connect( actHome, SIGNAL(activated()), this, SLOT(goHome()) );
}
Exemplo n.º 29
0
void VAttachmentList::init()
{
    if (m_initialized) {
        return;
    }

    m_initialized = true;

    setupUI();

    QShortcut *infoShortcut = new QShortcut(QKeySequence(c_infoShortcutSequence), this);
    infoShortcut->setContext(Qt::WidgetWithChildrenShortcut);
    connect(infoShortcut, &QShortcut::activated,
            this, &VAttachmentList::attachmentInfo);

    updateContent();
}
Exemplo n.º 30
0
ScheduleEditor::ScheduleEditor(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ScheduleEditor),
    m_mode(NormalMode)
{
    ui->setupUi(this);
    ui->ScheduleView->setEditTriggers(QAbstractItemView::AllEditTriggers);
    ScheduleModel *model = new ScheduleModel(ui->ScheduleView);
    ui->ScheduleView->setModel(model);
    ScheduleDelegate *delegate = new ScheduleDelegate(ui->ScheduleView);
    ui->ScheduleView->setItemDelegate(delegate);
    m_filter = QPair<int,int>(-1, -1);
    QShortcut *shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence("Ctrl+G"));
    shortcut->setContext(Qt::ApplicationShortcut);
    connect(shortcut, SIGNAL(activated()), this, SLOT(switchMode()));

}