当前位置: 首页>>代码示例>>C++>>正文


C++ QToolButton::setShortcut方法代码示例

本文整理汇总了C++中QToolButton::setShortcut方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setShortcut方法的具体用法?C++ QToolButton::setShortcut怎么用?C++ QToolButton::setShortcut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QToolButton的用法示例。


在下文中一共展示了QToolButton::setShortcut方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

/*
 * Obligatory initialization code.
 */
void SearchBar::init()
{
    setVisible(false);
    setObjectName("searchbar");
    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setSpacing(0);
    layout->setMargin(4);

    setStyleSheet("QWidget#searchbar{"
                  "border-top-width: .6px;"
                  "border-top-style: solid;"
                  "border-top-color: darkgray;}");

    m_searchLineEdit = new SearchLineEdit(this);
    m_searchLineEdit->setMinimumWidth(300);
    QToolButton *m_previousButton = new QToolButton(this);
    QToolButton *m_nextButton = new QToolButton(this);
    m_previousButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
    m_nextButton->setToolButtonStyle(Qt::ToolButtonTextOnly);

    QAction *m_previousAction = new QAction(this);
    QAction *m_nextAction = new QAction(this);

    m_previousAction->setText("< " + tr("Previous"));
    m_previousButton->setAutoRaise(true);
    m_previousAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3));
    m_nextAction->setText(tr("Next") + " >");
    m_nextButton->setAutoRaise(true);
    m_nextAction->setShortcut(Qt::Key_F3);
    m_previousButton->setDefaultAction(m_previousAction);
    m_nextButton->setDefaultAction(m_nextAction);

    QToolButton *tbClose = new QToolButton();
    tbClose->setIcon(IconHelper::getIconClose());

    tbClose->setAutoRaise(true);
    tbClose->setStyleSheet("QToolButton{ font-size: 16px; font-family: verdana; border-radius: 4px; } "
                           "QToolButton:hover{ background-color: palette(light); }"
                           "QToolButton::pressed{ background-color: palette(mid); }");

    tbClose->setToolTip(tr("Close"));
    tbClose->setShortcut(Qt::Key_Escape);

    layout->addWidget(tbClose, 1, Qt::AlignLeft);
    layout->addSpacing(3);
    layout->addWidget(m_searchLineEdit, 0, Qt::AlignLeft);
    layout->addSpacing(2);
    layout->addWidget(m_previousButton, 1, Qt::AlignLeft);
    layout->addWidget(m_nextButton, 20, Qt::AlignLeft);

    setLayout(layout);
    m_searchLineEdit->setFocus();

    connect(tbClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString)));
    connect(m_previousAction, SIGNAL(triggered()), this, SIGNAL(findPrevious()));
    connect(m_nextAction, SIGNAL(triggered()), this, SIGNAL(findNext()));
}
开发者ID:ericbsd,项目名称:octopkg,代码行数:61,代码来源:searchbar.cpp

示例2: reLabel

  /**
   * Creates and brings up the dialog box which allows the user to
   * re-label the plot various labes.
   * 
   */
  void ScatterPlotWindow::reLabel() {
    QDialog *dialog = new QDialog(p_scatterPlotWindow);
    dialog->setWindowTitle("Name Plot Labels");

    QWidget *buttons = new QWidget (dialog);
    QWidget *textAreas = new QWidget (dialog);
    QWidget *labels = new QWidget (dialog);
    QWidget *main = new QWidget (dialog);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(main,0);
    layout->addWidget(buttons,0);
    dialog->setLayout(layout);

    QToolButton *okButton = new QToolButton(dialog);
    connect(okButton,SIGNAL(released()),this,SLOT(setLabels()));
    connect(okButton,SIGNAL(released()),dialog,SLOT(hide()));
    okButton->setShortcut(Qt::Key_Enter);
    okButton->setText("Ok");

    QToolButton *cancelButton = new QToolButton(dialog);
    connect(cancelButton,SIGNAL(released()),dialog,SLOT(hide()));
    cancelButton->setText("Cancel");

    QLabel *plotLabel = new QLabel("Plot Title: ");
    QLabel *xAxisLabel = new QLabel("X-Axis Label: ");
    QLabel *yAxisLabel = new QLabel("Y-Axis Label: ");

    QVBoxLayout *vlayout = new QVBoxLayout();
    vlayout->addWidget(plotLabel);
    vlayout->addWidget(xAxisLabel);
    vlayout->addWidget(yAxisLabel);    
    labels->setLayout(vlayout);

    p_plotTitleText = new QLineEdit(p_plot->title().text(),dialog);
    p_xAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::xBottom).text(),dialog);
    p_yAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::yLeft).text(),dialog);

    QVBoxLayout *v2layout = new QVBoxLayout();
    v2layout->addWidget(p_plotTitleText);
    v2layout->addWidget(p_xAxisText);
    v2layout->addWidget(p_yAxisText);
    textAreas->setLayout(v2layout);

    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->addWidget(labels);
    mainLayout->addWidget(textAreas);
    main->setLayout(mainLayout);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->addWidget(okButton);
    hlayout->addWidget(cancelButton);
    buttons->setLayout(hlayout);

    dialog->setFixedSize(400,190);
    dialog->show();
  }
开发者ID:assutech,项目名称:isis3,代码行数:62,代码来源:ScatterPlotWindow.cpp

示例3: constructUI

void FindWidget::constructUI()
{

    QHBoxLayout* layout = new QHBoxLayout();// QBoxLayout::LeftToRight );
    layout->setMargin(7);
     setLayout( layout );



    QToolButton* toggleButton = new QToolButton(this);
    toggleButton->setFont( edbeeApp()->iconFont() );
    toggleButton->setText( QChar(icon_repeat) );
    toggleButton->setToolTip(tr("Wrap Around"));
    toggleButton->setCheckable(true);
    layout->addWidget( toggleButton, 0 );

    toggleButton = new QToolButton(this);
    toggleButton->setFont( edbeeApp()->iconFont() );
    toggleButton->setText( QChar(icon_asterisk) );
    toggleButton->setToolTip(tr("Regular Expressions"));
    toggleButton->setCheckable(true);
    layout->addWidget( toggleButton, 0 );

    toggleButton = new QToolButton(this);
    toggleButton->setFont( edbeeApp()->iconFont() );
    toggleButton->setText( QChar(icon_font) );
    toggleButton->setToolTip(tr("Case Sensitive"));
    toggleButton->setCheckable(true);
    layout->addWidget( toggleButton, 0 );




    QLabel* label = new QLabel( tr("Find") );
    layout->addWidget( label, 0, Qt::AlignLeft );


    lineEditRef_ = new QLineEdit(this);
//    lineEditRef_->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred);
//    lineEditRef_->setSizePolicy( QSizePolicy::M);
//    lineEditRef_->setMaximumWidth( 10000 );
    layout->addWidget( lineEditRef_, 1);//, Qt::AlignLeft);
//    layout->insertStretch(1);

    // add the action

    QToolButton* but = new QToolButton( this );
    but->setFont( edbeeApp()->iconFont() );
    but->setText( QChar(icon_caret_left) ); //<
    but->setShortcut( editorRef_->controller()->keyMap()->getSequence("find_prev_match") );
    but->setToolTip( QString(tr("Find Previous (%1)")).arg(but->shortcut().toString()) );
    connect( but, SIGNAL(clicked()), SLOT(findPrevWord()) );
    layout->addWidget( but, 0  );

    but = new QToolButton( this );
    but->setFont( edbeeApp()->iconFont() );
    but->setText( QChar(icon_caret_right) ); // >
    but->setShortcut( editorRef_->controller()->keyMap()->getSequence("find_next_match") );
    but->setToolTip( QString(tr("Find Next (%1)")).arg(but->shortcut().toString()) );
    connect( but, SIGNAL(clicked()), SLOT(findNextWord()) );
    layout->addWidget( but, 0 );


    but = new QToolButton( this );
    but->setFont( edbeeApp()->iconFont() );
    but->setText( QChar(icon_th) ); // >
    but->setShortcut( editorRef_->controller()->keyMap()->getSequence("sel_all_matches") );
    but->setToolTip( QString(tr("Select All (%1)")).arg(but->shortcut().toString()) );
    connect( but, SIGNAL(clicked()), SLOT(selectAllWords()) );
    layout->addWidget( but, 0 );


//    setWindowFlags( Qt::Popup );
}
开发者ID:tony,项目名称:edbee-app,代码行数:74,代码来源:findwidget.cpp

示例4: RecreateButtons


//.........这里部分代码省略.........
    // mmueller
    button->setCheckable ( true );

    if(currentToolID == m_ToolManager->GetActiveToolID())
      button->setChecked(true);

    QString label;
    if (m_GenerateAccelerators)
    {
      label += "&";
    }
    label += tool->GetName();
    QString tooltip = tool->GetName();
    MITK_DEBUG << tool->GetName() << ", " << label.toLocal8Bit().constData() << ", '" << tooltip.toLocal8Bit().constData();

    if ( m_ShowNames )
    {
      /*
      button->setUsesTextLabel(true);
      button->setTextLabel( label );              // a label
      QToolTip::add( button, tooltip );
      */
      // mmueller Qt
      button->setText( label );              // a label
      button->setToolTip( tooltip );
      // mmueller

      QFont currentFont = button->font();
      currentFont.setBold(false);
      button->setFont( currentFont );
    }

    us::ModuleResource iconResource = tool->GetIconResource();

    if (!iconResource.IsValid())
    {
      button->setIcon(QIcon(QPixmap(tool->GetXPM())));
    }
    else
    {
      us::ModuleResourceStream resourceStream(iconResource, std::ios::binary);
      resourceStream.seekg(0, std::ios::end);
      std::ios::pos_type length = resourceStream.tellg();
      resourceStream.seekg(0, std::ios::beg);

      char* data = new char[length];
      resourceStream.read(data, length);
      QPixmap pixmap;
      pixmap.loadFromData(QByteArray::fromRawData(data, length));
      QIcon* icon = new QIcon(pixmap);
      delete[] data;

      button->setIcon(*icon);

      if (m_ShowNames)
      {
        if (m_LayoutColumns == 1)
          button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        else
          button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);

        button->setIconSize(QSize(24, 24));
      }
      else
      {
        button->setToolButtonStyle(Qt::ToolButtonIconOnly);
        button->setIconSize(QSize(32,32));
        button->setToolTip(tooltip);
      }
    }

    if (m_GenerateAccelerators)
    {
      QString firstLetter = QString( tool->GetName() );
      firstLetter.truncate( 1 );
      button->setShortcut( firstLetter );                      // a keyboard shortcut (just the first letter of the given name w/o any CTRL or something)
    }

    mitk::DataNode* dataNode = m_ToolManager->GetReferenceData(0);

    if (dataNode != NULL && !tool->CanHandle(dataNode->GetData()))
      button->setEnabled(false);

    m_ButtonIDForToolID[currentToolID] = currentButtonID;
    m_ToolIDForButtonID[currentButtonID] = currentToolID;

    MITK_DEBUG << "m_ButtonIDForToolID[" << currentToolID << "] == " << currentButtonID;
    MITK_DEBUG << "m_ToolIDForButtonID[" << currentButtonID << "] == " << currentToolID;

    tool->GUIProcessEventsMessage += mitk::MessageDelegate<QmitkToolSelectionBox>( this, &QmitkToolSelectionBox::OnToolGUIProcessEventsMessage ); // will never add a listener twice, so we don't have to check here
    tool->ErrorMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>( this, &QmitkToolSelectionBox::OnToolErrorMessage ); // will never add a listener twice, so we don't have to check here
    tool->GeneralMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>( this, &QmitkToolSelectionBox::OnGeneralToolMessage );

    ++currentButtonID;
  }
  // setting grid layout for this groupbox
  this->setLayout(m_ButtonLayout);

  //this->update();
}
开发者ID:151706061,项目名称:MITK,代码行数:101,代码来源:QmitkToolSelectionBox.cpp

示例5: QWidget

FindBar::FindBar(QWidget *parent)
    : QWidget(parent)
    , m_lineEdit(new QLineEdit(this))
    , m_matchCase(new QCheckBox(tr("&Match case"), this))
    , m_highlightAll(new QCheckBox(tr("&Highlight all"), this)),
      m_associatedWebView(0)
{
    QHBoxLayout *layout = new QHBoxLayout;

    // cosmetic
    layout->setContentsMargins(2, 0, 2, 0);

    // hide button
    QToolButton *hideButton = new QToolButton(this);
    hideButton->setAutoRaise(true);
    hideButton->setIcon(QIcon::fromTheme(QLatin1String("dialog-close")));
    hideButton->setShortcut(tr("Esc"));
    connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
    layout->addWidget(hideButton);
    layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);

    // label
    QLabel *label = new QLabel(tr("Find:"));
    layout->addWidget(label);

    // Find Bar signal
    connect(this, SIGNAL(searchString(QString)), this, SLOT(find(QString)));

    // lineEdit, focusProxy
    setFocusProxy(m_lineEdit);
    m_lineEdit->setMaximumWidth(250);
    connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(find(QString)));
    layout->addWidget(m_lineEdit);

    // buttons
    QPushButton *findNext = new QPushButton(QIcon::fromTheme(QLatin1String("go-down")), tr("&Next"), this);
    findNext->setShortcut(tr("F3"));
    QPushButton *findPrev = new QPushButton(QIcon::fromTheme(QLatin1String("go-up")), tr("&Previous"), this);
    findPrev->setShortcut(tr("Shift+F3"));
    connect(findNext, SIGNAL(clicked()), this, SLOT(findNext()));
    connect(findPrev, SIGNAL(clicked()), this, SLOT(findPrevious()));
    layout->addWidget(findNext);
    layout->addWidget(findPrev);

    // Case sensitivity. Deliberately set so this is off by default.
    m_matchCase->setCheckState(Qt::Unchecked);
    m_matchCase->setTristate(false);
    connect(m_matchCase, SIGNAL(toggled(bool)), this, SLOT(matchCaseUpdate()));
    layout->addWidget(m_matchCase);

    // Hightlight All. On by default
    m_highlightAll->setCheckState(Qt::Checked);
    m_highlightAll->setTristate(false);
    connect(m_highlightAll, SIGNAL(toggled(bool)), this, SLOT(updateHighlight()));
    layout->addWidget(m_highlightAll);

    // stretching widget on the left
    layout->addStretch();

    setLayout(layout);

    // we start off hidden
    hide();
}
开发者ID:invalid404,项目名称:trojita,代码行数:64,代码来源:FindBar.cpp

示例6: QMenu

    /*!
     * \brief Constructor.
     *
     * \param parent Parent of the widget.
     */
    QuickOpen::QuickOpen(QWidget *parent) : QMenu(parent)
    {
        // Set window geometry
        setMinimumSize(300,300);

        QVBoxLayout *layout = new QVBoxLayout(this);

        // Create the toolbar
        QToolBar *toolbar = new QToolBar(this);

        QToolButton *buttonUp = new QToolButton(this);
        buttonUp->setIcon(Caneda::icon("go-up"));
        buttonUp->setShortcut(Qt::Key_Backspace);
        buttonUp->setStatusTip(tr("Go up one folder"));
        buttonUp->setToolTip(tr("Go up one folder"));
        buttonUp->setWhatsThis(tr("Go up one folder"));

        buttonBack = new QToolButton(this);
        buttonBack->setIcon(Caneda::icon("go-previous"));
        buttonBack->setShortcut(Qt::ALT + Qt::Key_Left);
        buttonBack->setStatusTip(tr("Go previous folder"));
        buttonBack->setToolTip(tr("Go previous folder"));
        buttonBack->setWhatsThis(tr("Go previous folder"));
        buttonBack->setEnabled(false);

        buttonForward = new QToolButton(this);
        buttonForward->setIcon(Caneda::icon("go-next"));
        buttonForward->setShortcut(Qt::ALT + Qt::Key_Right);
        buttonForward->setStatusTip(tr("Go next folder"));
        buttonForward->setToolTip(tr("Go next folder"));
        buttonForward->setWhatsThis(tr("Go next folder"));
        buttonForward->setEnabled(false);

        QToolButton *buttonHome = new QToolButton(this);
        buttonHome->setIcon(Caneda::icon("go-home"));
        buttonHome->setShortcut(Qt::CTRL + Qt::Key_Home);
        buttonHome->setStatusTip(tr("Go to the home folder"));
        buttonHome->setToolTip(tr("Go to the home folder"));
        buttonHome->setWhatsThis(tr("Go to the home folder"));

        // Create the filter button
        QToolButton *buttonFilters = new QToolButton(this);
        QMenu *filterMenu = new QMenu(this);
        filterGroup = new QActionGroup(this);

        buttonFilters->setIcon(Caneda::icon("configure"));
        buttonFilters->setPopupMode(QToolButton::InstantPopup);
        buttonFilters->setMenu(filterMenu);

        filterNone = new QAction(Caneda::icon("view-sidetree"), tr("Show all"), filterGroup);
        QAction *filtersSeparator = new QAction(filterGroup);
        filtersSeparator->setSeparator(true);
        filterSchematics = new QAction(Caneda::icon("application-x-caneda-schematic"), tr("Show schematics"), filterGroup);
        filterSymbols = new QAction(Caneda::icon("application-x-caneda-symbol"), tr("Show symbols"), filterGroup);
        filterLayouts = new QAction(Caneda::icon("application-x-caneda-layout"), tr("Show layouts"), filterGroup);
        filterSimulations = new QAction(Caneda::icon("application-x-spice-simulation-raw"), tr("Show simulations"), filterGroup);
        filterText = new QAction(Caneda::icon("text-plain"), tr("Show text files"), filterGroup);

        filterNone->setCheckable(true);
        filterSchematics->setCheckable(true);
        filterSymbols->setCheckable(true);
        filterLayouts->setCheckable(true);
        filterSimulations->setCheckable(true);
        filterText->setCheckable(true);

        Settings *settings = Settings::instance();
        int index = settings->currentValue("quickopen/filter").toInt();
        filterGroup->actions().at(index)->setChecked(true);

        filterMenu->addActions(filterGroup->actions());

        // Add the buttons to the toolbar
        toolbar->addWidget(buttonUp);
        toolbar->addWidget(buttonBack);
        toolbar->addWidget(buttonForward);
        toolbar->addWidget(buttonHome);

        QWidget *spacer = new QWidget(this);
        spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        toolbar->addWidget(spacer);

        toolbar->addWidget(buttonFilters);
        layout->addWidget(toolbar);

        // Set lineEdit properties
        m_filterEdit = new QLineEdit(this);
        m_filterEdit->setClearButtonEnabled(true);
        m_filterEdit->setPlaceholderText(tr("Search..."));
        m_filterEdit->installEventFilter(this);
        layout->addWidget(m_filterEdit);

        // Create a new filesystem model
        m_model = new QFileSystemModel(this);
        m_model->setIconProvider(new IconProvider());
        m_model->setRootPath(QDir::homePath());
//.........这里部分代码省略.........
开发者ID:Caneda,项目名称:Caneda,代码行数:101,代码来源:quickopen.cpp

示例7: buildWidget

void PythonEditorWidget::buildWidget() {
    setWindowIcon(QIcon(":/icons/python.png"));
    QWidget* content = new QWidget(this);
    QVBoxLayout* verticalLayout = new QVBoxLayout(content);
    ////Create Buttons
    QHBoxLayout* horizontalLayout = new QHBoxLayout();
    QToolButton* runButton = new QToolButton(content);
    QToolButton* newButton = new QToolButton(content);
    QToolButton* openButton = new QToolButton(content);
    QToolButton* saveButton = new QToolButton(content);
    QToolButton* saveAsButton = new QToolButton(content);
    QPushButton* clearOutputButton = new QPushButton(content);
    runButton->setShortcut(QKeySequence(tr("F5")));
    runButton->setIcon(QIcon(":/icons/python.png"));
    runButton->setToolTip("Compile and run (F5)");
    newButton->setIcon(QIcon(":/icons/new.png"));
    newButton->setToolTip("New file (Ctrl+N)");
    openButton->setIcon(QIcon(":/icons/open.png"));
    openButton->setToolTip("Open Python script");
    saveButton->setIcon(QIcon(":/icons/save.png"));
    saveButton->setToolTip("Save (Ctrl+S)");
    saveAsButton->setIcon(QIcon(":/icons/saveas.png"));
    saveAsButton->setToolTip("Save as");
    clearOutputButton->setText("Clear Output");
   
    QFrame* line1 = new QFrame(content);
    line1->setFrameShape(QFrame::VLine);
    line1->setFrameShadow(QFrame::Sunken);
    QFrame* line2 = new QFrame(content);
    line2->setFrameShape(QFrame::VLine);
    line2->setFrameShadow(QFrame::Sunken);
    QFrame* line3 = new QFrame(content);
    line3->setFrameShape(QFrame::VLine);
    line3->setFrameShadow(QFrame::Sunken);
    horizontalLayout->addWidget(runButton);
    horizontalLayout->addWidget(line1);
    horizontalLayout->addWidget(newButton);
    horizontalLayout->addWidget(openButton);
    horizontalLayout->addWidget(saveButton);
    horizontalLayout->addWidget(saveAsButton);
    horizontalLayout->addWidget(line2);
    horizontalLayout->addWidget(clearOutputButton);
    horizontalLayout->addWidget(line3);
    QSpacerItem* horizontalSpacer =
        new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    horizontalLayout->addItem(horizontalSpacer);
    // Done creating buttons
    QSplitter* splitter = new QSplitter(content);

    splitter->setOrientation(Qt::Vertical);
    pythonCode_ = new PythonTextEditor(content);
    pythonCode_->setObjectName("pythonEditor");
    pythonCode_->setUndoRedoEnabled(true);
    setDefaultText();
    pythonOutput_ = new QTextEdit(content);
    pythonOutput_->setObjectName("pythonConsole");
    pythonOutput_->setReadOnly(true);
    pythonOutput_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    syntaxHighligther_ =
        SyntaxHighligther::createSyntaxHighligther<Python>(pythonCode_->document());
    verticalLayout->addLayout(horizontalLayout);
    splitter->addWidget(pythonCode_);
    splitter->addWidget(pythonOutput_);
    splitter->setStretchFactor(0, 1);
    splitter->setStretchFactor(1, 0);
    splitter->setHandleWidth(2);
    // enable QSplitter:hover stylesheet 
    // QTBUG-13768 https://bugreports.qt.io/browse/QTBUG-13768
    splitter->handle(1)->setAttribute(Qt::WA_Hover);

    verticalLayout->addWidget(splitter);
    setWidget(content);
    connect(pythonCode_, SIGNAL(textChanged()), this, SLOT(onTextChange()));
    connect(runButton, SIGNAL(clicked()), this, SLOT(run()));
    connect(newButton, SIGNAL(clicked()), this, SLOT(setDefaultText()));
    connect(openButton, SIGNAL(clicked()), this, SLOT(open()));
    connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
    connect(saveAsButton, SIGNAL(clicked()), this, SLOT(saveAs()));
    connect(clearOutputButton, SIGNAL(clicked()), this, SLOT(clearOutput()));


    updateStyle();
    InviwoApplication::getPtr()->getSettingsByType<SystemSettings>()->pythonSyntax_.onChange(this, &PythonEditorWidget::updateStyle);
    InviwoApplication::getPtr()->getSettingsByType<SystemSettings>()->pyFontSize_.onChange(this, &PythonEditorWidget::updateStyle);
}
开发者ID:Ojaswi,项目名称:inviwo,代码行数:85,代码来源:pythoneditorwidget.cpp

示例8: QWidget

FindBar::FindBar(QWidget *parent)
    : QWidget(parent)
    , m_lineEdit(new LineEdit(this))
    , m_matchCase(new QCheckBox(tr("&Match case"), this))
    , m_highlightAll(new QCheckBox(tr("&Highlight all"), this)),
      m_associatedWebView(nullptr)
{
    QHBoxLayout *layout = new QHBoxLayout;

    // cosmetic
    layout->setContentsMargins(2, 0, 2, 0);

    // hide button
    QToolButton *hideButton = new QToolButton(this);
    hideButton->setAutoRaise(true);
    hideButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
    hideButton->setShortcut(tr("Esc"));
    connect(hideButton, &QAbstractButton::clicked, this, &QWidget::hide);
    layout->addWidget(hideButton);
    layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);

    // label
    QLabel *label = new QLabel(tr("Find:"));
    layout->addWidget(label);

    // Find Bar signal
    connect(this, &FindBar::searchString, this, &FindBar::findText);

    // lineEdit, focusProxy
    setFocusProxy(m_lineEdit);
    m_lineEdit->setMaximumWidth(250);
    connect(m_lineEdit, &QLineEdit::textChanged, this, &FindBar::findText);
    layout->addWidget(m_lineEdit);

    // buttons
    QPushButton *findNext = new QPushButton(QIcon::fromTheme(QStringLiteral("go-down")), tr("&Next"), this);
    findNext->setShortcut(tr("F3"));
    QPushButton *findPrev = new QPushButton(QIcon::fromTheme(QStringLiteral("go-up")), tr("&Previous"), this);
    //: Translators: You can change this shortcut, but button names like Shift should not be localized here.
    //: That will break setting the shortcut. Button names will still appear localized in the UI.
    findPrev->setShortcut(tr("Shift+F3"));
    connect(findNext, &QAbstractButton::clicked, this, &FindBar::findNext);
    connect(findPrev, &QAbstractButton::clicked, this, &FindBar::findPrevious);
    layout->addWidget(findNext);
    layout->addWidget(findPrev);

    // Case sensitivity. Deliberately set so this is off by default.
    m_matchCase->setCheckState(Qt::Unchecked);
    m_matchCase->setTristate(false);
    connect(m_matchCase, &QAbstractButton::toggled, this, &FindBar::matchCaseUpdate);
    layout->addWidget(m_matchCase);

    // Hightlight All. On by default
    m_highlightAll->setCheckState(Qt::Checked);
    m_highlightAll->setTristate(false);
    connect(m_highlightAll, &QAbstractButton::toggled, this, &FindBar::updateHighlight);
    layout->addWidget(m_highlightAll);

    // stretching widget on the left
    layout->addStretch();

    setLayout(layout);

    // we start off hidden
    hide();
}
开发者ID:Mucip,项目名称:trojita,代码行数:66,代码来源:FindBar.cpp

示例9: pix

EditorWidget::EditorWidget(QString theme, QWidget *parent) :
	QWidget(parent),
	editor_rich_text(new EditorRichText(this)),
	editor_plain_text(new CodeEditor(this, CodeEditor::Html)),
	pag_stacked(new QStackedWidget(this)),
	m_state(Clean),
	m_initialPag(RichTextIndex)
{
	m_theme = theme;
	m_color = editor_rich_text->textColor();

	connect(editor_plain_text, SIGNAL(textChanged()), this, SLOT(plainTextChanged()));
	connect(editor_rich_text, SIGNAL(textChanged()), this, SLOT(richTextChanged()));
	connect(editor_rich_text, SIGNAL(simplifyRichTextChanged(bool)), this, SLOT(richTextChanged()));
	connect(editor_rich_text, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat)));
	connect(editor_rich_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));

	list_smile = new QListWidget(this);
	list_smile->setMaximumSize(QSize(155, 16777215));
	list_smile->setMovement(QListView::Static);
	list_smile->setResizeMode(QListView::Adjust);
	list_smile->setViewMode(QListView::IconMode);
	connect(list_smile, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(list_smile_itemDoubleClicked(QListWidgetItem*)));

	toolbar_find_replace = new QWidget(this);
	toolbar_find_replace->setMinimumSize(QSize(0, 30));

	QVBoxLayout *main_layout = new QVBoxLayout(this);
	main_layout->setContentsMargins(0, 0, 0, 0);
	main_layout->setSpacing(4);

		QHBoxLayout *toolbar_layout = new QHBoxLayout();
		toolbar_layout->setContentsMargins(0, 0, 0, 0);
		toolbar_layout->setSpacing(10);

			QToolBar *toolbar_edit = new QToolBar(this);
			toolbar_edit->setMinimumSize(QSize(0, 30));
			toolbar_edit->setIconSize(QSize(20, 20));
			toolbar_edit->setStyleSheet("QToolBar{border:0px;}");
		// Save Pdf
		/*		m_pdf_action = createAction(QIcon(m_theme +"img16/pdf.png"), tr("Exportar a PDF") +"...", false, toolbar_edit);
				m_pdf_action->setPriority(QAction::LowPriority);
				m_pdf_action->setShortcut(Qt::CTRL + Qt::Key_D);
				connect(m_pdf_action, SIGNAL(triggered()), this, SLOT(on_edit_export_pdf()));
			toolbar_edit->addAction(m_pdf_action);
			toolbar_edit->addSeparator();*/
		// combos font and size
				QWidget *toolbar_font_input = new QWidget(this);
				QHBoxLayout *combofont_layout = new QHBoxLayout(toolbar_font_input);
				combofont_layout->setContentsMargins(0, 0, 2, 0);
					m_font_input = new QFontComboBox(toolbar_edit);
					connect(m_font_input, SIGNAL(activated(QString)), this, SLOT(on_edit_font(QString)));
				combofont_layout->addWidget(m_font_input);
					m_font_size_input = new QComboBox(toolbar_edit);
					QFontDatabase font_db;
					foreach(int size, font_db.standardSizes())
						m_font_size_input->addItem(QString::number(size));
					connect(m_font_size_input, SIGNAL(activated(QString)), this, SLOT(on_edit_font_size(QString)));
				combofont_layout->addWidget(m_font_size_input);
			//	combofont_layout->setStretch(0, 1);

			toolbar_edit->addWidget(toolbar_font_input);
			toolbar_edit->addSeparator();
		// cut, copy, paste
				m_cut_action = createAction(QIcon(m_theme +"img16/edit_cut.png"), tr("Cortar"), false, toolbar_edit);
				m_cut_action->setPriority(QAction::LowPriority);
				m_cut_action->setShortcut(QKeySequence::Cut);
				connect(m_cut_action, SIGNAL(triggered()), this, SLOT(on_edit_cut()));
			toolbar_edit->addAction(m_cut_action);
				m_copy_action = createAction(QIcon(m_theme +"img16/edit_copy.png"), tr("Copiar"), false, toolbar_edit);
				m_copy_action->setPriority(QAction::LowPriority);
				m_copy_action->setShortcut(QKeySequence::Copy);
				connect(m_copy_action, SIGNAL(triggered()), this, SLOT(on_edit_copy()));
			toolbar_edit->addAction(m_copy_action);
				m_paste_action = createAction(QIcon(m_theme +"img16/edit_paste.png"), tr("Pegar"), false, toolbar_edit);
				m_paste_action->setPriority(QAction::LowPriority);
				m_paste_action->setShortcut(QKeySequence::Paste);
				connect(m_paste_action, SIGNAL(triggered()), this, SLOT(on_edit_paste()));
			toolbar_edit->addAction(m_paste_action);
			toolbar_edit->addSeparator();
		// undo, redo
				m_undo_action = createAction(QIcon(m_theme +"img16/edit_deshacer.png"), tr("Deshacer"), false, toolbar_edit);
				m_undo_action->setShortcut(QKeySequence::Undo);
				connect(m_undo_action, SIGNAL(triggered()), this, SLOT(on_edit_undo()));
			toolbar_edit->addAction(m_undo_action);
				m_redo_action = createAction(QIcon(m_theme +"img16/edit_rehacer.png"), tr("Rehacer"), false, toolbar_edit);
				m_redo_action->setPriority(QAction::LowPriority);
				m_redo_action->setShortcut(QKeySequence::Redo);
				connect(m_redo_action, SIGNAL(triggered()), this, SLOT(on_edit_redo()));
			toolbar_edit->addAction(m_redo_action);
			toolbar_edit->addSeparator();
		// bold, italic, underline, ,
				m_bold_action = createAction(QIcon(m_theme +"img16/edit_negrita.png"), tr("Negrita"), true, toolbar_edit);
				m_bold_action->setPriority(QAction::LowPriority);
				m_bold_action->setShortcut(Qt::CTRL + Qt::Key_B);
				connect(m_bold_action, SIGNAL(triggered()), this, SLOT(on_edit_bold()));
			toolbar_edit->addAction(m_bold_action);
				m_italic_action = createAction(QIcon(m_theme +"img16/edit_cursiva.png"), tr("Cursiva"), true, toolbar_edit);
				m_italic_action->setPriority(QAction::LowPriority);
				m_italic_action->setShortcut(Qt::CTRL + Qt::Key_I);
//.........这里部分代码省略.........
开发者ID:Monthy,项目名称:gr-lida,代码行数:101,代码来源:editorwidget.cpp

示例10: toToolWidget

toPLSQLEditor::toPLSQLEditor(QWidget *main, toConnection &connection)
        : toToolWidget(PLSQLEditorTool, "plsqleditor.html", main, connection, "toPLSQLEditor")
{
    createActions();
    QToolBar *toolbar = toAllocBar(this, tr("PLSQLEditor"));
    layout()->addWidget(toolbar);

    toolbar->addAction(refreshAct);

    toolbar->addSeparator();

    Schema = new QComboBox(toolbar);
    Schema->setObjectName("PLSQLEditorSchemaCombo");
    toolbar->addWidget(Schema);
    connect(Schema,
            SIGNAL(activated(int)),
            this,
            SLOT(changeSchema(int)));

    toolbar->addSeparator();

    toolbar->addAction(newSheetAct);
    toolbar->addAction(compileAct);
    toolbar->addAction(compileWarnAct);
    // only show static check button when static checker is specified
    if (!toConfigurationSingle::Instance().staticChecker().isEmpty())
    {
        toolbar->addAction(checkCodeAct);
    }

    toolbar->addSeparator();

    toolbar->addAction(nextErrorAct);
    toolbar->addAction(previousErrorAct);
    toolbar->addAction(describeAct);

    toolbar->addWidget(new toSpacer());

    splitter = new QSplitter(Qt::Horizontal, this);
    layout()->addWidget(splitter);

    Objects = new QTreeView(splitter);
    CodeModel = new toCodeModel(Objects);
    Objects->setModel(CodeModel);
    QString selected = Schema->currentText();
    if (!selected.isEmpty())
        CodeModel->refresh(connection, selected);
    // even better (?) for reopening the tabs
//     connect(Objects->selectionModel(),
//             SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
//             this,
//             SLOT(changePackage(const QModelIndex &, const QModelIndex &)));
    connect(Objects, SIGNAL(doubleClicked(const QModelIndex &)),
            this, SLOT(changePackage(const QModelIndex &)));

    splitter->addWidget(Objects);

    Editors = new QTabWidget(this);
#if QT_VERSION >= 0x040500
    Editors->setTabsClosable(true);
    connect(Editors, SIGNAL(tabCloseRequested(int)),
            this, SLOT(closeEditor(int)));
#endif
    splitter->addWidget(Editors);
    Editors->setTabPosition(QTabWidget::North);

    QToolButton *closeButton = new toPopupButton(Editors);
    closeButton->setIcon(QPixmap(const_cast<const char**>(close_xpm)));
    closeButton->setFixedSize(20, 18);
    // HACK: disable closing the editor tabs with the global shortcut.
    // it raises: "QAction::eventFilter: Ambiguous shortcut overload: Ctrl+W"
    // on some systems. But it rejects to close unfinished.unsaved work.
    // - <[email protected]>
    closeButton->setShortcut(QKeySequence::Close);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(closeEditor()));

    Editors->setCornerWidget(closeButton);

    setFocusProxy(Editors);
    newSheet();

    ToolMenu = NULL;
    connect(toMainWidget()->workspace(), SIGNAL(subWindowActivated(QMdiSubWindow *)),
            this, SLOT(windowActivated(QMdiSubWindow *)));

    QSettings s;
    s.beginGroup("toPLSQLEditor");
    splitter->restoreState(s.value("splitter").toByteArray());
    s.endGroup();

    conn = &connection;

    refresh();
}
开发者ID:netrunner-debian-kde-extras,项目名称:tora,代码行数:94,代码来源:toplsqleditor.cpp


注:本文中的QToolButton::setShortcut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。