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


C++ QPlainTextEdit::setFrameShape方法代码示例

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


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

示例1: setWindowTitle

db_error_dialog::db_error_dialog(const QString error) : m_error_text(error)
{
  setWindowTitle(tr("Database error"));
  QVBoxLayout* layout = new QVBoxLayout(this);

  setMinimumWidth(400);		// reasonable minimum

  QPlainTextEdit* label = new QPlainTextEdit;
  label->setPlainText(error);
  label->setReadOnly(true);
  label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
  label->setFrameShape(QFrame::Box);
  label->setFrameShadow(QFrame::Raised);
  layout->addWidget(label);

  m_btn_group = new QButtonGroup(this);
  QButtonGroup* g = m_btn_group;

  QRadioButton* btn1 = new QRadioButton(tr("Continue"));
  g->addButton(btn1, 1);
  btn1->setChecked(true);

  QRadioButton* btn2 = new QRadioButton(tr("Try to reconnect"));
  g->addButton(btn2, 2);

  QRadioButton* btn3 = new QRadioButton(tr("Quit application"));
  g->addButton(btn3, 3);

  layout->addWidget(btn1);
  layout->addWidget(btn2);
  layout->addWidget(btn3);

  QPushButton* btn_OK = new QPushButton(tr("OK"));
  btn_OK->setDefault(true);

  QPushButton* copy_btn = new QPushButton(tr("Copy"));

  QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal);
  buttonBox->addButton(copy_btn, QDialogButtonBox::ActionRole);
  buttonBox->addButton(btn_OK, QDialogButtonBox::AcceptRole);
  layout->addWidget(buttonBox);
  connect(copy_btn, SIGNAL(clicked()), this, SLOT(copy_error()));
  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
  connect(this, SIGNAL(accepted()), this, SLOT(handle_error()));
}
开发者ID:manitou-mail,项目名称:manitou-mail-ui,代码行数:45,代码来源:db_error_dialog.cpp

示例2: initMenuItems

void ItemEditorWidget::initMenuItems()
{
    Q_ASSERT(m_editor);

    foreach (QAction *action, m_toolBar->actions())
        delete action;

    QAction *act;
    act = new QAction( iconSave(), tr("Save"), m_editor );
    m_toolBar->addAction(act);
    act->setToolTip( tr("Save Item (<strong>F2</strong>)") );
    act->setShortcut( QKeySequence(tr("F2", "Shortcut to save item editor changes")) );
    connect( act, SIGNAL(triggered()),
             this, SLOT(saveAndExit()) );

    act = new QAction( iconCancel(), tr("Cancel"), m_editor );
    m_toolBar->addAction(act);
    act->setToolTip( tr("Cancel Editing and Revert Changes") );
    act->setShortcut( QKeySequence(tr("Escape", "Shortcut to revert item editor changes")) );
    connect( act, SIGNAL(triggered()),
             this, SIGNAL(cancel()) );

    QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit*>(m_editor);
    if (plainTextEdit != NULL) {
        plainTextEdit->setFrameShape(QFrame::NoFrame);

        act = new QAction( iconUndo(), tr("Undo"), m_editor );
        m_toolBar->addAction(act);
        act->setShortcut(QKeySequence::Undo);
        act->setEnabled(false);
        connect( act, SIGNAL(triggered()), plainTextEdit, SLOT(undo()) );
        connect( plainTextEdit, SIGNAL(undoAvailable(bool)), act, SLOT(setEnabled(bool)) );

        act = new QAction( iconRedo(), tr("Redo"), m_editor );
        m_toolBar->addAction(act);
        act->setShortcut(QKeySequence::Redo);
        act->setEnabled(false);
        connect( act, SIGNAL(triggered()), plainTextEdit, SLOT(redo()) );
        connect( plainTextEdit, SIGNAL(redoAvailable(bool)), act, SLOT(setEnabled(bool)) );
    }
}
开发者ID:wizardofozzie,项目名称:CopyQ,代码行数:41,代码来源:itemeditorwidget.cpp


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